rasterizer state resets

Started by
3 comments, last by ekba89 10 years, 1 month ago

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?

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

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

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);

What information did you get from PIX, Visual Studio 2013, or any other graphics debugger?

L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

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.

This topic is closed to new replies.

Advertisement