Revert behaviour with cull mode not affecting texture overlays
* This is kind of a "damned if you do, damned if you don't" situation. If the cullmode is wrong, having it show up as failures in depth/stencil overlays is misleading. However if the cullmode is deliberate setting it to no-cull may ruin the results of those overlays. * The original behaviour of leaving cullmode as is ends up being a better tradeoff, since at least when it is misleading you can use the culling overlay to show the failure there. If culling is disabled it makes depth/stencil overlays useless in situations with no recourse. * Also add a test of a depth-clipped triangle to overlay tests
@@ -1064,46 +1064,39 @@ ResourceId D3D11Replay::RenderOverlay(ResourceId texid, CompType typeHint, Debug
|
||||
if(!cur.StencilEnable)
|
||||
cur.StencilEnable = D3D11_COMPARISON_ALWAYS;
|
||||
|
||||
// ensure culling doesn't hide the render, we're only showing the result of the depth test
|
||||
// ensure culling/depth clipping doesn't hide the render for the fail draw
|
||||
ID3D11RasterizerState *rs = NULL;
|
||||
{
|
||||
ID3D11RasterizerState *rs = NULL;
|
||||
D3D11_RASTERIZER_DESC rdesc;
|
||||
|
||||
m_pImmediateContext->RSGetState(&rs);
|
||||
|
||||
if(rs)
|
||||
{
|
||||
rs->GetDesc(&rdesc);
|
||||
}
|
||||
else
|
||||
{
|
||||
D3D11_RASTERIZER_DESC rdesc;
|
||||
|
||||
m_pImmediateContext->RSGetState(&rs);
|
||||
|
||||
if(rs)
|
||||
{
|
||||
rs->GetDesc(&rdesc);
|
||||
}
|
||||
else
|
||||
{
|
||||
rdesc.FillMode = D3D11_FILL_SOLID;
|
||||
rdesc.CullMode = D3D11_CULL_BACK;
|
||||
rdesc.FrontCounterClockwise = FALSE;
|
||||
rdesc.DepthBias = D3D11_DEFAULT_DEPTH_BIAS;
|
||||
rdesc.DepthBiasClamp = D3D11_DEFAULT_DEPTH_BIAS_CLAMP;
|
||||
rdesc.SlopeScaledDepthBias = D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS;
|
||||
rdesc.DepthClipEnable = TRUE;
|
||||
rdesc.ScissorEnable = FALSE;
|
||||
rdesc.MultisampleEnable = FALSE;
|
||||
rdesc.AntialiasedLineEnable = FALSE;
|
||||
}
|
||||
|
||||
SAFE_RELEASE(rs);
|
||||
|
||||
rdesc.FillMode = D3D11_FILL_SOLID;
|
||||
rdesc.CullMode = D3D11_CULL_NONE;
|
||||
rdesc.DepthClipEnable = FALSE;
|
||||
rdesc.CullMode = D3D11_CULL_BACK;
|
||||
rdesc.FrontCounterClockwise = FALSE;
|
||||
rdesc.DepthBias = D3D11_DEFAULT_DEPTH_BIAS;
|
||||
rdesc.DepthBiasClamp = D3D11_DEFAULT_DEPTH_BIAS_CLAMP;
|
||||
rdesc.SlopeScaledDepthBias = D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS;
|
||||
rdesc.DepthClipEnable = TRUE;
|
||||
rdesc.ScissorEnable = FALSE;
|
||||
rdesc.MultisampleEnable = FALSE;
|
||||
rdesc.AntialiasedLineEnable = FALSE;
|
||||
}
|
||||
|
||||
hr = m_pDevice->CreateRasterizerState(&rdesc, &rs);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
RDCERR("Failed to create wireframe rast state HRESULT: %s", ToStr(hr).c_str());
|
||||
return m_Overlay.resourceId;
|
||||
}
|
||||
rdesc.CullMode = D3D11_CULL_NONE;
|
||||
rdesc.DepthClipEnable = FALSE;
|
||||
|
||||
m_pImmediateContext->RSSetState(rs);
|
||||
hr = m_pDevice->CreateRasterizerState(&rdesc, &rs);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
RDCERR("Failed to create wireframe rast state HRESULT: %s", ToStr(hr).c_str());
|
||||
return m_Overlay.resourceId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1118,20 +1111,7 @@ ResourceId D3D11Replay::RenderOverlay(ResourceId texid, CompType typeHint, Debug
|
||||
dsDesc.DepthEnable = d.DepthEnable = TRUE;
|
||||
dsDesc.StencilEnable = d.StencilEnable = FALSE;
|
||||
|
||||
switch(cur.DepthFunc)
|
||||
{
|
||||
case D3D11_COMPARISON_ALWAYS: d.DepthFunc = D3D11_COMPARISON_NEVER; break;
|
||||
case D3D11_COMPARISON_NEVER: d.DepthFunc = D3D11_COMPARISON_ALWAYS; break;
|
||||
|
||||
case D3D11_COMPARISON_EQUAL: d.DepthFunc = D3D11_COMPARISON_NOT_EQUAL; break;
|
||||
case D3D11_COMPARISON_NOT_EQUAL: d.DepthFunc = D3D11_COMPARISON_EQUAL; break;
|
||||
|
||||
case D3D11_COMPARISON_LESS: d.DepthFunc = D3D11_COMPARISON_GREATER_EQUAL; break;
|
||||
case D3D11_COMPARISON_GREATER_EQUAL: d.DepthFunc = D3D11_COMPARISON_LESS; break;
|
||||
|
||||
case D3D11_COMPARISON_GREATER: d.DepthFunc = D3D11_COMPARISON_LESS_EQUAL; break;
|
||||
case D3D11_COMPARISON_LESS_EQUAL: d.DepthFunc = D3D11_COMPARISON_GREATER; break;
|
||||
}
|
||||
d.DepthFunc = D3D11_COMPARISON_ALWAYS;
|
||||
}
|
||||
else if(overlay == DebugOverlay::Stencil)
|
||||
{
|
||||
@@ -1143,51 +1123,7 @@ ResourceId D3D11Replay::RenderOverlay(ResourceId texid, CompType typeHint, Debug
|
||||
dsDesc.StencilReadMask = d.StencilReadMask = cur.StencilReadMask;
|
||||
dsDesc.StencilWriteMask = d.StencilWriteMask = cur.StencilWriteMask;
|
||||
|
||||
switch(cur.FrontFace.StencilFunc)
|
||||
{
|
||||
case D3D11_COMPARISON_ALWAYS: d.FrontFace.StencilFunc = D3D11_COMPARISON_NEVER; break;
|
||||
case D3D11_COMPARISON_NEVER: d.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS; break;
|
||||
|
||||
case D3D11_COMPARISON_EQUAL: d.FrontFace.StencilFunc = D3D11_COMPARISON_NOT_EQUAL; break;
|
||||
case D3D11_COMPARISON_NOT_EQUAL: d.FrontFace.StencilFunc = D3D11_COMPARISON_EQUAL; break;
|
||||
|
||||
case D3D11_COMPARISON_LESS:
|
||||
d.FrontFace.StencilFunc = D3D11_COMPARISON_GREATER_EQUAL;
|
||||
break;
|
||||
case D3D11_COMPARISON_GREATER_EQUAL:
|
||||
d.FrontFace.StencilFunc = D3D11_COMPARISON_LESS;
|
||||
break;
|
||||
|
||||
case D3D11_COMPARISON_GREATER:
|
||||
d.FrontFace.StencilFunc = D3D11_COMPARISON_LESS_EQUAL;
|
||||
break;
|
||||
case D3D11_COMPARISON_LESS_EQUAL:
|
||||
d.FrontFace.StencilFunc = D3D11_COMPARISON_GREATER;
|
||||
break;
|
||||
}
|
||||
|
||||
switch(cur.BackFace.StencilFunc)
|
||||
{
|
||||
case D3D11_COMPARISON_ALWAYS: d.BackFace.StencilFunc = D3D11_COMPARISON_NEVER; break;
|
||||
case D3D11_COMPARISON_NEVER: d.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS; break;
|
||||
|
||||
case D3D11_COMPARISON_EQUAL: d.BackFace.StencilFunc = D3D11_COMPARISON_NOT_EQUAL; break;
|
||||
case D3D11_COMPARISON_NOT_EQUAL: d.BackFace.StencilFunc = D3D11_COMPARISON_EQUAL; break;
|
||||
|
||||
case D3D11_COMPARISON_LESS:
|
||||
d.BackFace.StencilFunc = D3D11_COMPARISON_GREATER_EQUAL;
|
||||
break;
|
||||
case D3D11_COMPARISON_GREATER_EQUAL:
|
||||
d.BackFace.StencilFunc = D3D11_COMPARISON_LESS;
|
||||
break;
|
||||
|
||||
case D3D11_COMPARISON_GREATER:
|
||||
d.BackFace.StencilFunc = D3D11_COMPARISON_LESS_EQUAL;
|
||||
break;
|
||||
case D3D11_COMPARISON_LESS_EQUAL:
|
||||
d.BackFace.StencilFunc = D3D11_COMPARISON_GREATER;
|
||||
break;
|
||||
}
|
||||
d.BackFace.StencilFunc = d.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
|
||||
}
|
||||
|
||||
SAFE_RELEASE(os);
|
||||
@@ -1195,6 +1131,7 @@ ResourceId D3D11Replay::RenderOverlay(ResourceId texid, CompType typeHint, Debug
|
||||
if(FAILED(hr))
|
||||
{
|
||||
RDCERR("Failed to create depth/stencil overlay depth state HRESULT: %s", ToStr(hr).c_str());
|
||||
SAFE_RELEASE(rs);
|
||||
return m_Overlay.resourceId;
|
||||
}
|
||||
|
||||
@@ -1210,8 +1147,15 @@ ResourceId D3D11Replay::RenderOverlay(ResourceId texid, CompType typeHint, Debug
|
||||
|
||||
m_pImmediateContext->PSSetShader(m_General.FixedColPS, NULL, 0);
|
||||
|
||||
ID3D11RasterizerState *prevrs = NULL;
|
||||
m_pImmediateContext->RSGetState(&prevrs);
|
||||
|
||||
m_pImmediateContext->RSSetState(rs);
|
||||
|
||||
m_pDevice->ReplayLog(0, eventId, eReplay_OnlyDraw);
|
||||
|
||||
m_pImmediateContext->RSSetState(prevrs);
|
||||
|
||||
SAFE_RELEASE(os);
|
||||
|
||||
m_pImmediateContext->CopyResource(renderDepth, preDrawDepth);
|
||||
@@ -1249,6 +1193,8 @@ ResourceId D3D11Replay::RenderOverlay(ResourceId texid, CompType typeHint, Debug
|
||||
|
||||
SAFE_RELEASE(os);
|
||||
}
|
||||
|
||||
SAFE_RELEASE(rs);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1196,12 +1196,10 @@ ResourceId D3D12Replay::RenderOverlay(ResourceId texid, CompType typeHint, Debug
|
||||
psoDesc.BlendState.RenderTarget[0].LogicOpEnable = FALSE;
|
||||
|
||||
psoDesc.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID;
|
||||
psoDesc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE;
|
||||
psoDesc.RasterizerState.FrontCounterClockwise = FALSE;
|
||||
psoDesc.RasterizerState.DepthBias = D3D12_DEFAULT_DEPTH_BIAS;
|
||||
psoDesc.RasterizerState.DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP;
|
||||
psoDesc.RasterizerState.SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS;
|
||||
psoDesc.RasterizerState.DepthClipEnable = FALSE;
|
||||
psoDesc.RasterizerState.MultisampleEnable = FALSE;
|
||||
psoDesc.RasterizerState.AntialiasedLineEnable = FALSE;
|
||||
|
||||
@@ -1227,6 +1225,9 @@ ResourceId D3D12Replay::RenderOverlay(ResourceId texid, CompType typeHint, Debug
|
||||
psoDesc.DepthStencilState.StencilEnable = FALSE;
|
||||
psoDesc.DepthStencilState.DepthBoundsTestEnable = FALSE;
|
||||
|
||||
psoDesc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE;
|
||||
psoDesc.RasterizerState.DepthClipEnable = FALSE;
|
||||
|
||||
psoDesc.PS.pShaderBytecode = red->GetBufferPointer();
|
||||
psoDesc.PS.BytecodeLength = red->GetBufferSize();
|
||||
|
||||
|
||||
@@ -325,11 +325,14 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, CompType typeHint, DebugOve
|
||||
drv.glDisable(eGL_SCISSOR_TEST);
|
||||
drv.glDepthMask(GL_FALSE);
|
||||
drv.glDisable(eGL_CULL_FACE);
|
||||
if(!IsGLES)
|
||||
drv.glPolygonMode(eGL_FRONT_AND_BACK, eGL_FILL);
|
||||
drv.glDisable(eGL_DEPTH_TEST);
|
||||
drv.glDisable(eGL_STENCIL_TEST);
|
||||
drv.glStencilMask(0);
|
||||
if(!IsGLES)
|
||||
{
|
||||
drv.glPolygonMode(eGL_FRONT_AND_BACK, eGL_FILL);
|
||||
drv.glEnable(eGL_DEPTH_CLAMP);
|
||||
}
|
||||
|
||||
if(overlay == DebugOverlay::NaN || overlay == DebugOverlay::Clipping)
|
||||
{
|
||||
@@ -743,6 +746,11 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, CompType typeHint, DebugOve
|
||||
drv.glStencilMaskSeparate(eGL_BACK, rs.StencilBack.writemask);
|
||||
}
|
||||
|
||||
if(rs.Enabled[GLRenderState::eEnabled_CullFace])
|
||||
drv.glEnable(eGL_CULL_FACE);
|
||||
if(!IsGLES && !rs.Enabled[GLRenderState::eEnabled_DepthClamp])
|
||||
drv.glDisable(eGL_DEPTH_CLAMP);
|
||||
|
||||
// get latest depth/stencil from read FBO (existing FBO) into draw FBO (overlay FBO)
|
||||
SafeBlitFramebuffer(0, 0, DebugData.overlayTexWidth, DebugData.overlayTexHeight, 0, 0,
|
||||
DebugData.overlayTexWidth, DebugData.overlayTexHeight,
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
// enable this to enable validation layers on replay, useful for debugging
|
||||
// problems with new replay code
|
||||
#define FORCE_VALIDATION_LAYERS OPTION_OFF
|
||||
#define FORCE_VALIDATION_LAYERS OPTION_ON
|
||||
|
||||
// enable this to send replay-time validation layer messages to the UI.
|
||||
// By default we only display saved validation layer messages from capture, and then any runtime
|
||||
|
||||
@@ -1320,17 +1320,17 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, CompType typeHint, Debu
|
||||
VulkanRenderState prevstate = m_pDriver->m_RenderState;
|
||||
|
||||
// make patched shader
|
||||
VkShaderModule mod[2] = {0};
|
||||
VkPipeline pipe[2] = {0};
|
||||
VkShaderModule failmod = {}, passmod = {};
|
||||
VkPipeline failpipe = {}, passpipe = {};
|
||||
|
||||
// first shader, no depth testing, writes red
|
||||
GetDebugManager()->PatchFixedColShader(mod[0], highlightCol);
|
||||
// first shader, no depth/stencil testing, writes red
|
||||
GetDebugManager()->PatchFixedColShader(failmod, highlightCol);
|
||||
|
||||
highlightCol[0] = 0.0f;
|
||||
highlightCol[1] = 1.0f;
|
||||
|
||||
// second shader, enabled depth testing, writes green
|
||||
GetDebugManager()->PatchFixedColShader(mod[1], highlightCol);
|
||||
// second shader, enabled depth/stencil testing, writes green
|
||||
GetDebugManager()->PatchFixedColShader(passmod, highlightCol);
|
||||
|
||||
// make patched pipeline
|
||||
VkGraphicsPipelineCreateInfo pipeCreateInfo;
|
||||
@@ -1348,14 +1348,6 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, CompType typeHint, Debu
|
||||
ds->stencilTestEnable = false;
|
||||
ds->depthBoundsTestEnable = false;
|
||||
|
||||
VkPipelineRasterizationStateCreateInfo *rs =
|
||||
(VkPipelineRasterizationStateCreateInfo *)pipeCreateInfo.pRasterizationState;
|
||||
rs->cullMode = VK_CULL_MODE_NONE;
|
||||
rs->rasterizerDiscardEnable = false;
|
||||
|
||||
if(m_pDriver->GetDeviceFeatures().depthClamp)
|
||||
rs->depthClampEnable = true;
|
||||
|
||||
VkPipelineColorBlendStateCreateInfo *cb =
|
||||
(VkPipelineColorBlendStateCreateInfo *)pipeCreateInfo.pColorBlendState;
|
||||
cb->logicOpEnable = false;
|
||||
@@ -1378,8 +1370,7 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, CompType typeHint, Debu
|
||||
sc.extent.height = 16384;
|
||||
}
|
||||
|
||||
// set our renderpass and shader
|
||||
pipeCreateInfo.renderPass = m_Overlay.NoDepthRP;
|
||||
// subpass 0 in either render pass
|
||||
pipeCreateInfo.subpass = 0;
|
||||
|
||||
VkPipelineShaderStageCreateInfo *fragShader = NULL;
|
||||
@@ -1390,7 +1381,6 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, CompType typeHint, Debu
|
||||
(VkPipelineShaderStageCreateInfo &)pipeCreateInfo.pStages[i];
|
||||
if(sh.stage == VK_SHADER_STAGE_FRAGMENT_BIT)
|
||||
{
|
||||
sh.module = mod[0];
|
||||
sh.pName = "main";
|
||||
fragShader = &sh;
|
||||
break;
|
||||
@@ -1407,21 +1397,13 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, CompType typeHint, Debu
|
||||
sh.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
||||
sh.pNext = NULL;
|
||||
sh.stage = VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||
sh.module = mod[0];
|
||||
sh.pName = "main";
|
||||
sh.pSpecializationInfo = NULL;
|
||||
|
||||
fragShader = &sh;
|
||||
}
|
||||
|
||||
vkr = vt->EndCommandBuffer(Unwrap(cmd));
|
||||
RDCASSERTEQUAL(vkr, VK_SUCCESS);
|
||||
|
||||
vkr = m_pDriver->vkCreateGraphicsPipelines(m_Device, VK_NULL_HANDLE, 1, &pipeCreateInfo, NULL,
|
||||
&pipe[0]);
|
||||
RDCASSERTEQUAL(vkr, VK_SUCCESS);
|
||||
|
||||
fragShader->module = mod[1];
|
||||
fragShader->module = passmod;
|
||||
|
||||
if(depthRP != VK_NULL_HANDLE)
|
||||
{
|
||||
@@ -1433,7 +1415,25 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, CompType typeHint, Debu
|
||||
}
|
||||
|
||||
vkr = m_pDriver->vkCreateGraphicsPipelines(m_Device, VK_NULL_HANDLE, 1, &pipeCreateInfo, NULL,
|
||||
&pipe[1]);
|
||||
&passpipe);
|
||||
RDCASSERTEQUAL(vkr, VK_SUCCESS);
|
||||
|
||||
fragShader->module = failmod;
|
||||
|
||||
// set our renderpass and shader
|
||||
pipeCreateInfo.renderPass = m_Overlay.NoDepthRP;
|
||||
|
||||
// disable culling/discard and enable depth clamp. That way we show any failures due to these
|
||||
VkPipelineRasterizationStateCreateInfo *rs =
|
||||
(VkPipelineRasterizationStateCreateInfo *)pipeCreateInfo.pRasterizationState;
|
||||
rs->cullMode = VK_CULL_MODE_NONE;
|
||||
rs->rasterizerDiscardEnable = false;
|
||||
|
||||
if(m_pDriver->GetDeviceFeatures().depthClamp)
|
||||
rs->depthClampEnable = true;
|
||||
|
||||
vkr = m_pDriver->vkCreateGraphicsPipelines(m_Device, VK_NULL_HANDLE, 1, &pipeCreateInfo, NULL,
|
||||
&failpipe);
|
||||
RDCASSERTEQUAL(vkr, VK_SUCCESS);
|
||||
|
||||
// modify state
|
||||
@@ -1441,7 +1441,7 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, CompType typeHint, Debu
|
||||
m_pDriver->m_RenderState.subpass = 0;
|
||||
m_pDriver->m_RenderState.framebuffer = GetResID(m_Overlay.NoDepthFB);
|
||||
|
||||
m_pDriver->m_RenderState.graphics.pipeline = GetResID(pipe[0]);
|
||||
m_pDriver->m_RenderState.graphics.pipeline = GetResID(failpipe);
|
||||
|
||||
// set dynamic scissors in case pipeline was using them
|
||||
for(size_t i = 0; i < m_pDriver->m_RenderState.scissors.size(); i++)
|
||||
@@ -1452,9 +1452,12 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, CompType typeHint, Debu
|
||||
m_pDriver->m_RenderState.scissors[i].extent.height = 16384;
|
||||
}
|
||||
|
||||
vkr = vt->EndCommandBuffer(Unwrap(cmd));
|
||||
RDCASSERTEQUAL(vkr, VK_SUCCESS);
|
||||
|
||||
m_pDriver->ReplayLog(0, eventId, eReplay_OnlyDraw);
|
||||
|
||||
m_pDriver->m_RenderState.graphics.pipeline = GetResID(pipe[1]);
|
||||
m_pDriver->m_RenderState.graphics.pipeline = GetResID(passpipe);
|
||||
if(depthRP != VK_NULL_HANDLE)
|
||||
{
|
||||
m_pDriver->m_RenderState.renderPass = GetResID(depthRP);
|
||||
@@ -1475,11 +1478,10 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, CompType typeHint, Debu
|
||||
// restore state
|
||||
m_pDriver->m_RenderState = prevstate;
|
||||
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
m_pDriver->vkDestroyPipeline(m_Device, pipe[i], NULL);
|
||||
m_pDriver->vkDestroyShaderModule(m_Device, mod[i], NULL);
|
||||
}
|
||||
m_pDriver->vkDestroyPipeline(m_Device, failpipe, NULL);
|
||||
m_pDriver->vkDestroyShaderModule(m_Device, failmod, NULL);
|
||||
m_pDriver->vkDestroyPipeline(m_Device, passpipe, NULL);
|
||||
m_pDriver->vkDestroyShaderModule(m_Device, passmod, NULL);
|
||||
|
||||
if(depthRP != VK_NULL_HANDLE)
|
||||
{
|
||||
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -75,6 +75,11 @@ struct D3D11_Overlay_Test : D3D11GraphicsTest
|
||||
{Vec3f(0.5f, -0.2f, 0.5f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(0.0f, 1.0f)},
|
||||
{Vec3f(0.5f, 0.2f, 0.5f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(1.0f, 0.0f)},
|
||||
|
||||
// depth clipped (i.e. not clamped)
|
||||
{Vec3f(0.6f, 0.0f, 0.5f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(0.0f, 0.0f)},
|
||||
{Vec3f(0.7f, 0.2f, 0.5f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(0.0f, 1.0f)},
|
||||
{Vec3f(0.8f, 0.0f, 1.5f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(1.0f, 0.0f)},
|
||||
|
||||
// small triangles
|
||||
// size=0.01
|
||||
{Vec3f(0.0f, 0.4f, 0.5f), Vec4f(0.0f, 1.0f, 0.0f, 1.0f), Vec2f(0.0f, 0.0f)},
|
||||
@@ -153,7 +158,7 @@ struct D3D11_Overlay_Test : D3D11GraphicsTest
|
||||
depth.StencilEnable = TRUE;
|
||||
depth.FrontFace.StencilFunc = D3D11_COMPARISON_GREATER;
|
||||
SetDepthState(depth);
|
||||
ctx->Draw(21, 9);
|
||||
ctx->Draw(24, 9);
|
||||
|
||||
Present();
|
||||
}
|
||||
|
||||
@@ -70,6 +70,11 @@ struct D3D12_Overlay_Test : D3D12GraphicsTest
|
||||
{Vec3f(0.5f, -0.2f, 0.5f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(0.0f, 1.0f)},
|
||||
{Vec3f(0.5f, 0.2f, 0.5f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(1.0f, 0.0f)},
|
||||
|
||||
// depth clipped (i.e. not clamped)
|
||||
{Vec3f(0.6f, 0.0f, 0.5f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(0.0f, 0.0f)},
|
||||
{Vec3f(0.7f, 0.2f, 0.5f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(0.0f, 1.0f)},
|
||||
{Vec3f(0.8f, 0.0f, 1.5f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(1.0f, 0.0f)},
|
||||
|
||||
// small triangles
|
||||
// size=0.005
|
||||
{Vec3f(0.0f, 0.4f, 0.5f), Vec4f(0.0f, 1.0f, 0.0f, 1.0f), Vec2f(0.0f, 0.0f)},
|
||||
@@ -100,6 +105,7 @@ struct D3D12_Overlay_Test : D3D12GraphicsTest
|
||||
DXGI_FORMAT_D32_FLOAT_S8X24_UINT);
|
||||
|
||||
creator.GraphicsDesc.RasterizerState.CullMode = D3D12_CULL_MODE_BACK;
|
||||
creator.GraphicsDesc.RasterizerState.DepthClipEnable = TRUE;
|
||||
|
||||
creator.GraphicsDesc.DepthStencilState.DepthEnable = TRUE;
|
||||
creator.GraphicsDesc.DepthStencilState.DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALL;
|
||||
@@ -173,7 +179,7 @@ struct D3D12_Overlay_Test : D3D12GraphicsTest
|
||||
cmd->SetMarker(1, "Test Begin", sizeof("Test Begin"));
|
||||
|
||||
cmd->SetPipelineState(pipe);
|
||||
cmd->DrawInstanced(21, 1, 9, 0);
|
||||
cmd->DrawInstanced(24, 1, 9, 0);
|
||||
|
||||
FinishUsingBackbuffer(cmd, D3D12_RESOURCE_STATE_RENDER_TARGET);
|
||||
|
||||
|
||||
@@ -116,6 +116,11 @@ void main()
|
||||
{Vec3f(0.5f, -0.2f, 0.0f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(0.0f, 1.0f)},
|
||||
{Vec3f(0.5f, 0.2f, 0.0f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(1.0f, 0.0f)},
|
||||
|
||||
// depth clipped (i.e. not clamped)
|
||||
{Vec3f(0.6f, 0.0f, 0.0f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(0.0f, 0.0f)},
|
||||
{Vec3f(0.7f, 0.2f, 0.0f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(0.0f, 1.0f)},
|
||||
{Vec3f(0.8f, 0.0f, 2.0f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(1.0f, 0.0f)},
|
||||
|
||||
// small triangles
|
||||
// size=0.005
|
||||
{Vec3f(0.0f, 0.4f, 0.0f), Vec4f(0.0f, 1.0f, 0.0f, 1.0f), Vec2f(0.0f, 0.0f)},
|
||||
@@ -180,6 +185,7 @@ void main()
|
||||
|
||||
glDepthMask(GL_TRUE);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDisable(GL_DEPTH_CLAMP);
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
glStencilFunc(GL_ALWAYS, 0x55, 0xff);
|
||||
@@ -210,7 +216,7 @@ void main()
|
||||
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
glStencilFunc(GL_GREATER, 0x55, 0xff);
|
||||
glDrawArrays(GL_TRIANGLES, 9, 21);
|
||||
glDrawArrays(GL_TRIANGLES, 9, 24);
|
||||
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
|
||||
@@ -115,6 +115,11 @@ void main()
|
||||
{Vec3f(0.5f, 0.2f, 0.5f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(0.0f, 1.0f)},
|
||||
{Vec3f(0.5f, -0.2f, 0.5f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(1.0f, 0.0f)},
|
||||
|
||||
// depth clipped (i.e. not clamped)
|
||||
{Vec3f(0.6f, 0.0f, 0.5f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(0.0f, 0.0f)},
|
||||
{Vec3f(0.7f, -0.2f, 0.5f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(0.0f, 1.0f)},
|
||||
{Vec3f(0.8f, 0.0f, 1.5f), Vec4f(0.0f, 0.0f, 0.0f, 1.0f), Vec2f(1.0f, 0.0f)},
|
||||
|
||||
// small triangles
|
||||
// size=0.005
|
||||
{Vec3f(0.0f, -0.4f, 0.5f), Vec4f(0.0f, 1.0f, 0.0f, 1.0f), Vec2f(0.0f, 0.0f)},
|
||||
@@ -195,6 +200,7 @@ void main()
|
||||
CompileShaderModule(common + pixel, ShaderLang::glsl, ShaderStage::frag, "main"),
|
||||
};
|
||||
|
||||
pipeCreateInfo.rasterizationState.depthClampEnable = VK_FALSE;
|
||||
pipeCreateInfo.rasterizationState.cullMode = VK_CULL_MODE_BACK_BIT;
|
||||
|
||||
pipeCreateInfo.depthStencilState.depthTestEnable = VK_TRUE;
|
||||
@@ -263,7 +269,7 @@ void main()
|
||||
setMarker(cmd, "Test Begin");
|
||||
|
||||
vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipe);
|
||||
vkCmdDraw(cmd, 21, 1, 9, 0);
|
||||
vkCmdDraw(cmd, 24, 1, 9, 0);
|
||||
|
||||
vkCmdEndRenderPass(cmd);
|
||||
|
||||
|
||||