Commit e7c83cfb by John Kessenich

SPV GLSL.std.450: Add needed smear operations for min, max, clamp, mix, step, and smoothstep.

parent 6feb4989
...@@ -2871,6 +2871,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: ...@@ -2871,6 +2871,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
libCall = spv::GLSLstd450UMin; libCall = spv::GLSLstd450UMin;
else else
libCall = spv::GLSLstd450SMin; libCall = spv::GLSLstd450SMin;
builder.promoteScalar(precision, operands.front(), operands.back());
break; break;
case glslang::EOpModf: case glslang::EOpModf:
libCall = spv::GLSLstd450Modf; libCall = spv::GLSLstd450Modf;
...@@ -2882,6 +2883,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: ...@@ -2882,6 +2883,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
libCall = spv::GLSLstd450UMax; libCall = spv::GLSLstd450UMax;
else else
libCall = spv::GLSLstd450SMax; libCall = spv::GLSLstd450SMax;
builder.promoteScalar(precision, operands.front(), operands.back());
break; break;
case glslang::EOpPow: case glslang::EOpPow:
libCall = spv::GLSLstd450Pow; libCall = spv::GLSLstd450Pow;
...@@ -2900,18 +2902,24 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: ...@@ -2900,18 +2902,24 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
libCall = spv::GLSLstd450UClamp; libCall = spv::GLSLstd450UClamp;
else else
libCall = spv::GLSLstd450SClamp; libCall = spv::GLSLstd450SClamp;
builder.promoteScalar(precision, operands.front(), operands[1]);
builder.promoteScalar(precision, operands.front(), operands[2]);
break; break;
case glslang::EOpMix: case glslang::EOpMix:
if (isFloat) if (isFloat)
libCall = spv::GLSLstd450FMix; libCall = spv::GLSLstd450FMix;
else else
libCall = spv::GLSLstd450IMix; libCall = spv::GLSLstd450IMix;
builder.promoteScalar(precision, operands.front(), operands.back());
break; break;
case glslang::EOpStep: case glslang::EOpStep:
libCall = spv::GLSLstd450Step; libCall = spv::GLSLstd450Step;
builder.promoteScalar(precision, operands.front(), operands.back());
break; break;
case glslang::EOpSmoothStep: case glslang::EOpSmoothStep:
libCall = spv::GLSLstd450SmoothStep; libCall = spv::GLSLstd450SmoothStep;
builder.promoteScalar(precision, operands[0], operands[2]);
builder.promoteScalar(precision, operands[1], operands[2]);
break; break;
case glslang::EOpDistance: case glslang::EOpDistance:
......
...@@ -7,7 +7,7 @@ Linked fragment stage: ...@@ -7,7 +7,7 @@ Linked fragment stage:
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 55 // Id's are bound by 56
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
...@@ -82,7 +82,8 @@ Linked fragment stage: ...@@ -82,7 +82,8 @@ Linked fragment stage:
51: 6(float) Load 50(blend) 51: 6(float) Load 50(blend)
52: 6(float) Load 8(blendscale) 52: 6(float) Load 8(blendscale)
53: 6(float) FMul 51 52 53: 6(float) FMul 51 52
54: 10(fvec4) ExtInst 1(GLSL.std.450) 46(FMix) 45 48 53 54: 10(fvec4) CompositeConstruct 53 53 53 53
Store 44(gl_FragColor) 54 55: 10(fvec4) ExtInst 1(GLSL.std.450) 46(FMix) 45 48 54
Store 44(gl_FragColor) 55
Return Return
FunctionEnd FunctionEnd
...@@ -8,12 +8,12 @@ Linked fragment stage: ...@@ -8,12 +8,12 @@ Linked fragment stage:
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 290 // Id's are bound by 291
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 289 47 EntryPoint Fragment 4 "main" 290 47
ExecutionMode 4 OriginLowerLeft ExecutionMode 4 OriginLowerLeft
Source GLSL 130 Source GLSL 130
Name 4 "main" Name 4 "main"
...@@ -39,8 +39,8 @@ Linked fragment stage: ...@@ -39,8 +39,8 @@ Linked fragment stage:
Name 276 "gl_FragColor" Name 276 "gl_FragColor"
Name 279 "u" Name 279 "u"
Name 282 "blend" Name 282 "blend"
Name 288 "scale" Name 289 "scale"
Name 289 "t" Name 290 "t"
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
...@@ -103,9 +103,9 @@ Linked fragment stage: ...@@ -103,9 +103,9 @@ Linked fragment stage:
279(u): 278(ptr) Variable UniformConstant 279(u): 278(ptr) Variable UniformConstant
281: TypePointer UniformConstant 6(float) 281: TypePointer UniformConstant 6(float)
282(blend): 281(ptr) Variable UniformConstant 282(blend): 281(ptr) Variable UniformConstant
287: TypePointer UniformConstant 45(fvec2) 288: TypePointer UniformConstant 45(fvec2)
288(scale): 287(ptr) Variable UniformConstant 289(scale): 288(ptr) Variable UniformConstant
289(t): 46(ptr) Variable Input 290(t): 46(ptr) Variable Input
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
8(blendscale): 7(ptr) Variable Function 8(blendscale): 7(ptr) Variable Function
...@@ -370,7 +370,8 @@ Linked fragment stage: ...@@ -370,7 +370,8 @@ Linked fragment stage:
283: 6(float) Load 282(blend) 283: 6(float) Load 282(blend)
284: 6(float) Load 8(blendscale) 284: 6(float) Load 8(blendscale)
285: 6(float) FMul 283 284 285: 6(float) FMul 283 284
286: 22(fvec4) ExtInst 1(GLSL.std.450) 46(FMix) 277 280 285 286: 22(fvec4) CompositeConstruct 285 285 285 285
Store 276(gl_FragColor) 286 287: 22(fvec4) ExtInst 1(GLSL.std.450) 46(FMix) 277 280 286
Store 276(gl_FragColor) 287
Return Return
FunctionEnd FunctionEnd
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits. // For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run). // For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "SPIRV99.844" #define GLSLANG_REVISION "SPIRV99.845"
#define GLSLANG_DATE "13-Dec-2015" #define GLSLANG_DATE "13-Dec-2015"
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