mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-08 11:30:06 +00:00
Fix debug info file and source strings
The file and source text was not being set correctly in the test output. This change makes the test fixture consistent with the command line behavior, "-gVS", which was my original intent when I added these tests.
This commit is contained in:
parent
b0df68c490
commit
bf08e1db5c
@ -13,7 +13,7 @@ spv.debuginfo.bufferref.glsl.frag
|
||||
MemoryModel PhysicalStorageBuffer64EXT GLSL450
|
||||
EntryPoint Fragment 14 "main" 76 131
|
||||
ExecutionMode 14 OriginUpperLeft
|
||||
2: String ""
|
||||
2: String "spv.debuginfo.bufferref.glsl.frag"
|
||||
8: String "uint"
|
||||
16: String "main"
|
||||
19: String "// OpModuleProcessed auto-map-locations
|
||||
@ -23,6 +23,34 @@ spv.debuginfo.bufferref.glsl.frag
|
||||
// OpModuleProcessed keep-uncalled
|
||||
// OpModuleProcessed entry-point main
|
||||
#line 1
|
||||
#version 450 core
|
||||
#extension GL_EXT_buffer_reference : enable
|
||||
|
||||
layout(buffer_reference, std430) buffer MeshVertexPositions {
|
||||
float data[];
|
||||
};
|
||||
|
||||
struct Mesh {
|
||||
MeshVertexPositions positions;
|
||||
};
|
||||
|
||||
layout(set = 0, binding = 0) readonly buffer PerPass_meshes {
|
||||
Mesh data[];
|
||||
} perPass_meshes;
|
||||
|
||||
layout(location = 0) out vec4 out_fragColor;
|
||||
|
||||
layout(location = 0) in flat uint tri_idx0;
|
||||
|
||||
void main() {
|
||||
Mesh meshData = perPass_meshes.data[tri_idx0];
|
||||
|
||||
vec3 vertex_pos0 = vec3(meshData.positions.data[3 * tri_idx0],
|
||||
meshData.positions.data[3 * tri_idx0 + 1],
|
||||
meshData.positions.data[3 * tri_idx0 + 2]);
|
||||
|
||||
out_fragColor = vec4(vertex_pos0, 1.0);
|
||||
}
|
||||
"
|
||||
31: String "Mesh"
|
||||
34: String "float"
|
||||
|
@ -10,7 +10,7 @@ spv.debuginfo.const_params.glsl.comp
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint GLCompute 14 "main"
|
||||
ExecutionMode 14 LocalSize 1 1 1
|
||||
2: String ""
|
||||
2: String "spv.debuginfo.const_params.glsl.comp"
|
||||
8: String "uint"
|
||||
17: String "float"
|
||||
35: String "function"
|
||||
@ -21,6 +21,20 @@ spv.debuginfo.const_params.glsl.comp
|
||||
// OpModuleProcessed keep-uncalled
|
||||
// OpModuleProcessed entry-point main
|
||||
#line 1
|
||||
#version 450
|
||||
|
||||
void function(
|
||||
const float f,
|
||||
const vec2 f2,
|
||||
const vec3 f3,
|
||||
const vec4 f4)
|
||||
{
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
function(0, vec2(0), vec3(0), vec4(0));
|
||||
}
|
||||
"
|
||||
43: String "f"
|
||||
49: String "f2"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,7 @@ Validation failed
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 14 "main" 493 546
|
||||
ExecutionMode 14 OriginUpperLeft
|
||||
2: String ""
|
||||
2: String "spv.debuginfo.glsl.frag"
|
||||
8: String "uint"
|
||||
17: String "float"
|
||||
39: String "textureProj"
|
||||
@ -23,6 +23,200 @@ Validation failed
|
||||
// OpModuleProcessed keep-uncalled
|
||||
// OpModuleProcessed entry-point main
|
||||
#line 1
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2022 Sascha Willems
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#version 450
|
||||
|
||||
layout (binding = 1) uniform sampler2D samplerposition;
|
||||
layout (binding = 2) uniform sampler2D samplerNormal;
|
||||
layout (binding = 3) uniform sampler2D samplerAlbedo;
|
||||
layout (binding = 5) uniform sampler2DArray samplerShadowMap;
|
||||
|
||||
layout (location = 0) in vec2 inUV;
|
||||
|
||||
layout (location = 0) out vec4 outFragColor;
|
||||
|
||||
#define LIGHT_COUNT 3
|
||||
#define SHADOW_FACTOR 0.25
|
||||
#define AMBIENT_LIGHT 0.1
|
||||
#define USE_PCF
|
||||
|
||||
int global_var = 0;
|
||||
|
||||
struct Light
|
||||
{
|
||||
vec4 position;
|
||||
vec4 target;
|
||||
vec4 color;
|
||||
mat4 viewMatrix;
|
||||
};
|
||||
|
||||
layout (binding = 4) uniform UBO
|
||||
{
|
||||
vec4 viewPos;
|
||||
Light lights[LIGHT_COUNT];
|
||||
int useShadows;
|
||||
int debugDisplayTarget;
|
||||
} ubo;
|
||||
|
||||
float textureProj(vec4 P, float layer, vec2 offset)
|
||||
{
|
||||
float shadow = 1.0;
|
||||
vec4 shadowCoord = P / P.w;
|
||||
shadowCoord.st = shadowCoord.st * 0.5 + 0.5;
|
||||
|
||||
if (shadowCoord.z > -1.0 && shadowCoord.z < 1.0)
|
||||
{
|
||||
float dist = texture(samplerShadowMap, vec3(shadowCoord.st + offset, layer)).r;
|
||||
if (shadowCoord.w > 0.0 && dist < shadowCoord.z)
|
||||
{
|
||||
shadow = SHADOW_FACTOR;
|
||||
}
|
||||
}
|
||||
return shadow;
|
||||
}
|
||||
|
||||
float filterPCF(vec4 sc, float layer)
|
||||
{
|
||||
ivec2 texDim = textureSize(samplerShadowMap, 0).xy;
|
||||
float scale = 1.5;
|
||||
float dx = scale * 1.0 / float(texDim.x);
|
||||
float dy = scale * 1.0 / float(texDim.y);
|
||||
|
||||
float shadowFactor = 0.0;
|
||||
int count = 0;
|
||||
int range = 1;
|
||||
|
||||
for (int x = -range; x <= range; x++)
|
||||
{
|
||||
for (int y = -range; y <= range; y++)
|
||||
{
|
||||
shadowFactor += textureProj(sc, layer, vec2(dx*x, dy*y));
|
||||
count++;
|
||||
}
|
||||
|
||||
}
|
||||
return shadowFactor / count;
|
||||
}
|
||||
|
||||
vec3 shadow(vec3 fragcolor, vec3 fragpos) {
|
||||
for(int i = 0; i < LIGHT_COUNT; ++i)
|
||||
{
|
||||
vec4 shadowClip = ubo.lights[i].viewMatrix * vec4(fragpos, 1.0);
|
||||
|
||||
float shadowFactor;
|
||||
#ifdef USE_PCF
|
||||
shadowFactor= filterPCF(shadowClip, i);
|
||||
#else
|
||||
shadowFactor = textureProj(shadowClip, i, vec2(0.0));
|
||||
#endif
|
||||
|
||||
fragcolor *= shadowFactor;
|
||||
}
|
||||
return fragcolor;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
// Get G-Buffer values
|
||||
vec3 fragPos = texture(samplerposition, inUV).rgb;
|
||||
vec3 normal = texture(samplerNormal, inUV).rgb;
|
||||
vec4 albedo = texture(samplerAlbedo, inUV);
|
||||
|
||||
// Debug display
|
||||
if (ubo.debugDisplayTarget > 0) {
|
||||
switch (ubo.debugDisplayTarget) {
|
||||
case 1:
|
||||
outFragColor.rgb = shadow(vec3(1.0), fragPos).rgb;
|
||||
break;
|
||||
case 2:
|
||||
outFragColor.rgb = fragPos;
|
||||
break;
|
||||
case 3:
|
||||
outFragColor.rgb = normal;
|
||||
break;
|
||||
case 4:
|
||||
outFragColor.rgb = albedo.rgb;
|
||||
break;
|
||||
case 5:
|
||||
outFragColor.rgb = albedo.aaa;
|
||||
break;
|
||||
}
|
||||
outFragColor.a = 1.0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Ambient part
|
||||
vec3 fragcolor = albedo.rgb * AMBIENT_LIGHT;
|
||||
|
||||
vec3 N = normalize(normal);
|
||||
|
||||
for(int i = 0; i < LIGHT_COUNT; ++i)
|
||||
{
|
||||
// Vector to light
|
||||
vec3 L = ubo.lights[i].position.xyz - fragPos;
|
||||
// Distance from light to fragment position
|
||||
float dist = length(L);
|
||||
L = normalize(L);
|
||||
|
||||
// Viewer to fragment
|
||||
vec3 V = ubo.viewPos.xyz - fragPos;
|
||||
V = normalize(V);
|
||||
|
||||
float lightCosInnerAngle = cos(radians(15.0));
|
||||
float lightCosOuterAngle = cos(radians(25.0));
|
||||
float lightRange = 100.0;
|
||||
|
||||
// Direction vector from source to target
|
||||
vec3 dir = normalize(ubo.lights[i].position.xyz - ubo.lights[i].target.xyz);
|
||||
|
||||
// Dual cone spot light with smooth transition between inner and outer angle
|
||||
float cosDir = dot(L, dir);
|
||||
float spotEffect = smoothstep(lightCosOuterAngle, lightCosInnerAngle, cosDir);
|
||||
float heightAttenuation = smoothstep(lightRange, 0.0f, dist);
|
||||
|
||||
// Diffuse lighting
|
||||
float NdotL = max(0.0, dot(N, L));
|
||||
vec3 diff = vec3(NdotL);
|
||||
|
||||
// Specular lighting
|
||||
vec3 R = reflect(-L, N);
|
||||
float NdotR = max(0.0, dot(R, V));
|
||||
vec3 spec = vec3(pow(NdotR, 16.0) * albedo.a * 2.5);
|
||||
|
||||
fragcolor += vec3((diff + spec) * spotEffect * heightAttenuation) * ubo.lights[i].color.rgb * albedo.rgb;
|
||||
}
|
||||
|
||||
// Shadow calculations in a separate pass
|
||||
if (ubo.useShadows > 0)
|
||||
{
|
||||
fragcolor = shadow(fragcolor, fragPos);
|
||||
}
|
||||
|
||||
outFragColor = vec4(fragcolor, 1.0);
|
||||
}
|
||||
"
|
||||
47: String "P"
|
||||
53: String "layer"
|
||||
|
@ -1,7 +1,7 @@
|
||||
spv.debuginfo.glsl.geom
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 8000b
|
||||
// Id's are bound by 273
|
||||
// Id's are bound by 274
|
||||
|
||||
Capability Geometry
|
||||
Capability MultiViewport
|
||||
@ -9,12 +9,12 @@ spv.debuginfo.glsl.geom
|
||||
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
|
||||
3: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Geometry 14 "main" 64 98 121 130 134 168 208 217 236 249 255 259
|
||||
EntryPoint Geometry 14 "main" 64 98 121 130 134 168 208 217 236 250 256 260
|
||||
ExecutionMode 14 Triangles
|
||||
ExecutionMode 14 Invocations 2
|
||||
ExecutionMode 14 OutputTriangleStrip
|
||||
ExecutionMode 14 OutputVertices 3
|
||||
2: String ""
|
||||
2: String "spv.debuginfo.glsl.geom"
|
||||
8: String "uint"
|
||||
16: String "main"
|
||||
19: String "// OpModuleProcessed auto-map-locations
|
||||
@ -24,6 +24,75 @@ spv.debuginfo.glsl.geom
|
||||
// OpModuleProcessed keep-uncalled
|
||||
// OpModuleProcessed entry-point main
|
||||
#line 1
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2022 Sascha Willems
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#version 450
|
||||
|
||||
#extension GL_ARB_viewport_array : enable
|
||||
|
||||
layout (triangles, invocations = 2) in;
|
||||
layout (triangle_strip, max_vertices = 3) out;
|
||||
|
||||
layout (binding = 0) uniform UBO
|
||||
{
|
||||
mat4 projection[2];
|
||||
mat4 modelview[2];
|
||||
vec4 lightPos;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) in vec3 inNormal[];
|
||||
layout (location = 1) in vec3 inColor[];
|
||||
|
||||
layout (location = 0) out vec3 outNormal;
|
||||
layout (location = 1) out vec3 outColor;
|
||||
layout (location = 2) out vec3 outViewVec;
|
||||
layout (location = 3) out vec3 outLightVec;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
for(int i = 0; i < gl_in.length(); i++)
|
||||
{
|
||||
outNormal = mat3(ubo.modelview[gl_InvocationID]) * inNormal[i];
|
||||
outColor = inColor[i];
|
||||
|
||||
vec4 pos = gl_in[i].gl_Position;
|
||||
vec4 worldPos = (ubo.modelview[gl_InvocationID] * pos);
|
||||
|
||||
vec3 lPos = vec3(ubo.modelview[gl_InvocationID] * ubo.lightPos);
|
||||
outLightVec = lPos - worldPos.xyz;
|
||||
outViewVec = -worldPos.xyz;
|
||||
|
||||
gl_Position = ubo.projection[gl_InvocationID] * worldPos;
|
||||
|
||||
// Set the viewport index that the vertex will be emitted to
|
||||
gl_ViewportIndex = gl_InvocationID;
|
||||
gl_PrimitiveID = gl_PrimitiveIDIn;
|
||||
EmitVertex();
|
||||
}
|
||||
EndPrimitive();
|
||||
}
|
||||
"
|
||||
29: String "int"
|
||||
36: String "i"
|
||||
@ -49,9 +118,10 @@ spv.debuginfo.glsl.geom
|
||||
191: String "lPos"
|
||||
210: String "outLightVec"
|
||||
219: String "outViewVec"
|
||||
251: String "gl_ViewportIndex"
|
||||
257: String "gl_PrimitiveID"
|
||||
261: String "gl_PrimitiveIDIn"
|
||||
238: String ""
|
||||
252: String "gl_ViewportIndex"
|
||||
258: String "gl_PrimitiveID"
|
||||
262: String "gl_PrimitiveIDIn"
|
||||
SourceExtension "GL_ARB_viewport_array"
|
||||
Name 14 "main"
|
||||
Name 34 "i"
|
||||
@ -82,9 +152,9 @@ spv.debuginfo.glsl.geom
|
||||
MemberName 225(gl_PerVertex) 2 "gl_ClipDistance"
|
||||
MemberName 225(gl_PerVertex) 3 "gl_CullDistance"
|
||||
Name 236 ""
|
||||
Name 249 "gl_ViewportIndex"
|
||||
Name 255 "gl_PrimitiveID"
|
||||
Name 259 "gl_PrimitiveIDIn"
|
||||
Name 250 "gl_ViewportIndex"
|
||||
Name 256 "gl_PrimitiveID"
|
||||
Name 260 "gl_PrimitiveIDIn"
|
||||
Decorate 64(outNormal) Location 0
|
||||
Decorate 74 ArrayStride 64
|
||||
Decorate 76 ArrayStride 64
|
||||
@ -114,9 +184,9 @@ spv.debuginfo.glsl.geom
|
||||
MemberDecorate 225(gl_PerVertex) 2 BuiltIn ClipDistance
|
||||
MemberDecorate 225(gl_PerVertex) 3 BuiltIn CullDistance
|
||||
Decorate 225(gl_PerVertex) Block
|
||||
Decorate 249(gl_ViewportIndex) BuiltIn ViewportIndex
|
||||
Decorate 255(gl_PrimitiveID) BuiltIn PrimitiveId
|
||||
Decorate 259(gl_PrimitiveIDIn) BuiltIn PrimitiveId
|
||||
Decorate 250(gl_ViewportIndex) BuiltIn ViewportIndex
|
||||
Decorate 256(gl_PrimitiveID) BuiltIn PrimitiveId
|
||||
Decorate 260(gl_PrimitiveIDIn) BuiltIn PrimitiveId
|
||||
4: TypeVoid
|
||||
5: TypeFunction 4
|
||||
7: TypeInt 32 0
|
||||
@ -248,21 +318,21 @@ spv.debuginfo.glsl.geom
|
||||
234: TypePointer Output 225(gl_PerVertex)
|
||||
235: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 232 13 12
|
||||
236: 234(ptr) Variable Output
|
||||
237: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 2 232 18 233 12 21 2 236 68
|
||||
244: TypePointer Output 69(fvec4)
|
||||
245: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 70 13 12
|
||||
247: TypePointer Output 28(int)
|
||||
248: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 30 13 12
|
||||
249(gl_ViewportIndex): 247(ptr) Variable Output
|
||||
252: 7(int) Constant 64
|
||||
250: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 251 30 18 252 12 21 251 249(gl_ViewportIndex) 68
|
||||
255(gl_PrimitiveID): 247(ptr) Variable Output
|
||||
258: 7(int) Constant 65
|
||||
256: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 257 30 18 258 12 21 257 255(gl_PrimitiveID) 68
|
||||
259(gl_PrimitiveIDIn): 96(ptr) Variable Input
|
||||
260: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 261 30 18 258 12 21 261 259(gl_PrimitiveIDIn) 68
|
||||
265: 7(int) Constant 66
|
||||
272: 7(int) Constant 68
|
||||
237: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 238 232 18 233 12 21 238 236 68
|
||||
245: TypePointer Output 69(fvec4)
|
||||
246: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 70 13 12
|
||||
248: TypePointer Output 28(int)
|
||||
249: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 30 13 12
|
||||
250(gl_ViewportIndex): 248(ptr) Variable Output
|
||||
253: 7(int) Constant 64
|
||||
251: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 252 30 18 253 12 21 252 250(gl_ViewportIndex) 68
|
||||
256(gl_PrimitiveID): 248(ptr) Variable Output
|
||||
259: 7(int) Constant 65
|
||||
257: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 258 30 18 259 12 21 258 256(gl_PrimitiveID) 68
|
||||
260(gl_PrimitiveIDIn): 96(ptr) Variable Input
|
||||
261: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 262 30 18 259 12 21 262 260(gl_PrimitiveIDIn) 68
|
||||
266: 7(int) Constant 66
|
||||
273: 7(int) Constant 68
|
||||
14(main): 4 Function None 5
|
||||
15: Label
|
||||
34(i): 31(ptr) Variable Function
|
||||
@ -348,33 +418,33 @@ spv.debuginfo.glsl.geom
|
||||
223: 60(fvec3) VectorShuffle 221 221 0 1 2
|
||||
224: 60(fvec3) FNegate 223
|
||||
Store 217(outViewVec) 224
|
||||
239: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 233 233 12 12
|
||||
238: 28(int) Load 98(gl_InvocationID)
|
||||
240: 104(ptr) AccessChain 92(ubo) 41 238
|
||||
241: 71 Load 240
|
||||
242: 69(fvec4) Load 176(worldPos)
|
||||
243: 69(fvec4) MatrixTimesVector 241 242
|
||||
246: 244(ptr) AccessChain 236 41
|
||||
Store 246 243
|
||||
254: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 252 252 12 12
|
||||
253: 28(int) Load 98(gl_InvocationID)
|
||||
Store 249(gl_ViewportIndex) 253
|
||||
263: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 258 258 12 12
|
||||
262: 28(int) Load 259(gl_PrimitiveIDIn)
|
||||
Store 255(gl_PrimitiveID) 262
|
||||
264: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 265 265 12 12
|
||||
240: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 233 233 12 12
|
||||
239: 28(int) Load 98(gl_InvocationID)
|
||||
241: 104(ptr) AccessChain 92(ubo) 41 239
|
||||
242: 71 Load 241
|
||||
243: 69(fvec4) Load 176(worldPos)
|
||||
244: 69(fvec4) MatrixTimesVector 242 243
|
||||
247: 245(ptr) AccessChain 236 41
|
||||
Store 247 244
|
||||
255: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 253 253 12 12
|
||||
254: 28(int) Load 98(gl_InvocationID)
|
||||
Store 250(gl_ViewportIndex) 254
|
||||
264: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 259 259 12 12
|
||||
263: 28(int) Load 260(gl_PrimitiveIDIn)
|
||||
Store 256(gl_PrimitiveID) 263
|
||||
265: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 266 266 12 12
|
||||
EmitVertex
|
||||
Branch 45
|
||||
45: Label
|
||||
267: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17
|
||||
268: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 37 37 12 12
|
||||
266: 28(int) Load 34(i)
|
||||
269: 28(int) IAdd 266 95
|
||||
Store 34(i) 269
|
||||
268: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17
|
||||
269: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 37 37 12 12
|
||||
267: 28(int) Load 34(i)
|
||||
270: 28(int) IAdd 267 95
|
||||
Store 34(i) 270
|
||||
Branch 42
|
||||
44: Label
|
||||
270: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17
|
||||
271: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 272 272 12 12
|
||||
271: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17
|
||||
272: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 273 273 12 12
|
||||
EndPrimitive
|
||||
Return
|
||||
FunctionEnd
|
||||
|
@ -10,7 +10,7 @@ spv.debuginfo.glsl.tesc
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint TessellationControl 14 "main" 260 265 294 383 399 516 532 542 557
|
||||
ExecutionMode 14 OutputVertices 4
|
||||
2: String ""
|
||||
2: String "spv.debuginfo.glsl.tesc"
|
||||
8: String "uint"
|
||||
17: String "float"
|
||||
31: String "screenSpaceTessFactor"
|
||||
@ -21,6 +21,146 @@ spv.debuginfo.glsl.tesc
|
||||
// OpModuleProcessed keep-uncalled
|
||||
// OpModuleProcessed entry-point main
|
||||
#line 1
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2022 Sascha Willems
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#version 450
|
||||
|
||||
layout(set = 0, binding = 0) uniform UBO
|
||||
{
|
||||
mat4 projection;
|
||||
mat4 modelview;
|
||||
vec4 lightPos;
|
||||
vec4 frustumPlanes[6];
|
||||
float displacementFactor;
|
||||
float tessellationFactor;
|
||||
vec2 viewportDim;
|
||||
float tessellatedEdgeSize;
|
||||
} ubo;
|
||||
|
||||
layout(set = 0, binding = 1) uniform sampler2D samplerHeight;
|
||||
|
||||
layout (vertices = 4) out;
|
||||
|
||||
layout (location = 0) in vec3 inNormal[];
|
||||
layout (location = 1) in vec2 inUV[];
|
||||
|
||||
layout (location = 0) out vec3 outNormal[4];
|
||||
layout (location = 1) out vec2 outUV[4];
|
||||
|
||||
// Calculate the tessellation factor based on screen space
|
||||
// dimensions of the edge
|
||||
float screenSpaceTessFactor(vec4 p0, vec4 p1)
|
||||
{
|
||||
// Calculate edge mid point
|
||||
vec4 midPoint = 0.5 * (p0 + p1);
|
||||
// Sphere radius as distance between the control points
|
||||
float radius = distance(p0, p1) / 2.0;
|
||||
|
||||
// View space
|
||||
vec4 v0 = ubo.modelview * midPoint;
|
||||
|
||||
// Project into clip space
|
||||
vec4 clip0 = (ubo.projection * (v0 - vec4(radius, vec3(0.0))));
|
||||
vec4 clip1 = (ubo.projection * (v0 + vec4(radius, vec3(0.0))));
|
||||
|
||||
// Get normalized device coordinates
|
||||
clip0 /= clip0.w;
|
||||
clip1 /= clip1.w;
|
||||
|
||||
// Convert to viewport coordinates
|
||||
clip0.xy *= ubo.viewportDim;
|
||||
clip1.xy *= ubo.viewportDim;
|
||||
|
||||
// Return the tessellation factor based on the screen size
|
||||
// given by the distance of the two edge control points in screen space
|
||||
// and a reference (min.) tessellation size for the edge set by the application
|
||||
return clamp(distance(clip0, clip1) / ubo.tessellatedEdgeSize * ubo.tessellationFactor, 1.0, 64.0);
|
||||
}
|
||||
|
||||
// Checks the current's patch visibility against the frustum using a sphere check
|
||||
// Sphere radius is given by the patch size
|
||||
bool frustumCheck()
|
||||
{
|
||||
// Fixed radius (increase if patch size is increased in example)
|
||||
const float radius = 8.0f;
|
||||
vec4 pos = gl_in[gl_InvocationID].gl_Position;
|
||||
pos.y -= textureLod(samplerHeight, inUV[0], 0.0).r * ubo.displacementFactor;
|
||||
|
||||
// Check sphere against frustum planes
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (dot(pos, ubo.frustumPlanes[i]) + radius < 0.0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
if (gl_InvocationID == 0)
|
||||
{
|
||||
if (!frustumCheck())
|
||||
{
|
||||
gl_TessLevelInner[0] = 0.0;
|
||||
gl_TessLevelInner[1] = 0.0;
|
||||
gl_TessLevelOuter[0] = 0.0;
|
||||
gl_TessLevelOuter[1] = 0.0;
|
||||
gl_TessLevelOuter[2] = 0.0;
|
||||
gl_TessLevelOuter[3] = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ubo.tessellationFactor > 0.0)
|
||||
{
|
||||
gl_TessLevelOuter[0] = screenSpaceTessFactor(gl_in[3].gl_Position, gl_in[0].gl_Position);
|
||||
gl_TessLevelOuter[1] = screenSpaceTessFactor(gl_in[0].gl_Position, gl_in[1].gl_Position);
|
||||
gl_TessLevelOuter[2] = screenSpaceTessFactor(gl_in[1].gl_Position, gl_in[2].gl_Position);
|
||||
gl_TessLevelOuter[3] = screenSpaceTessFactor(gl_in[2].gl_Position, gl_in[3].gl_Position);
|
||||
gl_TessLevelInner[0] = mix(gl_TessLevelOuter[0], gl_TessLevelOuter[3], 0.5);
|
||||
gl_TessLevelInner[1] = mix(gl_TessLevelOuter[2], gl_TessLevelOuter[1], 0.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Tessellation factor can be set to zero by example
|
||||
// to demonstrate a simple passthrough
|
||||
gl_TessLevelInner[0] = 1.0;
|
||||
gl_TessLevelInner[1] = 1.0;
|
||||
gl_TessLevelOuter[0] = 1.0;
|
||||
gl_TessLevelOuter[1] = 1.0;
|
||||
gl_TessLevelOuter[2] = 1.0;
|
||||
gl_TessLevelOuter[3] = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
outNormal[gl_InvocationID] = inNormal[gl_InvocationID];
|
||||
outUV[gl_InvocationID] = inUV[gl_InvocationID];
|
||||
}
|
||||
"
|
||||
40: String "p0"
|
||||
46: String "p1"
|
||||
|
@ -1,18 +1,18 @@
|
||||
spv.debuginfo.glsl.tese
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 8000b
|
||||
// Id's are bound by 356
|
||||
// Id's are bound by 357
|
||||
|
||||
Capability Tessellation
|
||||
Extension "SPV_KHR_non_semantic_info"
|
||||
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
|
||||
3: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint TessellationEvaluation 14 "main" 47 66 93 116 143 183 300 315 323 336 343
|
||||
EntryPoint TessellationEvaluation 14 "main" 47 66 93 116 143 183 300 316 324 337 344
|
||||
ExecutionMode 14 Quads
|
||||
ExecutionMode 14 SpacingEqual
|
||||
ExecutionMode 14 VertexOrderCw
|
||||
2: String ""
|
||||
2: String "spv.debuginfo.glsl.tese"
|
||||
8: String "uint"
|
||||
16: String "main"
|
||||
19: String "// OpModuleProcessed auto-map-locations
|
||||
@ -22,6 +22,84 @@ spv.debuginfo.glsl.tese
|
||||
// OpModuleProcessed keep-uncalled
|
||||
// OpModuleProcessed entry-point main
|
||||
#line 1
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2022 Sascha Willems
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#version 450
|
||||
|
||||
layout (set = 0, binding = 0) uniform UBO
|
||||
{
|
||||
mat4 projection;
|
||||
mat4 modelview;
|
||||
vec4 lightPos;
|
||||
vec4 frustumPlanes[6];
|
||||
float displacementFactor;
|
||||
float tessellationFactor;
|
||||
vec2 viewportDim;
|
||||
float tessellatedEdgeSize;
|
||||
} ubo;
|
||||
|
||||
layout (set = 0, binding = 1) uniform sampler2D displacementMap;
|
||||
|
||||
layout(quads, equal_spacing, cw) in;
|
||||
|
||||
layout (location = 0) in vec3 inNormal[];
|
||||
layout (location = 1) in vec2 inUV[];
|
||||
|
||||
layout (location = 0) out vec3 outNormal;
|
||||
layout (location = 1) out vec2 outUV;
|
||||
layout (location = 2) out vec3 outViewVec;
|
||||
layout (location = 3) out vec3 outLightVec;
|
||||
layout (location = 4) out vec3 outEyePos;
|
||||
layout (location = 5) out vec3 outWorldPos;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Interpolate UV coordinates
|
||||
vec2 uv1 = mix(inUV[0], inUV[1], gl_TessCoord.x);
|
||||
vec2 uv2 = mix(inUV[3], inUV[2], gl_TessCoord.x);
|
||||
outUV = mix(uv1, uv2, gl_TessCoord.y);
|
||||
|
||||
vec3 n1 = mix(inNormal[0], inNormal[1], gl_TessCoord.x);
|
||||
vec3 n2 = mix(inNormal[3], inNormal[2], gl_TessCoord.x);
|
||||
outNormal = mix(n1, n2, gl_TessCoord.y);
|
||||
|
||||
// Interpolate positions
|
||||
vec4 pos1 = mix(gl_in[0].gl_Position, gl_in[1].gl_Position, gl_TessCoord.x);
|
||||
vec4 pos2 = mix(gl_in[3].gl_Position, gl_in[2].gl_Position, gl_TessCoord.x);
|
||||
vec4 pos = mix(pos1, pos2, gl_TessCoord.y);
|
||||
// Displace
|
||||
pos.y -= textureLod(displacementMap, outUV, 0.0).r * ubo.displacementFactor;
|
||||
// Perspective projection
|
||||
gl_Position = ubo.projection * ubo.modelview * pos;
|
||||
|
||||
// Calculate vectors for lighting based on tessellated position
|
||||
outViewVec = -pos.xyz;
|
||||
outLightVec = normalize(ubo.lightPos.xyz + outViewVec);
|
||||
outWorldPos = pos.xyz;
|
||||
outEyePos = vec3(ubo.modelview * pos);
|
||||
}
|
||||
"
|
||||
29: String "float"
|
||||
38: String "uv1"
|
||||
@ -55,10 +133,11 @@ spv.debuginfo.glsl.tese
|
||||
266: String "viewportDim"
|
||||
270: String "UBO"
|
||||
275: String "ubo"
|
||||
317: String "outViewVec"
|
||||
325: String "outLightVec"
|
||||
338: String "outWorldPos"
|
||||
345: String "outEyePos"
|
||||
302: String ""
|
||||
318: String "outViewVec"
|
||||
326: String "outLightVec"
|
||||
339: String "outWorldPos"
|
||||
346: String "outEyePos"
|
||||
Name 14 "main"
|
||||
Name 36 "uv1"
|
||||
Name 47 "inUV"
|
||||
@ -95,10 +174,10 @@ spv.debuginfo.glsl.tese
|
||||
MemberName 288(gl_PerVertex) 2 "gl_ClipDistance"
|
||||
MemberName 288(gl_PerVertex) 3 "gl_CullDistance"
|
||||
Name 300 ""
|
||||
Name 315 "outViewVec"
|
||||
Name 323 "outLightVec"
|
||||
Name 336 "outWorldPos"
|
||||
Name 343 "outEyePos"
|
||||
Name 316 "outViewVec"
|
||||
Name 324 "outLightVec"
|
||||
Name 337 "outWorldPos"
|
||||
Name 344 "outEyePos"
|
||||
Decorate 47(inUV) Location 1
|
||||
Decorate 66(gl_TessCoord) BuiltIn TessCoord
|
||||
Decorate 93(outUV) Location 1
|
||||
@ -132,10 +211,10 @@ spv.debuginfo.glsl.tese
|
||||
MemberDecorate 288(gl_PerVertex) 2 BuiltIn ClipDistance
|
||||
MemberDecorate 288(gl_PerVertex) 3 BuiltIn CullDistance
|
||||
Decorate 288(gl_PerVertex) Block
|
||||
Decorate 315(outViewVec) Location 2
|
||||
Decorate 323(outLightVec) Location 3
|
||||
Decorate 336(outWorldPos) Location 5
|
||||
Decorate 343(outEyePos) Location 4
|
||||
Decorate 316(outViewVec) Location 2
|
||||
Decorate 324(outLightVec) Location 3
|
||||
Decorate 337(outWorldPos) Location 5
|
||||
Decorate 344(outEyePos) Location 4
|
||||
4: TypeVoid
|
||||
5: TypeFunction 4
|
||||
7: TypeInt 32 0
|
||||
@ -292,25 +371,25 @@ spv.debuginfo.glsl.tese
|
||||
298: TypePointer Output 288(gl_PerVertex)
|
||||
299: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 296 13 12
|
||||
300: 298(ptr) Variable Output
|
||||
301: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 2 296 18 297 12 21 2 300 50
|
||||
302: TypePointer Uniform 243
|
||||
303: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 244 24 12
|
||||
312: TypePointer Output 154(fvec4)
|
||||
313: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 155 13 12
|
||||
315(outViewVec): 141(ptr) Variable Output
|
||||
318: 7(int) Constant 74
|
||||
316: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 317 63 18 318 12 21 317 315(outViewVec) 50
|
||||
323(outLightVec): 141(ptr) Variable Output
|
||||
326: 7(int) Constant 75
|
||||
324: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 325 63 18 326 12 21 325 323(outLightVec) 50
|
||||
327: TypePointer Uniform 154(fvec4)
|
||||
328: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 155 24 12
|
||||
336(outWorldPos): 141(ptr) Variable Output
|
||||
339: 7(int) Constant 76
|
||||
337: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 338 63 18 339 12 21 338 336(outWorldPos) 50
|
||||
343(outEyePos): 141(ptr) Variable Output
|
||||
346: 7(int) Constant 77
|
||||
344: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 345 63 18 346 12 21 345 343(outEyePos) 50
|
||||
301: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 302 296 18 297 12 21 302 300 50
|
||||
303: TypePointer Uniform 243
|
||||
304: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 244 24 12
|
||||
313: TypePointer Output 154(fvec4)
|
||||
314: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 155 13 12
|
||||
316(outViewVec): 141(ptr) Variable Output
|
||||
319: 7(int) Constant 74
|
||||
317: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 318 63 18 319 12 21 318 316(outViewVec) 50
|
||||
324(outLightVec): 141(ptr) Variable Output
|
||||
327: 7(int) Constant 75
|
||||
325: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 326 63 18 327 12 21 326 324(outLightVec) 50
|
||||
328: TypePointer Uniform 154(fvec4)
|
||||
329: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 155 24 12
|
||||
337(outWorldPos): 141(ptr) Variable Output
|
||||
340: 7(int) Constant 76
|
||||
338: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 339 63 18 340 12 21 339 337(outWorldPos) 50
|
||||
344(outEyePos): 141(ptr) Variable Output
|
||||
347: 7(int) Constant 77
|
||||
345: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 346 63 18 347 12 21 346 344(outEyePos) 50
|
||||
14(main): 4 Function None 5
|
||||
15: Label
|
||||
36(uv1): 33(ptr) Variable Function
|
||||
@ -427,42 +506,42 @@ spv.debuginfo.glsl.tese
|
||||
286: 28(float) FSub 285 281
|
||||
287: 282(ptr) AccessChain 210(pos) 22
|
||||
Store 287 286
|
||||
305: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 297 297 12 12
|
||||
304: 302(ptr) AccessChain 273(ubo) 54
|
||||
306: 243 Load 304
|
||||
307: 302(ptr) AccessChain 273(ubo) 59
|
||||
308: 243 Load 307
|
||||
309: 243 MatrixTimesMatrix 306 308
|
||||
310: 154(fvec4) Load 210(pos)
|
||||
311: 154(fvec4) MatrixTimesVector 309 310
|
||||
314: 312(ptr) AccessChain 300 54
|
||||
Store 314 311
|
||||
320: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 318 318 12 12
|
||||
319: 154(fvec4) Load 210(pos)
|
||||
321: 62(fvec3) VectorShuffle 319 319 0 1 2
|
||||
322: 62(fvec3) FNegate 321
|
||||
Store 315(outViewVec) 322
|
||||
330: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 326 326 12 12
|
||||
329: 327(ptr) AccessChain 273(ubo) 84
|
||||
331: 154(fvec4) Load 329
|
||||
332: 62(fvec3) VectorShuffle 331 331 0 1 2
|
||||
333: 62(fvec3) Load 315(outViewVec)
|
||||
334: 62(fvec3) FAdd 332 333
|
||||
335: 62(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 334
|
||||
Store 323(outLightVec) 335
|
||||
341: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 339 339 12 12
|
||||
340: 154(fvec4) Load 210(pos)
|
||||
342: 62(fvec3) VectorShuffle 340 340 0 1 2
|
||||
Store 336(outWorldPos) 342
|
||||
348: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 346 346 12 12
|
||||
347: 302(ptr) AccessChain 273(ubo) 59
|
||||
349: 243 Load 347
|
||||
350: 154(fvec4) Load 210(pos)
|
||||
351: 154(fvec4) MatrixTimesVector 349 350
|
||||
352: 28(float) CompositeExtract 351 0
|
||||
353: 28(float) CompositeExtract 351 1
|
||||
354: 28(float) CompositeExtract 351 2
|
||||
355: 62(fvec3) CompositeConstruct 352 353 354
|
||||
Store 343(outEyePos) 355
|
||||
306: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 297 297 12 12
|
||||
305: 303(ptr) AccessChain 273(ubo) 54
|
||||
307: 243 Load 305
|
||||
308: 303(ptr) AccessChain 273(ubo) 59
|
||||
309: 243 Load 308
|
||||
310: 243 MatrixTimesMatrix 307 309
|
||||
311: 154(fvec4) Load 210(pos)
|
||||
312: 154(fvec4) MatrixTimesVector 310 311
|
||||
315: 313(ptr) AccessChain 300 54
|
||||
Store 315 312
|
||||
321: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 319 319 12 12
|
||||
320: 154(fvec4) Load 210(pos)
|
||||
322: 62(fvec3) VectorShuffle 320 320 0 1 2
|
||||
323: 62(fvec3) FNegate 322
|
||||
Store 316(outViewVec) 323
|
||||
331: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 327 327 12 12
|
||||
330: 328(ptr) AccessChain 273(ubo) 84
|
||||
332: 154(fvec4) Load 330
|
||||
333: 62(fvec3) VectorShuffle 332 332 0 1 2
|
||||
334: 62(fvec3) Load 316(outViewVec)
|
||||
335: 62(fvec3) FAdd 333 334
|
||||
336: 62(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 335
|
||||
Store 324(outLightVec) 336
|
||||
342: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 340 340 12 12
|
||||
341: 154(fvec4) Load 210(pos)
|
||||
343: 62(fvec3) VectorShuffle 341 341 0 1 2
|
||||
Store 337(outWorldPos) 343
|
||||
349: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 347 347 12 12
|
||||
348: 303(ptr) AccessChain 273(ubo) 59
|
||||
350: 243 Load 348
|
||||
351: 154(fvec4) Load 210(pos)
|
||||
352: 154(fvec4) MatrixTimesVector 350 351
|
||||
353: 28(float) CompositeExtract 352 0
|
||||
354: 28(float) CompositeExtract 352 1
|
||||
355: 28(float) CompositeExtract 352 2
|
||||
356: 62(fvec3) CompositeConstruct 353 354 355
|
||||
Store 344(outEyePos) 356
|
||||
Return
|
||||
FunctionEnd
|
||||
|
@ -1,15 +1,15 @@
|
||||
spv.debuginfo.glsl.vert
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 8000b
|
||||
// Id's are bound by 444
|
||||
// Id's are bound by 445
|
||||
|
||||
Capability Shader
|
||||
Extension "SPV_KHR_non_semantic_info"
|
||||
1: ExtInstImport "NonSemantic.Shader.DebugInfo.100"
|
||||
3: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Vertex 14 "main" 35 42 47 55 65 83 305 323 328 353 370 389 427 436
|
||||
2: String ""
|
||||
EntryPoint Vertex 14 "main" 35 42 47 55 65 83 305 323 328 353 371 390 428 437
|
||||
2: String "spv.debuginfo.glsl.vert"
|
||||
8: String "uint"
|
||||
16: String "main"
|
||||
19: String "// OpModuleProcessed auto-map-locations
|
||||
@ -19,6 +19,111 @@ spv.debuginfo.glsl.vert
|
||||
// OpModuleProcessed keep-uncalled
|
||||
// OpModuleProcessed entry-point main
|
||||
#line 1
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2022 Sascha Willems
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#version 450
|
||||
|
||||
// Vertex attributes
|
||||
layout (location = 0) in vec3 inPos;
|
||||
layout (location = 1) in vec3 inNormal;
|
||||
layout (location = 2) in vec2 inUV;
|
||||
layout (location = 3) in vec3 inColor;
|
||||
|
||||
// Instanced attributes
|
||||
layout (location = 4) in vec3 instancePos;
|
||||
layout (location = 5) in vec3 instanceRot;
|
||||
layout (location = 6) in float instanceScale;
|
||||
layout (location = 7) in int instanceTexIndex;
|
||||
|
||||
layout (binding = 0) uniform UBO
|
||||
{
|
||||
mat4 projection;
|
||||
mat4 modelview;
|
||||
vec4 lightPos;
|
||||
float locSpeed;
|
||||
float globSpeed;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) out vec3 outNormal;
|
||||
layout (location = 1) out vec3 outColor;
|
||||
layout (location = 2) out vec3 outUV;
|
||||
layout (location = 3) out vec3 outViewVec;
|
||||
layout (location = 4) out vec3 outLightVec;
|
||||
|
||||
void main()
|
||||
{
|
||||
outColor = inColor;
|
||||
outUV = vec3(inUV, instanceTexIndex);
|
||||
|
||||
mat3 mx, my, mz;
|
||||
|
||||
// rotate around x
|
||||
float s = sin(instanceRot.x + ubo.locSpeed);
|
||||
float c = cos(instanceRot.x + ubo.locSpeed);
|
||||
|
||||
mx[0] = vec3(c, s, 0.0);
|
||||
mx[1] = vec3(-s, c, 0.0);
|
||||
mx[2] = vec3(0.0, 0.0, 1.0);
|
||||
|
||||
// rotate around y
|
||||
s = sin(instanceRot.y + ubo.locSpeed);
|
||||
c = cos(instanceRot.y + ubo.locSpeed);
|
||||
|
||||
my[0] = vec3(c, 0.0, s);
|
||||
my[1] = vec3(0.0, 1.0, 0.0);
|
||||
my[2] = vec3(-s, 0.0, c);
|
||||
|
||||
// rot around z
|
||||
s = sin(instanceRot.z + ubo.locSpeed);
|
||||
c = cos(instanceRot.z + ubo.locSpeed);
|
||||
|
||||
mz[0] = vec3(1.0, 0.0, 0.0);
|
||||
mz[1] = vec3(0.0, c, s);
|
||||
mz[2] = vec3(0.0, -s, c);
|
||||
|
||||
mat3 rotMat = mz * my * mx;
|
||||
|
||||
mat4 gRotMat;
|
||||
s = sin(instanceRot.y + ubo.globSpeed);
|
||||
c = cos(instanceRot.y + ubo.globSpeed);
|
||||
gRotMat[0] = vec4(c, 0.0, s, 0.0);
|
||||
gRotMat[1] = vec4(0.0, 1.0, 0.0, 0.0);
|
||||
gRotMat[2] = vec4(-s, 0.0, c, 0.0);
|
||||
gRotMat[3] = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
vec4 locPos = vec4(inPos.xyz * rotMat, 1.0);
|
||||
vec4 pos = vec4((locPos.xyz * instanceScale) + instancePos, 1.0);
|
||||
|
||||
gl_Position = ubo.projection * ubo.modelview * gRotMat * pos;
|
||||
outNormal = mat3(ubo.modelview * gRotMat) * inverse(rotMat) * inNormal;
|
||||
|
||||
pos = ubo.modelview * vec4(inPos.xyz + instancePos, 1.0);
|
||||
vec3 lPos = mat3(ubo.modelview) * ubo.lightPos.xyz;
|
||||
outLightVec = lPos - pos.xyz;
|
||||
outViewVec = -pos.xyz;
|
||||
}
|
||||
"
|
||||
29: String "float"
|
||||
37: String "outColor"
|
||||
@ -50,11 +155,12 @@ spv.debuginfo.glsl.vert
|
||||
344: String "gl_PointSize"
|
||||
346: String "gl_CullDistance"
|
||||
349: String "gl_PerVertex"
|
||||
372: String "outNormal"
|
||||
391: String "inNormal"
|
||||
408: String "lPos"
|
||||
429: String "outLightVec"
|
||||
438: String "outViewVec"
|
||||
355: String ""
|
||||
373: String "outNormal"
|
||||
392: String "inNormal"
|
||||
409: String "lPos"
|
||||
430: String "outLightVec"
|
||||
439: String "outViewVec"
|
||||
Name 14 "main"
|
||||
Name 35 "outColor"
|
||||
Name 42 "inColor"
|
||||
@ -87,11 +193,11 @@ spv.debuginfo.glsl.vert
|
||||
MemberName 339(gl_PerVertex) 2 "gl_ClipDistance"
|
||||
MemberName 339(gl_PerVertex) 3 "gl_CullDistance"
|
||||
Name 353 ""
|
||||
Name 370 "outNormal"
|
||||
Name 389 "inNormal"
|
||||
Name 406 "lPos"
|
||||
Name 427 "outLightVec"
|
||||
Name 436 "outViewVec"
|
||||
Name 371 "outNormal"
|
||||
Name 390 "inNormal"
|
||||
Name 407 "lPos"
|
||||
Name 428 "outLightVec"
|
||||
Name 437 "outViewVec"
|
||||
Decorate 35(outColor) Location 1
|
||||
Decorate 42(inColor) Location 3
|
||||
Decorate 47(outUV) Location 2
|
||||
@ -118,10 +224,10 @@ spv.debuginfo.glsl.vert
|
||||
MemberDecorate 339(gl_PerVertex) 2 BuiltIn ClipDistance
|
||||
MemberDecorate 339(gl_PerVertex) 3 BuiltIn CullDistance
|
||||
Decorate 339(gl_PerVertex) Block
|
||||
Decorate 370(outNormal) Location 0
|
||||
Decorate 389(inNormal) Location 1
|
||||
Decorate 427(outLightVec) Location 4
|
||||
Decorate 436(outViewVec) Location 3
|
||||
Decorate 371(outNormal) Location 0
|
||||
Decorate 390(inNormal) Location 1
|
||||
Decorate 428(outLightVec) Location 4
|
||||
Decorate 437(outViewVec) Location 3
|
||||
4: TypeVoid
|
||||
5: TypeFunction 4
|
||||
7: TypeInt 32 0
|
||||
@ -272,27 +378,27 @@ spv.debuginfo.glsl.vert
|
||||
351: TypePointer Output 339(gl_PerVertex)
|
||||
352: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 348 13 12
|
||||
353: 351(ptr) Variable Output
|
||||
354: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 2 348 18 350 12 21 2 353 39
|
||||
355: TypePointer Uniform 92
|
||||
356: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 93 24 12
|
||||
367: TypePointer Output 90(fvec4)
|
||||
368: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 91 13 12
|
||||
370(outNormal): 33(ptr) Variable Output
|
||||
373: 7(int) Constant 99
|
||||
371: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 372 32 18 373 12 21 372 370(outNormal) 39
|
||||
389(inNormal): 40(ptr) Variable Input
|
||||
390: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 391 32 18 373 12 21 391 389(inNormal) 39
|
||||
396: 7(int) Constant 101
|
||||
409: 7(int) Constant 102
|
||||
407: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 408 32 18 409 12 17 23
|
||||
421: TypePointer Uniform 90(fvec4)
|
||||
422: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 91 24 12
|
||||
427(outLightVec): 33(ptr) Variable Output
|
||||
430: 7(int) Constant 103
|
||||
428: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 429 32 18 430 12 21 429 427(outLightVec) 39
|
||||
436(outViewVec): 33(ptr) Variable Output
|
||||
439: 7(int) Constant 104
|
||||
437: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 438 32 18 439 12 21 438 436(outViewVec) 39
|
||||
354: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 355 348 18 350 12 21 355 353 39
|
||||
356: TypePointer Uniform 92
|
||||
357: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 93 24 12
|
||||
368: TypePointer Output 90(fvec4)
|
||||
369: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 91 13 12
|
||||
371(outNormal): 33(ptr) Variable Output
|
||||
374: 7(int) Constant 99
|
||||
372: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 373 32 18 374 12 21 373 371(outNormal) 39
|
||||
390(inNormal): 40(ptr) Variable Input
|
||||
391: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 392 32 18 374 12 21 392 390(inNormal) 39
|
||||
397: 7(int) Constant 101
|
||||
410: 7(int) Constant 102
|
||||
408: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 409 32 18 410 12 17 23
|
||||
422: TypePointer Uniform 90(fvec4)
|
||||
423: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 91 24 12
|
||||
428(outLightVec): 33(ptr) Variable Output
|
||||
431: 7(int) Constant 103
|
||||
429: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 430 32 18 431 12 21 430 428(outLightVec) 39
|
||||
437(outViewVec): 33(ptr) Variable Output
|
||||
440: 7(int) Constant 104
|
||||
438: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 439 32 18 440 12 21 439 437(outViewVec) 39
|
||||
14(main): 4 Function None 5
|
||||
15: Label
|
||||
76(s): 73(ptr) Variable Function
|
||||
@ -304,7 +410,7 @@ spv.debuginfo.glsl.vert
|
||||
272(gRotMat): 270(ptr) Variable Function
|
||||
299(locPos): 281(ptr) Variable Function
|
||||
315(pos): 281(ptr) Variable Function
|
||||
406(lPos): 151(ptr) Variable Function
|
||||
407(lPos): 151(ptr) Variable Function
|
||||
26: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17
|
||||
27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12
|
||||
25: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main)
|
||||
@ -487,74 +593,74 @@ spv.debuginfo.glsl.vert
|
||||
335: 28(float) CompositeExtract 332 2
|
||||
336: 90(fvec4) CompositeConstruct 333 334 335 163
|
||||
Store 315(pos) 336
|
||||
358: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 350 350 12 12
|
||||
357: 355(ptr) AccessChain 114(ubo) 146
|
||||
359: 92 Load 357
|
||||
360: 355(ptr) AccessChain 114(ubo) 154
|
||||
361: 92 Load 360
|
||||
362: 92 MatrixTimesMatrix 359 361
|
||||
363: 92 Load 272(gRotMat)
|
||||
364: 92 MatrixTimesMatrix 362 363
|
||||
365: 90(fvec4) Load 315(pos)
|
||||
366: 90(fvec4) MatrixTimesVector 364 365
|
||||
369: 367(ptr) AccessChain 353 146
|
||||
Store 369 366
|
||||
375: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 373 373 12 12
|
||||
374: 355(ptr) AccessChain 114(ubo) 154
|
||||
376: 92 Load 374
|
||||
377: 92 Load 272(gRotMat)
|
||||
378: 92 MatrixTimesMatrix 376 377
|
||||
379: 90(fvec4) CompositeExtract 378 0
|
||||
380: 31(fvec3) VectorShuffle 379 379 0 1 2
|
||||
381: 90(fvec4) CompositeExtract 378 1
|
||||
382: 31(fvec3) VectorShuffle 381 381 0 1 2
|
||||
383: 90(fvec4) CompositeExtract 378 2
|
||||
384: 31(fvec3) VectorShuffle 383 383 0 1 2
|
||||
385: 136 CompositeConstruct 380 382 384
|
||||
386: 136 Load 242(rotMat)
|
||||
387: 136 ExtInst 3(GLSL.std.450) 34(MatrixInverse) 386
|
||||
388: 136 MatrixTimesMatrix 385 387
|
||||
392: 31(fvec3) Load 389(inNormal)
|
||||
393: 31(fvec3) MatrixTimesVector 388 392
|
||||
Store 370(outNormal) 393
|
||||
395: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 396 396 12 12
|
||||
394: 355(ptr) AccessChain 114(ubo) 154
|
||||
397: 92 Load 394
|
||||
398: 31(fvec3) Load 305(inPos)
|
||||
399: 31(fvec3) Load 328(instancePos)
|
||||
400: 31(fvec3) FAdd 398 399
|
||||
401: 28(float) CompositeExtract 400 0
|
||||
402: 28(float) CompositeExtract 400 1
|
||||
403: 28(float) CompositeExtract 400 2
|
||||
404: 90(fvec4) CompositeConstruct 401 402 403 163
|
||||
405: 90(fvec4) MatrixTimesVector 397 404
|
||||
Store 315(pos) 405
|
||||
411: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 409 409 12 12
|
||||
410: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 407 406(lPos) 81
|
||||
412: 355(ptr) AccessChain 114(ubo) 154
|
||||
413: 92 Load 412
|
||||
414: 90(fvec4) CompositeExtract 413 0
|
||||
415: 31(fvec3) VectorShuffle 414 414 0 1 2
|
||||
416: 90(fvec4) CompositeExtract 413 1
|
||||
417: 31(fvec3) VectorShuffle 416 416 0 1 2
|
||||
418: 90(fvec4) CompositeExtract 413 2
|
||||
419: 31(fvec3) VectorShuffle 418 418 0 1 2
|
||||
420: 136 CompositeConstruct 415 417 419
|
||||
423: 421(ptr) AccessChain 114(ubo) 162
|
||||
424: 90(fvec4) Load 423
|
||||
425: 31(fvec3) VectorShuffle 424 424 0 1 2
|
||||
426: 31(fvec3) MatrixTimesVector 420 425
|
||||
Store 406(lPos) 426
|
||||
432: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 430 430 12 12
|
||||
431: 31(fvec3) Load 406(lPos)
|
||||
433: 90(fvec4) Load 315(pos)
|
||||
434: 31(fvec3) VectorShuffle 433 433 0 1 2
|
||||
435: 31(fvec3) FSub 431 434
|
||||
Store 427(outLightVec) 435
|
||||
441: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 439 439 12 12
|
||||
440: 90(fvec4) Load 315(pos)
|
||||
442: 31(fvec3) VectorShuffle 440 440 0 1 2
|
||||
443: 31(fvec3) FNegate 442
|
||||
Store 436(outViewVec) 443
|
||||
359: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 350 350 12 12
|
||||
358: 356(ptr) AccessChain 114(ubo) 146
|
||||
360: 92 Load 358
|
||||
361: 356(ptr) AccessChain 114(ubo) 154
|
||||
362: 92 Load 361
|
||||
363: 92 MatrixTimesMatrix 360 362
|
||||
364: 92 Load 272(gRotMat)
|
||||
365: 92 MatrixTimesMatrix 363 364
|
||||
366: 90(fvec4) Load 315(pos)
|
||||
367: 90(fvec4) MatrixTimesVector 365 366
|
||||
370: 368(ptr) AccessChain 353 146
|
||||
Store 370 367
|
||||
376: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 374 374 12 12
|
||||
375: 356(ptr) AccessChain 114(ubo) 154
|
||||
377: 92 Load 375
|
||||
378: 92 Load 272(gRotMat)
|
||||
379: 92 MatrixTimesMatrix 377 378
|
||||
380: 90(fvec4) CompositeExtract 379 0
|
||||
381: 31(fvec3) VectorShuffle 380 380 0 1 2
|
||||
382: 90(fvec4) CompositeExtract 379 1
|
||||
383: 31(fvec3) VectorShuffle 382 382 0 1 2
|
||||
384: 90(fvec4) CompositeExtract 379 2
|
||||
385: 31(fvec3) VectorShuffle 384 384 0 1 2
|
||||
386: 136 CompositeConstruct 381 383 385
|
||||
387: 136 Load 242(rotMat)
|
||||
388: 136 ExtInst 3(GLSL.std.450) 34(MatrixInverse) 387
|
||||
389: 136 MatrixTimesMatrix 386 388
|
||||
393: 31(fvec3) Load 390(inNormal)
|
||||
394: 31(fvec3) MatrixTimesVector 389 393
|
||||
Store 371(outNormal) 394
|
||||
396: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 397 397 12 12
|
||||
395: 356(ptr) AccessChain 114(ubo) 154
|
||||
398: 92 Load 395
|
||||
399: 31(fvec3) Load 305(inPos)
|
||||
400: 31(fvec3) Load 328(instancePos)
|
||||
401: 31(fvec3) FAdd 399 400
|
||||
402: 28(float) CompositeExtract 401 0
|
||||
403: 28(float) CompositeExtract 401 1
|
||||
404: 28(float) CompositeExtract 401 2
|
||||
405: 90(fvec4) CompositeConstruct 402 403 404 163
|
||||
406: 90(fvec4) MatrixTimesVector 398 405
|
||||
Store 315(pos) 406
|
||||
412: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 410 410 12 12
|
||||
411: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 408 407(lPos) 81
|
||||
413: 356(ptr) AccessChain 114(ubo) 154
|
||||
414: 92 Load 413
|
||||
415: 90(fvec4) CompositeExtract 414 0
|
||||
416: 31(fvec3) VectorShuffle 415 415 0 1 2
|
||||
417: 90(fvec4) CompositeExtract 414 1
|
||||
418: 31(fvec3) VectorShuffle 417 417 0 1 2
|
||||
419: 90(fvec4) CompositeExtract 414 2
|
||||
420: 31(fvec3) VectorShuffle 419 419 0 1 2
|
||||
421: 136 CompositeConstruct 416 418 420
|
||||
424: 422(ptr) AccessChain 114(ubo) 162
|
||||
425: 90(fvec4) Load 424
|
||||
426: 31(fvec3) VectorShuffle 425 425 0 1 2
|
||||
427: 31(fvec3) MatrixTimesVector 421 426
|
||||
Store 407(lPos) 427
|
||||
433: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 431 431 12 12
|
||||
432: 31(fvec3) Load 407(lPos)
|
||||
434: 90(fvec4) Load 315(pos)
|
||||
435: 31(fvec3) VectorShuffle 434 434 0 1 2
|
||||
436: 31(fvec3) FSub 432 435
|
||||
Store 428(outLightVec) 436
|
||||
442: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 440 440 12 12
|
||||
441: 90(fvec4) Load 315(pos)
|
||||
443: 31(fvec3) VectorShuffle 441 441 0 1 2
|
||||
444: 31(fvec3) FNegate 443
|
||||
Store 437(outViewVec) 444
|
||||
Return
|
||||
FunctionEnd
|
||||
|
@ -1,7 +1,7 @@
|
||||
spv.debuginfo.rt_types.glsl.rgen
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 8000b
|
||||
// Id's are bound by 122
|
||||
// Id's are bound by 123
|
||||
|
||||
Capability RayQueryKHR
|
||||
Capability RayTracingNV
|
||||
@ -12,7 +12,7 @@ spv.debuginfo.rt_types.glsl.rgen
|
||||
3: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint RayGenerationKHR 14 "main"
|
||||
2: String ""
|
||||
2: String "spv.debuginfo.rt_types.glsl.rgen"
|
||||
8: String "uint"
|
||||
16: String "main"
|
||||
19: String "// OpModuleProcessed auto-map-locations
|
||||
@ -22,6 +22,29 @@ spv.debuginfo.rt_types.glsl.rgen
|
||||
// OpModuleProcessed keep-uncalled
|
||||
// OpModuleProcessed entry-point main
|
||||
#line 1
|
||||
#version 460
|
||||
#extension GL_NV_ray_tracing : enable
|
||||
#extension GL_EXT_ray_query : enable
|
||||
layout(binding = 0, set = 0) uniform accelerationStructureEXT acc0;
|
||||
|
||||
layout(shaderRecordNV) buffer block
|
||||
{
|
||||
vec3 dir;
|
||||
vec3 origin;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
rayQueryEXT localRayQuery;
|
||||
uint rayFlags = gl_RayFlagsOpaqueEXT | gl_RayFlagsSkipClosestHitShaderEXT;
|
||||
float tMin = 0.f;
|
||||
float tMax = 1000.f;
|
||||
rayQueryInitializeEXT(localRayQuery, acc0, rayFlags, 0xFF , origin, tMin, dir, tMax);
|
||||
if (!rayQueryProceedEXT(localRayQuery))
|
||||
{
|
||||
rayQueryTerminateEXT(localRayQuery);
|
||||
}
|
||||
}
|
||||
"
|
||||
33: String "rayFlags"
|
||||
40: String "float"
|
||||
@ -35,8 +58,9 @@ spv.debuginfo.rt_types.glsl.rgen
|
||||
78: String "acc0"
|
||||
87: String "origin"
|
||||
90: String "block"
|
||||
97: String "int"
|
||||
110: String "bool"
|
||||
96: String ""
|
||||
98: String "int"
|
||||
111: String "bool"
|
||||
SourceExtension "GL_EXT_ray_query"
|
||||
SourceExtension "GL_NV_ray_tracing"
|
||||
Name 14 "main"
|
||||
@ -113,17 +137,17 @@ spv.debuginfo.rt_types.glsl.rgen
|
||||
92: 7(int) Constant 5343
|
||||
93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 89 92 12
|
||||
94: 91(ptr) Variable ShaderRecordBufferKHR
|
||||
95: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 2 89 18 61 12 21 2 94 69
|
||||
96: TypeInt 32 1
|
||||
98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 97 10 23 12
|
||||
99: 96(int) Constant 1
|
||||
100: TypePointer ShaderRecordBufferKHR 83(fvec3)
|
||||
101: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 84 92 12
|
||||
105: 96(int) Constant 0
|
||||
109: TypeBool
|
||||
111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 110 10 24 12
|
||||
114: 7(int) Constant 19
|
||||
120: 7(int) Constant 21
|
||||
95: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 96 89 18 61 12 21 96 94 69
|
||||
97: TypeInt 32 1
|
||||
99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 98 10 23 12
|
||||
100: 97(int) Constant 1
|
||||
101: TypePointer ShaderRecordBufferKHR 83(fvec3)
|
||||
102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 84 92 12
|
||||
106: 97(int) Constant 0
|
||||
110: TypeBool
|
||||
112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 111 10 24 12
|
||||
115: 7(int) Constant 19
|
||||
121: 7(int) Constant 21
|
||||
14(main): 4 Function None 5
|
||||
15: Label
|
||||
31(rayFlags): 28(ptr) Variable Function
|
||||
@ -144,24 +168,24 @@ spv.debuginfo.rt_types.glsl.rgen
|
||||
80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 61 61 12 12
|
||||
79: 70 Load 76(acc0)
|
||||
81: 7(int) Load 31(rayFlags)
|
||||
102: 100(ptr) AccessChain 94 99
|
||||
103: 83(fvec3) Load 102
|
||||
104: 39(float) Load 44(tMin)
|
||||
106: 100(ptr) AccessChain 94 105
|
||||
107: 83(fvec3) Load 106
|
||||
108: 39(float) Load 51(tMax)
|
||||
RayQueryInitializeKHR 66(localRayQuery) 79 81 82 103 104 107 108
|
||||
113: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 114 114 12 12
|
||||
112: 109(bool) RayQueryProceedKHR 66(localRayQuery)
|
||||
115: 109(bool) LogicalNot 112
|
||||
SelectionMerge 117 None
|
||||
BranchConditional 115 116 117
|
||||
116: Label
|
||||
118: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17
|
||||
119: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 120 120 12 12
|
||||
103: 101(ptr) AccessChain 94 100
|
||||
104: 83(fvec3) Load 103
|
||||
105: 39(float) Load 44(tMin)
|
||||
107: 101(ptr) AccessChain 94 106
|
||||
108: 83(fvec3) Load 107
|
||||
109: 39(float) Load 51(tMax)
|
||||
RayQueryInitializeKHR 66(localRayQuery) 79 81 82 104 105 108 109
|
||||
114: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 115 115 12 12
|
||||
113: 110(bool) RayQueryProceedKHR 66(localRayQuery)
|
||||
116: 110(bool) LogicalNot 113
|
||||
SelectionMerge 118 None
|
||||
BranchConditional 116 117 118
|
||||
117: Label
|
||||
119: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17
|
||||
120: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 121 121 12 12
|
||||
RayQueryTerminateKHR 66(localRayQuery)
|
||||
Branch 117
|
||||
117: Label
|
||||
121: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17
|
||||
Branch 118
|
||||
118: Label
|
||||
122: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17
|
||||
Return
|
||||
FunctionEnd
|
||||
|
@ -15,7 +15,7 @@ spv.debuginfo.scalar_types.glsl.frag
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 14 "main"
|
||||
ExecutionMode 14 OriginUpperLeft
|
||||
2: String ""
|
||||
2: String "spv.debuginfo.scalar_types.glsl.frag"
|
||||
8: String "uint"
|
||||
16: String "main"
|
||||
19: String "// OpModuleProcessed auto-map-locations
|
||||
@ -25,7 +25,61 @@ spv.debuginfo.scalar_types.glsl.frag
|
||||
// OpModuleProcessed keep-uncalled
|
||||
// OpModuleProcessed entry-point main
|
||||
#line 1
|
||||
"
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2023 NVIDIA CORPORATION.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#version 460
|
||||
|
||||
#extension GL_EXT_shader_explicit_arithmetic_types : require
|
||||
|
||||
bool VAR_bool;
|
||||
int VAR_int;
|
||||
uint VAR_uint;
|
||||
float VAR_float;
|
||||
double VAR_double;
|
||||
int8_t VAR_int8_t;
|
||||
uint8_t VAR_uint8_t;
|
||||
int16_t VAR_int16_t;
|
||||
uint16_t VAR_uint16_t;
|
||||
int64_t VAR_int64_t;
|
||||
uint64_t VAR_uint64_t;
|
||||
float16_t VAR_float16_t;
|
||||
|
||||
void main() {
|
||||
VAR_bool = bool(0);
|
||||
VAR_int = int(0);
|
||||
VAR_uint = uint(0);
|
||||
VAR_float = float(0);
|
||||
VAR_double = double(0);
|
||||
VAR_int8_t = int8_t(0);
|
||||
VAR_uint8_t = uint8_t(0);
|
||||
VAR_int16_t = int16_t(0);
|
||||
VAR_uint16_t = uint16_t(0);
|
||||
VAR_int64_t = int64_t(0);
|
||||
VAR_uint64_t = uint64_t(0);
|
||||
VAR_float16_t = float16_t(0);
|
||||
}"
|
||||
29: String "bool"
|
||||
35: String "VAR_bool"
|
||||
41: String "int"
|
||||
|
@ -1,55 +1,55 @@
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2023 NVIDIA CORPORATION.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#version 460
|
||||
|
||||
#extension GL_EXT_shader_explicit_arithmetic_types : require
|
||||
|
||||
bool VAR_bool;
|
||||
int VAR_int;
|
||||
uint VAR_uint;
|
||||
float VAR_float;
|
||||
double VAR_double;
|
||||
int8_t VAR_int8_t;
|
||||
uint8_t VAR_uint8_t;
|
||||
int16_t VAR_int16_t;
|
||||
uint16_t VAR_uint16_t;
|
||||
int64_t VAR_int64_t;
|
||||
uint64_t VAR_uint64_t;
|
||||
float16_t VAR_float16_t;
|
||||
|
||||
void main() {
|
||||
VAR_bool = bool(0);
|
||||
VAR_int = int(0);
|
||||
VAR_uint = uint(0);
|
||||
VAR_float = float(0);
|
||||
VAR_double = double(0);
|
||||
VAR_int8_t = int8_t(0);
|
||||
VAR_uint8_t = uint8_t(0);
|
||||
VAR_int16_t = int16_t(0);
|
||||
VAR_uint16_t = uint16_t(0);
|
||||
VAR_int64_t = int64_t(0);
|
||||
VAR_uint64_t = uint64_t(0);
|
||||
VAR_float16_t = float16_t(0);
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2023 NVIDIA CORPORATION.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#version 460
|
||||
|
||||
#extension GL_EXT_shader_explicit_arithmetic_types : require
|
||||
|
||||
bool VAR_bool;
|
||||
int VAR_int;
|
||||
uint VAR_uint;
|
||||
float VAR_float;
|
||||
double VAR_double;
|
||||
int8_t VAR_int8_t;
|
||||
uint8_t VAR_uint8_t;
|
||||
int16_t VAR_int16_t;
|
||||
uint16_t VAR_uint16_t;
|
||||
int64_t VAR_int64_t;
|
||||
uint64_t VAR_uint64_t;
|
||||
float16_t VAR_float16_t;
|
||||
|
||||
void main() {
|
||||
VAR_bool = bool(0);
|
||||
VAR_int = int(0);
|
||||
VAR_uint = uint(0);
|
||||
VAR_float = float(0);
|
||||
VAR_double = double(0);
|
||||
VAR_int8_t = int8_t(0);
|
||||
VAR_uint8_t = uint8_t(0);
|
||||
VAR_int16_t = int16_t(0);
|
||||
VAR_uint16_t = uint16_t(0);
|
||||
VAR_int64_t = int64_t(0);
|
||||
VAR_uint64_t = uint64_t(0);
|
||||
VAR_float16_t = float16_t(0);
|
||||
}
|
@ -255,7 +255,7 @@ TEST_P(CompileVulkanToNonSemanticShaderDebugInfoTest, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
||||
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
||||
Target::Spv, true, "", "/baseResults/", false, false, true);
|
||||
Target::Spv, true, "", "/baseResults/", false, true, true);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
|
Loading…
Reference in New Issue
Block a user