moving pointsets to the GPU via Uniform buffer

This commit is contained in:
CDaut 2024-07-09 20:18:28 +02:00
parent 74457d1a9c
commit 1114f4c8ff
Signed by: clara
GPG key ID: 223391B52FAD4463
6 changed files with 61 additions and 51 deletions

View file

@ -44,14 +44,14 @@ using uint = unsigned int;
START_BINDING(SceneBindings)
eGlobals = 0, // Global uniform containing camera matrices
eSceneDesc = 1, // Access to the scene buffers
eTextures = 2, // Access to textures
ePointsetTexture = 3 //Texture containing the pointset for primary raygen
eTextures = 2, // Access to textures
ePointset = 3 // Pointset
END_BINDING();
START_BINDING(RtxBindings)
eTlas = 0, // Top-level acceleration structure
eOutImage = 1, // Ray tracer output image
ePrimLookup = 2 // Lookup of objects
eTlas = 0, // Top-level acceleration structure
eOutImage = 1, // Ray tracer output image
ePrimLookup = 2 // Lookup of objects
END_BINDING();
// clang-format on
@ -111,4 +111,6 @@ struct GltfShadeMaterial
int pbrBaseColorTexture;
};
#define WINDOWSIZE 600
#endif

View file

@ -33,16 +33,14 @@ layout(set = 0, binding = 0) uniform accelerationStructureEXT topLevelAS;
layout(set = 0, binding = 1, rgba32f) uniform image2D image;
layout(set = 1, binding = 0) uniform _GlobalUniforms { GlobalUniforms uni; };
layout(set = 1, binding = ePointset) buffer PointsetBuffer { vec2[WINDOWSIZE * WINDOWSIZE] pointset; };
layout(push_constant) uniform _PushConstantRay { PushConstantRay pcRay; };
layout(set = 1, binding = ePointsetTexture) uniform sampler2D pointset;// bluenoise pointset
// clang-format on
void main()
{
vec2 uv = vec2(float(gl_LaunchIDEXT.x) / float(gl_LaunchSizeEXT.x), float(gl_LaunchIDEXT.y) / float(gl_LaunchSizeEXT.y));
const vec2 rayOriginInPix = vec2(gl_LaunchIDEXT.xy) + texture(pointset, uv).xy;
/*
const vec2 rayOriginInPix = vec2(gl_LaunchIDEXT.xy) + pointset[255].xy;
const vec2 inUV = rayOriginInPix / vec2(gl_LaunchSizeEXT.xy);
vec2 d = inUV * 2.0 - 1.0;
@ -66,6 +64,6 @@ void main()
tMax, // ray max range
0// payload (location = 0)
);
imageStore(image, ivec2(gl_LaunchIDEXT.xy), vec4(prd.hitValue, 1.0));
*/
imageStore(image, ivec2(gl_LaunchIDEXT.xy), vec4(pointset[gl_LaunchIDEXT.x + WINDOWSIZE * gl_LaunchIDEXT.y].xy, 0.f, 1.0));
}