Don't use sampler array for non-single texture descriptor
Devices like Apple A8 don't support it
This commit is contained in:
parent
6d74e84609
commit
3f99e63a3c
@ -41,47 +41,52 @@ vec4 sampleMeshTexture7(int material_id, vec2 uv)
|
||||
return texture(f_mesh_textures[(TOTAL_MESH_TEXTURE_LAYER * material_id) + 7], uv);
|
||||
}
|
||||
#else
|
||||
layout(binding = 0) uniform sampler2D f_mesh_textures[TOTAL_MESH_TEXTURE_LAYER];
|
||||
layout(binding = 0) uniform sampler2D f_mesh_texture_0;
|
||||
layout(binding = 1) uniform sampler2D f_mesh_texture_1;
|
||||
layout(binding = 2) uniform sampler2D f_mesh_texture_2;
|
||||
layout(binding = 3) uniform sampler2D f_mesh_texture_3;
|
||||
layout(binding = 4) uniform sampler2D f_mesh_texture_4;
|
||||
layout(binding = 5) uniform sampler2D f_mesh_texture_5;
|
||||
layout(binding = 6) uniform sampler2D f_mesh_texture_6;
|
||||
layout(binding = 7) uniform sampler2D f_mesh_texture_7;
|
||||
|
||||
vec4 sampleMeshTexture0(int material_id, vec2 uv)
|
||||
{
|
||||
return texture(f_mesh_textures[0], uv);
|
||||
return texture(f_mesh_texture_0, uv);
|
||||
}
|
||||
|
||||
vec4 sampleMeshTexture1(int material_id, vec2 uv)
|
||||
{
|
||||
return texture(f_mesh_textures[1], uv);
|
||||
return texture(f_mesh_texture_1, uv);
|
||||
}
|
||||
|
||||
#ifdef PBR_ENABLED
|
||||
vec4 sampleMeshTexture2(int material_id, vec2 uv)
|
||||
{
|
||||
return texture(f_mesh_textures[2], uv);
|
||||
return texture(f_mesh_texture_2, uv);
|
||||
}
|
||||
|
||||
vec4 sampleMeshTexture3(int material_id, vec2 uv)
|
||||
{
|
||||
return texture(f_mesh_textures[3], uv);
|
||||
return texture(f_mesh_texture_3, uv);
|
||||
}
|
||||
|
||||
vec4 sampleMeshTexture4(int material_id, vec2 uv)
|
||||
{
|
||||
return texture(f_mesh_textures[4], uv);
|
||||
return texture(f_mesh_texture_4, uv);
|
||||
}
|
||||
|
||||
vec4 sampleMeshTexture5(int material_id, vec2 uv)
|
||||
{
|
||||
return texture(f_mesh_textures[5], uv);
|
||||
return texture(f_mesh_texture_5, uv);
|
||||
}
|
||||
|
||||
vec4 sampleMeshTexture6(int material_id, vec2 uv)
|
||||
{
|
||||
return texture(f_mesh_textures[6], uv);
|
||||
return texture(f_mesh_texture_6, uv);
|
||||
}
|
||||
|
||||
vec4 sampleMeshTexture7(int material_id, vec2 uv)
|
||||
{
|
||||
return texture(f_mesh_textures[7], uv);
|
||||
return texture(f_mesh_texture_7, uv);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -26,20 +26,27 @@ GEVulkanTextureDescriptor::GEVulkanTextureDescriptor(unsigned max_texture_list,
|
||||
m_vk = getVKDriver();
|
||||
|
||||
// m_descriptor_set_layout
|
||||
VkDescriptorSetLayoutBinding texture_layout_binding = {};
|
||||
texture_layout_binding.binding = m_binding;
|
||||
texture_layout_binding.descriptorCount =
|
||||
single_descriptor ? m_max_texture_list * m_max_layer : m_max_layer;
|
||||
texture_layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
|
||||
texture_layout_binding.pImmutableSamplers = NULL;
|
||||
texture_layout_binding.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||
std::vector<VkDescriptorSetLayoutBinding> texture_layout_binding;
|
||||
texture_layout_binding.resize(1);
|
||||
texture_layout_binding[0].binding = m_binding;
|
||||
texture_layout_binding[0].descriptorCount =
|
||||
single_descriptor ? m_max_texture_list * m_max_layer : 1;
|
||||
texture_layout_binding[0].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
|
||||
texture_layout_binding[0].pImmutableSamplers = NULL;
|
||||
texture_layout_binding[0].stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||
if (!single_descriptor)
|
||||
{
|
||||
texture_layout_binding.resize(m_max_layer, texture_layout_binding[0]);
|
||||
for (unsigned i = 1; i < m_max_layer; i++)
|
||||
texture_layout_binding[i].binding = m_binding + i;
|
||||
}
|
||||
|
||||
VkDescriptorSetLayoutCreateInfo setinfo = {};
|
||||
setinfo.flags = 0;
|
||||
setinfo.pNext = NULL;
|
||||
setinfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
|
||||
setinfo.pBindings = &texture_layout_binding;
|
||||
setinfo.bindingCount = 1;
|
||||
setinfo.pBindings = texture_layout_binding.data();
|
||||
setinfo.bindingCount = texture_layout_binding.size();
|
||||
if (vkCreateDescriptorSetLayout(m_vk->getDevice(), &setinfo,
|
||||
NULL, &m_descriptor_set_layout) != VK_SUCCESS)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user