Fix vertex instrumentation to use VertexIndex and InstanceIndex (#2294)

...instead of VertexId and InstanceId
This commit is contained in:
greg-lunarg 2019-01-16 16:02:07 -07:00 committed by David Neto
parent 70404a96ab
commit 8d2d66f30c
4 changed files with 15 additions and 15 deletions

View File

@ -75,8 +75,8 @@ static const int kInstCommonOutCnt = 4;
// error. // error.
// //
// Vertex Shader Output Record Offsets // Vertex Shader Output Record Offsets
static const int kInstVertOutVertexId = kInstCommonOutCnt; static const int kInstVertOutVertexIndex = kInstCommonOutCnt;
static const int kInstVertOutInstanceId = kInstCommonOutCnt + 1; static const int kInstVertOutInstanceIndex = kInstCommonOutCnt + 1;
// Frag Shader Output Record Offsets // Frag Shader Output Record Offsets
static const int kInstFragOutFragCoordX = kInstCommonOutCnt; static const int kInstFragOutFragCoordX = kInstCommonOutCnt;

View File

@ -168,10 +168,10 @@ void InstrumentPass::GenStageStreamWriteCode(uint32_t stage_idx,
switch (stage_idx) { switch (stage_idx) {
case SpvExecutionModelVertex: { case SpvExecutionModelVertex: {
// Load and store VertexId and InstanceId // Load and store VertexId and InstanceId
GenBuiltinOutputCode(context()->GetBuiltinVarId(SpvBuiltInVertexId), GenBuiltinOutputCode(context()->GetBuiltinVarId(SpvBuiltInVertexIndex),
kInstVertOutVertexId, base_offset_id, builder); kInstVertOutVertexIndex, base_offset_id, builder);
GenBuiltinOutputCode(context()->GetBuiltinVarId(SpvBuiltInInstanceId), GenBuiltinOutputCode(context()->GetBuiltinVarId(SpvBuiltInInstanceIndex),
kInstVertOutInstanceId, base_offset_id, builder); kInstVertOutInstanceIndex, base_offset_id, builder);
} break; } break;
case SpvExecutionModelGLCompute: { case SpvExecutionModelGLCompute: {
// Load and store GlobalInvocationId. Second word is unused; store zero. // Load and store GlobalInvocationId. Second word is unused; store zero.

View File

@ -669,8 +669,8 @@ uint32_t IRContext::GetBuiltinVarId(uint32_t builtin) {
reg_type = type_mgr->GetRegisteredType(&v4float_ty); reg_type = type_mgr->GetRegisteredType(&v4float_ty);
break; break;
} }
case SpvBuiltInVertexId: case SpvBuiltInVertexIndex:
case SpvBuiltInInstanceId: case SpvBuiltInInstanceIndex:
case SpvBuiltInPrimitiveId: case SpvBuiltInPrimitiveId:
case SpvBuiltInInvocationId: case SpvBuiltInInvocationId:
case SpvBuiltInGlobalInvocationId: { case SpvBuiltInGlobalInvocationId: {

View File

@ -1650,7 +1650,7 @@ OpCapability Sampled1D
OpExtension "SPV_KHR_storage_buffer_storage_class" OpExtension "SPV_KHR_storage_buffer_storage_class"
%1 = OpExtInstImport "GLSL.std.450" %1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %_ %coords2D %gl_VertexID %gl_InstanceID OpEntryPoint Vertex %main "main" %_ %coords2D %gl_VertexIndex %gl_InstanceIndex
OpSource GLSL 450 OpSource GLSL 450
OpName %main "main" OpName %main "main"
OpName %lod "lod" OpName %lod "lod"
@ -1684,8 +1684,8 @@ OpMemberDecorate %_struct_61 0 Offset 0
OpMemberDecorate %_struct_61 1 Offset 4 OpMemberDecorate %_struct_61 1 Offset 4
OpDecorate %63 DescriptorSet 7 OpDecorate %63 DescriptorSet 7
OpDecorate %63 Binding 0 OpDecorate %63 Binding 0
OpDecorate %gl_VertexID BuiltIn VertexId OpDecorate %gl_VertexIndex BuiltIn VertexIndex
OpDecorate %gl_InstanceID BuiltIn InstanceId OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex
%void = OpTypeVoid %void = OpTypeVoid
%12 = OpTypeFunction %void %12 = OpTypeFunction %void
%float = OpTypeFloat 32 %float = OpTypeFloat 32
@ -1730,8 +1730,8 @@ OpDecorate %gl_InstanceID BuiltIn InstanceId
%uint_2 = OpConstant %uint 2 %uint_2 = OpConstant %uint 2
%uint_3 = OpConstant %uint 3 %uint_3 = OpConstant %uint 3
%_ptr_Input_uint = OpTypePointer Input %uint %_ptr_Input_uint = OpTypePointer Input %uint
%gl_VertexID = OpVariable %_ptr_Input_uint Input %gl_VertexIndex = OpVariable %_ptr_Input_uint Input
%gl_InstanceID = OpVariable %_ptr_Input_uint Input %gl_InstanceIndex = OpVariable %_ptr_Input_uint Input
%uint_5 = OpConstant %uint 5 %uint_5 = OpConstant %uint 5
%uint_6 = OpConstant %uint 6 %uint_6 = OpConstant %uint 6
%uint_7 = OpConstant %uint 7 %uint_7 = OpConstant %uint 7
@ -1819,11 +1819,11 @@ OpStore %81 %55
%83 = OpIAdd %uint %68 %uint_3 %83 = OpIAdd %uint %68 %uint_3
%84 = OpAccessChain %_ptr_StorageBuffer_uint %63 %uint_1 %83 %84 = OpAccessChain %_ptr_StorageBuffer_uint %63 %uint_1 %83
OpStore %84 %uint_0 OpStore %84 %uint_0
%87 = OpLoad %uint %gl_VertexID %87 = OpLoad %uint %gl_VertexIndex
%88 = OpIAdd %uint %68 %uint_4 %88 = OpIAdd %uint %68 %uint_4
%89 = OpAccessChain %_ptr_StorageBuffer_uint %63 %uint_1 %88 %89 = OpAccessChain %_ptr_StorageBuffer_uint %63 %uint_1 %88
OpStore %89 %87 OpStore %89 %87
%91 = OpLoad %uint %gl_InstanceID %91 = OpLoad %uint %gl_InstanceIndex
%93 = OpIAdd %uint %68 %uint_5 %93 = OpIAdd %uint %68 %uint_5
%94 = OpAccessChain %_ptr_StorageBuffer_uint %63 %uint_1 %93 %94 = OpAccessChain %_ptr_StorageBuffer_uint %63 %uint_1 %93
OpStore %94 %91 OpStore %94 %91