base: multi raytrace shaders
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
.\dxc.exe -Zpr -Fo ..\raytrace_brute_core.cso -T cs_6_5 .\raytrace_brute.hlsl
|
||||
.\dxc.exe -Zpr -Fo ..\raytrace_brute_full.cso -T cs_6_5 .\raytrace_brute.hlsl -D _FULL
|
||||
.\dxc.exe -Zpr -Fo ..\raytrace_brute_forge_core.cso -T cs_6_5 .\raytrace_brute.hlsl -D _FORGE
|
||||
.\dxc.exe -Zpr -Fo ..\raytrace_brute_forge_full.cso -T cs_6_5 .\raytrace_brute.hlsl -D _FORGE -D _FULL
|
||||
.\dxc.exe -Zpr -Fo ..\raytrace_brute_multi_core.cso -T cs_6_5 .\raytrace_brute.hlsl -D _MULTI
|
||||
.\dxc.exe -Zpr -Fo ..\raytrace_brute_multi_full.cso -T cs_6_5 .\raytrace_brute.hlsl -D _MULTI -D _FULL
|
||||
.\dxc.exe -Zpr -Fo ..\raytrace_bake_ao.cso -T cs_6_5 .\raytrace_bake_ao.hlsl
|
||||
.\dxc.exe -Zpr -Fo ..\raytrace_bake_light.cso -T cs_6_5 .\raytrace_bake_light.hlsl
|
||||
.\dxc.exe -Zpr -Fo ..\raytrace_bake_bent.cso -T cs_6_5 .\raytrace_bake_bent.hlsl
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
./glslangValidator -V --target-env vulkan1.3 raytrace_brute.comp -o ../raytrace_brute_core.spirv
|
||||
./glslangValidator -V --target-env vulkan1.3 -D_FULL raytrace_brute.comp -o ../raytrace_brute_full.spirv
|
||||
./glslangValidator -V --target-env vulkan1.3 -D_FORGE raytrace_brute.comp -o ../raytrace_brute_forge_core.spirv
|
||||
./glslangValidator -V --target-env vulkan1.3 -D_FORGE -D_FULL raytrace_brute.comp -o ../raytrace_brute_forge_full.spirv
|
||||
./glslangValidator -V --target-env vulkan1.3 -D_MULTI raytrace_brute.comp -o ../raytrace_brute_multi_core.spirv
|
||||
./glslangValidator -V --target-env vulkan1.3 -D_MULTI -D_FULL raytrace_brute.comp -o ../raytrace_brute_multi_full.spirv
|
||||
./glslangValidator -V --target-env vulkan1.3 raytrace_bake_ao.comp -o ../raytrace_bake_ao.spirv
|
||||
./glslangValidator -V --target-env vulkan1.3 raytrace_bake_light.comp -o ../raytrace_bake_light.spirv
|
||||
./glslangValidator -V --target-env vulkan1.3 raytrace_bake_bent.comp -o ../raytrace_bake_bent.spirv
|
||||
|
||||
@@ -168,12 +168,11 @@ Vertex get_vertex(uint index) {
|
||||
|
||||
bool process_hit(rayQueryEXT query, inout RayPayload payload, uvec2 pixel_coord, int sample_index) {
|
||||
uint triangle_index = rayQueryGetIntersectionPrimitiveIndexEXT(query, true);
|
||||
uint instance_id = rayQueryGetIntersectionInstanceIdEXT(query, true);
|
||||
|
||||
uint base_index = triangle_index * 3u;
|
||||
|
||||
#ifdef _FORGE
|
||||
base_index += instance_id;
|
||||
#ifdef _MULTI
|
||||
base_index += uint(rayQueryGetIntersectionInstanceCustomIndexEXT(query, true));
|
||||
#endif
|
||||
|
||||
uvec3 indices_sample = uvec3(
|
||||
@@ -218,7 +217,7 @@ bool process_hit(rayQueryEXT query, inout RayPayload payload, uvec2 pixel_coord,
|
||||
vertex_normals[1] * barycentrics.y +
|
||||
vertex_normals[2] * barycentrics.z);
|
||||
|
||||
#ifdef _FORGE
|
||||
#ifdef _MULTI
|
||||
mat4x3 obj_to_world = rayQueryGetIntersectionObjectToWorldEXT(query, true);
|
||||
n = normalize(mat3(obj_to_world) * n);
|
||||
#endif
|
||||
|
||||
@@ -115,7 +115,7 @@ void main(uint3 id : SV_DispatchThreadID) {
|
||||
}
|
||||
|
||||
uint base = q.CommittedPrimitiveIndex() * 12;
|
||||
#ifdef _FORGE
|
||||
#ifdef _MULTI
|
||||
base += q.CommittedInstanceID(); // Offset to index buffer of this instance
|
||||
#endif
|
||||
uint3 idx = indices.Load3(base);
|
||||
@@ -154,7 +154,7 @@ void main(uint3 id : SV_DispatchThreadID) {
|
||||
};
|
||||
float3 n = normalize(hit_attribute(vn, attr));
|
||||
|
||||
#ifdef _FORGE
|
||||
#ifdef _MULTI
|
||||
float3x4 objToWorld = q.CommittedObjectToWorld3x4();
|
||||
n = normalize(mul(float3x3(objToWorld[0].xyz, objToWorld[1].xyz, objToWorld[2].xyz), n));
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user