mirror of
https://github.com/libretro/RetroArch
synced 2025-04-02 16:20:39 +00:00
Move pass set texture to vulkan_common.c
This commit is contained in:
parent
8f1aa8c2c3
commit
920e89a506
@ -3463,3 +3463,25 @@ void vulkan_framebuffer_clear(VkImage image, VkCommandBuffer cmd)
|
|||||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
|
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vulkan_pass_set_texture(
|
||||||
|
VkDevice device,
|
||||||
|
VkDescriptorSet set, VkSampler sampler,
|
||||||
|
unsigned binding,
|
||||||
|
VkImageView imageView, VkImageLayout imageLayout)
|
||||||
|
{
|
||||||
|
VkDescriptorImageInfo image_info;
|
||||||
|
VkWriteDescriptorSet write = { VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET };
|
||||||
|
|
||||||
|
image_info.sampler = sampler;
|
||||||
|
image_info.imageView = imageView;
|
||||||
|
image_info.imageLayout = imageLayout;
|
||||||
|
|
||||||
|
write.dstSet = set;
|
||||||
|
write.dstBinding = binding;
|
||||||
|
write.descriptorCount = 1;
|
||||||
|
write.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
|
||||||
|
write.pImageInfo = &image_info;
|
||||||
|
|
||||||
|
vkUpdateDescriptorSets(device, 1, &write, 0, NULL);
|
||||||
|
}
|
||||||
|
@ -619,6 +619,12 @@ void vulkan_framebuffer_clear(VkImage image, VkCommandBuffer cmd);
|
|||||||
void vulkan_initialize_render_pass(VkDevice device,
|
void vulkan_initialize_render_pass(VkDevice device,
|
||||||
VkFormat format, VkRenderPass *render_pass);
|
VkFormat format, VkRenderPass *render_pass);
|
||||||
|
|
||||||
|
void vulkan_pass_set_texture(
|
||||||
|
VkDevice device,
|
||||||
|
VkDescriptorSet set, VkSampler sampler,
|
||||||
|
unsigned binding,
|
||||||
|
VkImageView imageView, VkImageLayout imageLayout);
|
||||||
|
|
||||||
RETRO_END_DECLS
|
RETRO_END_DECLS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -431,9 +431,6 @@ class Pass
|
|||||||
bool init_pipeline();
|
bool init_pipeline();
|
||||||
bool init_pipeline_layout();
|
bool init_pipeline_layout();
|
||||||
|
|
||||||
void set_texture(VkDescriptorSet set, unsigned binding,
|
|
||||||
const Texture &texture);
|
|
||||||
|
|
||||||
void set_semantic_texture(VkDescriptorSet set, slang_texture_semantic semantic,
|
void set_semantic_texture(VkDescriptorSet set, slang_texture_semantic semantic,
|
||||||
const Texture &texture);
|
const Texture &texture);
|
||||||
void set_semantic_texture_array(VkDescriptorSet set,
|
void set_semantic_texture_array(VkDescriptorSet set,
|
||||||
@ -2018,36 +2015,14 @@ bool Pass::build()
|
|||||||
filtered_parameters.push_back(parameters[i]);
|
filtered_parameters.push_back(parameters[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!init_pipeline())
|
return init_pipeline();
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Pass::set_texture(VkDescriptorSet set, unsigned binding,
|
|
||||||
const Texture &texture)
|
|
||||||
{
|
|
||||||
VkDescriptorImageInfo image_info;
|
|
||||||
VkWriteDescriptorSet write = { VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET };
|
|
||||||
|
|
||||||
image_info.sampler = common->samplers[texture.filter][texture.mip_filter][texture.address];
|
|
||||||
image_info.imageView = texture.texture.view;
|
|
||||||
image_info.imageLayout = texture.texture.layout;
|
|
||||||
|
|
||||||
write.dstSet = set;
|
|
||||||
write.dstBinding = binding;
|
|
||||||
write.descriptorCount = 1;
|
|
||||||
write.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
|
|
||||||
write.pImageInfo = &image_info;
|
|
||||||
|
|
||||||
vkUpdateDescriptorSets(device, 1, &write, 0, nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pass::set_semantic_texture(VkDescriptorSet set,
|
void Pass::set_semantic_texture(VkDescriptorSet set,
|
||||||
slang_texture_semantic semantic, const Texture &texture)
|
slang_texture_semantic semantic, const Texture &texture)
|
||||||
{
|
{
|
||||||
if (reflection.semantic_textures[semantic][0].texture)
|
if (reflection.semantic_textures[semantic][0].texture)
|
||||||
set_texture(set, reflection.semantic_textures[semantic][0].binding, texture);
|
vulkan_pass_set_texture(device, set, common->samplers[texture.filter][texture.mip_filter][texture.address], reflection.semantic_textures[semantic][0].binding, texture.texture.view, texture.texture.layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pass::set_semantic_texture_array(VkDescriptorSet set,
|
void Pass::set_semantic_texture_array(VkDescriptorSet set,
|
||||||
@ -2056,7 +2031,7 @@ void Pass::set_semantic_texture_array(VkDescriptorSet set,
|
|||||||
{
|
{
|
||||||
if (index < reflection.semantic_textures[semantic].size() &&
|
if (index < reflection.semantic_textures[semantic].size() &&
|
||||||
reflection.semantic_textures[semantic][index].texture)
|
reflection.semantic_textures[semantic][index].texture)
|
||||||
set_texture(set, reflection.semantic_textures[semantic][index].binding, texture);
|
vulkan_pass_set_texture(device, set, common->samplers[texture.filter][texture.mip_filter][texture.address], reflection.semantic_textures[semantic][index].binding, texture.texture.view, texture.texture.layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pass::build_semantic_texture_array_vec4(uint8_t *data, slang_texture_semantic semantic,
|
void Pass::build_semantic_texture_array_vec4(uint8_t *data, slang_texture_semantic semantic,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user