@@ -36,9 +36,9 @@ void rayGenMain() {
3636 float2 pixelCenter = float2(launchID.xy) + float2(0.5, 0.5);
3737 float2 d = 2.0 * (pixelCenter / float2(launchSize.xy)) - 1.0;
3838
39- float4 origin = mul( float4(0, 0, 0, 1), pc.cam->viewInverse );
40- float4 target = mul( float4(d, 1, 1), pc.cam->projInverse );
41- float4 direction = mul( float4(normalize(target.xyz), 0), pc.cam->viewInverse );
39+ float4 origin = pc.cam->viewInverse * float4(0, 0, 0, 1);
40+ float4 target = pc.cam->projInverse * float4(d, 1, 1);
41+ float4 direction = pc.cam->viewInverse * float4(normalize(target.xyz), 0);
4242
4343 RayDesc ray;
4444 ray.Origin = origin.xyz;
@@ -65,7 +65,7 @@ void rayGenMain() {
6565float2 rotate(float2 v, float angle) {
6666 float2x2 r = float2x2(cos(angle), -sin(angle),
6767 sin(angle), cos(angle));
68- return mul (v-0.5*DispatchRaysDimensions().xy, r );
68+ return r * (v-0.5*DispatchRaysDimensions().xy);
6969}
7070
7171// helper function for GLSL-style mod() that works with negative numbers
@@ -121,8 +121,8 @@ void main() {
121121 vec2 pixelCenter = gl_LaunchIDEXT.xy + vec2(0.5);
122122 vec2 d = 2.0 * (pixelCenter / gl_LaunchSizeEXT.xy) - 1.0;
123123
124- vec4 origin = cam.viewInverse * vec4(0,0,0,1);
125- vec4 target = cam.projInverse * vec4(d, 1, 1);
124+ vec4 origin = cam.viewInverse * vec4(0,0,0,1);
125+ vec4 target = cam.projInverse * vec4(d, 1, 1);
126126 vec4 direction = cam.viewInverse * vec4(normalize(target.xyz), 0);
127127
128128 payload = vec3(0.0);
0 commit comments