• Advertisement
Sign in to follow this  

rasterizer state resets

This topic is 1390 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I created a wireframe rasterizer state and it works if I set it everytime I render an object. But if I initialized it one time next frame it resets to default rasterizer state. Is this the default behaviour or there is something wrong with my code?

Share this post


Link to post
Share on other sites
Advertisement

Search your code for “RSSetState” and ensure you are never calling it with NULL or otherwise unexpectedly.

Direct3D 11 does not reset any states between “frames” (that would assume Direct3D 11 had more than an assumption as to what a frame is) and there is something wrong within your client code.

 

 

L. Spiro

Share this post


Link to post
Share on other sites

Yeah that was the first thing I have checked and there is only one place that I call RSSetState function. So here is how I set it. And as I said this works if I set it everytime before I call draw for my object.

D3D11_RASTERIZER_DESC rd;
	ZeroMemory(&rd, sizeof(rd));
	rd.AntialiasedLineEnable = false;
	rd.CullMode = D3D11_CULL_BACK;
	rd.DepthBias = 0;
	rd.DepthBiasClamp = 0.0f;
	rd.DepthClipEnable = true;
	rd.FillMode = D3D11_FILL_WIREFRAME;
	rd.FrontCounterClockwise = false;
	rd.MultisampleEnable = false;
	rd.ScissorEnable = false;
	rd.SlopeScaledDepthBias = 0.0f;

	d3dDevice->CreateRasterizerState(&rd, &rasterizerStateWireFrame);
	deviceContex->RSSetState(rasterizerStateWireFrame);

Share this post


Link to post
Share on other sites

It was a stupid mistake. I found it when I checked the debugger on VS2012. I was using DirectXTK to write some stuff to screen. And it was changing the rasterizer state. Thanks for the help.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement