Merge pull request #2558 from greg-lunarg/i2551

Allow grad texture ops in all shaders
This commit is contained in:
greg-lunarg 2021-03-01 14:11:10 -07:00 committed by GitHub
commit 0eca413092
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 7 deletions

View File

@ -1,8 +1,9 @@
spv.ext.MissShader.rmiss
// Module Version 10400
// Generated by (magic number): 8000a
// Id's are bound by 71
// Id's are bound by 90
Capability MinLod
Capability GroupNonUniform
Capability GroupNonUniformBallot
Capability SubgroupBallotKHR
@ -13,9 +14,10 @@ spv.ext.MissShader.rmiss
Extension "SPV_NV_shader_sm_builtins"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint MissKHR 4 "main" 11 14 21 24 29 32 36 51 53 58 63 70
EntryPoint MissKHR 4 "main" 11 14 21 24 29 32 36 51 53 58 63 74 78 85 89
Source GLSL 460
SourceExtension "GL_ARB_shader_ballot"
SourceExtension "GL_ARB_sparse_texture_clamp"
SourceExtension "GL_EXT_ray_tracing"
SourceExtension "GL_KHR_shader_subgroup_ballot"
SourceExtension "GL_KHR_shader_subgroup_basic"
@ -38,7 +40,11 @@ spv.ext.MissShader.rmiss
Name 53 "gl_SubGroupSizeARB"
Name 58 "gl_SubgroupEqMask"
Name 63 "gl_WarpIDNV"
Name 70 "localPayload"
Name 70 "texel"
Name 74 "s2D"
Name 78 "c2"
Name 85 "lodClamp"
Name 89 "localPayload"
Decorate 11(gl_LaunchIDEXT) BuiltIn LaunchIdKHR
Decorate 14(gl_LaunchSizeEXT) BuiltIn LaunchSizeKHR
Decorate 21(gl_WorldRayOriginEXT) BuiltIn WorldRayOriginKHR
@ -57,7 +63,11 @@ spv.ext.MissShader.rmiss
Decorate 63(gl_WarpIDNV) BuiltIn WarpIDNV
Decorate 63(gl_WarpIDNV) Volatile
Decorate 63(gl_WarpIDNV) Coherent
Decorate 70(localPayload) Location 0
Decorate 74(s2D) DescriptorSet 0
Decorate 74(s2D) Binding 1
Decorate 78(c2) Location 2
Decorate 85(lodClamp) Location 3
Decorate 89(localPayload) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
@ -100,8 +110,20 @@ spv.ext.MissShader.rmiss
58(gl_SubgroupEqMask): 57(ptr) Variable Input
63(gl_WarpIDNV): 52(ptr) Variable Input
67: TypePointer IncomingRayPayloadKHR 16(float)
69: TypePointer RayPayloadKHR 49(fvec4)
70(localPayload): 69(ptr) Variable RayPayloadKHR
69: TypePointer Function 49(fvec4)
71: TypeImage 16(float) 2D sampled format:Unknown
72: TypeSampledImage 71
73: TypePointer UniformConstant 72
74(s2D): 73(ptr) Variable UniformConstant
76: TypeVector 16(float) 2
77: TypePointer Input 76(fvec2)
78(c2): 77(ptr) Variable Input
82: TypeVector 47(int) 2
83: 47(int) Constant 5
84: 82(ivec2) ConstantComposite 83 83
85(lodClamp): 28(ptr) Variable Input
88: TypePointer RayPayloadKHR 49(fvec4)
89(localPayload): 88(ptr) Variable RayPayloadKHR
4(main): 2 Function None 3
5: Label
9(v0): 8(ptr) Variable Function
@ -110,6 +132,7 @@ spv.ext.MissShader.rmiss
23(v3): 18(ptr) Variable Function
27(v4): 26(ptr) Variable Function
31(v5): 26(ptr) Variable Function
70(texel): 69(ptr) Variable Function
12: 7(ivec3) Load 11(gl_LaunchIDEXT)
Store 9(v0) 12
15: 7(ivec3) Load 14(gl_LaunchSizeEXT)
@ -135,5 +158,12 @@ spv.ext.MissShader.rmiss
66: 16(float) FAdd 62 65
68: 67(ptr) AccessChain 51(incomingPayload) 38
Store 68 66
75: 72 Load 74(s2D)
79: 76(fvec2) Load 78(c2)
80: 76(fvec2) Load 78(c2)
81: 76(fvec2) Load 78(c2)
86: 16(float) Load 85(lodClamp)
87: 49(fvec4) ImageSampleExplicitLod 75 79 Grad ConstOffset MinLod 80 81 84 86
Store 70(texel) 87
Return
FunctionEnd

View File

@ -4,9 +4,16 @@
#extension GL_KHR_shader_subgroup_ballot : enable
#extension GL_ARB_shader_ballot : enable
#extension GL_NV_shader_sm_builtins : enable
#extension GL_ARB_sparse_texture_clamp: enable
layout(binding = 0, set = 0) uniform accelerationStructureEXT accEXT;
layout(location = 0) rayPayloadEXT vec4 localPayload;
layout(location = 1) rayPayloadInEXT vec4 incomingPayload;
layout(binding = 1, set = 0) uniform sampler2D s2D;
layout(location = 2) in vec2 c2;
layout(location = 3) in float lodClamp;
void main()
{
uvec3 v0 = gl_LaunchIDEXT;
@ -17,4 +24,5 @@ void main()
float v5 = gl_RayTmaxEXT;
traceRayEXT(accEXT, 0u, 1u, 2u, 3u, 0u, vec3(0.5f), 0.5f, vec3(1.0f), 0.75f, 1);
incomingPayload.x = float(gl_SubGroupSizeARB) + float(gl_SubgroupEqMask) + float(gl_WarpIDNV);
vec4 texel = textureGradOffsetClampARB(s2D, c2, c2, c2, ivec2(5), lodClamp);
}

View File

@ -6538,7 +6538,7 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName,
s.append(");\n");
// Add to the per-language set of built-ins
if (bias || lodClamp != 0) {
if (!grad && (bias || lodClamp != 0)) {
stageBuiltins[EShLangFragment].append(s);
stageBuiltins[EShLangCompute].append(s);
} else