From 937087a641ca21f0bc25121c125fa419eee38035 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Fri, 16 Nov 2018 08:05:25 -0800 Subject: Updated comment --- Graphics/GLSLTools/src/SPIRVShaderResources.cpp | 27 +++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'Graphics/GLSLTools') diff --git a/Graphics/GLSLTools/src/SPIRVShaderResources.cpp b/Graphics/GLSLTools/src/SPIRVShaderResources.cpp index 86261e5b..fc881893 100644 --- a/Graphics/GLSLTools/src/SPIRVShaderResources.cpp +++ b/Graphics/GLSLTools/src/SPIRVShaderResources.cpp @@ -112,19 +112,34 @@ static spv::ExecutionModel ShaderTypeToExecutionModel(SHADER_TYPE ShaderType) const std::string& GetUBName(spirv_cross::Compiler& Compiler, const spirv_cross::Resource& UB, const spirv_cross::ParsedIR::Source& IRSource) { // Consider the following HLSL constant buffer: + // // cbuffer Constants // { // float4x4 g_WorldViewProj; // }; // - // Reflecion information for this constant buffer extracted from the byte code produced - // by glslang and dxc looks as follows: + // glslang emits SPIRV as if the following GLSL was written: + // + // uniform Constants // UB.name + // { + // float4x4 g_WorldViewProj; + // }; // no instance name + // + // DXC emits the byte code that corresponds to the following GLSL: // - // glslang DXC - // UB.name "Constants" "type_Constants" - // Compiler.get_name(UB.id) "" "Constants" + // uniform type_Constants // UB.name + // { + // float4x4 g_WorldViewProj; + // }Constants; // get_name(UB.id) + // + // + // | glslang | DXC + // ------------------------------------------------------------------- + // UB.name | "Constants" | "type_Constants" + // Compiler.get_name(UB.id) | "" | "Constants" // - // For byte code produced from GLSL, we must always use UB.name + // Note that for the byte code produced from GLSL, we must always + // use UB.name even if the instance name is present const auto& instance_name = Compiler.get_name(UB.id); return (IRSource.hlsl && !instance_name.empty()) ? instance_name : UB.name; -- cgit v1.2.3