mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-10-08 21:31:36 +00:00
Enable depth clipping for solid mesh render, disable for wireframes
* Wireframes can render without a near plane clip and be mostly fine, but solid renders need the depth so they should clip. Behaviour was inconsistent between APIs before
This commit is contained in:
7 files changed
+24
-2
No files matched your search
@@ -1004,6 +1004,15 @@ void D3D11Replay::GeneralMisc::Init(WrappedID3D11Device *device)
|
||||
if(FAILED(hr))
|
||||
RDCERR("Failed to create default rasterizer state HRESULT: %s", ToStr(hr).c_str());
|
||||
|
||||
rastDesc.DepthClipEnable = TRUE;
|
||||
|
||||
hr = device->CreateRasterizerState(&rastDesc, &RasterClipState);
|
||||
|
||||
if(FAILED(hr))
|
||||
RDCERR("Failed to create depthclip rasterizer state HRESULT: %s", ToStr(hr).c_str());
|
||||
|
||||
rastDesc.DepthClipEnable = FALSE;
|
||||
|
||||
rastDesc.ScissorEnable = TRUE;
|
||||
|
||||
hr = device->CreateRasterizerState(&rastDesc, &RasterScissorState);
|
||||
@@ -1024,6 +1033,7 @@ void D3D11Replay::GeneralMisc::Init(WrappedID3D11Device *device)
|
||||
void D3D11Replay::GeneralMisc::Release()
|
||||
{
|
||||
SAFE_RELEASE(RasterState);
|
||||
SAFE_RELEASE(RasterClipState);
|
||||
SAFE_RELEASE(RasterScissorState);
|
||||
|
||||
SAFE_RELEASE(FullscreenVS);
|
||||
|
||||
@@ -286,7 +286,7 @@ void D3D11Replay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secon
|
||||
if(cfg.visualisationMode != Visualisation::NoSolid &&
|
||||
cfg.position.topology < Topology::PatchList_1CPs)
|
||||
{
|
||||
m_pImmediateContext->RSSetState(m_General.RasterState);
|
||||
m_pImmediateContext->RSSetState(m_General.RasterClipState);
|
||||
|
||||
m_pImmediateContext->IASetPrimitiveTopology(topo);
|
||||
|
||||
|
||||
@@ -415,6 +415,7 @@ private:
|
||||
void Release();
|
||||
|
||||
ID3D11RasterizerState *RasterState = NULL;
|
||||
ID3D11RasterizerState *RasterClipState = NULL;
|
||||
ID3D11RasterizerState *RasterScissorState = NULL;
|
||||
|
||||
ID3D11VertexShader *FullscreenVS = NULL;
|
||||
|
||||
@@ -204,6 +204,7 @@ MeshDisplayPipelines D3D12DebugManager::CacheMeshDisplayPipelines(const MeshForm
|
||||
RDCASSERTEQUAL(hr, S_OK);
|
||||
|
||||
pipeDesc.DepthStencilState.DepthEnable = TRUE;
|
||||
pipeDesc.RasterizerState.DepthClipEnable = TRUE;
|
||||
pipeDesc.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_LESS_EQUAL;
|
||||
pipeDesc.DepthStencilState.DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALL;
|
||||
|
||||
|
||||
@@ -729,6 +729,7 @@ extern bool IsGLES;
|
||||
/* super-set. */ \
|
||||
EXT_TO_CHECK(32, 31, ARB_texture_multisample_no_array) \
|
||||
EXT_TO_CHECK(32, 32, ARB_texture_multisample) \
|
||||
EXT_TO_CHECK(32, 99, ARB_depth_clamp) \
|
||||
EXT_TO_CHECK(33, 30, ARB_explicit_attrib_location) \
|
||||
EXT_TO_CHECK(33, 30, ARB_sampler_objects) \
|
||||
EXT_TO_CHECK(33, 30, ARB_texture_swizzle) \
|
||||
@@ -826,6 +827,7 @@ extern bool IsGLES;
|
||||
EXT_COMP_CHECK(ARB_base_instance, EXT_base_instance) \
|
||||
EXT_COMP_CHECK(ARB_copy_image, EXT_copy_image) \
|
||||
EXT_COMP_CHECK(ARB_copy_image, OES_copy_image) \
|
||||
EXT_COMP_CHECK(ARB_depth_clamp, EXT_depth_clamp) \
|
||||
EXT_COMP_CHECK(ARB_draw_buffers_blend, EXT_draw_buffers_indexed) \
|
||||
EXT_COMP_CHECK(ARB_draw_buffers_blend, OES_draw_buffers_indexed) \
|
||||
EXT_COMP_CHECK(ARB_geometry_shader4, EXT_geometry_shader) \
|
||||
|
||||
@@ -98,6 +98,8 @@ void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondar
|
||||
}
|
||||
|
||||
drv.glDisable(eGL_CULL_FACE);
|
||||
if(HasExt[ARB_depth_clamp])
|
||||
drv.glEnable(eGL_DEPTH_CLAMP);
|
||||
|
||||
if(cfg.position.unproject)
|
||||
{
|
||||
@@ -355,6 +357,8 @@ void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondar
|
||||
if(cfg.visualisationMode != Visualisation::NoSolid && topo != eGL_PATCHES)
|
||||
{
|
||||
drv.glDepthFunc(eGL_LESS);
|
||||
if(HasExt[ARB_depth_clamp])
|
||||
drv.glDisable(eGL_DEPTH_CLAMP);
|
||||
|
||||
GLuint solidProg = prog;
|
||||
|
||||
@@ -427,6 +431,9 @@ void GLReplay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondar
|
||||
drv.glDisableVertexAttribArray(1);
|
||||
|
||||
drv.glUseProgram(prog);
|
||||
|
||||
if(HasExt[ARB_depth_clamp])
|
||||
drv.glEnable(eGL_DEPTH_CLAMP);
|
||||
}
|
||||
|
||||
drv.glDepthFunc(eGL_ALWAYS);
|
||||
|
||||
@@ -235,7 +235,7 @@ VKMeshDisplayPipelines VulkanDebugManager::CacheMeshDisplayPipelines(VkPipelineL
|
||||
VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
VK_POLYGON_MODE_FILL,
|
||||
VK_CULL_MODE_NONE,
|
||||
@@ -411,6 +411,7 @@ VKMeshDisplayPipelines VulkanDebugManager::CacheMeshDisplayPipelines(VkPipelineL
|
||||
CHECK_VKR(m_pDriver, vkr);
|
||||
|
||||
ds.depthTestEnable = true;
|
||||
rs.depthClampEnable = false;
|
||||
|
||||
vkr = vt->CreateGraphicsPipelines(Unwrap(m_Device), VK_NULL_HANDLE, 1, &pipeInfo, NULL,
|
||||
&cache.pipes[VKMeshDisplayPipelines::ePipe_SolidDepth]);
|
||||
|
||||
Reference in new issue
Block a user