Browse Source

[BUG] On shader reflection fetch only the active attributes

Panagiotis Christopoulos Charitos 8 years ago
parent
commit
bf43dfd667
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/anki/gr/vulkan/ShaderImpl.cpp

+ 2 - 1
src/anki/gr/vulkan/ShaderImpl.cpp

@@ -325,6 +325,7 @@ void ShaderImpl::doReflection(const std::vector<unsigned int>& spirv)
 {
 {
 	spirv_cross::Compiler spvc(spirv);
 	spirv_cross::Compiler spvc(spirv);
 	spirv_cross::ShaderResources rsrc = spvc.get_shader_resources();
 	spirv_cross::ShaderResources rsrc = spvc.get_shader_resources();
+	spirv_cross::ShaderResources rsrcActive = spvc.get_shader_resources(spvc.get_active_interface_variables());
 
 
 	Array<U, MAX_DESCRIPTOR_SETS> counts = {{
 	Array<U, MAX_DESCRIPTOR_SETS> counts = {{
 		0,
 		0,
@@ -383,7 +384,7 @@ void ShaderImpl::doReflection(const std::vector<unsigned int>& spirv)
 	// Attribs
 	// Attribs
 	if(m_shaderType == ShaderType::VERTEX)
 	if(m_shaderType == ShaderType::VERTEX)
 	{
 	{
-		for(const spirv_cross::Resource& r : rsrc.stage_inputs)
+		for(const spirv_cross::Resource& r : rsrcActive.stage_inputs)
 		{
 		{
 			const U32 id = r.id;
 			const U32 id = r.id;
 			const U32 location = spvc.get_decoration(id, spv::Decoration::DecorationLocation);
 			const U32 location = spvc.get_decoration(id, spv::Decoration::DecorationLocation);