Jump to content
  • Advertisement
Sign in to follow this  

Conservative Rasterization with ID3D11RasterizerState2

Recommended Posts

Some D3D11 code that runs fine on my GTX 970, does not seem to run on my GTX 960M.

More particularly, I want to create a rasterizer state that enables conservative rasterization:

[[nodiscard]] HRESULT
        CreateVoxelizationRasterizerState(ID3D11Device3 *device, 
                                          ID3D11RasterizerState2 **state) noexcept {
        Assert(device);
        Assert(state);

        D3D11_RASTERIZER_DESC2 desc = {};
        desc.CullMode           = D3D11_CULL_BACK;
        desc.FillMode           = D3D11_FILL_SOLID;
        desc.DepthClipEnable    = TRUE;
        desc.MultisampleEnable  = TRUE;
        desc.ConservativeRaster = D3D11_CONSERVATIVE_RASTERIZATION_MODE_ON;

        return device->CreateRasterizerState2(&desc, state);
    }

Both function arguments are non-nullptr. The returned HRESULT value is equal to 80070057, representing the error message: "One or more arguments are not valid".

So what could this error message mean in this context? I could only think of a support problem. In this case, the error message wouldn't be very accurate though. Furthermore both GPUs are based on the Maxwell architecture.

Edited by matt77hias

Share this post


Link to post
Share on other sites
Advertisement

That feature is widely unsupported, be sure to check like this:

D3D11_FEATURE_DATA_D3D11_OPTIONS2 features_2;
HRESULT hr = device->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS2, &features_2, sizeof(features_2));
bool CONSERVATIVE_RASTERIZATION = features_2.ConservativeRasterizationTier >= D3D11_CONSERVATIVE_RASTERIZATION_TIER_1;

Note that it even has multiple levels of possible support.

Share this post


Link to post
Share on other sites

Not supported. Damn, back to custom conservative rasterization.

D3D11_FEATURE_DATA_D3D11_OPTIONS2 features;
device->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS2, &features, (UINT)sizeof(features));

ConservativeRasterizationTier    D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED


 

Share this post


Link to post
Share on other sites
8 minutes ago, matt77hias said:

Not supported. Damn, back to custom conservative rasterization.


D3D11_FEATURE_DATA_D3D11_OPTIONS2 features;
device->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS2, &features, (UINT)sizeof(features));

ConservativeRasterizationTier    D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED


 

It doesn't work if you want to rasterize into 3D texture anyway in a single pass. The fact that you change axis of rasterization per triangle seem to mess up the thing. Though maybe a 3-pass voxelization might be worth it, so you avoid the geometry shader and can use this conservative raster feature.

Share this post


Link to post
Share on other sites
9 minutes ago, turanszkij said:

Though maybe a 3-pass voxelization might be worth it, so you avoid the geometry shader and can use this conservative raster feature.

You still need to discard triangles in the GS, since the mesh will probably contain triangles for each direction.

Share this post


Link to post
Share on other sites

FYI this wiki page has a chart that shows you the optional feature support for different GPU families. It's for D3D12 so it doesn't guarantee D3D11.3 support, but it does at least tell you some of the hardware capabilities. In the case of conservative rasterization HW support was added for second-gen Maxwell, and unfortunately your 960M is a first-gen Maxwell.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!