This commit is contained in:
2025-12-13 00:46:12 -06:00
parent 20b7a7ef90
commit 5cca719ef5
2 changed files with 9 additions and 5 deletions

12
gpu.c
View File

@@ -1192,7 +1192,7 @@ JSC_CCALL(cmd_render_pass,
uint32_t colorCount = JS_ArrayLength(js, colorTargetsVal);
SDL_GPUColorTargetInfo colortars[colorCount];
SDL_GPUDepthStencilTargetInfo depthtar;
SDL_GPUDepthStencilTargetInfo depthtar = (SDL_GPUDepthStencilTargetInfo){0};
int has_depth = 0;
// Fill colorInfos from JS array
@@ -1204,7 +1204,7 @@ JSC_CCALL(cmd_render_pass,
// Optional depth_stencil
JSValue depthval = JS_GetPropertyStr(js, passObj, "depth_stencil");
if (!JS_IsNull(depthval)) {
if (JS_IsObject(depthval)) {
has_depth = 1;
JS_GETPROP(js, depthtar.texture, depthval, texture, SDL_GPUTexture)
JS_GETPROP(js, depthtar.load_op, depthval, load, SDL_GPULoadOp)
@@ -1213,6 +1213,9 @@ JSC_CCALL(cmd_render_pass,
JS_GETPROP(js, depthtar.stencil_store_op, depthval, stencil_store, SDL_GPUStoreOp)
JS_GETPROP(js,depthtar.clear_depth, depthval, clear, number)
JS_GETPROP(js,depthtar.clear_stencil,depthval,clear_stencil,number)
// If texture was null/invalid, treat as no depth attachment.
if (!depthtar.texture) has_depth = 0;
}
JS_FreeValue(js, depthval);
@@ -1380,7 +1383,7 @@ JSC_CCALL(cmd_swapchain_pass,
colorTargetInfo.texture = swapchainTexture;
SDL_GPUDepthStencilTargetInfo depthtar;
SDL_GPUDepthStencilTargetInfo depthtar = (SDL_GPUDepthStencilTargetInfo){0};
int has_depth = 0;
JSValue depthval = JS_GetPropertyStr(js, passObj, "depth_stencil");
@@ -1393,6 +1396,9 @@ JSC_CCALL(cmd_swapchain_pass,
JS_GETPROP(js, depthtar.stencil_store_op, depthval, stencil_store, SDL_GPUStoreOp)
JS_GETPROP(js, depthtar.clear_depth, depthval, clear, number)
JS_GETPROP(js, depthtar.clear_stencil, depthval, clear_stencil, number)
// If texture was null/invalid, treat as no depth attachment.
if (!depthtar.texture) has_depth = 0;
}
JS_FreeValue(js, depthval);

View File

@@ -202,8 +202,6 @@ static JSValue js_SDL_Window_constructor(JSContext *js, JSValueConst new_target,
}
JS_FreeValue(js, text_input);
printf("created window %p\n", window);
return window_obj;
}