Commit 67b2a00f by John Kessenich

Merge branch 'master' into khronosmaster

parents 2b5b41bb 019f08fc
...@@ -88,7 +88,9 @@ public: ...@@ -88,7 +88,9 @@ public:
void dumpSpv(std::vector<unsigned int>& out); void dumpSpv(std::vector<unsigned int>& out);
protected: protected:
spv::Decoration TranslateInterpolationDecoration(const glslang::TQualifier& qualifier);
spv::BuiltIn TranslateBuiltInDecoration(glslang::TBuiltInVariable); spv::BuiltIn TranslateBuiltInDecoration(glslang::TBuiltInVariable);
spv::ImageFormat TranslateImageFormat(const glslang::TType& type);
spv::Id createSpvVariable(const glslang::TIntermSymbol*); spv::Id createSpvVariable(const glslang::TIntermSymbol*);
spv::Id getSampledType(const glslang::TSampler&); spv::Id getSampledType(const glslang::TSampler&);
spv::Id convertGlslangToSpvType(const glslang::TType& type); spv::Id convertGlslangToSpvType(const glslang::TType& type);
...@@ -301,7 +303,7 @@ spv::Decoration TranslateLayoutDecoration(const glslang::TType& type, glslang::T ...@@ -301,7 +303,7 @@ spv::Decoration TranslateLayoutDecoration(const glslang::TType& type, glslang::T
// Translate glslang type to SPIR-V interpolation decorations. // Translate glslang type to SPIR-V interpolation decorations.
// Returns spv::Decoration(spv::BadValue) when no decoration // Returns spv::Decoration(spv::BadValue) when no decoration
// should be applied. // should be applied.
spv::Decoration TranslateInterpolationDecoration(const glslang::TQualifier& qualifier) spv::Decoration TGlslangToSpvTraverser::TranslateInterpolationDecoration(const glslang::TQualifier& qualifier)
{ {
if (qualifier.smooth) { if (qualifier.smooth) {
// Smooth decoration doesn't exist in SPIR-V 1.0 // Smooth decoration doesn't exist in SPIR-V 1.0
...@@ -315,9 +317,10 @@ spv::Decoration TranslateInterpolationDecoration(const glslang::TQualifier& qual ...@@ -315,9 +317,10 @@ spv::Decoration TranslateInterpolationDecoration(const glslang::TQualifier& qual
return spv::DecorationFlat; return spv::DecorationFlat;
else if (qualifier.centroid) else if (qualifier.centroid)
return spv::DecorationCentroid; return spv::DecorationCentroid;
else if (qualifier.sample) else if (qualifier.sample) {
builder.addCapability(spv::CapabilitySampleRateShading);
return spv::DecorationSample; return spv::DecorationSample;
else } else
return (spv::Decoration)spv::BadValue; return (spv::Decoration)spv::BadValue;
} }
...@@ -358,6 +361,18 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI ...@@ -358,6 +361,18 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
// TODO: builder.addCapability(spv::CapabilityMultiViewport); // TODO: builder.addCapability(spv::CapabilityMultiViewport);
return spv::BuiltInViewportIndex; return spv::BuiltInViewportIndex;
case glslang::EbvSampleId:
builder.addCapability(spv::CapabilitySampleRateShading);
return spv::BuiltInSampleId;
case glslang::EbvSamplePosition:
builder.addCapability(spv::CapabilitySampleRateShading);
return spv::BuiltInSamplePosition;
case glslang::EbvSampleMask:
builder.addCapability(spv::CapabilitySampleRateShading);
return spv::BuiltInSampleMask;
case glslang::EbvPosition: return spv::BuiltInPosition; case glslang::EbvPosition: return spv::BuiltInPosition;
case glslang::EbvVertexId: return spv::BuiltInVertexId; case glslang::EbvVertexId: return spv::BuiltInVertexId;
case glslang::EbvInstanceId: return spv::BuiltInInstanceId; case glslang::EbvInstanceId: return spv::BuiltInInstanceId;
...@@ -377,9 +392,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI ...@@ -377,9 +392,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
case glslang::EbvFragCoord: return spv::BuiltInFragCoord; case glslang::EbvFragCoord: return spv::BuiltInFragCoord;
case glslang::EbvPointCoord: return spv::BuiltInPointCoord; case glslang::EbvPointCoord: return spv::BuiltInPointCoord;
case glslang::EbvFace: return spv::BuiltInFrontFacing; case glslang::EbvFace: return spv::BuiltInFrontFacing;
case glslang::EbvSampleId: return spv::BuiltInSampleId;
case glslang::EbvSamplePosition: return spv::BuiltInSamplePosition;
case glslang::EbvSampleMask: return spv::BuiltInSampleMask;
case glslang::EbvFragDepth: return spv::BuiltInFragDepth; case glslang::EbvFragDepth: return spv::BuiltInFragDepth;
case glslang::EbvHelperInvocation: return spv::BuiltInHelperInvocation; case glslang::EbvHelperInvocation: return spv::BuiltInHelperInvocation;
case glslang::EbvNumWorkGroups: return spv::BuiltInNumWorkgroups; case glslang::EbvNumWorkGroups: return spv::BuiltInNumWorkgroups;
...@@ -393,10 +405,48 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI ...@@ -393,10 +405,48 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
} }
// Translate glslang image layout format to SPIR-V image format. // Translate glslang image layout format to SPIR-V image format.
spv::ImageFormat TranslateImageFormat(const glslang::TType& type) spv::ImageFormat TGlslangToSpvTraverser::TranslateImageFormat(const glslang::TType& type)
{ {
assert(type.getBasicType() == glslang::EbtSampler); assert(type.getBasicType() == glslang::EbtSampler);
// Check for capabilities
switch (type.getQualifier().layoutFormat) {
case glslang::ElfRg32f:
case glslang::ElfRg16f:
case glslang::ElfR11fG11fB10f:
case glslang::ElfR16f:
case glslang::ElfRgba16:
case glslang::ElfRgb10A2:
case glslang::ElfRg16:
case glslang::ElfRg8:
case glslang::ElfR16:
case glslang::ElfR8:
case glslang::ElfRgba16Snorm:
case glslang::ElfRg16Snorm:
case glslang::ElfRg8Snorm:
case glslang::ElfR16Snorm:
case glslang::ElfR8Snorm:
case glslang::ElfRg32i:
case glslang::ElfRg16i:
case glslang::ElfRg8i:
case glslang::ElfR16i:
case glslang::ElfR8i:
case glslang::ElfRgb10a2ui:
case glslang::ElfRg32ui:
case glslang::ElfRg16ui:
case glslang::ElfRg8ui:
case glslang::ElfR16ui:
case glslang::ElfR8ui:
builder.addCapability(spv::CapabilityStorageImageExtendedFormats);
break;
default:
break;
}
// do the translation
switch (type.getQualifier().layoutFormat) { switch (type.getQualifier().layoutFormat) {
case glslang::ElfNone: return spv::ImageFormatUnknown; case glslang::ElfNone: return spv::ImageFormatUnknown;
case glslang::ElfRgba32f: return spv::ImageFormatRgba32f; case glslang::ElfRgba32f: return spv::ImageFormatRgba32f;
...@@ -2126,6 +2176,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -2126,6 +2176,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
operands.push_back(*opIt); operands.push_back(*opIt);
} }
return builder.createOp(spv::OpImageRead, convertGlslangToSpvType(node->getType()), operands); return builder.createOp(spv::OpImageRead, convertGlslangToSpvType(node->getType()), operands);
if (builder.getImageTypeFormat(builder.getImageType(operands.front())) == spv::ImageFormatUnknown)
builder.addCapability(spv::CapabilityStorageImageReadWithoutFormat);
} else if (node->getOp() == glslang::EOpImageStore) { } else if (node->getOp() == glslang::EOpImageStore) {
if (sampler.ms) { if (sampler.ms) {
operands.push_back(*(opIt + 1)); operands.push_back(*(opIt + 1));
...@@ -2134,6 +2186,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -2134,6 +2186,8 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
} else } else
operands.push_back(*opIt); operands.push_back(*opIt);
builder.createNoResultOp(spv::OpImageWrite, operands); builder.createNoResultOp(spv::OpImageWrite, operands);
if (builder.getImageTypeFormat(builder.getImageType(operands.front())) == spv::ImageFormatUnknown)
builder.addCapability(spv::CapabilityStorageImageWriteWithoutFormat);
return spv::NoResult; return spv::NoResult;
} else if (node->isSparseImage()) { } else if (node->isSparseImage()) {
spv::MissingFunctionality("sparse image functions"); spv::MissingFunctionality("sparse image functions");
...@@ -2182,6 +2236,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -2182,6 +2236,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
params.coords = arguments[1]; params.coords = arguments[1];
int extraArgs = 0; int extraArgs = 0;
bool noImplicitLod = false;
// sort out where Dref is coming from // sort out where Dref is coming from
if (cubeCompare) { if (cubeCompare) {
...@@ -2203,7 +2258,11 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -2203,7 +2258,11 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
if (cracked.lod) { if (cracked.lod) {
params.lod = arguments[2]; params.lod = arguments[2];
++extraArgs; ++extraArgs;
} else if (sampler.ms) { } else if (glslangIntermediate->getStage() != EShLangFragment) {
// we need to invent the default lod for an explicit lod instruction for a non-fragment stage
noImplicitLod = true;
}
if (sampler.ms) {
params.sample = arguments[2]; // For MS, "sample" should be specified params.sample = arguments[2]; // For MS, "sample" should be specified
++extraArgs; ++extraArgs;
} }
...@@ -2241,7 +2300,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -2241,7 +2300,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
} }
} }
return builder.createTextureCall(precision, convertGlslangToSpvType(node->getType()), sparse, cracked.fetch, cracked.proj, cracked.gather, params); return builder.createTextureCall(precision, convertGlslangToSpvType(node->getType()), sparse, cracked.fetch, cracked.proj, cracked.gather, noImplicitLod, params);
} }
spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAggregate* node) spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAggregate* node)
...@@ -2883,10 +2942,6 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: ...@@ -2883,10 +2942,6 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv:
return createAtomicOperation(op, precision, typeId, operands, typeProxy); return createAtomicOperation(op, precision, typeId, operands, typeProxy);
} }
case glslang::EOpImageLoad:
unaryOp = spv::OpImageRead;
break;
case glslang::EOpBitFieldReverse: case glslang::EOpBitFieldReverse:
unaryOp = spv::OpBitReverse; unaryOp = spv::OpBitReverse;
break; break;
......
...@@ -165,6 +165,18 @@ Id Builder::makeIntegerType(int width, bool hasSign) ...@@ -165,6 +165,18 @@ Id Builder::makeIntegerType(int width, bool hasSign)
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type)); constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type); module.mapInstruction(type);
// deal with capabilities
switch (width) {
case 16:
addCapability(CapabilityInt16);
break;
case 64:
addCapability(CapabilityInt64);
break;
default:
break;
}
return type->getResultId(); return type->getResultId();
} }
...@@ -185,6 +197,18 @@ Id Builder::makeFloatType(int width) ...@@ -185,6 +197,18 @@ Id Builder::makeFloatType(int width)
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type)); constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type); module.mapInstruction(type);
// deal with capabilities
switch (width) {
case 16:
addCapability(CapabilityFloat16);
break;
case 64:
addCapability(CapabilityFloat64);
break;
default:
break;
}
return type->getResultId(); return type->getResultId();
} }
...@@ -382,6 +406,48 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo ...@@ -382,6 +406,48 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type)); constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type); module.mapInstruction(type);
// deal with capabilities
switch (dim) {
case DimBuffer:
if (sampled)
addCapability(CapabilitySampledBuffer);
else
addCapability(CapabilityImageBuffer);
break;
case Dim1D:
if (sampled)
addCapability(CapabilitySampled1D);
else
addCapability(CapabilityImage1D);
break;
case DimCube:
if (arrayed) {
if (sampled)
addCapability(CapabilitySampledCubeArray);
else
addCapability(CapabilityImageCubeArray);
}
break;
case DimRect:
if (sampled)
addCapability(CapabilitySampledRect);
else
addCapability(CapabilityImageRect);
break;
case DimSubpassData:
addCapability(CapabilityInputAttachment);
break;
default:
break;
}
if (ms) {
if (arrayed)
addCapability(CapabilityImageMSArray);
if (! sampled)
addCapability(CapabilityStorageImageMultisample);
}
return type->getResultId(); return type->getResultId();
} }
...@@ -1220,7 +1286,7 @@ Id Builder::createBuiltinCall(Id resultType, Id builtins, int entryPoint, std::v ...@@ -1220,7 +1286,7 @@ Id Builder::createBuiltinCall(Id resultType, Id builtins, int entryPoint, std::v
// Accept all parameters needed to create a texture instruction. // Accept all parameters needed to create a texture instruction.
// Create the correct instruction based on the inputs, and make the call. // Create the correct instruction based on the inputs, and make the call.
Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather, const TextureParameters& parameters) Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather, bool noImplicitLod, const TextureParameters& parameters)
{ {
static const int maxTextureArgs = 10; static const int maxTextureArgs = 10;
Id texArgs[maxTextureArgs] = {}; Id texArgs[maxTextureArgs] = {};
...@@ -1229,7 +1295,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, ...@@ -1229,7 +1295,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
// Set up the fixed arguments // Set up the fixed arguments
// //
int numArgs = 0; int numArgs = 0;
bool xplicit = false; bool explicitLod = false;
texArgs[numArgs++] = parameters.sampler; texArgs[numArgs++] = parameters.sampler;
texArgs[numArgs++] = parameters.coords; texArgs[numArgs++] = parameters.coords;
if (parameters.Dref) if (parameters.Dref)
...@@ -1250,13 +1316,18 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, ...@@ -1250,13 +1316,18 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
if (parameters.lod) { if (parameters.lod) {
mask = (ImageOperandsMask)(mask | ImageOperandsLodMask); mask = (ImageOperandsMask)(mask | ImageOperandsLodMask);
texArgs[numArgs++] = parameters.lod; texArgs[numArgs++] = parameters.lod;
xplicit = true; explicitLod = true;
} } else if (parameters.gradX) {
if (parameters.gradX) {
mask = (ImageOperandsMask)(mask | ImageOperandsGradMask); mask = (ImageOperandsMask)(mask | ImageOperandsGradMask);
texArgs[numArgs++] = parameters.gradX; texArgs[numArgs++] = parameters.gradX;
texArgs[numArgs++] = parameters.gradY; texArgs[numArgs++] = parameters.gradY;
xplicit = true; explicitLod = true;
} else if (noImplicitLod && ! fetch && ! gather) {
// have to explicitly use lod of 0 if not allowed to have them be implicit, and
// we would otherwise be about to issue an implicit instruction
mask = (ImageOperandsMask)(mask | ImageOperandsLodMask);
texArgs[numArgs++] = makeFloatConstant(0.0);
explicitLod = true;
} }
if (parameters.offset) { if (parameters.offset) {
if (isConstant(parameters.offset)) if (isConstant(parameters.offset))
...@@ -1274,6 +1345,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, ...@@ -1274,6 +1345,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
texArgs[numArgs++] = parameters.sample; texArgs[numArgs++] = parameters.sample;
} }
if (parameters.lodClamp) { if (parameters.lodClamp) {
// capability if this bit is used
addCapability(CapabilityMinLod);
mask = (ImageOperandsMask)(mask | ImageOperandsMinLodMask); mask = (ImageOperandsMask)(mask | ImageOperandsMinLodMask);
texArgs[numArgs++] = parameters.lodClamp; texArgs[numArgs++] = parameters.lodClamp;
} }
...@@ -1285,8 +1359,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, ...@@ -1285,8 +1359,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
// //
// Set up the instruction // Set up the instruction
// //
Op opCode; Op opCode = OpNop; // All paths below need to set this
opCode = OpImageSampleImplicitLod;
if (fetch) { if (fetch) {
if (sparse) if (sparse)
opCode = OpImageSparseFetch; opCode = OpImageSparseFetch;
...@@ -1303,7 +1376,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, ...@@ -1303,7 +1376,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
opCode = OpImageSparseGather; opCode = OpImageSparseGather;
else else
opCode = OpImageGather; opCode = OpImageGather;
} else if (xplicit) { } else if (explicitLod) {
if (parameters.Dref) { if (parameters.Dref) {
if (proj) if (proj)
if (sparse) if (sparse)
...@@ -1393,6 +1466,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, ...@@ -1393,6 +1466,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
Id resultId = textureInst->getResultId(); Id resultId = textureInst->getResultId();
if (sparse) { if (sparse) {
// set capability
addCapability(CapabilitySparseResidency);
// Decode the return type that was a special structure // Decode the return type that was a special structure
createStore(createCompositeExtract(resultId, typeId1, 1), parameters.texelOut); createStore(createCompositeExtract(resultId, typeId1, 1), parameters.texelOut);
resultId = createCompositeExtract(resultId, typeId0, 0); resultId = createCompositeExtract(resultId, typeId0, 0);
...@@ -1410,6 +1486,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, ...@@ -1410,6 +1486,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
// Comments in header // Comments in header
Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameters) Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameters)
{ {
// All these need a capability
addCapability(CapabilityImageQuery);
// Figure out the result type // Figure out the result type
Id resultType = 0; Id resultType = 0;
switch (opCode) { switch (opCode) {
......
...@@ -124,6 +124,7 @@ public: ...@@ -124,6 +124,7 @@ public:
Id getContainedTypeId(Id typeId) const; Id getContainedTypeId(Id typeId) const;
Id getContainedTypeId(Id typeId, int) const; Id getContainedTypeId(Id typeId, int) const;
StorageClass getTypeStorageClass(Id typeId) const { return module.getStorageClass(typeId); } StorageClass getTypeStorageClass(Id typeId) const { return module.getStorageClass(typeId); }
ImageFormat getImageTypeFormat(Id typeId) const { return (ImageFormat)module.getInstruction(typeId)->getImmediateOperand(6); }
bool isPointer(Id resultId) const { return isPointerType(getTypeId(resultId)); } bool isPointer(Id resultId) const { return isPointerType(getTypeId(resultId)); }
bool isScalar(Id resultId) const { return isScalarType(getTypeId(resultId)); } bool isScalar(Id resultId) const { return isScalarType(getTypeId(resultId)); }
...@@ -322,7 +323,7 @@ public: ...@@ -322,7 +323,7 @@ public:
}; };
// Select the correct texture operation based on all inputs, and emit the correct instruction // Select the correct texture operation based on all inputs, and emit the correct instruction
Id createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather, const TextureParameters&); Id createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather, bool noImplicit, const TextureParameters&);
// Emit the OpTextureQuery* instruction that was passed in. // Emit the OpTextureQuery* instruction that was passed in.
// Figure out the right return value and type, and return it. // Figure out the right return value and type, and return it.
......
...@@ -11,6 +11,10 @@ Linked fragment stage: ...@@ -11,6 +11,10 @@ Linked fragment stage:
Capability Shader Capability Shader
Capability ClipDistance Capability ClipDistance
Capability SampledRect
Capability Sampled1D
Capability SampledCubeArray
Capability ImageQuery
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 17 68 79 99 173 184 185 186 EntryPoint Fragment 4 "main" 17 68 79 99 173 184 185 186
......
...@@ -9,6 +9,9 @@ Linked fragment stage: ...@@ -9,6 +9,9 @@ Linked fragment stage:
Capability Shader Capability Shader
Capability ClipDistance Capability ClipDistance
Capability SampledRect
Capability SampledBuffer
Capability ImageQuery
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 16 28 33 43 EntryPoint Fragment 4 "main" 16 28 33 43
......
...@@ -5,13 +5,13 @@ Linked vertex stage: ...@@ -5,13 +5,13 @@ Linked vertex stage:
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 50 // Id's are bound by 67
Capability Shader Capability Shader
Capability ClipDistance Capability ClipDistance
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 13 17 39 48 49 EntryPoint Vertex 4 "main" 13 17 39 65 66
Source GLSL 150 Source GLSL 150
Name 4 "main" Name 4 "main"
Name 11 "gl_PerVertex" Name 11 "gl_PerVertex"
...@@ -30,16 +30,17 @@ Linked vertex stage: ...@@ -30,16 +30,17 @@ Linked vertex stage:
MemberName 37(s2) 1 "d" MemberName 37(s2) 1 "d"
Name 39 "s2out" Name 39 "s2out"
Name 41 "i" Name 41 "i"
Name 46 "ui" Name 48 "s2D"
Name 48 "gl_VertexID" Name 63 "ui"
Name 49 "gl_InstanceID" Name 65 "gl_VertexID"
Name 66 "gl_InstanceID"
MemberDecorate 11(gl_PerVertex) 0 Invariant MemberDecorate 11(gl_PerVertex) 0 Invariant
MemberDecorate 11(gl_PerVertex) 0 BuiltIn Position MemberDecorate 11(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 11(gl_PerVertex) 1 BuiltIn PointSize MemberDecorate 11(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 11(gl_PerVertex) 2 BuiltIn ClipDistance MemberDecorate 11(gl_PerVertex) 2 BuiltIn ClipDistance
Decorate 11(gl_PerVertex) Block Decorate 11(gl_PerVertex) Block
Decorate 48(gl_VertexID) BuiltIn VertexId Decorate 65(gl_VertexID) BuiltIn VertexId
Decorate 49(gl_InstanceID) BuiltIn InstanceId Decorate 66(gl_InstanceID) BuiltIn InstanceId
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
...@@ -70,11 +71,22 @@ Linked vertex stage: ...@@ -70,11 +71,22 @@ Linked vertex stage:
38: TypePointer Output 37(s2) 38: TypePointer Output 37(s2)
39(s2out): 38(ptr) Variable Output 39(s2out): 38(ptr) Variable Output
40: TypePointer Function 14(int) 40: TypePointer Function 14(int)
45: TypePointer UniformConstant 14(int) 45: TypeImage 6(float) 2D sampled format:Unknown
46(ui): 45(ptr) Variable UniformConstant 46: TypeSampledImage 45
47: TypePointer Input 14(int) 47: TypePointer UniformConstant 46
48(gl_VertexID): 47(ptr) Variable Input 48(s2D): 47(ptr) Variable UniformConstant
49(gl_InstanceID): 47(ptr) Variable Input 50: TypeVector 6(float) 2
51: 6(float) Constant 1056964608
52: 50(fvec2) ConstantComposite 51 51
53: 6(float) Constant 0
56: TypeVector 6(float) 3
57: 56(fvec3) ConstantComposite 51 51 51
60: 6(float) Constant 1078774989
62: TypePointer UniformConstant 14(int)
63(ui): 62(ptr) Variable UniformConstant
64: TypePointer Input 14(int)
65(gl_VertexID): 64(ptr) Variable Input
66(gl_InstanceID): 64(ptr) Variable Input
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
41(i): 40(ptr) Variable Function 41(i): 40(ptr) Variable Function
...@@ -92,5 +104,11 @@ Linked vertex stage: ...@@ -92,5 +104,11 @@ Linked vertex stage:
43: 6(float) Load 23(ps) 43: 6(float) Load 23(ps)
44: 25(ptr) AccessChain 39(s2out) 21 42 27 27 33 44: 25(ptr) AccessChain 39(s2out) 21 42 27 27 33
Store 44 43 Store 44 43
49: 46 Load 48(s2D)
54: 7(fvec4) ImageSampleExplicitLod 49 52 Lod 53
55: 46 Load 48(s2D)
58: 7(fvec4) ImageSampleProjExplicitLod 55 57 Lod 53
59: 46 Load 48(s2D)
61: 7(fvec4) ImageSampleExplicitLod 59 52 Lod 60
Return Return
FunctionEnd FunctionEnd
...@@ -10,7 +10,9 @@ Linked fragment stage: ...@@ -10,7 +10,9 @@ Linked fragment stage:
// Id's are bound by 1104 // Id's are bound by 1104
Capability Shader Capability Shader
Capability Float64
Capability ClipDistance Capability ClipDistance
Capability SampledRect
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 13 1025 1031 1036 1048 1074 1095 1097 EntryPoint Fragment 4 "main" 13 1025 1031 1036 1048 1074 1095 1097
......
...@@ -10,6 +10,7 @@ Linked compute stage: ...@@ -10,6 +10,7 @@ Linked compute stage:
// Id's are bound by 62 // Id's are bound by 62
Capability Shader Capability Shader
Capability Float64
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main" 26 33 EntryPoint GLCompute 4 "main" 26 33
......
...@@ -7,12 +7,20 @@ Linked fragment stage: ...@@ -7,12 +7,20 @@ Linked fragment stage:
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 372 // Id's are bound by 378
Capability Shader Capability Shader
Capability SampledRect
Capability Sampled1D
Capability SampledCubeArray
Capability SampledBuffer
Capability ImageMSArray
Capability StorageImageExtendedFormats
Capability ImageQuery
Capability StorageImageWriteWithoutFormat
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 356 EntryPoint Fragment 4 "main" 362
ExecutionMode 4 OriginLowerLeft ExecutionMode 4 OriginLowerLeft
Source GLSL 450 Source GLSL 450
Name 4 "main" Name 4 "main"
...@@ -36,8 +44,9 @@ Linked fragment stage: ...@@ -36,8 +44,9 @@ Linked fragment stage:
Name 232 "ii1D" Name 232 "ii1D"
Name 245 "ui2D" Name 245 "ui2D"
Name 248 "value" Name 248 "value"
Name 356 "fragData" Name 357 "wo2D"
Name 371 "ic4D" Name 362 "fragData"
Name 377 "ic4D"
Decorate 15(i1D) Binding 0 Decorate 15(i1D) Binding 0
Decorate 27(i2D) Binding 1 Decorate 27(i2D) Binding 1
Decorate 38(i3D) Binding 2 Decorate 38(i3D) Binding 2
...@@ -51,6 +60,7 @@ Linked fragment stage: ...@@ -51,6 +60,7 @@ Linked fragment stage:
Decorate 108(i2DMSArray) Binding 10 Decorate 108(i2DMSArray) Binding 10
Decorate 232(ii1D) Binding 11 Decorate 232(ii1D) Binding 11
Decorate 245(ui2D) Binding 12 Decorate 245(ui2D) Binding 12
Decorate 357(wo2D) Binding 1
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeInt 32 1 6: TypeInt 32 1
...@@ -84,7 +94,7 @@ Linked fragment stage: ...@@ -84,7 +94,7 @@ Linked fragment stage:
70: TypeImage 12(float) 1D array nonsampled format:Rgba32f 70: TypeImage 12(float) 1D array nonsampled format:Rgba32f
71: TypePointer UniformConstant 70 71: TypePointer UniformConstant 70
72(i1DArray): 71(ptr) Variable UniformConstant 72(i1DArray): 71(ptr) Variable UniformConstant
80: TypeImage 12(float) 2D array nonsampled format:Rgba32f 80: TypeImage 12(float) 2D array nonsampled format:Rg16
81: TypePointer UniformConstant 80 81: TypePointer UniformConstant 80
82(i2DArray): 81(ptr) Variable UniformConstant 82(i2DArray): 81(ptr) Variable UniformConstant
87: TypeImage 12(float) Buffer nonsampled format:Rgba32f 87: TypeImage 12(float) Buffer nonsampled format:Rgba32f
...@@ -132,18 +142,21 @@ Linked fragment stage: ...@@ -132,18 +142,21 @@ Linked fragment stage:
340: 6(int) Constant 18 340: 6(int) Constant 18
341: 6(int) Constant 17 341: 6(int) Constant 17
349: 18(int) Constant 19 349: 18(int) Constant 19
355: TypePointer Output 125(fvec4) 355: TypeImage 12(float) 2D nonsampled format:Unknown
356(fragData): 355(ptr) Variable Output 356: TypePointer UniformConstant 355
362: TypeBool 357(wo2D): 356(ptr) Variable UniformConstant
369: TypeVector 6(int) 4 361: TypePointer Output 125(fvec4)
370: TypePointer UniformConstant 369(ivec4) 362(fragData): 361(ptr) Variable Output
371(ic4D): 370(ptr) Variable UniformConstant 368: TypeBool
375: TypeVector 6(int) 4
376: TypePointer UniformConstant 375(ivec4)
377(ic4D): 376(ptr) Variable UniformConstant
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
9(iv): 8(ptr) Variable Function 9(iv): 8(ptr) Variable Function
127(v): 126(ptr) Variable Function 127(v): 126(ptr) Variable Function
229(ui): 228(ptr) Variable Function 229(ui): 228(ptr) Variable Function
357: 126(ptr) Variable Function 363: 126(ptr) Variable Function
Store 9(iv) 11 Store 9(iv) 11
16: 13 Load 15(i1D) 16: 13 Load 15(i1D)
17: 6(int) ImageQuerySize 16 17: 6(int) ImageQuerySize 16
...@@ -465,22 +478,26 @@ Linked fragment stage: ...@@ -465,22 +478,26 @@ Linked fragment stage:
353: 18(int) Load 229(ui) 353: 18(int) Load 229(ui)
354: 18(int) IAdd 353 352 354: 18(int) IAdd 353 352
Store 229(ui) 354 Store 229(ui) 354
358: 18(int) Load 229(ui) 358: 355 Load 357(wo2D)
359: 20(ptr) AccessChain 9(iv) 237 359: 29(ivec2) Load 142(ic2D)
360: 6(int) Load 359 360: 125(fvec4) Load 127(v)
361: 18(int) Bitcast 360 ImageWrite 358 359 360
363: 362(bool) INotEqual 358 361 364: 18(int) Load 229(ui)
SelectionMerge 365 None 365: 20(ptr) AccessChain 9(iv) 237
BranchConditional 363 364 367 366: 6(int) Load 365
364: Label 367: 18(int) Bitcast 366
366: 125(fvec4) Load 127(v) 369: 368(bool) INotEqual 364 367
Store 357 366 SelectionMerge 371 None
Branch 365 BranchConditional 369 370 373
367: Label 370: Label
Store 357 129 372: 125(fvec4) Load 127(v)
Branch 365 Store 363 372
365: Label Branch 371
368: 125(fvec4) Load 357 373: Label
Store 356(fragData) 368 Store 363 129
Branch 371
371: Label
374: 125(fvec4) Load 363
Store 362(fragData) 374
Return Return
FunctionEnd FunctionEnd
...@@ -10,6 +10,9 @@ Linked fragment stage: ...@@ -10,6 +10,9 @@ Linked fragment stage:
// Id's are bound by 278 // Id's are bound by 278
Capability Shader Capability Shader
Capability SampledRect
Capability SampledCubeArray
Capability ImageQuery
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 17 26 29 55 81 84 91 247 277 EntryPoint Fragment 4 "main" 17 26 29 55 81 84 91 247 277
......
...@@ -10,6 +10,11 @@ Linked fragment stage: ...@@ -10,6 +10,11 @@ Linked fragment stage:
// Id's are bound by 237 // Id's are bound by 237
Capability Shader Capability Shader
Capability SampledRect
Capability Sampled1D
Capability SampledCubeArray
Capability SampledBuffer
Capability ImageQuery
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" EntryPoint Fragment 4 "main"
......
...@@ -10,6 +10,9 @@ Linked fragment stage: ...@@ -10,6 +10,9 @@ Linked fragment stage:
// Id's are bound by 399 // Id's are bound by 399
Capability Shader Capability Shader
Capability SampledRect
Capability SparseResidency
Capability SampledCubeArray
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 384 EntryPoint Fragment 4 "main" 384
......
...@@ -10,6 +10,10 @@ Linked fragment stage: ...@@ -10,6 +10,10 @@ Linked fragment stage:
// Id's are bound by 360 // Id's are bound by 360
Capability Shader Capability Shader
Capability SampledRect
Capability SparseResidency
Capability MinLod
Capability SampledCubeArray
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 345 EntryPoint Fragment 4 "main" 345
......
...@@ -8,6 +8,7 @@ Linked fragment stage: ...@@ -8,6 +8,7 @@ Linked fragment stage:
// Id's are bound by 291 // Id's are bound by 291
Capability Shader Capability Shader
Capability Sampled1D
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 47 276 290 EntryPoint Fragment 4 "main" 47 276 290
......
...@@ -8,6 +8,7 @@ Linked vertex stage: ...@@ -8,6 +8,7 @@ Linked vertex stage:
// Id's are bound by 146 // Id's are bound by 146
Capability Shader Capability Shader
Capability Sampled1D
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 39 140 144 145 EntryPoint Vertex 4 "main" 39 140 144 145
......
...@@ -4,6 +4,7 @@ in vec4 iv4; ...@@ -4,6 +4,7 @@ in vec4 iv4;
uniform float ps; uniform float ps;
uniform int ui; uniform int ui;
uniform sampler2D s2D;
invariant gl_Position; invariant gl_Position;
...@@ -27,13 +28,11 @@ void main() ...@@ -27,13 +28,11 @@ void main()
gl_ClipDistance[2] = iv4.x; gl_ClipDistance[2] = iv4.x;
int i; int i;
s2out.d[i].b[2].w = ps; s2out.d[i].b[2].w = ps;
// test recovery from nonsupported built-ins // test non-implicit lod
//float n1 = noise1(2.4); texture(s2D, vec2(0.5));
//n1 = noise1(vec4(n1)); textureProj(s2D, vec3(0.5));
//vec2 n2 = noise2(vec3(n1)); textureLod(s2D, vec2(0.5), 3.2);
//vec3 n3 = noise3(n2);
//vec4 n4 = noise4(n3);
} }
out float gl_ClipDistance[4]; out float gl_ClipDistance[4];
...@@ -7,7 +7,7 @@ layout(rgba32f, binding = 3) uniform imageCube iCube; ...@@ -7,7 +7,7 @@ layout(rgba32f, binding = 3) uniform imageCube iCube;
layout(rgba32f, binding = 4) uniform imageCubeArray iCubeArray; layout(rgba32f, binding = 4) uniform imageCubeArray iCubeArray;
layout(rgba32f, binding = 5) uniform image2DRect i2DRect; layout(rgba32f, binding = 5) uniform image2DRect i2DRect;
layout(rgba32f, binding = 6) uniform image1DArray i1DArray; layout(rgba32f, binding = 6) uniform image1DArray i1DArray;
layout(rgba32f, binding = 7) uniform image2DArray i2DArray; layout(rg16, binding = 7) uniform image2DArray i2DArray;
layout(rgba32f, binding = 8) uniform imageBuffer iBuffer; layout(rgba32f, binding = 8) uniform imageBuffer iBuffer;
layout(rgba32f, binding = 9) uniform image2DMS i2DMS; layout(rgba32f, binding = 9) uniform image2DMS i2DMS;
layout(rgba32f, binding = 10) uniform image2DMSArray i2DMSArray; layout(rgba32f, binding = 10) uniform image2DMSArray i2DMSArray;
...@@ -15,6 +15,8 @@ layout(rgba32f, binding = 10) uniform image2DMSArray i2DMSArray; ...@@ -15,6 +15,8 @@ layout(rgba32f, binding = 10) uniform image2DMSArray i2DMSArray;
layout(r32i, binding = 11) uniform iimage1D ii1D; layout(r32i, binding = 11) uniform iimage1D ii1D;
layout(r32ui, binding = 12) uniform uimage2D ui2D; layout(r32ui, binding = 12) uniform uimage2D ui2D;
writeonly layout(binding = 1) uniform image2D wo2D;
uniform int ic1D; uniform int ic1D;
uniform ivec2 ic2D; uniform ivec2 ic2D;
uniform ivec3 ic3D; uniform ivec3 ic3D;
...@@ -84,6 +86,8 @@ void main() ...@@ -84,6 +86,8 @@ void main()
iv.x += imageAtomicCompSwap(ii1D, ic1D, 18, 17); iv.x += imageAtomicCompSwap(ii1D, ic1D, 18, 17);
ui += imageAtomicCompSwap(ui2D, ic2D, 19u, value); ui += imageAtomicCompSwap(ui2D, ic2D, 19u, value);
imageStore(wo2D, ic2D, v);
fragData = ui != iv.y ? v : vec4(0.0); fragData = ui != iv.y ? v : vec4(0.0);
} }
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