Improve macOS Retina UI clarity and bundle HD assets
This commit is contained in:
@@ -42,7 +42,7 @@ VkDescriptorSet VulkanWindow::allocate_texture_descriptor_set(VkImageView view0,
|
||||
return set;
|
||||
}
|
||||
|
||||
VkDescriptorSet VulkanWindow::allocate_ui_texture_descriptor_set(VkImageView view0, VkImageView view1) {
|
||||
VkDescriptorSet VulkanWindow::allocate_ui_texture_descriptor_set(VkImageView view0, VkImageView view1, bool point) {
|
||||
VkDescriptorSet set = VK_NULL_HANDLE;
|
||||
VkDescriptorSetAllocateInfo desc_alloc{VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO};
|
||||
desc_alloc.descriptorPool = descriptor_pool_;
|
||||
@@ -51,10 +51,10 @@ VkDescriptorSet VulkanWindow::allocate_ui_texture_descriptor_set(VkImageView vie
|
||||
check(vkAllocateDescriptorSets(device_, &desc_alloc, &set), "vkAllocateDescriptorSets ui");
|
||||
|
||||
VkDescriptorImageInfo image_infos[2]{};
|
||||
image_infos[0].sampler = ui_sampler_ ? ui_sampler_ : sampler_;
|
||||
image_infos[0].sampler = point ? ui_point_sampler_ : (ui_sampler_ ? ui_sampler_ : sampler_);
|
||||
image_infos[0].imageView = view0;
|
||||
image_infos[0].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
image_infos[1].sampler = ui_sampler_ ? ui_sampler_ : (clamp_sampler_ ? clamp_sampler_ : sampler_);
|
||||
image_infos[1].sampler = point ? ui_point_sampler_ : (ui_sampler_ ? ui_sampler_ : sampler_);
|
||||
image_infos[1].imageView = view1;
|
||||
image_infos[1].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
|
||||
@@ -195,8 +195,13 @@ VkDescriptorSet VulkanWindow::get_texture_descriptor(
|
||||
VkDescriptorSet VulkanWindow::get_ui_texture_descriptor(
|
||||
const std::string& texture0_name,
|
||||
const std::string& mask_name,
|
||||
const std::unordered_map<std::string, std::vector<std::uint8_t>>& capture_textures) {
|
||||
const auto& tex0 = get_gpu_texture(texture0_name, capture_textures);
|
||||
const std::unordered_map<std::string, std::vector<std::uint8_t>>& capture_textures, bool point) {
|
||||
auto& tex0 = get_gpu_texture(texture0_name, capture_textures);
|
||||
if (point && mask_name.empty() && tex0.view) {
|
||||
if (!tex0.ui_point_descriptor)
|
||||
tex0.ui_point_descriptor = allocate_ui_texture_descriptor_set(tex0.view, fallback_texture_.view, true);
|
||||
return tex0.ui_point_descriptor;
|
||||
}
|
||||
if (mask_name.empty()) return tex0.ui_descriptor ? tex0.ui_descriptor : tex0.descriptor;
|
||||
const auto& tex1 = get_gpu_texture(mask_name, capture_textures);
|
||||
if (!tex0.view || !tex1.view) return tex0.ui_descriptor ? tex0.ui_descriptor : tex0.descriptor;
|
||||
@@ -221,6 +226,8 @@ void VulkanWindow::upload_texture(
|
||||
bool generate_mips,
|
||||
const std::vector<std::vector<std::uint8_t>>* file_mips) {
|
||||
const ScopedMs timer(timings_.texture_upload_ms);
|
||||
texture.width = width;
|
||||
texture.height = height;
|
||||
const bool has_file_mips = !generate_mips && file_mips && !file_mips->empty();
|
||||
VkDeviceSize byte_size = VkDeviceSize(width) * height * 4;
|
||||
if (has_file_mips)
|
||||
@@ -395,7 +402,7 @@ void VulkanWindow::upload_texture(
|
||||
}
|
||||
|
||||
void VulkanWindow::release_texture(GpuTexture& texture) {
|
||||
for (VkDescriptorSet set : {texture.descriptor, texture.ui_descriptor})
|
||||
for (VkDescriptorSet set : {texture.descriptor, texture.ui_descriptor, texture.ui_point_descriptor})
|
||||
if (set && set != fallback_texture_.descriptor && set != fallback_texture_.ui_descriptor)
|
||||
vkFreeDescriptorSets(device_, descriptor_pool_, 1, &set);
|
||||
if (texture.view) vkDestroyImageView(device_, texture.view, nullptr);
|
||||
|
||||
Reference in New Issue
Block a user