From a496e3a8ba98ece0219ed3630afbb0df2c9ce09c Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 10 Apr 2023 20:45:15 +0200 Subject: [PATCH] tests: Disable culling in shader runners. Signed-off-by: Nikolay Sivov --- tests/shader_runner_d3d11.c | 18 ++++++++++++++++++ tests/shader_runner_d3d12.c | 2 +- tests/shader_runner_d3d9.c | 2 ++ tests/shader_runner_vulkan.c | 2 +- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/tests/shader_runner_d3d11.c b/tests/shader_runner_d3d11.c index 965b8b18..2954cab8 100644 --- a/tests/shader_runner_d3d11.c +++ b/tests/shader_runner_d3d11.c @@ -63,6 +63,7 @@ struct d3d11_shader_runner HWND window; IDXGISwapChain *swapchain; ID3D11DeviceContext *immediate_context; + ID3D11RasterizerState *rasterizer_state; }; static struct d3d11_shader_runner *d3d11_shader_runner(struct shader_runner *r) @@ -250,7 +251,9 @@ static IDXGISwapChain *create_swapchain(ID3D11Device *device, HWND window) static BOOL init_test_context(struct d3d11_shader_runner *runner) { unsigned int rt_width, rt_height; + D3D11_RASTERIZER_DESC rs_desc; D3D11_VIEWPORT vp; + HRESULT hr; RECT rect; memset(runner, 0, sizeof(*runner)); @@ -279,6 +282,19 @@ static BOOL init_test_context(struct d3d11_shader_runner *runner) vp.MaxDepth = 1.0f; ID3D11DeviceContext_RSSetViewports(runner->immediate_context, 1, &vp); + rs_desc.FillMode = D3D11_FILL_SOLID; + rs_desc.CullMode = D3D11_CULL_NONE; + rs_desc.FrontCounterClockwise = FALSE; + rs_desc.DepthBias = 0; + rs_desc.DepthBiasClamp = 0.0f; + rs_desc.SlopeScaledDepthBias = 0.0f; + rs_desc.DepthClipEnable = TRUE; + rs_desc.ScissorEnable = FALSE; + rs_desc.MultisampleEnable = FALSE; + rs_desc.AntialiasedLineEnable = FALSE; + hr = ID3D11Device_CreateRasterizerState(runner->device, &rs_desc, &runner->rasterizer_state); + ok(hr == S_OK, "Failed to create rasterizer state.\n"); + return TRUE; } @@ -286,6 +302,7 @@ static void destroy_test_context(struct d3d11_shader_runner *runner) { ULONG ref; + ID3D11RasterizerState_Release(runner->rasterizer_state); ID3D11DeviceContext_Release(runner->immediate_context); IDXGISwapChain_Release(runner->swapchain); DestroyWindow(runner->window); @@ -594,6 +611,7 @@ static bool d3d11_runner_draw(struct shader_runner *r, ID3D11DeviceContext_IASetPrimitiveTopology(context, primitive_topology); ID3D11DeviceContext_VSSetShader(context, vs, NULL, 0); ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0); + ID3D11DeviceContext_RSSetState(context, runner->rasterizer_state); ID3D11DeviceContext_Draw(context, vertex_count, 0); diff --git a/tests/shader_runner_d3d12.c b/tests/shader_runner_d3d12.c index 87e5d130..54d1c51a 100644 --- a/tests/shader_runner_d3d12.c +++ b/tests/shader_runner_d3d12.c @@ -380,7 +380,7 @@ static bool d3d12_runner_draw(struct shader_runner *r, pso_desc.PS.pShaderBytecode = ID3D10Blob_GetBufferPointer(ps_code); pso_desc.PS.BytecodeLength = ID3D10Blob_GetBufferSize(ps_code); pso_desc.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID; - pso_desc.RasterizerState.CullMode = D3D12_CULL_MODE_BACK; + pso_desc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE; pso_desc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; pso_desc.SampleDesc.Count = 1; pso_desc.SampleMask = ~(UINT)0; diff --git a/tests/shader_runner_d3d9.c b/tests/shader_runner_d3d9.c index 51cd6dc9..b983dc08 100644 --- a/tests/shader_runner_d3d9.c +++ b/tests/shader_runner_d3d9.c @@ -418,6 +418,8 @@ static bool d3d9_runner_draw(struct shader_runner *r, ok(hr == D3D_OK, "Failed to set vertex shader, hr %#lx.\n", hr); hr = IDirect3DDevice9_SetPixelShader(device, ps); ok(hr == D3D_OK, "Failed to set pixel shader, hr %#lx.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_CULLMODE, D3DCULL_NONE); + ok(hr == D3D_OK, "Failed to set cull mode, hr %#lx.\n", hr); hr = IDirect3DDevice9_BeginScene(device); ok(hr == D3D_OK, "Failed to draw, hr %#lx.\n", hr); diff --git a/tests/shader_runner_vulkan.c b/tests/shader_runner_vulkan.c index c7b1dee0..aca17a1a 100644 --- a/tests/shader_runner_vulkan.c +++ b/tests/shader_runner_vulkan.c @@ -619,7 +619,7 @@ static VkPipeline create_graphics_pipeline(const struct vulkan_shader_runner *ru vp_desc.scissorCount = 1; vp_desc.pScissors = &rt_rect; - rs_desc.frontFace = VK_FRONT_FACE_CLOCKWISE; + rs_desc.cullMode = VK_CULL_MODE_NONE; rs_desc.lineWidth = 1.0f; ms_desc.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;