HLSL: Catch error cases earlier, preventing a later assert.
Related to https://github.com/KhronosGroup/SPIRV-Cross/issues/1414.
The real problem is either using DX10 semantics for DX9 or missing
functionality in DX10 parsing.
diff --git a/glslang/HLSL/hlslParseHelper.cpp b/glslang/HLSL/hlslParseHelper.cpp
index dff3264..ca0d207 100755
--- a/glslang/HLSL/hlslParseHelper.cpp
+++ b/glslang/HLSL/hlslParseHelper.cpp
@@ -3924,6 +3924,7 @@
case Esd3D: constructOp = EOpConstructVec3; coordSize = 3; break; // 3D
case EsdCube: constructOp = EOpConstructVec3; coordSize = 3; break; // also 3D
default:
+ error(loc, "unhandled DX9 texture LoD dimension", "", "");
break;
}
@@ -3960,7 +3961,9 @@
case Esd2D: constructOp = EOpConstructVec2; break; // 2D
case Esd3D: constructOp = EOpConstructVec3; break; // 3D
case EsdCube: constructOp = EOpConstructVec3; break; // also 3D
- default: break;
+ default:
+ error(loc, "unhandled DX9 texture bias dimension", "", "");
+ break;
}
TIntermAggregate* constructCoord = new TIntermAggregate(constructOp);
@@ -4084,7 +4087,8 @@
case EsdBuffer: numDims = 1; break; // W (buffers)
case EsdRect: numDims = 2; break; // W, H (rect)
default:
- assert(0 && "unhandled texture dimension");
+ error(loc, "unhandled DX10 MethodGet dimension", "", "");
+ break;
}
// Arrayed adds another dimension for the number of array elements
@@ -4220,7 +4224,9 @@
case 3: constructOp = EOpConstructVec3; break;
case 4: constructOp = EOpConstructVec4; break;
case 5: constructOp = EOpConstructVec4; break; // cubeArrayShadow, cmp value is separate arg.
- default: assert(0); break;
+ default:
+ error(loc, "unhandled DX10 MethodSample dimension", "", "");
+ break;
}
TIntermAggregate* coordWithCmp = new TIntermAggregate(constructOp);