mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-22 03:30:06 +00:00
Handle OpMemberDecorateStringGOOGLE in ACDE (#2029)
Add missing case to the switch statement for the annotation instructions. See https://github.com/KhronosGroup/glslang/issues/1561.
This commit is contained in:
parent
9e6f5134d1
commit
f2cc71e5cb
@ -643,6 +643,7 @@ bool AggressiveDCEPass::ProcessGlobalValues() {
|
|||||||
case SpvOpDecorate:
|
case SpvOpDecorate:
|
||||||
case SpvOpMemberDecorate:
|
case SpvOpMemberDecorate:
|
||||||
case SpvOpDecorateStringGOOGLE:
|
case SpvOpDecorateStringGOOGLE:
|
||||||
|
case SpvOpMemberDecorateStringGOOGLE:
|
||||||
if (IsTargetDead(annotation)) {
|
if (IsTargetDead(annotation)) {
|
||||||
context()->KillInst(annotation);
|
context()->KillInst(annotation);
|
||||||
modified = true;
|
modified = true;
|
||||||
|
@ -6135,6 +6135,42 @@ TEST_F(AggressiveDCETest, DeadHlslCounterBufferGOOGLE) {
|
|||||||
SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS);
|
SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS);
|
||||||
SinglePassRunAndMatch<AggressiveDCEPass>(test, true);
|
SinglePassRunAndMatch<AggressiveDCEPass>(test, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(AggressiveDCETest, Dead) {
|
||||||
|
// We are able to remove "local2" because it is not loaded, but have to keep
|
||||||
|
// the stores to "local1".
|
||||||
|
const std::string test =
|
||||||
|
R"(
|
||||||
|
; CHECK: OpCapability
|
||||||
|
; CHECK-NOT: OpMemberDecorateStringGOOGLE
|
||||||
|
; CHECK: OpFunctionEnd
|
||||||
|
OpCapability Shader
|
||||||
|
OpExtension "SPV_GOOGLE_hlsl_functionality1"
|
||||||
|
%1 = OpExtInstImport "GLSL.std.450"
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint Vertex %VSMain "VSMain"
|
||||||
|
OpSource HLSL 500
|
||||||
|
OpName %VSMain "VSMain"
|
||||||
|
OpName %PSInput "PSInput"
|
||||||
|
OpMemberName %PSInput 0 "Pos"
|
||||||
|
OpMemberName %PSInput 1 "uv"
|
||||||
|
OpMemberDecorateStringGOOGLE %PSInput 0 HlslSemanticGOOGLE "SV_POSITION"
|
||||||
|
OpMemberDecorateStringGOOGLE %PSInput 1 HlslSemanticGOOGLE "TEX_COORD"
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%5 = OpTypeFunction %void
|
||||||
|
%float = OpTypeFloat 32
|
||||||
|
%v2float = OpTypeVector %float 2
|
||||||
|
%v4float = OpTypeVector %float 4
|
||||||
|
%PSInput = OpTypeStruct %v4float %v2float
|
||||||
|
%VSMain = OpFunction %void None %5
|
||||||
|
%9 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
||||||
|
)";
|
||||||
|
|
||||||
|
SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS);
|
||||||
|
SinglePassRunAndMatch<AggressiveDCEPass>(test, true);
|
||||||
|
}
|
||||||
// TODO(greg-lunarg): Add tests to verify handling of these cases:
|
// TODO(greg-lunarg): Add tests to verify handling of these cases:
|
||||||
//
|
//
|
||||||
// Check that logical addressing required
|
// Check that logical addressing required
|
||||||
|
Loading…
Reference in New Issue
Block a user