Mesa (gallium-clip-state): d3d1x: adapt to new clip state

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Fri Jan 6 17:00:25 UTC 2012


Module: Mesa
Branch: gallium-clip-state
Commit: d919791f2742e913173d6b335128e7d4c63c0840
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d919791f2742e913173d6b335128e7d4c63c0840

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Fri Jan  6 17:59:22 2012 +0100

d3d1x: adapt to new clip state

---

 .../state_trackers/d3d1x/gd3d11/d3d11_context.h    |   18 +-----------------
 .../state_trackers/d3d1x/gd3d11/d3d11_objects.h    |    6 ++----
 .../state_trackers/d3d1x/gd3d11/d3d11_screen.h     |    3 ++-
 3 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
index a64e8d1..da3cc23 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
@@ -75,7 +75,6 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
 	float blend_color[4];
 	unsigned sample_mask;
 	unsigned stencil_ref;
-	bool depth_clamp;
 
 	void* default_input_layout;
 	void* default_rasterizer;
@@ -169,7 +168,6 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
 		memset(blend_color, 0, sizeof(blend_color));
 		sample_mask = ~0;
 		stencil_ref = 0;
-		depth_clamp = 0;
 
 		// derived state
 		primitive_mode = 0;
@@ -194,6 +192,7 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
 		rasterizerd.flatshade_first = 1;
 		rasterizerd.line_width = 1.0f;
 		rasterizerd.point_size = 1.0f;
+		rasterizerd.depth_clip = TRUE;
 		default_rasterizer = pipe->create_rasterizer_state(pipe, &rasterizerd);
 
 		struct pipe_depth_stencil_alpha_state depth_stencild;
@@ -938,14 +937,6 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
 	}
 #endif
 
-	void set_clip()
-	{
-		pipe_clip_state clip;
-		clip.nr = 0;
-		clip.depth_clamp = depth_clamp;
-		pipe->set_clip_state(pipe, &clip);
-	}
-
 	virtual void STDMETHODCALLTYPE RSSetState(
 		ID3D11RasterizerState *new_rasterizer_state)
 	{
@@ -954,12 +945,6 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
 		{
 			rasterizer_state = new_rasterizer_state;
 			pipe->bind_rasterizer_state(pipe, new_rasterizer_state ? ((GalliumD3D11RasterizerState*)new_rasterizer_state)->object : default_rasterizer);
-			bool new_depth_clamp = new_rasterizer_state ? ((GalliumD3D11RasterizerState*)new_rasterizer_state)->depth_clamp : false;
-			if(depth_clamp != new_depth_clamp)
-			{
-				depth_clamp = new_depth_clamp;
-				set_clip();
-			}
 		}
 	}
 
@@ -1688,7 +1673,6 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe>
 			pipe->set_stream_output_targets(pipe, num_so_targets, so_targets, ~0);
 		set_framebuffer();
 		set_viewport();
-		set_clip();
 		set_render_condition();
 
 		update_flags |= UPDATE_VERTEX_BUFFERS | (1 << (UPDATE_SAMPLERS_SHIFT + D3D11_STAGE_PS)) | (1 << (UPDATE_VIEWS_SHIFT + D3D11_STAGE_PS));
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h
index e1ef7b8..faeb306 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h
@@ -210,10 +210,8 @@ struct GalliumD3D10BlendState : public GalliumD3D10BlendStateBase
 
 struct GalliumD3D11RasterizerState : public GalliumD3D11RasterizerStateBase
 {
-	bool depth_clamp;
-
-	GalliumD3D11RasterizerState(GalliumD3D11Screen* device, void* object, const D3D11_RASTERIZER_DESC& desc, bool depth_clamp)
-	: GalliumD3D11RasterizerStateBase(device, object, desc), depth_clamp(depth_clamp)
+	GalliumD3D11RasterizerState(GalliumD3D11Screen* device, void* object, const D3D11_RASTERIZER_DESC& desc)
+	: GalliumD3D11RasterizerStateBase(device, object, desc)
 	{}
 };
 
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
index e64e1f6..31e59bf 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
@@ -578,6 +578,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
 		state.offset_scale = rasterizer_desc->SlopeScaledDepthBias;
 		state.offset_units = rasterizer_desc->DepthBias;
 		state.offset_clamp = rasterizer_desc->DepthBiasClamp;
+		state.depth_clip = rasterizer_desc->DepthClipEnable;
 		state.scissor = !!rasterizer_desc->ScissorEnable;
 		state.multisample = !!rasterizer_desc->MultisampleEnable;
 		state.line_smooth = !!rasterizer_desc->AntialiasedLineEnable;
@@ -595,7 +596,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
 		if(!object)
 			return E_FAIL;
 
-		*out_rasterizer_state = new GalliumD3D11RasterizerState(this, object, *rasterizer_desc, !rasterizer_desc->DepthClipEnable);
+		*out_rasterizer_state = new GalliumD3D11RasterizerState(this, object, *rasterizer_desc);
 		return S_OK;
 	}
 




More information about the mesa-commit mailing list