SPV: RelaxedPrecision: Generalize fix #2293 to cover more operations.

This simplifies and enforces use of precision in many more places,
to help avoid accidental loss of RelaxedPrecision through intermediate
operations. Known fixes are:
- ?:
- function return values with mis-matched precision
- precision of function return values when a copy was needed to fix types
This commit is contained in:
John Kessenich 2020-06-30 01:27:08 -06:00
parent 27e915ed4f
commit 435dd8028b
10 changed files with 835 additions and 670 deletions

View File

@ -2981,7 +2981,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
// receive the result, and must later swizzle that into the original // receive the result, and must later swizzle that into the original
// l-value. // l-value.
complexLvalues.push_back(builder.getAccessChain()); complexLvalues.push_back(builder.getAccessChain());
temporaryLvalues.push_back(builder.createVariable(spv::StorageClassFunction, temporaryLvalues.push_back(builder.createVariable(
spv::NoPrecision, spv::StorageClassFunction,
builder.accessChainGetInferredType(), "swizzleTemp")); builder.accessChainGetInferredType(), "swizzleTemp"));
operands.push_back(temporaryLvalues.back()); operands.push_back(temporaryLvalues.back());
} else { } else {
@ -3084,7 +3085,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
for (unsigned int i = 0; i < temporaryLvalues.size(); ++i) { for (unsigned int i = 0; i < temporaryLvalues.size(); ++i) {
builder.setAccessChain(complexLvalues[i]); builder.setAccessChain(complexLvalues[i]);
builder.accessChainStore(builder.createLoad(temporaryLvalues[i])); builder.accessChainStore(builder.createLoad(temporaryLvalues[i], spv::NoPrecision));
} }
} }
@ -3201,7 +3202,8 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang
} else { } else {
// We need control flow to select the result. // We need control flow to select the result.
// TODO: Once SPIR-V OpSelect allows arbitrary types, eliminate this path. // TODO: Once SPIR-V OpSelect allows arbitrary types, eliminate this path.
result = builder.createVariable(spv::StorageClassFunction, convertGlslangToSpvType(node->getType())); result = builder.createVariable(TranslatePrecisionDecoration(node->getType()),
spv::StorageClassFunction, convertGlslangToSpvType(node->getType()));
// Selection control: // Selection control:
const spv::SelectionControlMask control = TranslateSelectionControl(*node); const spv::SelectionControlMask control = TranslateSelectionControl(*node);
@ -3226,8 +3228,10 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang
// Execute the one side needed, as per the condition // Execute the one side needed, as per the condition
const auto executeOneSide = [&]() { const auto executeOneSide = [&]() {
// Always emit control flow. // Always emit control flow.
if (node->getBasicType() != glslang::EbtVoid) if (node->getBasicType() != glslang::EbtVoid) {
result = builder.createVariable(spv::StorageClassFunction, convertGlslangToSpvType(node->getType())); result = builder.createVariable(TranslatePrecisionDecoration(node->getType()), spv::StorageClassFunction,
convertGlslangToSpvType(node->getType()));
}
// Selection control: // Selection control:
const spv::SelectionControlMask control = TranslateSelectionControl(*node); const spv::SelectionControlMask control = TranslateSelectionControl(*node);
@ -3424,15 +3428,17 @@ bool TGlslangToSpvTraverser::visitBranch(glslang::TVisit /* visit */, glslang::T
builder.createLoopContinue(); builder.createLoopContinue();
break; break;
case glslang::EOpReturn: case glslang::EOpReturn:
if (node->getExpression()) { if (node->getExpression() != nullptr) {
const glslang::TType& glslangReturnType = node->getExpression()->getType(); const glslang::TType& glslangReturnType = node->getExpression()->getType();
spv::Id returnId = accessChainLoad(glslangReturnType); spv::Id returnId = accessChainLoad(glslangReturnType);
if (builder.getTypeId(returnId) != currentFunction->getReturnType()) { if (builder.getTypeId(returnId) != currentFunction->getReturnType() ||
TranslatePrecisionDecoration(glslangReturnType) != currentFunction->getReturnPrecision()) {
builder.clearAccessChain(); builder.clearAccessChain();
spv::Id copyId = builder.createVariable(spv::StorageClassFunction, currentFunction->getReturnType()); spv::Id copyId = builder.createVariable(currentFunction->getReturnPrecision(),
spv::StorageClassFunction, currentFunction->getReturnType());
builder.setAccessChainLValue(copyId); builder.setAccessChainLValue(copyId);
multiTypeStore(glslangReturnType, returnId); multiTypeStore(glslangReturnType, returnId);
returnId = builder.createLoad(copyId); returnId = builder.createLoad(copyId, currentFunction->getReturnPrecision());
} }
builder.makeReturn(false, returnId); builder.makeReturn(false, returnId);
} else } else
@ -3539,7 +3545,7 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol*
false /* specConst */); false /* specConst */);
} }
return builder.createVariable(storageClass, spvType, name, initializer); return builder.createVariable(spv::NoPrecision, storageClass, spvType, name, initializer);
} }
// Return type Id of the sampled type. // Return type Id of the sampled type.
@ -5334,10 +5340,8 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
++lValueCount; ++lValueCount;
} else if (writableParam(qualifiers[a])) { } else if (writableParam(qualifiers[a])) {
// need space to hold the copy // need space to hold the copy
arg = builder.createVariable(spv::StorageClassFunction, arg = builder.createVariable(function->getParamPrecision(a), spv::StorageClassFunction,
builder.getContainedTypeId(function->getParamType(a)), "param"); builder.getContainedTypeId(function->getParamType(a)), "param");
if (function->isReducedPrecisionParam(a))
builder.setPrecision(arg, spv::DecorationRelaxedPrecision);
if (qualifiers[a] == glslang::EvqIn || qualifiers[a] == glslang::EvqInOut) { if (qualifiers[a] == glslang::EvqIn || qualifiers[a] == glslang::EvqInOut) {
// need to copy the input into output space // need to copy the input into output space
builder.setAccessChain(lValues[lValueCount]); builder.setAccessChain(lValues[lValueCount]);
@ -5348,21 +5352,15 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
} }
++lValueCount; ++lValueCount;
} else { } else {
const bool argIsRelaxedPrecision = TranslatePrecisionDecoration(*argTypes[a]) ==
spv::DecorationRelaxedPrecision;
// process r-value, which involves a copy for a type mismatch // process r-value, which involves a copy for a type mismatch
if (function->getParamType(a) != convertGlslangToSpvType(*argTypes[a]) || if (function->getParamType(a) != convertGlslangToSpvType(*argTypes[a]) ||
argIsRelaxedPrecision != function->isReducedPrecisionParam(a)) TranslatePrecisionDecoration(*argTypes[a]) != function->getParamPrecision(a))
{ {
spv::Id argCopy = builder.createVariable(spv::StorageClassFunction, function->getParamType(a), "arg"); spv::Id argCopy = builder.createVariable(function->getParamPrecision(a), spv::StorageClassFunction, function->getParamType(a), "arg");
if (function->isReducedPrecisionParam(a))
builder.setPrecision(argCopy, spv::DecorationRelaxedPrecision);
builder.clearAccessChain(); builder.clearAccessChain();
builder.setAccessChainLValue(argCopy); builder.setAccessChainLValue(argCopy);
multiTypeStore(*argTypes[a], rValues[rValueCount]); multiTypeStore(*argTypes[a], rValues[rValueCount]);
arg = builder.createLoad(argCopy); arg = builder.createLoad(argCopy, function->getParamPrecision(a));
if (function->isReducedPrecisionParam(a))
builder.setPrecision(arg, spv::DecorationRelaxedPrecision);
} else } else
arg = rValues[rValueCount]; arg = rValues[rValueCount];
++rValueCount; ++rValueCount;
@ -5381,7 +5379,7 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
++lValueCount; ++lValueCount;
else if (writableParam(qualifiers[a])) { else if (writableParam(qualifiers[a])) {
if (qualifiers[a] == glslang::EvqOut || qualifiers[a] == glslang::EvqInOut) { if (qualifiers[a] == glslang::EvqOut || qualifiers[a] == glslang::EvqInOut) {
spv::Id copy = builder.createLoad(spvArgs[a]); spv::Id copy = builder.createLoad(spvArgs[a], spv::NoPrecision);
builder.setAccessChain(lValues[lValueCount]); builder.setAccessChain(lValues[lValueCount]);
multiTypeStore(*argTypes[a], copy); multiTypeStore(*argTypes[a], copy);
} }

View File

@ -1297,11 +1297,11 @@ Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const
// Set up the precisions // Set up the precisions
setPrecision(function->getId(), precision); setPrecision(function->getId(), precision);
function->setReturnPrecision(precision);
for (unsigned p = 0; p < (unsigned)decorations.size(); ++p) { for (unsigned p = 0; p < (unsigned)decorations.size(); ++p) {
for (int d = 0; d < (int)decorations[p].size(); ++d) { for (int d = 0; d < (int)decorations[p].size(); ++d) {
addDecoration(firstParamId + p, decorations[p][d]); addDecoration(firstParamId + p, decorations[p][d]);
if (decorations[p][d] == DecorationRelaxedPrecision) function->addParamPrecision(p, decorations[p][d]);
function->addReducedPrecisionParam(p);
} }
} }
@ -1359,7 +1359,7 @@ void Builder::makeDiscard()
} }
// Comments in header // Comments in header
Id Builder::createVariable(StorageClass storageClass, Id type, const char* name, Id initializer) Id Builder::createVariable(Decoration precision, StorageClass storageClass, Id type, const char* name, Id initializer)
{ {
Id pointerType = makePointer(storageClass, type); Id pointerType = makePointer(storageClass, type);
Instruction* inst = new Instruction(getUniqueId(), pointerType, OpVariable); Instruction* inst = new Instruction(getUniqueId(), pointerType, OpVariable);
@ -1381,6 +1381,7 @@ Id Builder::createVariable(StorageClass storageClass, Id type, const char* name,
if (name) if (name)
addName(inst->getResultId(), name); addName(inst->getResultId(), name);
setPrecision(inst->getResultId(), precision);
return inst->getResultId(); return inst->getResultId();
} }
@ -1437,7 +1438,8 @@ void Builder::createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAcce
} }
// Comments in header // Comments in header
Id Builder::createLoad(Id lValue, spv::MemoryAccessMask memoryAccess, spv::Scope scope, unsigned int alignment) Id Builder::createLoad(Id lValue, spv::Decoration precision, spv::MemoryAccessMask memoryAccess,
spv::Scope scope, unsigned int alignment)
{ {
Instruction* load = new Instruction(getUniqueId(), getDerefTypeId(lValue), OpLoad); Instruction* load = new Instruction(getUniqueId(), getDerefTypeId(lValue), OpLoad);
load->addIdOperand(lValue); load->addIdOperand(lValue);
@ -1455,6 +1457,7 @@ Id Builder::createLoad(Id lValue, spv::MemoryAccessMask memoryAccess, spv::Scope
} }
buildPoint->addInstruction(std::unique_ptr<Instruction>(load)); buildPoint->addInstruction(std::unique_ptr<Instruction>(load));
setPrecision(load->getResultId(), precision);
return load->getResultId(); return load->getResultId();
} }
@ -2677,7 +2680,7 @@ void Builder::accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess, sp
// If swizzle still exists, it is out-of-order or not full, we must load the target vector, // If swizzle still exists, it is out-of-order or not full, we must load the target vector,
// extract and insert elements to perform writeMask and/or swizzle. // extract and insert elements to perform writeMask and/or swizzle.
if (accessChain.swizzle.size() > 0) { if (accessChain.swizzle.size() > 0) {
Id tempBaseId = createLoad(base); Id tempBaseId = createLoad(base, spv::NoPrecision);
source = createLvalueSwizzle(getTypeId(tempBaseId), tempBaseId, source, accessChain.swizzle); source = createLvalueSwizzle(getTypeId(tempBaseId), tempBaseId, source, accessChain.swizzle);
} }
@ -2716,17 +2719,17 @@ Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resu
if (constant) { if (constant) {
id = createCompositeExtract(accessChain.base, swizzleBase, indexes); id = createCompositeExtract(accessChain.base, swizzleBase, indexes);
setPrecision(id, precision);
} else { } else {
Id lValue = NoResult; Id lValue = NoResult;
if (spvVersion >= Spv_1_4) { if (spvVersion >= Spv_1_4) {
// make a new function variable for this r-value, using an initializer, // make a new function variable for this r-value, using an initializer,
// and mark it as NonWritable so that downstream it can be detected as a lookup // and mark it as NonWritable so that downstream it can be detected as a lookup
// table // table
lValue = createVariable(StorageClassFunction, getTypeId(accessChain.base), "indexable", lValue = createVariable(NoPrecision, StorageClassFunction, getTypeId(accessChain.base), "indexable", accessChain.base);
accessChain.base);
addDecoration(lValue, DecorationNonWritable); addDecoration(lValue, DecorationNonWritable);
} else { } else {
lValue = createVariable(StorageClassFunction, getTypeId(accessChain.base), "indexable"); lValue = createVariable(NoPrecision, StorageClassFunction, getTypeId(accessChain.base), "indexable");
// store into it // store into it
createStore(accessChain.base, lValue); createStore(accessChain.base, lValue);
} }
@ -2735,9 +2738,8 @@ Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resu
accessChain.isRValue = false; accessChain.isRValue = false;
// load through the access chain // load through the access chain
id = createLoad(collapseAccessChain()); id = createLoad(collapseAccessChain(), precision);
} }
setPrecision(id, precision);
} else } else
id = accessChain.base; // no precision, it was set when this was defined id = accessChain.base; // no precision, it was set when this was defined
} else { } else {
@ -2756,8 +2758,7 @@ Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resu
// loaded image types get decorated. TODO: This should maybe move to // loaded image types get decorated. TODO: This should maybe move to
// createImageTextureFunctionCall. // createImageTextureFunctionCall.
addDecoration(id, nonUniform); addDecoration(id, nonUniform);
id = createLoad(id, memoryAccess, scope, alignment); id = createLoad(id, precision, memoryAccess, scope, alignment);
setPrecision(id, precision);
addDecoration(id, nonUniform); addDecoration(id, nonUniform);
} }

View File

@ -347,7 +347,8 @@ public:
void makeDiscard(); void makeDiscard();
// Create a global or function local or IO variable. // Create a global or function local or IO variable.
Id createVariable(StorageClass, Id type, const char* name = 0, Id initializer = NoResult); Id createVariable(Decoration precision, StorageClass, Id type, const char* name = nullptr,
Id initializer = NoResult);
// Create an intermediate with an undefined value. // Create an intermediate with an undefined value.
Id createUndefined(Id type); Id createUndefined(Id type);
@ -357,7 +358,8 @@ public:
spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0); spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0);
// Load from an Id and return it // Load from an Id and return it
Id createLoad(Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, Id createLoad(Id lValue, spv::Decoration precision,
spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone,
spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0); spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0);
// Create an OpAccessChain instruction // Create an OpAccessChain instruction

View File

@ -352,13 +352,27 @@ public:
const std::vector<Block*>& getBlocks() const { return blocks; } const std::vector<Block*>& getBlocks() const { return blocks; }
void addLocalVariable(std::unique_ptr<Instruction> inst); void addLocalVariable(std::unique_ptr<Instruction> inst);
Id getReturnType() const { return functionInstruction.getTypeId(); } Id getReturnType() const { return functionInstruction.getTypeId(); }
void setReturnPrecision(Decoration precision)
{
if (precision == DecorationRelaxedPrecision)
reducedPrecisionReturn = true;
}
Decoration getReturnPrecision() const
{ return reducedPrecisionReturn ? DecorationRelaxedPrecision : NoPrecision; }
void setImplicitThis() { implicitThis = true; } void setImplicitThis() { implicitThis = true; }
bool hasImplicitThis() const { return implicitThis; } bool hasImplicitThis() const { return implicitThis; }
void addReducedPrecisionParam(int p) { reducedPrecisionParams.insert(p); } void addParamPrecision(unsigned param, Decoration precision)
bool isReducedPrecisionParam(int p) const {
{ return reducedPrecisionParams.find(p) != reducedPrecisionParams.end(); } if (precision == DecorationRelaxedPrecision)
reducedPrecisionParams.insert(param);
}
Decoration getParamPrecision(unsigned param) const
{
return reducedPrecisionParams.find(param) != reducedPrecisionParams.end() ?
DecorationRelaxedPrecision : NoPrecision;
}
void dump(std::vector<unsigned int>& out) const void dump(std::vector<unsigned int>& out) const
{ {
@ -384,6 +398,7 @@ protected:
std::vector<Instruction*> parameterInstructions; std::vector<Instruction*> parameterInstructions;
std::vector<Block*> blocks; std::vector<Block*> blocks;
bool implicitThis; // true if this is a member function expecting to be passed a 'this' as the first argument bool implicitThis; // true if this is a member function expecting to be passed a 'this' as the first argument
bool reducedPrecisionReturn;
std::set<int> reducedPrecisionParams; // list of parameter indexes that need a relaxed precision arg std::set<int> reducedPrecisionParams; // list of parameter indexes that need a relaxed precision arg
}; };
@ -445,7 +460,8 @@ protected:
// - the OpFunction instruction // - the OpFunction instruction
// - all the OpFunctionParameter instructions // - all the OpFunctionParameter instructions
__inline Function::Function(Id id, Id resultType, Id functionType, Id firstParamId, Module& parent) __inline Function::Function(Id id, Id resultType, Id functionType, Id firstParamId, Module& parent)
: parent(parent), functionInstruction(id, resultType, OpFunction), implicitThis(false) : parent(parent), functionInstruction(id, resultType, OpFunction), implicitThis(false),
reducedPrecisionReturn(false)
{ {
// OpFunction // OpFunction
functionInstruction.addImmediateOperand(FunctionControlMaskNone); functionInstruction.addImmediateOperand(FunctionControlMaskNone);

View File

@ -1,12 +1,12 @@
spv.forwardFun.frag spv.forwardFun.frag
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 8000a // Generated by (magic number): 8000a
// Id's are bound by 60 // Id's are bound by 64
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 20 30 36 59 EntryPoint Fragment 4 "main" 20 30 36 63
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source GLSL 140 Source GLSL 140
Name 4 "main" Name 4 "main"
@ -20,7 +20,7 @@ spv.forwardFun.frag
Name 27 "f" Name 27 "f"
Name 30 "gl_FragColor" Name 30 "gl_FragColor"
Name 36 "d" Name 36 "d"
Name 59 "bigColor" Name 63 "bigColor"
Decorate 10(unreachableReturn() RelaxedPrecision Decorate 10(unreachableReturn() RelaxedPrecision
Decorate 16(foo(vf4;) RelaxedPrecision Decorate 16(foo(vf4;) RelaxedPrecision
Decorate 15(bar) RelaxedPrecision Decorate 15(bar) RelaxedPrecision
@ -39,10 +39,14 @@ spv.forwardFun.frag
Decorate 33 RelaxedPrecision Decorate 33 RelaxedPrecision
Decorate 36(d) RelaxedPrecision Decorate 36(d) RelaxedPrecision
Decorate 37 RelaxedPrecision Decorate 37 RelaxedPrecision
Decorate 52 RelaxedPrecision Decorate 44 RelaxedPrecision
Decorate 55 RelaxedPrecision Decorate 45 RelaxedPrecision
Decorate 49 RelaxedPrecision
Decorate 50 RelaxedPrecision
Decorate 56 RelaxedPrecision Decorate 56 RelaxedPrecision
Decorate 59(bigColor) RelaxedPrecision Decorate 59 RelaxedPrecision
Decorate 60 RelaxedPrecision
Decorate 63(bigColor) RelaxedPrecision
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
8: TypeFloat 32 8: TypeFloat 32
@ -60,11 +64,11 @@ spv.forwardFun.frag
38: 8(float) Constant 1082549862 38: 8(float) Constant 1082549862
39: TypeBool 39: TypeBool
43: 8(float) Constant 1067030938 43: 8(float) Constant 1067030938
46: 8(float) Constant 1083179008 48: 8(float) Constant 1083179008
49: TypeInt 32 0 53: TypeInt 32 0
50: 49(int) Constant 0 54: 53(int) Constant 0
53: 49(int) Constant 1 57: 53(int) Constant 1
59(bigColor): 19(ptr) Variable Input 63(bigColor): 19(ptr) Variable Input
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
18(color): 13(ptr) Variable Function 18(color): 13(ptr) Variable Function
@ -90,25 +94,31 @@ spv.forwardFun.frag
FunctionEnd FunctionEnd
10(unreachableReturn(): 8(float) Function None 9 10(unreachableReturn(): 8(float) Function None 9
11: Label 11: Label
44: 26(ptr) Variable Function
49: 26(ptr) Variable Function
34: 2 FunctionCall 6(bar() 34: 2 FunctionCall 6(bar()
37: 8(float) Load 36(d) 37: 8(float) Load 36(d)
40: 39(bool) FOrdLessThan 37 38 40: 39(bool) FOrdLessThan 37 38
SelectionMerge 42 None SelectionMerge 42 None
BranchConditional 40 41 45 BranchConditional 40 41 47
41: Label 41: Label
ReturnValue 43 Store 44 43
45: Label 45: 8(float) Load 44
ReturnValue 46 ReturnValue 45
47: Label
Store 49 48
50: 8(float) Load 49
ReturnValue 50
42: Label 42: Label
Unreachable Unreachable
FunctionEnd FunctionEnd
16(foo(vf4;): 8(float) Function None 14 16(foo(vf4;): 8(float) Function None 14
15(bar): 13(ptr) FunctionParameter 15(bar): 13(ptr) FunctionParameter
17: Label 17: Label
51: 26(ptr) AccessChain 15(bar) 50 55: 26(ptr) AccessChain 15(bar) 54
52: 8(float) Load 51 56: 8(float) Load 55
54: 26(ptr) AccessChain 15(bar) 53 58: 26(ptr) AccessChain 15(bar) 57
55: 8(float) Load 54 59: 8(float) Load 58
56: 8(float) FAdd 52 55 60: 8(float) FAdd 56 59
ReturnValue 56 ReturnValue 60
FunctionEnd FunctionEnd

View File

@ -1,12 +1,12 @@
spv.precision.frag spv.precision.frag
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 8000a // Generated by (magic number): 8000a
// Id's are bound by 127 // Id's are bound by 146
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 23 59 61 73 116 EntryPoint Fragment 4 "main" 23 62 64 76 119
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source ESSL 310 Source ESSL 310
Name 4 "main" Name 4 "main"
@ -15,72 +15,83 @@ spv.precision.frag
Name 19 "boolfun(vb2;" Name 19 "boolfun(vb2;"
Name 18 "bv2" Name 18 "bv2"
Name 23 "highfin" Name 23 "highfin"
Name 38 "sum" Name 41 "sum"
Name 40 "uniform_medium" Name 43 "uniform_medium"
Name 42 "uniform_high" Name 45 "uniform_high"
Name 48 "uniform_low" Name 51 "uniform_low"
Name 53 "arg1" Name 56 "arg1"
Name 55 "arg2" Name 58 "arg2"
Name 57 "d" Name 60 "d"
Name 59 "lowfin" Name 62 "lowfin"
Name 61 "mediumfin" Name 64 "mediumfin"
Name 65 "global_highp" Name 68 "global_highp"
Name 69 "local_highp" Name 72 "local_highp"
Name 73 "mediumfout" Name 76 "mediumfout"
Name 104 "ub2" Name 107 "ub2"
Name 105 "param" Name 108 "param"
Name 114 "S" Name 117 "S"
MemberName 114(S) 0 "a" MemberName 117(S) 0 "a"
MemberName 114(S) 1 "b" MemberName 117(S) 1 "b"
Name 116 "s" Name 119 "s"
Decorate 12(foo(vf3;) RelaxedPrecision Decorate 12(foo(vf3;) RelaxedPrecision
Decorate 11(mv3) RelaxedPrecision Decorate 11(mv3) RelaxedPrecision
Decorate 38(sum) RelaxedPrecision Decorate 27 RelaxedPrecision
Decorate 40(uniform_medium) RelaxedPrecision Decorate 28 RelaxedPrecision
Decorate 41 RelaxedPrecision Decorate 41(sum) RelaxedPrecision
Decorate 46 RelaxedPrecision Decorate 43(uniform_medium) RelaxedPrecision
Decorate 48(uniform_low) RelaxedPrecision Decorate 44 RelaxedPrecision
Decorate 49 RelaxedPrecision Decorate 49 RelaxedPrecision
Decorate 50 RelaxedPrecision Decorate 51(uniform_low) RelaxedPrecision
Decorate 51 RelaxedPrecision Decorate 52 RelaxedPrecision
Decorate 53(arg1) RelaxedPrecision Decorate 53 RelaxedPrecision
Decorate 55(arg2) RelaxedPrecision Decorate 54 RelaxedPrecision
Decorate 57(d) RelaxedPrecision Decorate 56(arg1) RelaxedPrecision
Decorate 59(lowfin) RelaxedPrecision Decorate 58(arg2) RelaxedPrecision
Decorate 60 RelaxedPrecision Decorate 60(d) RelaxedPrecision
Decorate 61(mediumfin) RelaxedPrecision Decorate 62(lowfin) RelaxedPrecision
Decorate 62 RelaxedPrecision
Decorate 63 RelaxedPrecision Decorate 63 RelaxedPrecision
Decorate 73(mediumfout) RelaxedPrecision Decorate 64(mediumfin) RelaxedPrecision
Decorate 74 RelaxedPrecision Decorate 65 RelaxedPrecision
Decorate 75 RelaxedPrecision Decorate 66 RelaxedPrecision
Decorate 76 RelaxedPrecision Decorate 76(mediumfout) RelaxedPrecision
Decorate 77 RelaxedPrecision Decorate 77 RelaxedPrecision
Decorate 78 RelaxedPrecision Decorate 78 RelaxedPrecision
Decorate 79 RelaxedPrecision Decorate 79 RelaxedPrecision
Decorate 83 RelaxedPrecision Decorate 80 RelaxedPrecision
Decorate 85 RelaxedPrecision Decorate 81 RelaxedPrecision
Decorate 87 RelaxedPrecision Decorate 82 RelaxedPrecision
Decorate 86 RelaxedPrecision
Decorate 88 RelaxedPrecision Decorate 88 RelaxedPrecision
Decorate 90 RelaxedPrecision Decorate 90 RelaxedPrecision
Decorate 91 RelaxedPrecision Decorate 91 RelaxedPrecision
Decorate 93 RelaxedPrecision
Decorate 94 RelaxedPrecision Decorate 94 RelaxedPrecision
Decorate 95 RelaxedPrecision
Decorate 96 RelaxedPrecision
Decorate 97 RelaxedPrecision Decorate 97 RelaxedPrecision
Decorate 98 RelaxedPrecision Decorate 98 RelaxedPrecision
Decorate 99 RelaxedPrecision Decorate 99 RelaxedPrecision
Decorate 100 RelaxedPrecision Decorate 100 RelaxedPrecision
Decorate 101 RelaxedPrecision Decorate 101 RelaxedPrecision
Decorate 102 RelaxedPrecision Decorate 102 RelaxedPrecision
Decorate 110 RelaxedPrecision Decorate 103 RelaxedPrecision
Decorate 112 RelaxedPrecision Decorate 104 RelaxedPrecision
Decorate 105 RelaxedPrecision
Decorate 113 RelaxedPrecision Decorate 113 RelaxedPrecision
MemberDecorate 114(S) 1 RelaxedPrecision Decorate 115 RelaxedPrecision
Decorate 120 RelaxedPrecision Decorate 116 RelaxedPrecision
Decorate 124 RelaxedPrecision MemberDecorate 117(S) 1 RelaxedPrecision
Decorate 125 RelaxedPrecision Decorate 123 RelaxedPrecision
Decorate 126 RelaxedPrecision Decorate 127 RelaxedPrecision
Decorate 128 RelaxedPrecision
Decorate 129 RelaxedPrecision
Decorate 130 RelaxedPrecision
Decorate 131 RelaxedPrecision
Decorate 132 RelaxedPrecision
Decorate 135 RelaxedPrecision
Decorate 139 RelaxedPrecision
Decorate 140 RelaxedPrecision
Decorate 143 RelaxedPrecision
Decorate 144 RelaxedPrecision
Decorate 145 RelaxedPrecision
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
@ -95,134 +106,161 @@ spv.precision.frag
21: TypeVector 6(float) 4 21: TypeVector 6(float) 4
22: TypePointer Input 21(fvec4) 22: TypePointer Input 21(fvec4)
23(highfin): 22(ptr) Variable Input 23(highfin): 22(ptr) Variable Input
29: 14(bool) ConstantFalse 26: TypePointer Function 9(fvec2)
30: 14(bool) ConstantTrue 32: 14(bool) ConstantFalse
31: 15(bvec2) ConstantComposite 29 30 33: 14(bool) ConstantTrue
36: TypeInt 32 1 34: 15(bvec2) ConstantComposite 32 33
37: TypePointer Function 36(int) 39: TypeInt 32 1
39: TypePointer Private 36(int) 40: TypePointer Function 39(int)
40(uniform_medium): 39(ptr) Variable Private 42: TypePointer Private 39(int)
42(uniform_high): 39(ptr) Variable Private 43(uniform_medium): 42(ptr) Variable Private
48(uniform_low): 39(ptr) Variable Private 45(uniform_high): 42(ptr) Variable Private
52: TypePointer Function 6(float) 51(uniform_low): 42(ptr) Variable Private
54: 6(float) Constant 1078774989 55: TypePointer Function 6(float)
56: 6(float) Constant 1232730691 57: 6(float) Constant 1078774989
58: TypePointer Input 6(float) 59: 6(float) Constant 1232730691
59(lowfin): 58(ptr) Variable Input 61: TypePointer Input 6(float)
61(mediumfin): 58(ptr) Variable Input 62(lowfin): 61(ptr) Variable Input
64: TypePointer Private 6(float) 64(mediumfin): 61(ptr) Variable Input
65(global_highp): 64(ptr) Variable Private 67: TypePointer Private 6(float)
68: TypePointer Function 21(fvec4) 68(global_highp): 67(ptr) Variable Private
72: TypePointer Output 21(fvec4) 71: TypePointer Function 21(fvec4)
73(mediumfout): 72(ptr) Variable Output 75: TypePointer Output 21(fvec4)
82: 36(int) Constant 4 76(mediumfout): 75(ptr) Variable Output
84: TypeVector 36(int) 2 85: 39(int) Constant 4
92: TypeInt 32 0 87: TypeVector 39(int) 2
93: 92(int) Constant 0 95: TypeInt 32 0
103: TypePointer Private 15(bvec2) 96: 95(int) Constant 0
104(ub2): 103(ptr) Variable Private 106: TypePointer Private 15(bvec2)
111: 6(float) Constant 1065353216 107(ub2): 106(ptr) Variable Private
114(S): TypeStruct 6(float) 6(float) 114: 6(float) Constant 1065353216
115: TypePointer Input 114(S) 117(S): TypeStruct 6(float) 6(float)
116(s): 115(ptr) Variable Input 118: TypePointer Input 117(S)
117: 36(int) Constant 0 119(s): 118(ptr) Variable Input
122: 36(int) Constant 1 120: 39(int) Constant 0
125: 39(int) Constant 1
133: 6(float) Constant 1082549862
138: 6(float) Constant 1073741824
142: 6(float) Constant 1077936128
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
38(sum): 37(ptr) Variable Function 41(sum): 40(ptr) Variable Function
53(arg1): 52(ptr) Variable Function 56(arg1): 55(ptr) Variable Function
55(arg2): 52(ptr) Variable Function 58(arg2): 55(ptr) Variable Function
57(d): 52(ptr) Variable Function 60(d): 55(ptr) Variable Function
69(local_highp): 68(ptr) Variable Function 72(local_highp): 71(ptr) Variable Function
105(param): 16(ptr) Variable Function 108(param): 16(ptr) Variable Function
41: 36(int) Load 40(uniform_medium) 135: 71(ptr) Variable Function
43: 36(int) Load 42(uniform_high) 44: 39(int) Load 43(uniform_medium)
44: 36(int) IAdd 41 43 46: 39(int) Load 45(uniform_high)
Store 38(sum) 44 47: 39(int) IAdd 44 46
45: 36(int) Load 42(uniform_high) Store 41(sum) 47
46: 36(int) Load 38(sum) 48: 39(int) Load 45(uniform_high)
47: 36(int) IAdd 46 45 49: 39(int) Load 41(sum)
Store 38(sum) 47 50: 39(int) IAdd 49 48
49: 36(int) Load 48(uniform_low) Store 41(sum) 50
50: 36(int) Load 38(sum) 52: 39(int) Load 51(uniform_low)
51: 36(int) IAdd 50 49 53: 39(int) Load 41(sum)
Store 38(sum) 51 54: 39(int) IAdd 53 52
Store 53(arg1) 54 Store 41(sum) 54
Store 55(arg2) 56 Store 56(arg1) 57
60: 6(float) Load 59(lowfin) Store 58(arg2) 59
62: 6(float) Load 61(mediumfin) 63: 6(float) Load 62(lowfin)
63: 6(float) ExtInst 1(GLSL.std.450) 67(Distance) 60 62 65: 6(float) Load 64(mediumfin)
Store 57(d) 63 66: 6(float) ExtInst 1(GLSL.std.450) 67(Distance) 63 65
66: 21(fvec4) Load 23(highfin) Store 60(d) 66
67: 6(float) ExtInst 1(GLSL.std.450) 66(Length) 66 69: 21(fvec4) Load 23(highfin)
Store 65(global_highp) 67 70: 6(float) ExtInst 1(GLSL.std.450) 66(Length) 69
70: 6(float) Load 65(global_highp) Store 68(global_highp) 70
71: 21(fvec4) CompositeConstruct 70 70 70 70 73: 6(float) Load 68(global_highp)
Store 69(local_highp) 71 74: 21(fvec4) CompositeConstruct 73 73 73 73
74: 6(float) Load 57(d) Store 72(local_highp) 74
75: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 74 77: 6(float) Load 60(d)
76: 21(fvec4) CompositeConstruct 75 75 75 75 78: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 77
77: 6(float) Load 55(arg2) 79: 21(fvec4) CompositeConstruct 78 78 78 78
78: 21(fvec4) CompositeConstruct 77 77 77 77 80: 6(float) Load 58(arg2)
79: 21(fvec4) FAdd 76 78 81: 21(fvec4) CompositeConstruct 80 80 80 80
80: 21(fvec4) Load 69(local_highp) 82: 21(fvec4) FAdd 79 81
81: 21(fvec4) FAdd 79 80 83: 21(fvec4) Load 72(local_highp)
Store 73(mediumfout) 81 84: 21(fvec4) FAdd 82 83
83: 36(int) Load 48(uniform_low) Store 76(mediumfout) 84
85: 84(ivec2) CompositeConstruct 83 83 86: 39(int) Load 51(uniform_low)
86: 36(int) Load 42(uniform_high) 88: 87(ivec2) CompositeConstruct 86 86
87: 84(ivec2) CompositeConstruct 86 86 89: 39(int) Load 45(uniform_high)
88: 84(ivec2) IMul 85 87 90: 87(ivec2) CompositeConstruct 89 89
89: 36(int) Load 42(uniform_high) 91: 87(ivec2) IMul 88 90
90: 84(ivec2) CompositeConstruct 89 89 92: 39(int) Load 45(uniform_high)
91: 84(ivec2) IAdd 88 90 93: 87(ivec2) CompositeConstruct 92 92
94: 36(int) CompositeExtract 91 0 94: 87(ivec2) IAdd 91 93
95: 36(int) IAdd 82 94 97: 39(int) CompositeExtract 94 0
96: 36(int) Load 38(sum) 98: 39(int) IAdd 85 97
97: 36(int) IAdd 96 95 99: 39(int) Load 41(sum)
Store 38(sum) 97 100: 39(int) IAdd 99 98
98: 36(int) Load 38(sum) Store 41(sum) 100
99: 6(float) ConvertSToF 98 101: 39(int) Load 41(sum)
100: 21(fvec4) CompositeConstruct 99 99 99 99 102: 6(float) ConvertSToF 101
101: 21(fvec4) Load 73(mediumfout) 103: 21(fvec4) CompositeConstruct 102 102 102 102
102: 21(fvec4) FAdd 101 100 104: 21(fvec4) Load 76(mediumfout)
Store 73(mediumfout) 102 105: 21(fvec4) FAdd 104 103
106: 15(bvec2) Load 104(ub2) Store 76(mediumfout) 105
Store 105(param) 106 109: 15(bvec2) Load 107(ub2)
107: 14(bool) FunctionCall 19(boolfun(vb2;) 105(param) Store 108(param) 109
SelectionMerge 109 None 110: 14(bool) FunctionCall 19(boolfun(vb2;) 108(param)
BranchConditional 107 108 109 SelectionMerge 112 None
108: Label BranchConditional 110 111 112
110: 21(fvec4) Load 73(mediumfout) 111: Label
112: 21(fvec4) CompositeConstruct 111 111 111 111 113: 21(fvec4) Load 76(mediumfout)
113: 21(fvec4) FAdd 110 112 115: 21(fvec4) CompositeConstruct 114 114 114 114
Store 73(mediumfout) 113 116: 21(fvec4) FAdd 113 115
Branch 109 Store 76(mediumfout) 116
109: Label Branch 112
118: 58(ptr) AccessChain 116(s) 117 112: Label
119: 6(float) Load 118 121: 61(ptr) AccessChain 119(s) 120
120: 21(fvec4) Load 73(mediumfout) 122: 6(float) Load 121
121: 21(fvec4) VectorTimesScalar 120 119 123: 21(fvec4) Load 76(mediumfout)
Store 73(mediumfout) 121 124: 21(fvec4) VectorTimesScalar 123 122
123: 58(ptr) AccessChain 116(s) 122 Store 76(mediumfout) 124
124: 6(float) Load 123 126: 61(ptr) AccessChain 119(s) 125
125: 21(fvec4) Load 73(mediumfout) 127: 6(float) Load 126
126: 21(fvec4) VectorTimesScalar 125 124 128: 21(fvec4) Load 76(mediumfout)
Store 73(mediumfout) 126 129: 21(fvec4) VectorTimesScalar 128 127
Store 76(mediumfout) 129
130: 6(float) Load 64(mediumfin)
131: 6(float) Load 64(mediumfin)
132: 6(float) FMul 130 131
134: 14(bool) FOrdGreaterThan 132 133
SelectionMerge 137 None
BranchConditional 134 136 141
136: Label
139: 21(fvec4) Load 76(mediumfout)
140: 21(fvec4) VectorTimesScalar 139 138
Store 135 140
Branch 137
141: Label
143: 21(fvec4) Load 76(mediumfout)
144: 21(fvec4) VectorTimesScalar 143 142
Store 135 144
Branch 137
137: Label
145: 21(fvec4) Load 135
Store 76(mediumfout) 145
Return Return
FunctionEnd FunctionEnd
12(foo(vf3;): 9(fvec2) Function None 10 12(foo(vf3;): 9(fvec2) Function None 10
11(mv3): 8(ptr) FunctionParameter 11(mv3): 8(ptr) FunctionParameter
13: Label 13: Label
27: 26(ptr) Variable Function
24: 21(fvec4) Load 23(highfin) 24: 21(fvec4) Load 23(highfin)
25: 9(fvec2) VectorShuffle 24 24 0 1 25: 9(fvec2) VectorShuffle 24 24 0 1
ReturnValue 25 Store 27 25
28: 9(fvec2) Load 27
ReturnValue 28
FunctionEnd FunctionEnd
19(boolfun(vb2;): 14(bool) Function None 17 19(boolfun(vb2;): 14(bool) Function None 17
18(bv2): 16(ptr) FunctionParameter 18(bv2): 16(ptr) FunctionParameter
20: Label 20: Label
28: 15(bvec2) Load 18(bv2) 31: 15(bvec2) Load 18(bv2)
32: 15(bvec2) LogicalEqual 28 31 35: 15(bvec2) LogicalEqual 31 34
33: 14(bool) All 32 36: 14(bool) All 35
ReturnValue 33 ReturnValue 36
FunctionEnd FunctionEnd

View File

@ -1,7 +1,7 @@
spv.precisionArgs.frag spv.precisionArgs.frag
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 8000a // Generated by (magic number): 8000a
// Id's are bound by 42 // Id's are bound by 83
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
@ -16,66 +16,109 @@ spv.precisionArgs.frag
Name 16 "foo(f1;f1;" Name 16 "foo(f1;f1;"
Name 14 "f" Name 14 "f"
Name 15 "g" Name 15 "g"
Name 18 "aM" Name 20 "retM(f1;"
Name 20 "bM" Name 19 "x"
Name 22 "arg" Name 23 "retH(f1;"
Name 25 "aH" Name 22 "x"
Name 27 "bH" Name 26 "retHM(f1;"
Name 29 "arg" Name 25 "x"
Name 32 "param" Name 29 "retMH(f1;"
Name 34 "param" Name 28 "x"
Name 37 "param" Name 47 "aM"
Name 39 "param" Name 49 "bM"
Name 51 "arg"
Name 54 "aH"
Name 56 "bH"
Name 58 "arg"
Name 61 "param"
Name 63 "param"
Name 66 "param"
Name 68 "param"
Name 71 "param"
Name 74 "param"
Name 77 "param"
Name 80 "param"
Decorate 8(f) RelaxedPrecision Decorate 8(f) RelaxedPrecision
Decorate 14(f) RelaxedPrecision Decorate 14(f) RelaxedPrecision
Decorate 18(aM) RelaxedPrecision Decorate 20(retM(f1;) RelaxedPrecision
Decorate 19 RelaxedPrecision Decorate 19(x) RelaxedPrecision
Decorate 20(bM) RelaxedPrecision Decorate 26(retHM(f1;) RelaxedPrecision
Decorate 21 RelaxedPrecision Decorate 28(x) RelaxedPrecision
Decorate 29(arg) RelaxedPrecision Decorate 31 RelaxedPrecision
Decorate 30 RelaxedPrecision Decorate 38 RelaxedPrecision
Decorate 32(param) RelaxedPrecision Decorate 39 RelaxedPrecision
Decorate 33 RelaxedPrecision Decorate 42 RelaxedPrecision
Decorate 35 RelaxedPrecision Decorate 47(aM) RelaxedPrecision
Decorate 37(param) RelaxedPrecision Decorate 48 RelaxedPrecision
Decorate 49(bM) RelaxedPrecision
Decorate 50 RelaxedPrecision
Decorate 58(arg) RelaxedPrecision
Decorate 59 RelaxedPrecision
Decorate 61(param) RelaxedPrecision
Decorate 62 RelaxedPrecision
Decorate 64 RelaxedPrecision
Decorate 66(param) RelaxedPrecision
Decorate 71(param) RelaxedPrecision
Decorate 72 RelaxedPrecision
Decorate 73 RelaxedPrecision
Decorate 79 RelaxedPrecision
Decorate 80(param) RelaxedPrecision
Decorate 81 RelaxedPrecision
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
7: TypeFunction 2 6(float) 6(float) 7: TypeFunction 2 6(float) 6(float)
12: TypePointer Function 6(float) 12: TypePointer Function 6(float)
13: TypeFunction 2 12(ptr) 12(ptr) 13: TypeFunction 2 12(ptr) 12(ptr)
18: TypeFunction 6(float) 12(ptr)
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
18(aM): 12(ptr) Variable Function 47(aM): 12(ptr) Variable Function
20(bM): 12(ptr) Variable Function 49(bM): 12(ptr) Variable Function
22(arg): 12(ptr) Variable Function 51(arg): 12(ptr) Variable Function
25(aH): 12(ptr) Variable Function 54(aH): 12(ptr) Variable Function
27(bH): 12(ptr) Variable Function 56(bH): 12(ptr) Variable Function
29(arg): 12(ptr) Variable Function 58(arg): 12(ptr) Variable Function
32(param): 12(ptr) Variable Function 61(param): 12(ptr) Variable Function
34(param): 12(ptr) Variable Function 63(param): 12(ptr) Variable Function
37(param): 12(ptr) Variable Function 66(param): 12(ptr) Variable Function
39(param): 12(ptr) Variable Function 68(param): 12(ptr) Variable Function
19: 6(float) Load 18(aM) 71(param): 12(ptr) Variable Function
21: 6(float) Load 20(bM) 74(param): 12(ptr) Variable Function
Store 22(arg) 21 77(param): 12(ptr) Variable Function
23: 6(float) Load 22(arg) 80(param): 12(ptr) Variable Function
24: 2 FunctionCall 10(fooConst(f1;f1;) 19 23 48: 6(float) Load 47(aM)
26: 6(float) Load 25(aH) 50: 6(float) Load 49(bM)
28: 6(float) Load 27(bH) Store 51(arg) 50
Store 29(arg) 26 52: 6(float) Load 51(arg)
30: 6(float) Load 29(arg) 53: 2 FunctionCall 10(fooConst(f1;f1;) 48 52
31: 2 FunctionCall 10(fooConst(f1;f1;) 30 28 55: 6(float) Load 54(aH)
33: 6(float) Load 18(aM) 57: 6(float) Load 56(bH)
Store 32(param) 33 Store 58(arg) 55
35: 6(float) Load 20(bM) 59: 6(float) Load 58(arg)
Store 34(param) 35 60: 2 FunctionCall 10(fooConst(f1;f1;) 59 57
36: 2 FunctionCall 16(foo(f1;f1;) 32(param) 34(param) 62: 6(float) Load 47(aM)
38: 6(float) Load 25(aH) Store 61(param) 62
Store 37(param) 38 64: 6(float) Load 49(bM)
40: 6(float) Load 27(bH) Store 63(param) 64
Store 39(param) 40 65: 2 FunctionCall 16(foo(f1;f1;) 61(param) 63(param)
41: 2 FunctionCall 16(foo(f1;f1;) 37(param) 39(param) 67: 6(float) Load 54(aH)
Store 66(param) 67
69: 6(float) Load 56(bH)
Store 68(param) 69
70: 2 FunctionCall 16(foo(f1;f1;) 66(param) 68(param)
72: 6(float) Load 47(aM)
Store 71(param) 72
73: 6(float) FunctionCall 20(retM(f1;) 71(param)
75: 6(float) Load 54(aH)
Store 74(param) 75
76: 6(float) FunctionCall 23(retH(f1;) 74(param)
78: 6(float) Load 54(aH)
Store 77(param) 78
79: 6(float) FunctionCall 26(retHM(f1;) 77(param)
81: 6(float) Load 47(aM)
Store 80(param) 81
82: 6(float) FunctionCall 29(retMH(f1;) 80(param)
Return Return
FunctionEnd FunctionEnd
10(fooConst(f1;f1;): 2 Function None 7 10(fooConst(f1;f1;): 2 Function None 7
@ -90,3 +133,33 @@ spv.precisionArgs.frag
17: Label 17: Label
Return Return
FunctionEnd FunctionEnd
20(retM(f1;): 6(float) Function None 18
19(x): 12(ptr) FunctionParameter
21: Label
31: 6(float) Load 19(x)
ReturnValue 31
FunctionEnd
23(retH(f1;): 6(float) Function None 18
22(x): 12(ptr) FunctionParameter
24: Label
34: 6(float) Load 22(x)
ReturnValue 34
FunctionEnd
26(retHM(f1;): 6(float) Function None 18
25(x): 12(ptr) FunctionParameter
27: Label
38: 12(ptr) Variable Function
37: 6(float) Load 25(x)
Store 38 37
39: 6(float) Load 38
ReturnValue 39
FunctionEnd
29(retMH(f1;): 6(float) Function None 18
28(x): 12(ptr) FunctionParameter
30: Label
43: 12(ptr) Variable Function
42: 6(float) Load 28(x)
Store 43 42
44: 6(float) Load 43
ReturnValue 44
FunctionEnd

View File

@ -5,12 +5,12 @@ WARNING: 0:139: 'switch' : last case/default label not followed by statements
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 8000a // Generated by (magic number): 8000a
// Id's are bound by 269 // Id's are bound by 275
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 62 75 129 227 233 EntryPoint Fragment 4 "main" 68 81 135 233 239
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source ESSL 310 Source ESSL 310
Name 4 "main" Name 4 "main"
@ -22,21 +22,21 @@ WARNING: 0:139: 'switch' : last case/default label not followed by statements
Name 17 "v1" Name 17 "v1"
Name 18 "v2" Name 18 "v2"
Name 19 "i1" Name 19 "i1"
Name 60 "local" Name 66 "local"
Name 62 "c" Name 68 "c"
Name 73 "f" Name 79 "f"
Name 75 "x" Name 81 "x"
Name 129 "d" Name 135 "d"
Name 155 "i" Name 161 "i"
Name 175 "j" Name 181 "j"
Name 227 "color" Name 233 "color"
Name 233 "v" Name 239 "v"
Name 234 "param" Name 240 "param"
Name 236 "param" Name 242 "param"
Name 238 "param" Name 244 "param"
Name 246 "param" Name 252 "param"
Name 248 "param" Name 254 "param"
Name 250 "param" Name 256 "param"
Decorate 15(foo1(vf4;vf4;i1;) RelaxedPrecision Decorate 15(foo1(vf4;vf4;i1;) RelaxedPrecision
Decorate 12(v1) RelaxedPrecision Decorate 12(v1) RelaxedPrecision
Decorate 13(v2) RelaxedPrecision Decorate 13(v2) RelaxedPrecision
@ -51,131 +51,137 @@ WARNING: 0:139: 'switch' : last case/default label not followed by statements
Decorate 31 RelaxedPrecision Decorate 31 RelaxedPrecision
Decorate 32 RelaxedPrecision Decorate 32 RelaxedPrecision
Decorate 33 RelaxedPrecision Decorate 33 RelaxedPrecision
Decorate 40 RelaxedPrecision Decorate 38 RelaxedPrecision
Decorate 46 RelaxedPrecision Decorate 39 RelaxedPrecision
Decorate 51 RelaxedPrecision Decorate 42 RelaxedPrecision
Decorate 48 RelaxedPrecision
Decorate 52 RelaxedPrecision
Decorate 53 RelaxedPrecision Decorate 53 RelaxedPrecision
Decorate 54 RelaxedPrecision
Decorate 55 RelaxedPrecision Decorate 55 RelaxedPrecision
Decorate 60(local) RelaxedPrecision Decorate 57 RelaxedPrecision
Decorate 62(c) RelaxedPrecision Decorate 58 RelaxedPrecision
Decorate 62(c) Flat Decorate 59 RelaxedPrecision
Decorate 62 RelaxedPrecision
Decorate 63 RelaxedPrecision Decorate 63 RelaxedPrecision
Decorate 64 RelaxedPrecision Decorate 66(local) RelaxedPrecision
Decorate 66 RelaxedPrecision Decorate 68(c) RelaxedPrecision
Decorate 67 RelaxedPrecision Decorate 68(c) Flat
Decorate 73(f) RelaxedPrecision Decorate 69 RelaxedPrecision
Decorate 75(x) RelaxedPrecision Decorate 70 RelaxedPrecision
Decorate 76 RelaxedPrecision Decorate 72 RelaxedPrecision
Decorate 77 RelaxedPrecision Decorate 73 RelaxedPrecision
Decorate 79 RelaxedPrecision Decorate 79(f) RelaxedPrecision
Decorate 80 RelaxedPrecision Decorate 81(x) RelaxedPrecision
Decorate 82 RelaxedPrecision Decorate 82 RelaxedPrecision
Decorate 83 RelaxedPrecision Decorate 83 RelaxedPrecision
Decorate 85 RelaxedPrecision Decorate 85 RelaxedPrecision
Decorate 90 RelaxedPrecision Decorate 86 RelaxedPrecision
Decorate 88 RelaxedPrecision
Decorate 89 RelaxedPrecision
Decorate 91 RelaxedPrecision Decorate 91 RelaxedPrecision
Decorate 92 RelaxedPrecision
Decorate 93 RelaxedPrecision
Decorate 94 RelaxedPrecision
Decorate 95 RelaxedPrecision
Decorate 96 RelaxedPrecision Decorate 96 RelaxedPrecision
Decorate 97 RelaxedPrecision Decorate 97 RelaxedPrecision
Decorate 98 RelaxedPrecision
Decorate 99 RelaxedPrecision Decorate 99 RelaxedPrecision
Decorate 100 RelaxedPrecision Decorate 100 RelaxedPrecision
Decorate 101 RelaxedPrecision Decorate 101 RelaxedPrecision
Decorate 102 RelaxedPrecision Decorate 102 RelaxedPrecision
Decorate 104 RelaxedPrecision Decorate 103 RelaxedPrecision
Decorate 105 RelaxedPrecision
Decorate 106 RelaxedPrecision
Decorate 107 RelaxedPrecision
Decorate 108 RelaxedPrecision Decorate 108 RelaxedPrecision
Decorate 109 RelaxedPrecision
Decorate 110 RelaxedPrecision Decorate 110 RelaxedPrecision
Decorate 111 RelaxedPrecision
Decorate 113 RelaxedPrecision
Decorate 114 RelaxedPrecision Decorate 114 RelaxedPrecision
Decorate 115 RelaxedPrecision Decorate 115 RelaxedPrecision
Decorate 116 RelaxedPrecision Decorate 116 RelaxedPrecision
Decorate 117 RelaxedPrecision
Decorate 119 RelaxedPrecision Decorate 119 RelaxedPrecision
Decorate 124 RelaxedPrecision Decorate 120 RelaxedPrecision
Decorate 121 RelaxedPrecision
Decorate 122 RelaxedPrecision
Decorate 125 RelaxedPrecision Decorate 125 RelaxedPrecision
Decorate 126 RelaxedPrecision
Decorate 127 RelaxedPrecision
Decorate 129(d) RelaxedPrecision
Decorate 129(d) Flat
Decorate 130 RelaxedPrecision Decorate 130 RelaxedPrecision
Decorate 134 RelaxedPrecision Decorate 131 RelaxedPrecision
Decorate 135 RelaxedPrecision Decorate 132 RelaxedPrecision
Decorate 133 RelaxedPrecision
Decorate 135(d) RelaxedPrecision
Decorate 135(d) Flat
Decorate 136 RelaxedPrecision Decorate 136 RelaxedPrecision
Decorate 137 RelaxedPrecision
Decorate 138 RelaxedPrecision
Decorate 139 RelaxedPrecision
Decorate 140 RelaxedPrecision Decorate 140 RelaxedPrecision
Decorate 141 RelaxedPrecision
Decorate 142 RelaxedPrecision Decorate 142 RelaxedPrecision
Decorate 143 RelaxedPrecision Decorate 143 RelaxedPrecision
Decorate 144 RelaxedPrecision Decorate 144 RelaxedPrecision
Decorate 145 RelaxedPrecision Decorate 145 RelaxedPrecision
Decorate 146 RelaxedPrecision Decorate 146 RelaxedPrecision
Decorate 148 RelaxedPrecision
Decorate 149 RelaxedPrecision
Decorate 150 RelaxedPrecision Decorate 150 RelaxedPrecision
Decorate 151 RelaxedPrecision Decorate 151 RelaxedPrecision
Decorate 152 RelaxedPrecision Decorate 152 RelaxedPrecision
Decorate 153 RelaxedPrecision Decorate 156 RelaxedPrecision
Decorate 155(i) RelaxedPrecision Decorate 157 RelaxedPrecision
Decorate 162 RelaxedPrecision Decorate 158 RelaxedPrecision
Decorate 166 RelaxedPrecision Decorate 159 RelaxedPrecision
Decorate 171 RelaxedPrecision Decorate 161(i) RelaxedPrecision
Decorate 168 RelaxedPrecision
Decorate 172 RelaxedPrecision Decorate 172 RelaxedPrecision
Decorate 173 RelaxedPrecision Decorate 177 RelaxedPrecision
Decorate 174 RelaxedPrecision Decorate 178 RelaxedPrecision
Decorate 175(j) RelaxedPrecision Decorate 179 RelaxedPrecision
Decorate 182 RelaxedPrecision Decorate 180 RelaxedPrecision
Decorate 185 RelaxedPrecision Decorate 181(j) RelaxedPrecision
Decorate 186 RelaxedPrecision Decorate 188 RelaxedPrecision
Decorate 187 RelaxedPrecision Decorate 191 RelaxedPrecision
Decorate 192 RelaxedPrecision
Decorate 193 RelaxedPrecision Decorate 193 RelaxedPrecision
Decorate 194 RelaxedPrecision
Decorate 196 RelaxedPrecision
Decorate 197 RelaxedPrecision
Decorate 198 RelaxedPrecision
Decorate 199 RelaxedPrecision Decorate 199 RelaxedPrecision
Decorate 200 RelaxedPrecision
Decorate 202 RelaxedPrecision Decorate 202 RelaxedPrecision
Decorate 203 RelaxedPrecision Decorate 203 RelaxedPrecision
Decorate 204 RelaxedPrecision Decorate 204 RelaxedPrecision
Decorate 205 RelaxedPrecision Decorate 205 RelaxedPrecision
Decorate 207 RelaxedPrecision Decorate 208 RelaxedPrecision
Decorate 209 RelaxedPrecision
Decorate 210 RelaxedPrecision
Decorate 211 RelaxedPrecision
Decorate 213 RelaxedPrecision Decorate 213 RelaxedPrecision
Decorate 214 RelaxedPrecision
Decorate 215 RelaxedPrecision
Decorate 219 RelaxedPrecision Decorate 219 RelaxedPrecision
Decorate 220 RelaxedPrecision Decorate 220 RelaxedPrecision
Decorate 221 RelaxedPrecision Decorate 221 RelaxedPrecision
Decorate 222 RelaxedPrecision Decorate 225 RelaxedPrecision
Decorate 227(color) RelaxedPrecision Decorate 226 RelaxedPrecision
Decorate 227 RelaxedPrecision
Decorate 228 RelaxedPrecision Decorate 228 RelaxedPrecision
Decorate 229 RelaxedPrecision Decorate 233(color) RelaxedPrecision
Decorate 230 RelaxedPrecision Decorate 234 RelaxedPrecision
Decorate 231 RelaxedPrecision
Decorate 233(v) RelaxedPrecision
Decorate 234(param) RelaxedPrecision
Decorate 235 RelaxedPrecision Decorate 235 RelaxedPrecision
Decorate 236(param) RelaxedPrecision Decorate 236 RelaxedPrecision
Decorate 237 RelaxedPrecision Decorate 237 RelaxedPrecision
Decorate 238(param) RelaxedPrecision Decorate 239(v) RelaxedPrecision
Decorate 239 RelaxedPrecision Decorate 240(param) RelaxedPrecision
Decorate 240 RelaxedPrecision Decorate 241 RelaxedPrecision
Decorate 242(param) RelaxedPrecision
Decorate 243 RelaxedPrecision Decorate 243 RelaxedPrecision
Decorate 244 RelaxedPrecision Decorate 244(param) RelaxedPrecision
Decorate 245 RelaxedPrecision Decorate 245 RelaxedPrecision
Decorate 246(param) RelaxedPrecision Decorate 246 RelaxedPrecision
Decorate 247 RelaxedPrecision
Decorate 248(param) RelaxedPrecision
Decorate 249 RelaxedPrecision Decorate 249 RelaxedPrecision
Decorate 250(param) RelaxedPrecision Decorate 250 RelaxedPrecision
Decorate 251 RelaxedPrecision Decorate 251 RelaxedPrecision
Decorate 252 RelaxedPrecision Decorate 252(param) RelaxedPrecision
Decorate 254 RelaxedPrecision Decorate 253 RelaxedPrecision
Decorate 254(param) RelaxedPrecision
Decorate 255 RelaxedPrecision Decorate 255 RelaxedPrecision
Decorate 256 RelaxedPrecision Decorate 256(param) RelaxedPrecision
Decorate 257 RelaxedPrecision Decorate 257 RelaxedPrecision
Decorate 264 RelaxedPrecision Decorate 258 RelaxedPrecision
Decorate 260 RelaxedPrecision
Decorate 261 RelaxedPrecision
Decorate 262 RelaxedPrecision
Decorate 263 RelaxedPrecision
Decorate 270 RelaxedPrecision
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
@ -186,295 +192,295 @@ WARNING: 0:139: 'switch' : last case/default label not followed by statements
11: TypeFunction 7(fvec4) 8(ptr) 8(ptr) 10(ptr) 11: TypeFunction 7(fvec4) 8(ptr) 8(ptr) 10(ptr)
36: 6(float) Constant 0 36: 6(float) Constant 0
37: 7(fvec4) ConstantComposite 36 36 36 36 37: 7(fvec4) ConstantComposite 36 36 36 36
48: 6(float) Constant 1065353216 50: 6(float) Constant 1065353216
49: 7(fvec4) ConstantComposite 48 48 48 48 51: 7(fvec4) ConstantComposite 50 50 50 50
61: TypePointer Input 9(int) 67: TypePointer Input 9(int)
62(c): 61(ptr) Variable Input 68(c): 67(ptr) Variable Input
65: 9(int) Constant 1 71: 9(int) Constant 1
72: TypePointer Function 6(float) 78: TypePointer Function 6(float)
74: TypePointer Input 6(float) 80: TypePointer Input 6(float)
75(x): 74(ptr) Variable Input 81(x): 80(ptr) Variable Input
129(d): 61(ptr) Variable Input 135(d): 67(ptr) Variable Input
156: 9(int) Constant 0 162: 9(int) Constant 0
163: 9(int) Constant 10 169: 9(int) Constant 10
164: TypeBool 170: TypeBool
176: 9(int) Constant 20 182: 9(int) Constant 20
183: 9(int) Constant 30 189: 9(int) Constant 30
188: 6(float) Constant 1120429670 194: 6(float) Constant 1120429670
208: 6(float) Constant 1079739679 214: 6(float) Constant 1079739679
226: TypePointer Output 6(float) 232: TypePointer Output 6(float)
227(color): 226(ptr) Variable Output 233(color): 232(ptr) Variable Output
232: TypePointer Input 7(fvec4) 238: TypePointer Input 7(fvec4)
233(v): 232(ptr) Variable Input 239(v): 238(ptr) Variable Input
241: TypeInt 32 0 247: TypeInt 32 0
242: 241(int) Constant 1 248: 247(int) Constant 1
253: 241(int) Constant 2 259: 247(int) Constant 2
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
60(local): 10(ptr) Variable Function 66(local): 10(ptr) Variable Function
73(f): 72(ptr) Variable Function 79(f): 78(ptr) Variable Function
155(i): 10(ptr) Variable Function 161(i): 10(ptr) Variable Function
175(j): 10(ptr) Variable Function 181(j): 10(ptr) Variable Function
234(param): 8(ptr) Variable Function 240(param): 8(ptr) Variable Function
236(param): 8(ptr) Variable Function 242(param): 8(ptr) Variable Function
238(param): 10(ptr) Variable Function 244(param): 10(ptr) Variable Function
246(param): 8(ptr) Variable Function 252(param): 8(ptr) Variable Function
248(param): 8(ptr) Variable Function 254(param): 8(ptr) Variable Function
250(param): 10(ptr) Variable Function 256(param): 10(ptr) Variable Function
63: 9(int) Load 62(c) 69: 9(int) Load 68(c)
Store 60(local) 63 Store 66(local) 69
64: 9(int) Load 60(local) 70: 9(int) Load 66(local)
66: 9(int) IAdd 64 65 72: 9(int) IAdd 70 71
Store 60(local) 66 Store 66(local) 72
67: 9(int) Load 62(c) 73: 9(int) Load 68(c)
SelectionMerge 71 None SelectionMerge 77 None
Switch 67 70 Switch 73 76
case 1: 68 case 1: 74
case 2: 69 case 2: 75
70: Label 76: Label
82: 6(float) Load 75(x) 88: 6(float) Load 81(x)
83: 6(float) ExtInst 1(GLSL.std.450) 15(Tan) 82 89: 6(float) ExtInst 1(GLSL.std.450) 15(Tan) 88
Store 73(f) 83 Store 79(f) 89
Branch 71 Branch 77
68: Label 74: Label
76: 6(float) Load 75(x) 82: 6(float) Load 81(x)
77: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 76 83: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 82
Store 73(f) 77 Store 79(f) 83
Branch 71 Branch 77
69: Label 75: Label
79: 6(float) Load 75(x) 85: 6(float) Load 81(x)
80: 6(float) ExtInst 1(GLSL.std.450) 14(Cos) 79 86: 6(float) ExtInst 1(GLSL.std.450) 14(Cos) 85
Store 73(f) 80 Store 79(f) 86
Branch 71 Branch 77
71: Label 77: Label
85: 9(int) Load 62(c) 91: 9(int) Load 68(c)
SelectionMerge 89 None SelectionMerge 95 None
Switch 85 88 Switch 91 94
case 1: 86 case 1: 92
case 2: 87 case 2: 93
88: Label 94: Label
99: 6(float) Load 75(x) 105: 6(float) Load 81(x)
100: 6(float) ExtInst 1(GLSL.std.450) 15(Tan) 99 106: 6(float) ExtInst 1(GLSL.std.450) 15(Tan) 105
101: 6(float) Load 73(f) 107: 6(float) Load 79(f)
102: 6(float) FAdd 101 100 108: 6(float) FAdd 107 106
Store 73(f) 102 Store 79(f) 108
Branch 89 Branch 95
86: Label 92: Label
90: 6(float) Load 75(x) 96: 6(float) Load 81(x)
91: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 90 97: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 96
92: 6(float) Load 73(f) 98: 6(float) Load 79(f)
93: 6(float) FAdd 92 91 99: 6(float) FAdd 98 97
Store 73(f) 93 Store 79(f) 99
Branch 87 Branch 93
87: Label 93: Label
94: 6(float) Load 75(x) 100: 6(float) Load 81(x)
95: 6(float) ExtInst 1(GLSL.std.450) 14(Cos) 94 101: 6(float) ExtInst 1(GLSL.std.450) 14(Cos) 100
96: 6(float) Load 73(f) 102: 6(float) Load 79(f)
97: 6(float) FAdd 96 95 103: 6(float) FAdd 102 101
Store 73(f) 97 Store 79(f) 103
Branch 89 Branch 95
89: Label 95: Label
104: 9(int) Load 62(c) 110: 9(int) Load 68(c)
SelectionMerge 107 None SelectionMerge 113 None
Switch 104 107 Switch 110 113
case 1: 105 case 1: 111
case 2: 106 case 2: 112
105: Label 111: Label
108: 6(float) Load 75(x) 114: 6(float) Load 81(x)
109: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 108 115: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 114
110: 6(float) Load 73(f) 116: 6(float) Load 79(f)
111: 6(float) FAdd 110 109 117: 6(float) FAdd 116 115
Store 73(f) 111 Store 79(f) 117
Branch 107 Branch 113
106: Label 112: Label
113: 6(float) Load 75(x) 119: 6(float) Load 81(x)
114: 6(float) ExtInst 1(GLSL.std.450) 14(Cos) 113 120: 6(float) ExtInst 1(GLSL.std.450) 14(Cos) 119
115: 6(float) Load 73(f) 121: 6(float) Load 79(f)
116: 6(float) FAdd 115 114 122: 6(float) FAdd 121 120
Store 73(f) 116 Store 79(f) 122
Branch 107 Branch 113
107: Label 113: Label
119: 9(int) Load 62(c) 125: 9(int) Load 68(c)
SelectionMerge 123 None SelectionMerge 129 None
Switch 119 122 Switch 125 128
case 1: 120 case 1: 126
case 2: 121 case 2: 127
122: Label 128: Label
150: 6(float) Load 75(x) 156: 6(float) Load 81(x)
151: 6(float) ExtInst 1(GLSL.std.450) 15(Tan) 150 157: 6(float) ExtInst 1(GLSL.std.450) 15(Tan) 156
152: 6(float) Load 73(f) 158: 6(float) Load 79(f)
153: 6(float) FAdd 152 151 159: 6(float) FAdd 158 157
Store 73(f) 153 Store 79(f) 159
Branch 123 Branch 129
120: Label 126: Label
124: 6(float) Load 75(x) 130: 6(float) Load 81(x)
125: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 124 131: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 130
126: 6(float) Load 73(f) 132: 6(float) Load 79(f)
127: 6(float) FAdd 126 125 133: 6(float) FAdd 132 131
Store 73(f) 127 Store 79(f) 133
Branch 123 Branch 129
121: Label 127: Label
130: 9(int) Load 129(d) 136: 9(int) Load 135(d)
SelectionMerge 133 None SelectionMerge 139 None
Switch 130 133 Switch 136 139
case 1: 131 case 1: 137
case 2: 132 case 2: 138
131: Label 137: Label
134: 6(float) Load 75(x) 140: 6(float) Load 81(x)
135: 6(float) Load 75(x) 141: 6(float) Load 81(x)
136: 6(float) FMul 134 135 142: 6(float) FMul 140 141
137: 6(float) Load 75(x) 143: 6(float) Load 81(x)
138: 6(float) FMul 136 137
139: 6(float) Load 73(f)
140: 6(float) FAdd 139 138
Store 73(f) 140
Branch 133
132: Label
142: 6(float) Load 75(x)
143: 6(float) Load 75(x)
144: 6(float) FMul 142 143 144: 6(float) FMul 142 143
145: 6(float) Load 73(f) 145: 6(float) Load 79(f)
146: 6(float) FAdd 145 144 146: 6(float) FAdd 145 144
Store 73(f) 146 Store 79(f) 146
Branch 133 Branch 139
133: Label 138: Label
Branch 123 148: 6(float) Load 81(x)
123: Label 149: 6(float) Load 81(x)
Store 155(i) 156 150: 6(float) FMul 148 149
Branch 157 151: 6(float) Load 79(f)
157: Label 152: 6(float) FAdd 151 150
LoopMerge 159 160 None Store 79(f) 152
Branch 161 Branch 139
161: Label 139: Label
162: 9(int) Load 155(i) Branch 129
165: 164(bool) SLessThan 162 163 129: Label
BranchConditional 165 158 159 Store 161(i) 162
158: Label Branch 163
166: 9(int) Load 62(c) 163: Label
SelectionMerge 170 None LoopMerge 165 166 None
Switch 166 169 Branch 167
case 1: 167 167: Label
case 2: 168 168: 9(int) Load 161(i)
169: Label 171: 170(bool) SLessThan 168 169
202: 6(float) Load 75(x) BranchConditional 171 164 165
203: 6(float) ExtInst 1(GLSL.std.450) 15(Tan) 202 164: Label
204: 6(float) Load 73(f) 172: 9(int) Load 68(c)
SelectionMerge 176 None
Switch 172 175
case 1: 173
case 2: 174
175: Label
208: 6(float) Load 81(x)
209: 6(float) ExtInst 1(GLSL.std.450) 15(Tan) 208
210: 6(float) Load 79(f)
211: 6(float) FAdd 210 209
Store 79(f) 211
Branch 176
173: Label
177: 6(float) Load 81(x)
178: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 177
179: 6(float) Load 79(f)
180: 6(float) FAdd 179 178
Store 79(f) 180
Store 181(j) 182
Branch 183
183: Label
LoopMerge 185 186 None
Branch 187
187: Label
188: 9(int) Load 181(j)
190: 170(bool) SLessThan 188 189
BranchConditional 190 184 185
184: Label
191: 6(float) Load 79(f)
192: 6(float) FAdd 191 50
Store 79(f) 192
193: 6(float) Load 79(f)
195: 170(bool) FOrdLessThan 193 194
SelectionMerge 197 None
BranchConditional 195 196 197
196: Label
Branch 185
197: Label
Branch 186
186: Label
199: 9(int) Load 181(j)
200: 9(int) IAdd 199 71
Store 181(j) 200
Branch 183
185: Label
Branch 176
174: Label
202: 6(float) Load 81(x)
203: 6(float) ExtInst 1(GLSL.std.450) 14(Cos) 202
204: 6(float) Load 79(f)
205: 6(float) FAdd 204 203 205: 6(float) FAdd 204 203
Store 73(f) 205 Store 79(f) 205
Branch 170 Branch 176
167: Label 176: Label
171: 6(float) Load 75(x) 213: 6(float) Load 79(f)
172: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 171 215: 170(bool) FOrdLessThan 213 214
173: 6(float) Load 73(f) SelectionMerge 217 None
174: 6(float) FAdd 173 172 BranchConditional 215 216 217
Store 73(f) 174 216: Label
Store 175(j) 176 Branch 165
Branch 177
177: Label
LoopMerge 179 180 None
Branch 181
181: Label
182: 9(int) Load 175(j)
184: 164(bool) SLessThan 182 183
BranchConditional 184 178 179
178: Label
185: 6(float) Load 73(f)
186: 6(float) FAdd 185 48
Store 73(f) 186
187: 6(float) Load 73(f)
189: 164(bool) FOrdLessThan 187 188
SelectionMerge 191 None
BranchConditional 189 190 191
190: Label
Branch 179
191: Label
Branch 180
180: Label
193: 9(int) Load 175(j)
194: 9(int) IAdd 193 65
Store 175(j) 194
Branch 177
179: Label
Branch 170
168: Label
196: 6(float) Load 75(x)
197: 6(float) ExtInst 1(GLSL.std.450) 14(Cos) 196
198: 6(float) Load 73(f)
199: 6(float) FAdd 198 197
Store 73(f) 199
Branch 170
170: Label
207: 6(float) Load 73(f)
209: 164(bool) FOrdLessThan 207 208
SelectionMerge 211 None
BranchConditional 209 210 211
210: Label
Branch 159
211: Label
Branch 160
160: Label
213: 9(int) Load 155(i)
214: 9(int) IAdd 213 65
Store 155(i) 214
Branch 157
159: Label
215: 9(int) Load 62(c)
SelectionMerge 218 None
Switch 215 218
case 1: 216
case 2: 217
216: Label
219: 6(float) Load 75(x)
220: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 219
221: 6(float) Load 73(f)
222: 6(float) FAdd 221 220
Store 73(f) 222
Branch 218
217: Label 217: Label
Branch 218 Branch 166
218: Label 166: Label
228: 6(float) Load 73(f) 219: 9(int) Load 161(i)
229: 9(int) Load 60(local) 220: 9(int) IAdd 219 71
230: 6(float) ConvertSToF 229 Store 161(i) 220
231: 6(float) FAdd 228 230 Branch 163
Store 227(color) 231 165: Label
235: 7(fvec4) Load 233(v) 221: 9(int) Load 68(c)
Store 234(param) 235 SelectionMerge 224 None
237: 7(fvec4) Load 233(v) Switch 221 224
Store 236(param) 237 case 1: 222
239: 9(int) Load 62(c) case 2: 223
Store 238(param) 239 222: Label
240: 7(fvec4) FunctionCall 15(foo1(vf4;vf4;i1;) 234(param) 236(param) 238(param) 225: 6(float) Load 81(x)
243: 6(float) CompositeExtract 240 1 226: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 225
244: 6(float) Load 227(color) 227: 6(float) Load 79(f)
245: 6(float) FAdd 244 243 228: 6(float) FAdd 227 226
Store 227(color) 245 Store 79(f) 228
247: 7(fvec4) Load 233(v) Branch 224
Store 246(param) 247 223: Label
249: 7(fvec4) Load 233(v) Branch 224
Store 248(param) 249 224: Label
251: 9(int) Load 62(c) 234: 6(float) Load 79(f)
Store 250(param) 251 235: 9(int) Load 66(local)
252: 7(fvec4) FunctionCall 20(foo2(vf4;vf4;i1;) 246(param) 248(param) 250(param) 236: 6(float) ConvertSToF 235
254: 6(float) CompositeExtract 252 2 237: 6(float) FAdd 234 236
255: 6(float) Load 227(color) Store 233(color) 237
256: 6(float) FAdd 255 254 241: 7(fvec4) Load 239(v)
Store 227(color) 256 Store 240(param) 241
257: 9(int) Load 62(c) 243: 7(fvec4) Load 239(v)
SelectionMerge 260 None Store 242(param) 243
Switch 257 259 245: 9(int) Load 68(c)
case 0: 258 Store 244(param) 245
259: Label 246: 7(fvec4) FunctionCall 15(foo1(vf4;vf4;i1;) 240(param) 242(param) 244(param)
Branch 260 249: 6(float) CompositeExtract 246 1
258: Label 250: 6(float) Load 233(color)
Branch 260 251: 6(float) FAdd 250 249
260: Label Store 233(color) 251
264: 9(int) Load 62(c) 253: 7(fvec4) Load 239(v)
Store 252(param) 253
255: 7(fvec4) Load 239(v)
Store 254(param) 255
257: 9(int) Load 68(c)
Store 256(param) 257
258: 7(fvec4) FunctionCall 20(foo2(vf4;vf4;i1;) 252(param) 254(param) 256(param)
260: 6(float) CompositeExtract 258 2
261: 6(float) Load 233(color)
262: 6(float) FAdd 261 260
Store 233(color) 262
263: 9(int) Load 68(c)
SelectionMerge 266 None SelectionMerge 266 None
Switch 264 265 Switch 263 265
case 0: 264
265: Label 265: Label
Branch 266 Branch 266
264: Label
Branch 266
266: Label 266: Label
270: 9(int) Load 68(c)
SelectionMerge 272 None
Switch 270 271
271: Label
Branch 272
272: Label
Return Return
FunctionEnd FunctionEnd
15(foo1(vf4;vf4;i1;): 7(fvec4) Function None 11 15(foo1(vf4;vf4;i1;): 7(fvec4) Function None 11
@ -482,6 +488,7 @@ WARNING: 0:139: 'switch' : last case/default label not followed by statements
13(v2): 8(ptr) FunctionParameter 13(v2): 8(ptr) FunctionParameter
14(i1): 10(ptr) FunctionParameter 14(i1): 10(ptr) FunctionParameter
16: Label 16: Label
38: 8(ptr) Variable Function
22: 9(int) Load 14(i1) 22: 9(int) Load 14(i1)
SelectionMerge 26 None SelectionMerge 26 None
Switch 22 26 Switch 22 26
@ -501,33 +508,41 @@ WARNING: 0:139: 'switch' : last case/default label not followed by statements
33: 7(fvec4) FMul 31 32 33: 7(fvec4) FMul 31 32
ReturnValue 33 ReturnValue 33
26: Label 26: Label
ReturnValue 37 Store 38 37
39: 7(fvec4) Load 38
ReturnValue 39
FunctionEnd FunctionEnd
20(foo2(vf4;vf4;i1;): 7(fvec4) Function None 11 20(foo2(vf4;vf4;i1;): 7(fvec4) Function None 11
17(v1): 8(ptr) FunctionParameter 17(v1): 8(ptr) FunctionParameter
18(v2): 8(ptr) FunctionParameter 18(v2): 8(ptr) FunctionParameter
19(i1): 10(ptr) FunctionParameter 19(i1): 10(ptr) FunctionParameter
21: Label 21: Label
40: 9(int) Load 19(i1) 52: 8(ptr) Variable Function
SelectionMerge 45 None 62: 8(ptr) Variable Function
Switch 40 45 42: 9(int) Load 19(i1)
case 0: 41 SelectionMerge 47 None
case 2: 42 Switch 42 47
case 1: 43 case 0: 43
case 3: 44 case 2: 44
41: Label case 1: 45
46: 7(fvec4) Load 17(v1) case 3: 46
ReturnValue 46
42: Label
ReturnValue 49
43: Label 43: Label
51: 7(fvec4) Load 18(v2) 48: 7(fvec4) Load 17(v1)
ReturnValue 51 ReturnValue 48
44: Label 44: Label
53: 7(fvec4) Load 17(v1) Store 52 51
54: 7(fvec4) Load 18(v2) 53: 7(fvec4) Load 52
55: 7(fvec4) FMul 53 54 ReturnValue 53
45: Label
55: 7(fvec4) Load 18(v2)
ReturnValue 55 ReturnValue 55
45: Label 46: Label
ReturnValue 37 57: 7(fvec4) Load 17(v1)
58: 7(fvec4) Load 18(v2)
59: 7(fvec4) FMul 57 58
ReturnValue 59
47: Label
Store 62 37
63: 7(fvec4) Load 62
ReturnValue 63
FunctionEnd FunctionEnd

View File

@ -57,4 +57,6 @@ void main()
mediumfout *= s.a; mediumfout *= s.a;
mediumfout *= s.b; mediumfout *= s.b;
mediumfout = ((mediumfin * mediumfin > 4.2) ? 2.0 * mediumfout : 3.0 * mediumfout);
} }

View File

@ -6,6 +6,11 @@ void fooConst(const in float f, const in highp float g) { }
void foo(in float f, in highp float g) { } void foo(in float f, in highp float g) { }
float retM ( float x) { return x; }
highp float retH (highp float x) { return x; }
float retHM(highp float x) { return x; }
highp float retMH( float x) { return x; }
void main() void main()
{ {
float aM, bM; float aM, bM;
@ -14,4 +19,9 @@ void main()
fooConst(aH, bH); // must copy aH fooConst(aH, bH); // must copy aH
foo(aM, bM); foo(aM, bM);
foo(aH, bH); foo(aH, bH);
retM(aM);
retH(aH);
retHM(aH);
retMH(aM);
} }