fix
This commit is contained in:
12
gpu.c
12
gpu.c
@@ -1192,7 +1192,7 @@ JSC_CCALL(cmd_render_pass,
|
|||||||
|
|
||||||
uint32_t colorCount = JS_ArrayLength(js, colorTargetsVal);
|
uint32_t colorCount = JS_ArrayLength(js, colorTargetsVal);
|
||||||
SDL_GPUColorTargetInfo colortars[colorCount];
|
SDL_GPUColorTargetInfo colortars[colorCount];
|
||||||
SDL_GPUDepthStencilTargetInfo depthtar;
|
SDL_GPUDepthStencilTargetInfo depthtar = (SDL_GPUDepthStencilTargetInfo){0};
|
||||||
int has_depth = 0;
|
int has_depth = 0;
|
||||||
|
|
||||||
// Fill colorInfos from JS array
|
// Fill colorInfos from JS array
|
||||||
@@ -1204,7 +1204,7 @@ JSC_CCALL(cmd_render_pass,
|
|||||||
|
|
||||||
// Optional depth_stencil
|
// Optional depth_stencil
|
||||||
JSValue depthval = JS_GetPropertyStr(js, passObj, "depth_stencil");
|
JSValue depthval = JS_GetPropertyStr(js, passObj, "depth_stencil");
|
||||||
if (!JS_IsNull(depthval)) {
|
if (JS_IsObject(depthval)) {
|
||||||
has_depth = 1;
|
has_depth = 1;
|
||||||
JS_GETPROP(js, depthtar.texture, depthval, texture, SDL_GPUTexture)
|
JS_GETPROP(js, depthtar.texture, depthval, texture, SDL_GPUTexture)
|
||||||
JS_GETPROP(js, depthtar.load_op, depthval, load, SDL_GPULoadOp)
|
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.stencil_store_op, depthval, stencil_store, SDL_GPUStoreOp)
|
||||||
JS_GETPROP(js,depthtar.clear_depth, depthval, clear, number)
|
JS_GETPROP(js,depthtar.clear_depth, depthval, clear, number)
|
||||||
JS_GETPROP(js,depthtar.clear_stencil,depthval,clear_stencil,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);
|
JS_FreeValue(js, depthval);
|
||||||
|
|
||||||
@@ -1380,7 +1383,7 @@ JSC_CCALL(cmd_swapchain_pass,
|
|||||||
|
|
||||||
colorTargetInfo.texture = swapchainTexture;
|
colorTargetInfo.texture = swapchainTexture;
|
||||||
|
|
||||||
SDL_GPUDepthStencilTargetInfo depthtar;
|
SDL_GPUDepthStencilTargetInfo depthtar = (SDL_GPUDepthStencilTargetInfo){0};
|
||||||
int has_depth = 0;
|
int has_depth = 0;
|
||||||
|
|
||||||
JSValue depthval = JS_GetPropertyStr(js, passObj, "depth_stencil");
|
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.stencil_store_op, depthval, stencil_store, SDL_GPUStoreOp)
|
||||||
JS_GETPROP(js, depthtar.clear_depth, depthval, clear, number)
|
JS_GETPROP(js, depthtar.clear_depth, depthval, clear, number)
|
||||||
JS_GETPROP(js, depthtar.clear_stencil, depthval, clear_stencil, 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);
|
JS_FreeValue(js, depthval);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user