Merge pull request #1580 from TiemoJung/float1_times_scalar_fix

HLSL: fix invalid spir-v vector * scalar for float1
This commit is contained in:
John Kessenich 2018-11-14 11:39:22 -07:00 committed by GitHub
commit 844e0773a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -4633,7 +4633,9 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, OpD
assert(builder.isScalar(right)); assert(builder.isScalar(right));
needMatchingVectors = false; needMatchingVectors = false;
binOp = spv::OpVectorTimesScalar; binOp = spv::OpVectorTimesScalar;
} else } else if (isFloat)
binOp = spv::OpFMul;
else
binOp = spv::OpIMul; binOp = spv::OpIMul;
break; break;
case glslang::EOpVectorTimesMatrix: case glslang::EOpVectorTimesMatrix:

View File

@ -64,10 +64,6 @@ gl_FragCoord origin is upper left
0:? 'f1' ( global 1-component vector of float) 0:? 'f1' ( global 1-component vector of float)
0:? 'scalar' ( global float) 0:? 'scalar' ( global float)
error: SPIRV-Tools Validation Errors
error: Expected int scalar or vector type as Result Type: IMul
%20 = OpIMul %float %18 %19
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80007 // Generated by (magic number): 80007
// Id's are bound by 27 // Id's are bound by 27
@ -106,10 +102,10 @@ error: Expected int scalar or vector type as Result Type: IMul
12: Label 12: Label
18: 6(float) Load 14(f1) 18: 6(float) Load 14(f1)
19: 6(float) Load 16(scalar) 19: 6(float) Load 16(scalar)
20: 6(float) IMul 18 19 20: 6(float) FMul 18 19
21: 6(float) Load 9(inFloat1) 21: 6(float) Load 9(inFloat1)
22: 6(float) Load 10(inScalar) 22: 6(float) Load 10(inScalar)
23: 6(float) IMul 21 22 23: 6(float) FMul 21 22
24: 6(float) FAdd 20 23 24: 6(float) FAdd 20 23
ReturnValue 24 ReturnValue 24
FunctionEnd FunctionEnd