[D3D12] Don't drop draw calls with no render targets

This commit is contained in:
Triang3l 2019-04-12 16:59:45 +03:00
parent 93a18a517b
commit ecc056912d
2 changed files with 14 additions and 7 deletions

View File

@ -1210,10 +1210,7 @@ bool D3D12CommandProcessor::IssueDraw(PrimitiveType primitive_type,
// Set up the render targets - this may bind pipelines.
if (!render_target_cache_->UpdateRenderTargets(pixel_shader)) {
// Doesn't actually draw.
// TODO(Triang3l): Do something so memexport still works in this case maybe?
// Not distingushing between no operation and a true failure.
return true;
return false;
}
const RenderTargetCache::PipelineRenderTarget* pipeline_render_targets =
render_target_cache_->GetCurrentPipelineRenderTargets();

View File

@ -543,6 +543,8 @@ bool RenderTargetCache::UpdateRenderTargets(const D3D12Shader* pixel_shader) {
uint32_t rb_surface_info = regs[XE_GPU_REG_RB_SURFACE_INFO].u32;
uint32_t surface_pitch = std::min(rb_surface_info & 0x3FFF, 2560u);
if (surface_pitch == 0) {
// TODO(Triang3l): Do something if a memexport-only draw has 0 surface
// pitch (never seen in any game so far, not sure if even legal).
return false;
}
MsaaSamples msaa_samples = MsaaSamples((rb_surface_info >> 16) & 0x3);
@ -606,10 +608,18 @@ bool RenderTargetCache::UpdateRenderTargets(const D3D12Shader* pixel_shader) {
(2048 - edram_bases[i]) / edram_row_tiles[i]);
}
}
if (edram_max_rows == 0 || edram_max_rows == UINT32_MAX) {
// Some render target is totally in the end of EDRAM, or nothing is drawn.
if (edram_max_rows == UINT32_MAX) {
// No render targets needed - likely a memexport-only draw, just keep using
// the current state (or 0 if nothing bound yet, but nothing will be bound
// anyway so it won't matter).
edram_max_rows = current_edram_max_rows_;
} else {
if (edram_max_rows == 0) {
// Some render target is totally in the end of EDRAM - can't create
// textures with 0 height.
return false;
}
}
// Don't create render targets larger than x2560.
edram_max_rows = std::min(edram_max_rows, 160u * msaa_samples_y);
// Check the following full update conditions: