fix: set default DepthStencilState in graphics_device_init
Prevents UILayer init from breaking 3D rendering pipeline. Creates explicit LESS_EQUAL depth state at init time.
This commit is contained in:
1 parent
ea3e0ab61c
commit
8b76ae6a0d
1 file changed
+12
@@ -65,6 +65,18 @@ int graphics_device_init(GraphicsDevice* d, void* hwnd, uint32_t w, uint32_t h,
|
||||
vp.Width = (float)w; vp.Height = (float)h;
|
||||
vp.MaxDepth = 1.0f;
|
||||
d->context->lpVtbl->RSSetViewports(d->context, 1, &vp);
|
||||
|
||||
// 设置默认深度状态 (避免 UILayer init 破坏)
|
||||
D3D11_DEPTH_STENCIL_DESC dsd = {0};
|
||||
dsd.DepthEnable = TRUE;
|
||||
dsd.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
|
||||
dsd.DepthFunc = D3D11_COMPARISON_LESS_EQUAL;
|
||||
ID3D11DepthStencilState* default_dss = NULL;
|
||||
d->device->lpVtbl->CreateDepthStencilState(d->device, &dsd, &default_dss);
|
||||
if (default_dss) {
|
||||
d->context->lpVtbl->OMSetDepthStencilState(d->context, default_dss, 0);
|
||||
default_dss->lpVtbl->Release(default_dss);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user