D3D11 stock objects: Remove unused items

This commit is contained in:
Henrik Rydgård committed 2025-08-01 17:59:33 +02:00
1 parent e0d9edc077
commit a5aac9c386
2 files changed
-49

No files matched your search

-43
View File
@@ -109,38 +109,7 @@ HRESULT CreateGeometryShaderD3D11(ID3D11Device *device, const char *code, size_t
}
void StockObjectsD3D11::Create(ID3D11Device *device) {
D3D11_BLEND_DESC blend_desc{};
blend_desc.RenderTarget[0].BlendEnable = false;
blend_desc.IndependentBlendEnable = false;
for (int i = 0; i < 16; i++) {
blend_desc.RenderTarget[0].RenderTargetWriteMask = i;
ASSERT_SUCCESS(device->CreateBlendState(&blend_desc, &blendStateDisabledWithColorMask[i]));
}
D3D11_DEPTH_STENCIL_DESC depth_desc{};
depth_desc.DepthEnable = FALSE;
ASSERT_SUCCESS(device->CreateDepthStencilState(&depth_desc, &depthStencilDisabled));
depth_desc.StencilEnable = TRUE;
depth_desc.StencilReadMask = 0xFF;
depth_desc.StencilWriteMask = 0xFF;
depth_desc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_REPLACE;
depth_desc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_REPLACE;
depth_desc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_REPLACE;
depth_desc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
depth_desc.BackFace = depth_desc.FrontFace;
ASSERT_SUCCESS(device->CreateDepthStencilState(&depth_desc, &depthDisabledStencilWrite));
D3D11_RASTERIZER_DESC raster_desc{};
raster_desc.FillMode = D3D11_FILL_SOLID;
raster_desc.CullMode = D3D11_CULL_NONE;
raster_desc.ScissorEnable = FALSE;
raster_desc.DepthClipEnable = TRUE; // the default! FALSE is unsupported on D3D11 level 9
ASSERT_SUCCESS(device->CreateRasterizerState(&raster_desc, &rasterStateNoCull));
D3D11_SAMPLER_DESC sampler_desc{};
sampler_desc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
sampler_desc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
sampler_desc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
sampler_desc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
sampler_desc.ComparisonFunc = D3D11_COMPARISON_NEVER;
for (int i = 0; i < 4; i++)
@@ -149,27 +118,15 @@ void StockObjectsD3D11::Create(ID3D11Device *device) {
sampler_desc.MaxLOD = FLT_MAX;
sampler_desc.MipLODBias = 0.0f;
sampler_desc.MaxAnisotropy = 1;
ASSERT_SUCCESS(device->CreateSamplerState(&sampler_desc, &samplerPoint2DWrap));
sampler_desc.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;
ASSERT_SUCCESS(device->CreateSamplerState(&sampler_desc, &samplerLinear2DWrap));
sampler_desc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
sampler_desc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
sampler_desc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
sampler_desc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
ASSERT_SUCCESS(device->CreateSamplerState(&sampler_desc, &samplerPoint2DClamp));
sampler_desc.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;
ASSERT_SUCCESS(device->CreateSamplerState(&sampler_desc, &samplerLinear2DClamp));
}
void StockObjectsD3D11::Destroy() {
for (int i = 0; i < 16; i++) {
blendStateDisabledWithColorMask[i].Reset();
}
depthStencilDisabled.Reset();
depthDisabledStencilWrite.Reset();
rasterStateNoCull.Reset();
samplerPoint2DWrap.Reset();
samplerLinear2DWrap.Reset();
samplerPoint2DClamp.Reset();
samplerLinear2DClamp.Reset();
}
-6
View File
@@ -85,12 +85,6 @@ public:
void Create(ID3D11Device *device);
void Destroy();
Microsoft::WRL::ComPtr<ID3D11DepthStencilState> depthStencilDisabled;
Microsoft::WRL::ComPtr<ID3D11DepthStencilState> depthDisabledStencilWrite;
Microsoft::WRL::ComPtr<ID3D11BlendState> blendStateDisabledWithColorMask[16];
Microsoft::WRL::ComPtr<ID3D11RasterizerState> rasterStateNoCull;
Microsoft::WRL::ComPtr<ID3D11SamplerState> samplerPoint2DWrap;
Microsoft::WRL::ComPtr<ID3D11SamplerState> samplerLinear2DWrap;
Microsoft::WRL::ComPtr<ID3D11SamplerState> samplerPoint2DClamp;
Microsoft::WRL::ComPtr<ID3D11SamplerState> samplerLinear2DClamp;
};