mirror of
https://github.com/RPCS3/glslang.git
synced 2024-11-24 03:39:51 +00:00
SPV: Correct selection of storage-image capabilities. Fixes #986.
Code was reflecting an old historical use of sampled as a SPIR-V 2-valued operand, instead of its current 3 values.
This commit is contained in:
parent
e516d4335f
commit
260f50616a
@ -402,6 +402,8 @@ Id Builder::makeFunctionType(Id returnType, const std::vector<Id>& paramTypes)
|
||||
|
||||
Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, bool ms, unsigned sampled, ImageFormat format)
|
||||
{
|
||||
assert(sampled == 1 || sampled == 2);
|
||||
|
||||
// try to find it
|
||||
Instruction* type;
|
||||
for (int t = 0; t < (int)groupedTypes[OpTypeImage].size(); ++t) {
|
||||
@ -433,27 +435,27 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo
|
||||
// deal with capabilities
|
||||
switch (dim) {
|
||||
case DimBuffer:
|
||||
if (sampled)
|
||||
if (sampled == 1)
|
||||
addCapability(CapabilitySampledBuffer);
|
||||
else
|
||||
addCapability(CapabilityImageBuffer);
|
||||
break;
|
||||
case Dim1D:
|
||||
if (sampled)
|
||||
if (sampled == 1)
|
||||
addCapability(CapabilitySampled1D);
|
||||
else
|
||||
addCapability(CapabilityImage1D);
|
||||
break;
|
||||
case DimCube:
|
||||
if (arrayed) {
|
||||
if (sampled)
|
||||
if (sampled == 1)
|
||||
addCapability(CapabilitySampledCubeArray);
|
||||
else
|
||||
addCapability(CapabilityImageCubeArray);
|
||||
}
|
||||
break;
|
||||
case DimRect:
|
||||
if (sampled)
|
||||
if (sampled == 1)
|
||||
addCapability(CapabilitySampledRect);
|
||||
else
|
||||
addCapability(CapabilityImageRect);
|
||||
@ -466,10 +468,11 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo
|
||||
}
|
||||
|
||||
if (ms) {
|
||||
if (arrayed)
|
||||
addCapability(CapabilityImageMSArray);
|
||||
if (! sampled)
|
||||
if (sampled == 2) {
|
||||
addCapability(CapabilityStorageImageMultisample);
|
||||
if (arrayed)
|
||||
addCapability(CapabilityImageMSArray);
|
||||
}
|
||||
}
|
||||
|
||||
return type->getResultId();
|
||||
|
@ -2322,7 +2322,6 @@ gl_FragCoord origin is upper left
|
||||
Capability Shader
|
||||
Capability Sampled1D
|
||||
Capability SampledCubeArray
|
||||
Capability ImageMSArray
|
||||
Capability ImageQuery
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
|
@ -720,8 +720,8 @@ gl_FragCoord origin is upper left
|
||||
// Id's are bound by 232
|
||||
|
||||
Capability Shader
|
||||
Capability Sampled1D
|
||||
Capability SampledBuffer
|
||||
Capability Image1D
|
||||
Capability ImageBuffer
|
||||
Capability ImageQuery
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
|
@ -582,7 +582,6 @@ gl_FragCoord origin is upper left
|
||||
// Id's are bound by 221
|
||||
|
||||
Capability Shader
|
||||
Capability ImageMSArray
|
||||
Capability ImageQuery
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
|
@ -361,7 +361,6 @@ gl_FragCoord origin is upper left
|
||||
|
||||
Capability Shader
|
||||
Capability ImageGatherExtended
|
||||
Capability ImageMSArray
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 120 124
|
||||
|
@ -114,7 +114,7 @@ gl_FragCoord origin is upper left
|
||||
// Id's are bound by 57
|
||||
|
||||
Capability Shader
|
||||
Capability SampledBuffer
|
||||
Capability ImageBuffer
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 54
|
||||
|
@ -210,7 +210,7 @@ gl_FragCoord origin is upper left
|
||||
// Id's are bound by 119
|
||||
|
||||
Capability Shader
|
||||
Capability Sampled1D
|
||||
Capability Image1D
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 82 86
|
||||
|
@ -246,7 +246,7 @@ gl_FragCoord origin is upper left
|
||||
// Id's are bound by 132
|
||||
|
||||
Capability Shader
|
||||
Capability Sampled1D
|
||||
Capability Image1D
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 104 108
|
||||
|
@ -68,7 +68,7 @@ gl_FragCoord origin is upper left
|
||||
// Id's are bound by 36
|
||||
|
||||
Capability Shader
|
||||
Capability SampledBuffer
|
||||
Capability ImageBuffer
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 34
|
||||
|
@ -3950,8 +3950,8 @@ gl_FragCoord origin is upper left
|
||||
// Id's are bound by 1147
|
||||
|
||||
Capability Shader
|
||||
Capability Sampled1D
|
||||
Capability SampledBuffer
|
||||
Capability Image1D
|
||||
Capability ImageBuffer
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 1117
|
||||
|
@ -1748,7 +1748,7 @@ gl_FragCoord origin is upper left
|
||||
// Id's are bound by 607
|
||||
|
||||
Capability Shader
|
||||
Capability Sampled1D
|
||||
Capability Image1D
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 583
|
||||
|
@ -102,8 +102,8 @@ gl_FragCoord origin is upper left
|
||||
// Id's are bound by 42
|
||||
|
||||
Capability Shader
|
||||
Capability Sampled1D
|
||||
Capability SampledBuffer
|
||||
Capability Image1D
|
||||
Capability ImageBuffer
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 39
|
||||
|
@ -1694,7 +1694,7 @@ gl_FragCoord origin is upper left
|
||||
// Id's are bound by 571
|
||||
|
||||
Capability Shader
|
||||
Capability Sampled1D
|
||||
Capability Image1D
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 547
|
||||
|
@ -206,7 +206,7 @@ gl_FragCoord origin is upper left
|
||||
// Id's are bound by 63
|
||||
|
||||
Capability Shader
|
||||
Capability SampledBuffer
|
||||
Capability ImageBuffer
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 58
|
||||
|
@ -1712,7 +1712,7 @@ gl_FragCoord origin is upper left
|
||||
// Id's are bound by 605
|
||||
|
||||
Capability Shader
|
||||
Capability Sampled1D
|
||||
Capability Image1D
|
||||
Capability StorageImageExtendedFormats
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
|
@ -138,7 +138,7 @@ local_size = (256, 1, 1)
|
||||
// Id's are bound by 61
|
||||
|
||||
Capability Shader
|
||||
Capability SampledBuffer
|
||||
Capability ImageBuffer
|
||||
Capability StorageImageExtendedFormats
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
|
@ -4,10 +4,11 @@ spv.image.frag
|
||||
// Id's are bound by 376
|
||||
|
||||
Capability Shader
|
||||
Capability SampledRect
|
||||
Capability Sampled1D
|
||||
Capability SampledCubeArray
|
||||
Capability SampledBuffer
|
||||
Capability StorageImageMultisample
|
||||
Capability ImageCubeArray
|
||||
Capability ImageRect
|
||||
Capability Image1D
|
||||
Capability ImageBuffer
|
||||
Capability ImageMSArray
|
||||
Capability StorageImageExtendedFormats
|
||||
Capability ImageQuery
|
||||
|
@ -4,8 +4,8 @@ spv.memoryQualifier.frag
|
||||
// Id's are bound by 97
|
||||
|
||||
Capability Shader
|
||||
Capability SampledRect
|
||||
Capability Sampled1D
|
||||
Capability ImageRect
|
||||
Capability Image1D
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main"
|
||||
|
@ -4,8 +4,8 @@ spv.rw.autoassign.frag
|
||||
// Id's are bound by 42
|
||||
|
||||
Capability Shader
|
||||
Capability Sampled1D
|
||||
Capability SampledBuffer
|
||||
Capability Image1D
|
||||
Capability ImageBuffer
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 39
|
||||
|
@ -8,7 +8,6 @@ spv.separate.frag
|
||||
Capability Sampled1D
|
||||
Capability SampledCubeArray
|
||||
Capability SampledBuffer
|
||||
Capability ImageMSArray
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 11 34
|
||||
|
@ -4,6 +4,7 @@ spv.sparseTexture.frag
|
||||
// Id's are bound by 438
|
||||
|
||||
Capability Shader
|
||||
Capability StorageImageMultisample
|
||||
Capability SampledRect
|
||||
Capability SparseResidency
|
||||
Capability SampledCubeArray
|
||||
|
@ -4,6 +4,7 @@ spv.subpass.frag
|
||||
// Id's are bound by 67
|
||||
|
||||
Capability Shader
|
||||
Capability StorageImageMultisample
|
||||
Capability InputAttachment
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
|
Loading…
Reference in New Issue
Block a user