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