Commit b112fac0 by John Kessenich

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.
parent 8d3f3b7d
...@@ -3924,6 +3924,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType ...@@ -3924,6 +3924,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
case Esd3D: constructOp = EOpConstructVec3; coordSize = 3; break; // 3D case Esd3D: constructOp = EOpConstructVec3; coordSize = 3; break; // 3D
case EsdCube: constructOp = EOpConstructVec3; coordSize = 3; break; // also 3D case EsdCube: constructOp = EOpConstructVec3; coordSize = 3; break; // also 3D
default: default:
error(loc, "unhandled DX9 texture LoD dimension", "", "");
break; break;
} }
...@@ -3960,7 +3961,9 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType ...@@ -3960,7 +3961,9 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
case Esd2D: constructOp = EOpConstructVec2; break; // 2D case Esd2D: constructOp = EOpConstructVec2; break; // 2D
case Esd3D: constructOp = EOpConstructVec3; break; // 3D case Esd3D: constructOp = EOpConstructVec3; break; // 3D
case EsdCube: constructOp = EOpConstructVec3; break; // also 3D case EsdCube: constructOp = EOpConstructVec3; break; // also 3D
default: break; default:
error(loc, "unhandled DX9 texture bias dimension", "", "");
break;
} }
TIntermAggregate* constructCoord = new TIntermAggregate(constructOp); TIntermAggregate* constructCoord = new TIntermAggregate(constructOp);
...@@ -4084,7 +4087,8 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType ...@@ -4084,7 +4087,8 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
case EsdBuffer: numDims = 1; break; // W (buffers) case EsdBuffer: numDims = 1; break; // W (buffers)
case EsdRect: numDims = 2; break; // W, H (rect) case EsdRect: numDims = 2; break; // W, H (rect)
default: default:
assert(0 && "unhandled texture dimension"); error(loc, "unhandled DX10 MethodGet dimension", "", "");
break;
} }
// Arrayed adds another dimension for the number of array elements // Arrayed adds another dimension for the number of array elements
...@@ -4220,7 +4224,9 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType ...@@ -4220,7 +4224,9 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
case 3: constructOp = EOpConstructVec3; break; case 3: constructOp = EOpConstructVec3; break;
case 4: constructOp = EOpConstructVec4; break; case 4: constructOp = EOpConstructVec4; break;
case 5: constructOp = EOpConstructVec4; break; // cubeArrayShadow, cmp value is separate arg. 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); TIntermAggregate* coordWithCmp = new TIntermAggregate(constructOp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment