From d5cfab703b1179ac6e81c6281f6e25d1cab9d4c2 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Thu, 20 Oct 2011 20:43:11 +0200 Subject: [PATCH] d3d1x: fix/improve OMSetRenderTargets Don't count trailing NULL RTVs. Don't skip update if only DSV has changed. --- .../d3d1x/gd3d11/d3d11_context.h | 45 +++++++++++-------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index d6b640025a0..6385fc123ca 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h @@ -1188,31 +1188,38 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl ID3D11DepthStencilView *new_depth_stencil_view) { SYNCHRONIZED; + + bool update = false; + unsigned i, num; + + if(depth_stencil_view.p != new_depth_stencil_view) { + update = true; + depth_stencil_view = new_depth_stencil_view; + } + if(!new_render_target_views) count = 0; - if(count == num_render_target_views) - { - for(unsigned i = 0; i < count; ++i) - { - if(new_render_target_views[i] != render_target_views[i].p) - goto changed; - } - return; - } -changed: - depth_stencil_view = new_depth_stencil_view; - unsigned i; - for(i = 0; i < count; ++i) - { - render_target_views[i] = new_render_target_views[i]; + + for(num = 0, i = 0; i < count; ++i) { #if API >= 11 + // XXX: is unbinding the UAVs here correct ? om_unordered_access_views[i] = (ID3D11UnorderedAccessView*)NULL; #endif + if(new_render_target_views[i] != render_target_views[i].p) { + update = true; + render_target_views[i] = new_render_target_views[i]; + } + if(new_render_target_views[i]) + num = i + 1; } - for(; i < num_render_target_views; ++i) - render_target_views[i] = (ID3D11RenderTargetView*)NULL; - num_render_target_views = count; - set_framebuffer(); + if(num != num_render_target_views) { + update = true; + for(; i < num_render_target_views; ++i) + render_target_views[i] = (ID3D11RenderTargetView*)NULL; + } + num_render_target_views = num; + if(update) + set_framebuffer(); } virtual void STDMETHODCALLTYPE OMGetRenderTargets( -- 2.30.2