Skip to content

Commit

Permalink
Fix global base type member access in HLSL
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Aug 24, 2024
1 parent cd42704 commit fda8973
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Sources/backends/hlsl.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,9 @@ static void write_functions(char *hlsl, size_t *offset, shader_stage stage, func
global g = get_global(j);
if (o->op_load_member.from.index == g.var_index) {
global_var_index = g.var_index;
if (get_type(g.type)->built_in) {
global_var_index = 0;
}
break;
}
}
Expand Down
14 changes: 14 additions & 0 deletions tests/in/test.kong
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ fun sendrays(): void {
var target: float3 = float3((uv.x * 2 - 1) * 1.8 * (size.x / size.y),
(1 - uv.y) * 4 - 2 + camera.y,
0);

//RayDesc ray;
//ray.Origin = camera;
//ray.Direction = target - camera;
//ray.TMin = 0.001;
//ray.TMax = 1000;

var payload: Payload;
payload.allow_reflection = true;
payload.missed = false;

//TraceRay(scene, RAY_FLAG_NONE, 0xFF, 0, 0, 0, ray, payload);

//uav[idx] = float4(payload.color, 1);
}

fun raymissed(payload: Payload): void {
Expand Down

0 comments on commit fda8973

Please sign in to comment.