2022-01-26 17:40:33 -08:00
|
|
|
/*
|
|
|
|
* Copyright 2008 Henri Verbeet for CodeWeavers
|
|
|
|
* Copyright 2015 Józef Kucia for CodeWeavers
|
|
|
|
* Copyright 2021 Zebediah Figura for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2023-01-18 04:53:51 -08:00
|
|
|
#ifdef _WIN32
|
|
|
|
|
2022-01-26 17:40:33 -08:00
|
|
|
#define COBJMACROS
|
|
|
|
#define CONST_VTABLE
|
2023-01-18 04:53:51 -08:00
|
|
|
#define INITGUID
|
2022-01-26 17:40:33 -08:00
|
|
|
#define VKD3D_TEST_NO_DEFS
|
|
|
|
#include <d3d11_4.h>
|
|
|
|
#define __vkd3d_d3dcommon_h__
|
|
|
|
#define __vkd3d_dxgibase_h__
|
|
|
|
#define __vkd3d_dxgiformat_h__
|
|
|
|
#include "vkd3d_d3dcompiler.h"
|
|
|
|
#include "shader_runner.h"
|
|
|
|
#include "vkd3d_test.h"
|
|
|
|
|
|
|
|
static HRESULT (WINAPI *pCreateDXGIFactory1)(REFIID iid, void **factory);
|
|
|
|
|
|
|
|
static HRESULT (WINAPI *pD3D11CreateDevice)(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_type,
|
|
|
|
HMODULE swrast, UINT flags, const D3D_FEATURE_LEVEL *feature_levels, UINT levels,
|
|
|
|
UINT sdk_version, ID3D11Device **device_out, D3D_FEATURE_LEVEL *obtained_feature_level,
|
|
|
|
ID3D11DeviceContext **immediate_context);
|
|
|
|
|
2022-03-21 18:42:17 -07:00
|
|
|
struct d3d11_resource
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
2022-03-21 18:42:17 -07:00
|
|
|
struct resource r;
|
2022-01-26 17:40:33 -08:00
|
|
|
|
2022-03-21 18:42:18 -07:00
|
|
|
ID3D11Resource *resource;
|
2023-05-17 14:09:20 -07:00
|
|
|
ID3D11Buffer *buffer;
|
2022-06-08 16:18:37 -07:00
|
|
|
ID3D11Texture2D *texture;
|
|
|
|
ID3D11RenderTargetView *rtv;
|
2024-04-14 17:33:15 -07:00
|
|
|
ID3D11DepthStencilView *dsv;
|
2022-01-26 17:40:33 -08:00
|
|
|
ID3D11ShaderResourceView *srv;
|
2022-06-08 16:18:35 -07:00
|
|
|
ID3D11UnorderedAccessView *uav;
|
2024-03-12 23:36:59 -07:00
|
|
|
bool is_uav_counter;
|
2022-01-26 17:40:33 -08:00
|
|
|
};
|
|
|
|
|
2022-03-21 18:42:17 -07:00
|
|
|
static struct d3d11_resource *d3d11_resource(struct resource *r)
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
2022-03-21 18:42:17 -07:00
|
|
|
return CONTAINING_RECORD(r, struct d3d11_resource, r);
|
2022-01-26 17:40:33 -08:00
|
|
|
}
|
|
|
|
|
2022-03-19 10:35:33 -07:00
|
|
|
struct d3d11_shader_runner
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
2022-03-19 10:35:33 -07:00
|
|
|
struct shader_runner r;
|
2024-02-19 07:47:11 -08:00
|
|
|
struct shader_runner_caps caps;
|
2022-01-26 17:40:33 -08:00
|
|
|
|
|
|
|
ID3D11Device *device;
|
|
|
|
HWND window;
|
|
|
|
IDXGISwapChain *swapchain;
|
|
|
|
ID3D11DeviceContext *immediate_context;
|
2023-04-10 11:45:15 -07:00
|
|
|
ID3D11RasterizerState *rasterizer_state;
|
2022-01-26 17:40:33 -08:00
|
|
|
};
|
|
|
|
|
2022-03-19 10:35:33 -07:00
|
|
|
static struct d3d11_shader_runner *d3d11_shader_runner(struct shader_runner *r)
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
2022-03-19 10:35:33 -07:00
|
|
|
return CONTAINING_RECORD(r, struct d3d11_shader_runner, r);
|
2022-01-26 17:40:33 -08:00
|
|
|
}
|
|
|
|
|
2023-07-12 22:41:14 -07:00
|
|
|
static ID3D10Blob *compile_shader(const struct d3d11_shader_runner *runner, const char *source, const char *type)
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
|
|
|
ID3D10Blob *blob = NULL, *errors = NULL;
|
2022-03-21 18:42:15 -07:00
|
|
|
char profile[7];
|
2022-01-26 17:40:33 -08:00
|
|
|
HRESULT hr;
|
|
|
|
|
2022-03-21 18:42:15 -07:00
|
|
|
static const char *const shader_models[] =
|
|
|
|
{
|
|
|
|
[SHADER_MODEL_2_0] = "4_0",
|
2023-04-30 17:27:58 -07:00
|
|
|
[SHADER_MODEL_3_0] = "4_0",
|
2022-03-21 18:42:15 -07:00
|
|
|
[SHADER_MODEL_4_0] = "4_0",
|
|
|
|
[SHADER_MODEL_4_1] = "4_1",
|
|
|
|
[SHADER_MODEL_5_0] = "5_0",
|
|
|
|
[SHADER_MODEL_5_1] = "5_1",
|
|
|
|
};
|
|
|
|
|
2023-07-12 22:41:14 -07:00
|
|
|
sprintf(profile, "%s_%s", type, shader_models[runner->r.minimum_shader_model]);
|
2023-08-25 06:05:51 -07:00
|
|
|
hr = D3DCompile(source, strlen(source), NULL, NULL, NULL, "main", profile, runner->r.compile_options, 0, &blob, &errors);
|
2022-01-26 17:40:33 -08:00
|
|
|
ok(hr == S_OK, "Failed to compile shader, hr %#lx.\n", hr);
|
|
|
|
if (errors)
|
|
|
|
{
|
|
|
|
if (vkd3d_test_state.debug_level)
|
|
|
|
trace("%s\n", (char *)ID3D10Blob_GetBufferPointer(errors));
|
|
|
|
ID3D10Blob_Release(errors);
|
|
|
|
}
|
|
|
|
return blob;
|
|
|
|
}
|
|
|
|
|
|
|
|
static IDXGIAdapter *create_adapter(void)
|
|
|
|
{
|
|
|
|
IDXGIFactory4 *factory4;
|
|
|
|
IDXGIFactory *factory;
|
|
|
|
IDXGIAdapter *adapter;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (!pCreateDXGIFactory1)
|
|
|
|
{
|
|
|
|
trace("CreateDXGIFactory1() is not available.\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (FAILED(hr = pCreateDXGIFactory1(&IID_IDXGIFactory, (void **)&factory)))
|
|
|
|
{
|
|
|
|
trace("Failed to create IDXGIFactory, hr %#lx.\n", hr);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
adapter = NULL;
|
2023-02-21 15:46:36 -08:00
|
|
|
if (test_options.use_warp_device)
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
|
|
|
if (SUCCEEDED(hr = IDXGIFactory_QueryInterface(factory, &IID_IDXGIFactory4, (void **)&factory4)))
|
|
|
|
{
|
|
|
|
hr = IDXGIFactory4_EnumWarpAdapter(factory4, &IID_IDXGIAdapter, (void **)&adapter);
|
|
|
|
IDXGIFactory4_Release(factory4);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
trace("Failed to get IDXGIFactory4, hr %#lx.\n", hr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-02-21 15:46:36 -08:00
|
|
|
hr = IDXGIFactory_EnumAdapters(factory, test_options.adapter_idx, &adapter);
|
2022-01-26 17:40:33 -08:00
|
|
|
}
|
|
|
|
IDXGIFactory_Release(factory);
|
|
|
|
if (FAILED(hr))
|
|
|
|
trace("Failed to get adapter, hr %#lx.\n", hr);
|
|
|
|
return adapter;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void init_adapter_info(void)
|
|
|
|
{
|
|
|
|
char name[MEMBER_SIZE(DXGI_ADAPTER_DESC, Description)];
|
|
|
|
IDXGIAdapter *adapter;
|
|
|
|
DXGI_ADAPTER_DESC desc;
|
|
|
|
unsigned int i;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (!(adapter = create_adapter()))
|
|
|
|
return;
|
|
|
|
|
|
|
|
hr = IDXGIAdapter_GetDesc(adapter, &desc);
|
|
|
|
ok(hr == S_OK, "Failed to get adapter desc, hr %#lx.\n", hr);
|
|
|
|
|
|
|
|
/* FIXME: Use debugstr_w(). */
|
|
|
|
for (i = 0; i < ARRAY_SIZE(desc.Description) && isprint(desc.Description[i]); ++i)
|
|
|
|
name[i] = desc.Description[i];
|
|
|
|
name[min(i, ARRAY_SIZE(name) - 1)] = '\0';
|
|
|
|
|
|
|
|
trace("Adapter: %s, %04x:%04x.\n", name, desc.VendorId, desc.DeviceId);
|
|
|
|
|
|
|
|
if (desc.VendorId == 0x1414 && desc.DeviceId == 0x008c)
|
|
|
|
{
|
|
|
|
trace("Using WARP device.\n");
|
2023-02-21 15:46:36 -08:00
|
|
|
test_options.use_warp_device = true;
|
2022-01-26 17:40:33 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
IDXGIAdapter_Release(adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ID3D11Device *create_device(void)
|
|
|
|
{
|
|
|
|
static const D3D_FEATURE_LEVEL feature_level[] =
|
|
|
|
{
|
|
|
|
D3D_FEATURE_LEVEL_11_0,
|
|
|
|
D3D_FEATURE_LEVEL_10_1,
|
|
|
|
D3D_FEATURE_LEVEL_10_0,
|
|
|
|
};
|
|
|
|
IDXGIAdapter *adapter;
|
|
|
|
ID3D11Device *device;
|
|
|
|
UINT flags = 0;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2023-02-21 15:46:36 -08:00
|
|
|
if (test_options.enable_debug_layer)
|
2022-01-26 17:40:33 -08:00
|
|
|
flags |= D3D11_CREATE_DEVICE_DEBUG;
|
|
|
|
|
|
|
|
if ((adapter = create_adapter()))
|
|
|
|
{
|
|
|
|
hr = pD3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, flags,
|
|
|
|
feature_level, ARRAY_SIZE(feature_level), D3D11_SDK_VERSION, &device, NULL, NULL);
|
|
|
|
IDXGIAdapter_Release(adapter);
|
|
|
|
return SUCCEEDED(hr) ? device : NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (SUCCEEDED(pD3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, flags,
|
|
|
|
feature_level, ARRAY_SIZE(feature_level), D3D11_SDK_VERSION, &device, NULL, NULL)))
|
|
|
|
return device;
|
|
|
|
if (SUCCEEDED(pD3D11CreateDevice(NULL, D3D_DRIVER_TYPE_WARP, NULL, flags,
|
|
|
|
feature_level, ARRAY_SIZE(feature_level), D3D11_SDK_VERSION, &device, NULL, NULL)))
|
|
|
|
return device;
|
|
|
|
if (SUCCEEDED(pD3D11CreateDevice(NULL, D3D_DRIVER_TYPE_REFERENCE, NULL, flags,
|
|
|
|
feature_level, ARRAY_SIZE(feature_level), D3D11_SDK_VERSION, &device, NULL, NULL)))
|
|
|
|
return device;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static IDXGISwapChain *create_swapchain(ID3D11Device *device, HWND window)
|
|
|
|
{
|
|
|
|
DXGI_SWAP_CHAIN_DESC dxgi_desc;
|
|
|
|
IDXGISwapChain *swapchain;
|
|
|
|
IDXGIDevice *dxgi_device;
|
|
|
|
IDXGIAdapter *adapter;
|
|
|
|
IDXGIFactory *factory;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = ID3D11Device_QueryInterface(device, &IID_IDXGIDevice, (void **)&dxgi_device);
|
|
|
|
ok(hr == S_OK, "Failed to get DXGI device, hr %#lx.\n", hr);
|
|
|
|
hr = IDXGIDevice_GetAdapter(dxgi_device, &adapter);
|
|
|
|
ok(hr == S_OK, "Failed to get adapter, hr %#lx.\n", hr);
|
|
|
|
IDXGIDevice_Release(dxgi_device);
|
|
|
|
hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory);
|
|
|
|
ok(hr == S_OK, "Failed to get factory, hr %#lx.\n", hr);
|
|
|
|
IDXGIAdapter_Release(adapter);
|
|
|
|
|
2022-03-19 10:35:34 -07:00
|
|
|
dxgi_desc.BufferDesc.Width = RENDER_TARGET_WIDTH;
|
|
|
|
dxgi_desc.BufferDesc.Height = RENDER_TARGET_HEIGHT;
|
2022-01-26 17:40:33 -08:00
|
|
|
dxgi_desc.BufferDesc.RefreshRate.Numerator = 60;
|
|
|
|
dxgi_desc.BufferDesc.RefreshRate.Denominator = 1;
|
|
|
|
dxgi_desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
|
|
|
dxgi_desc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
|
|
|
|
dxgi_desc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
|
|
|
|
dxgi_desc.SampleDesc.Count = 1;
|
|
|
|
dxgi_desc.SampleDesc.Quality = 0;
|
|
|
|
dxgi_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
|
|
|
dxgi_desc.BufferCount = 1;
|
|
|
|
dxgi_desc.OutputWindow = window;
|
|
|
|
dxgi_desc.Windowed = TRUE;
|
|
|
|
dxgi_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
|
|
|
|
dxgi_desc.Flags = 0;
|
|
|
|
|
|
|
|
hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &dxgi_desc, &swapchain);
|
|
|
|
ok(hr == S_OK, "Failed to create swapchain, hr %#lx.\n", hr);
|
|
|
|
IDXGIFactory_Release(factory);
|
|
|
|
|
|
|
|
return swapchain;
|
|
|
|
}
|
|
|
|
|
2022-03-19 10:35:33 -07:00
|
|
|
static BOOL init_test_context(struct d3d11_shader_runner *runner)
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
2023-10-13 14:35:12 -07:00
|
|
|
D3D11_FEATURE_DATA_D3D11_OPTIONS2 options2 = {0};
|
2023-12-14 00:47:23 -08:00
|
|
|
D3D11_FEATURE_DATA_DOUBLES doubles = {0};
|
2022-01-26 17:40:33 -08:00
|
|
|
unsigned int rt_width, rt_height;
|
2023-04-10 11:45:15 -07:00
|
|
|
D3D11_RASTERIZER_DESC rs_desc;
|
2022-01-26 17:40:33 -08:00
|
|
|
D3D11_VIEWPORT vp;
|
2023-04-10 11:45:15 -07:00
|
|
|
HRESULT hr;
|
2022-01-26 17:40:33 -08:00
|
|
|
RECT rect;
|
|
|
|
|
2022-03-19 10:35:33 -07:00
|
|
|
memset(runner, 0, sizeof(*runner));
|
2022-01-26 17:40:33 -08:00
|
|
|
|
2022-03-19 10:35:33 -07:00
|
|
|
if (!(runner->device = create_device()))
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
|
|
|
skip("Failed to create device.\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2024-02-19 08:01:00 -08:00
|
|
|
runner->caps.runner = "d3d11.dll";
|
2024-02-19 07:47:11 -08:00
|
|
|
runner->caps.minimum_shader_model = SHADER_MODEL_4_0;
|
2024-04-15 14:51:32 -07:00
|
|
|
runner->caps.maximum_shader_model = SHADER_MODEL_5_0;
|
2024-02-19 07:47:11 -08:00
|
|
|
|
2023-12-14 00:47:23 -08:00
|
|
|
hr = ID3D11Device_CheckFeatureSupport(runner->device, D3D11_FEATURE_DOUBLES,
|
|
|
|
&doubles, sizeof(doubles));
|
|
|
|
ok(hr == S_OK, "Failed to check double precision feature support, hr %#lx.\n", hr);
|
2024-02-19 07:47:11 -08:00
|
|
|
runner->caps.float64 = doubles.DoublePrecisionFloatShaderOps;
|
2023-12-14 00:47:23 -08:00
|
|
|
|
2023-10-13 14:35:12 -07:00
|
|
|
hr = ID3D11Device_CheckFeatureSupport(runner->device,
|
|
|
|
D3D11_FEATURE_D3D11_OPTIONS2, &options2, sizeof(options2));
|
|
|
|
ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
2024-02-19 07:47:11 -08:00
|
|
|
runner->caps.rov = options2.ROVsSupported;
|
2023-10-13 14:35:12 -07:00
|
|
|
|
2022-03-19 10:35:34 -07:00
|
|
|
rt_width = RENDER_TARGET_WIDTH;
|
|
|
|
rt_height = RENDER_TARGET_HEIGHT;
|
2022-01-26 17:40:33 -08:00
|
|
|
SetRect(&rect, 0, 0, rt_width, rt_height);
|
|
|
|
AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);
|
2022-03-19 10:35:33 -07:00
|
|
|
runner->window = CreateWindowA("static", "d3dcompiler_test", WS_OVERLAPPEDWINDOW,
|
2022-01-26 17:40:33 -08:00
|
|
|
0, 0, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, NULL, NULL);
|
2022-03-19 10:35:33 -07:00
|
|
|
runner->swapchain = create_swapchain(runner->device, runner->window);
|
2022-01-26 17:40:33 -08:00
|
|
|
|
2022-03-19 10:35:33 -07:00
|
|
|
ID3D11Device_GetImmediateContext(runner->device, &runner->immediate_context);
|
2022-01-26 17:40:33 -08:00
|
|
|
|
|
|
|
vp.TopLeftX = 0.0f;
|
|
|
|
vp.TopLeftY = 0.0f;
|
|
|
|
vp.Width = rt_width;
|
|
|
|
vp.Height = rt_height;
|
|
|
|
vp.MinDepth = 0.0f;
|
|
|
|
vp.MaxDepth = 1.0f;
|
2022-03-19 10:35:33 -07:00
|
|
|
ID3D11DeviceContext_RSSetViewports(runner->immediate_context, 1, &vp);
|
2022-01-26 17:40:33 -08:00
|
|
|
|
2023-04-10 11:45:15 -07:00
|
|
|
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");
|
|
|
|
|
2022-01-26 17:40:33 -08:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2022-03-19 10:35:33 -07:00
|
|
|
static void destroy_test_context(struct d3d11_shader_runner *runner)
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
|
|
|
ULONG ref;
|
|
|
|
|
2023-04-10 11:45:15 -07:00
|
|
|
ID3D11RasterizerState_Release(runner->rasterizer_state);
|
2022-03-19 10:35:33 -07:00
|
|
|
ID3D11DeviceContext_Release(runner->immediate_context);
|
|
|
|
IDXGISwapChain_Release(runner->swapchain);
|
|
|
|
DestroyWindow(runner->window);
|
2022-01-26 17:40:33 -08:00
|
|
|
|
2022-03-19 10:35:33 -07:00
|
|
|
ref = ID3D11Device_Release(runner->device);
|
2022-01-26 17:40:33 -08:00
|
|
|
ok(!ref, "Device has %lu references left.\n", ref);
|
|
|
|
}
|
|
|
|
|
2024-01-31 22:01:45 -08:00
|
|
|
static ID3D11Buffer *create_buffer(ID3D11Device *device, unsigned int bind_flags, unsigned int size,
|
2024-05-31 06:46:38 -07:00
|
|
|
bool is_raw, unsigned int stride, const void *data)
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
|
|
|
D3D11_SUBRESOURCE_DATA resource_data;
|
|
|
|
D3D11_BUFFER_DESC buffer_desc;
|
|
|
|
ID3D11Buffer *buffer;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
buffer_desc.ByteWidth = size;
|
|
|
|
buffer_desc.Usage = D3D11_USAGE_DEFAULT;
|
|
|
|
buffer_desc.BindFlags = bind_flags;
|
|
|
|
buffer_desc.CPUAccessFlags = 0;
|
2024-05-31 06:46:38 -07:00
|
|
|
if (is_raw)
|
|
|
|
buffer_desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS;
|
|
|
|
else if (stride)
|
|
|
|
buffer_desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
|
|
|
|
else
|
|
|
|
buffer_desc.MiscFlags = 0;
|
2024-01-31 22:01:45 -08:00
|
|
|
buffer_desc.StructureByteStride = stride;
|
2022-01-26 17:40:33 -08:00
|
|
|
|
|
|
|
resource_data.pSysMem = data;
|
|
|
|
resource_data.SysMemPitch = 0;
|
|
|
|
resource_data.SysMemSlicePitch = 0;
|
|
|
|
|
|
|
|
hr = ID3D11Device_CreateBuffer(device, &buffer_desc, data ? &resource_data : NULL, &buffer);
|
|
|
|
ok(hr == S_OK, "Failed to create buffer, hr %#lx.\n", hr);
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
2024-04-09 20:51:06 -07:00
|
|
|
static bool init_resource_2d(struct d3d11_shader_runner *runner, struct d3d11_resource *resource,
|
2024-01-22 15:20:18 -08:00
|
|
|
const struct resource_params *params)
|
|
|
|
{
|
2024-03-20 18:21:12 -07:00
|
|
|
D3D11_SUBRESOURCE_DATA resource_data[3];
|
2024-01-22 15:20:18 -08:00
|
|
|
ID3D11Device *device = runner->device;
|
|
|
|
D3D11_TEXTURE2D_DESC desc = {0};
|
2024-04-09 20:51:06 -07:00
|
|
|
UINT quality_levels;
|
2024-01-22 15:20:18 -08:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (params->level_count > ARRAY_SIZE(resource_data))
|
|
|
|
fatal_error("Level count %u is too high.\n", params->level_count);
|
|
|
|
|
2024-04-09 20:51:06 -07:00
|
|
|
if (params->sample_count > 1)
|
|
|
|
{
|
|
|
|
if (params->level_count > 1)
|
|
|
|
fatal_error("Multisampled texture has multiple levels.\n");
|
|
|
|
|
|
|
|
if (FAILED(ID3D11Device_CheckMultisampleQualityLevels(device,
|
|
|
|
params->format, params->sample_count, &quality_levels)) || !quality_levels)
|
|
|
|
{
|
|
|
|
trace("Format #%x with sample count %u is not supported; skipping.\n", params->format, params->sample_count);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-22 15:20:18 -08:00
|
|
|
desc.Width = params->width;
|
|
|
|
desc.Height = params->height;
|
|
|
|
desc.MipLevels = params->level_count;
|
|
|
|
desc.ArraySize = 1;
|
|
|
|
desc.Format = params->format;
|
2024-04-09 20:51:06 -07:00
|
|
|
desc.SampleDesc.Count = max(params->sample_count, 1);
|
2024-01-22 15:20:18 -08:00
|
|
|
desc.Usage = D3D11_USAGE_DEFAULT;
|
|
|
|
if (params->type == RESOURCE_TYPE_UAV)
|
|
|
|
desc.BindFlags = D3D11_BIND_UNORDERED_ACCESS;
|
|
|
|
else if (params->type == RESOURCE_TYPE_RENDER_TARGET)
|
|
|
|
desc.BindFlags = D3D11_BIND_RENDER_TARGET;
|
2024-04-14 17:33:15 -07:00
|
|
|
else if (params->type == RESOURCE_TYPE_DEPTH_STENCIL)
|
|
|
|
desc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
|
2024-01-22 15:20:18 -08:00
|
|
|
else
|
|
|
|
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
|
|
|
|
|
|
|
if (params->data)
|
|
|
|
{
|
|
|
|
unsigned int buffer_offset = 0;
|
|
|
|
|
2024-04-09 20:51:06 -07:00
|
|
|
if (params->sample_count > 1)
|
|
|
|
fatal_error("Cannot upload data to a multisampled texture.\n");
|
|
|
|
|
2024-01-22 15:20:18 -08:00
|
|
|
for (unsigned int level = 0; level < params->level_count; ++level)
|
|
|
|
{
|
|
|
|
unsigned int level_width = get_level_dimension(params->width, level);
|
|
|
|
unsigned int level_height = get_level_dimension(params->height, level);
|
|
|
|
|
|
|
|
resource_data[level].pSysMem = ¶ms->data[buffer_offset];
|
|
|
|
resource_data[level].SysMemPitch = level_width * params->texel_size;
|
|
|
|
resource_data[level].SysMemSlicePitch = level_height * resource_data[level].SysMemPitch;
|
|
|
|
buffer_offset += resource_data[level].SysMemSlicePitch;
|
|
|
|
}
|
|
|
|
hr = ID3D11Device_CreateTexture2D(device, &desc, resource_data, &resource->texture);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
hr = ID3D11Device_CreateTexture2D(device, &desc, NULL, &resource->texture);
|
|
|
|
}
|
|
|
|
ok(hr == S_OK, "Failed to create texture, hr %#lx.\n", hr);
|
|
|
|
|
|
|
|
resource->resource = (ID3D11Resource *)resource->texture;
|
|
|
|
if (params->type == RESOURCE_TYPE_UAV)
|
|
|
|
hr = ID3D11Device_CreateUnorderedAccessView(device, resource->resource, NULL, &resource->uav);
|
|
|
|
else if (params->type == RESOURCE_TYPE_RENDER_TARGET)
|
|
|
|
hr = ID3D11Device_CreateRenderTargetView(device, resource->resource, NULL, &resource->rtv);
|
2024-04-14 17:33:15 -07:00
|
|
|
else if (params->type == RESOURCE_TYPE_DEPTH_STENCIL)
|
|
|
|
hr = ID3D11Device_CreateDepthStencilView(device, resource->resource, NULL, &resource->dsv);
|
2024-01-22 15:20:18 -08:00
|
|
|
else
|
|
|
|
hr = ID3D11Device_CreateShaderResourceView(device, resource->resource, NULL, &resource->srv);
|
|
|
|
ok(hr == S_OK, "Failed to create view, hr %#lx.\n", hr);
|
2024-04-09 20:51:06 -07:00
|
|
|
|
|
|
|
return true;
|
2024-01-22 15:20:18 -08:00
|
|
|
}
|
|
|
|
|
2024-01-23 15:26:11 -08:00
|
|
|
static void init_resource_srv_buffer(struct d3d11_shader_runner *runner, struct d3d11_resource *resource,
|
|
|
|
const struct resource_params *params)
|
|
|
|
{
|
|
|
|
D3D11_SHADER_RESOURCE_VIEW_DESC srv_desc;
|
|
|
|
ID3D11Device *device = runner->device;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2024-05-31 06:46:38 -07:00
|
|
|
resource->buffer = create_buffer(device, D3D11_BIND_SHADER_RESOURCE, params->data_size, params->is_raw,
|
|
|
|
params->stride, params->data);
|
2024-01-23 15:26:11 -08:00
|
|
|
resource->resource = (ID3D11Resource *)resource->buffer;
|
|
|
|
|
|
|
|
srv_desc.Format = params->format;
|
|
|
|
srv_desc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
|
|
|
srv_desc.Buffer.FirstElement = 0;
|
|
|
|
srv_desc.Buffer.NumElements = params->data_size / params->texel_size;
|
|
|
|
hr = ID3D11Device_CreateShaderResourceView(device, resource->resource, &srv_desc, &resource->srv);
|
|
|
|
ok(hr == S_OK, "Failed to create view, hr %#lx.\n", hr);
|
|
|
|
}
|
|
|
|
|
2024-01-22 15:20:18 -08:00
|
|
|
static void init_resource_uav_buffer(struct d3d11_shader_runner *runner, struct d3d11_resource *resource,
|
|
|
|
const struct resource_params *params)
|
|
|
|
{
|
|
|
|
D3D11_UNORDERED_ACCESS_VIEW_DESC uav_desc;
|
|
|
|
ID3D11Device *device = runner->device;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2024-05-31 06:46:38 -07:00
|
|
|
resource->buffer = create_buffer(device, D3D11_BIND_UNORDERED_ACCESS, params->data_size, params->is_raw,
|
|
|
|
params->stride, params->data);
|
2024-01-22 15:20:18 -08:00
|
|
|
resource->resource = (ID3D11Resource *)resource->buffer;
|
2024-03-12 23:36:59 -07:00
|
|
|
resource->is_uav_counter = params->is_uav_counter;
|
2024-01-22 15:20:18 -08:00
|
|
|
|
|
|
|
uav_desc.Format = params->format;
|
|
|
|
uav_desc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
|
|
|
|
uav_desc.Buffer.FirstElement = 0;
|
|
|
|
uav_desc.Buffer.NumElements = params->data_size / params->texel_size;
|
2024-05-31 06:46:38 -07:00
|
|
|
if (params->is_raw)
|
|
|
|
uav_desc.Buffer.Flags = D3D11_BUFFER_UAV_FLAG_RAW;
|
|
|
|
else if (params->is_uav_counter)
|
|
|
|
uav_desc.Buffer.Flags = D3D11_BUFFER_UAV_FLAG_COUNTER;
|
|
|
|
else
|
|
|
|
uav_desc.Buffer.Flags = 0;
|
2024-01-22 15:20:18 -08:00
|
|
|
hr = ID3D11Device_CreateUnorderedAccessView(device, resource->resource, &uav_desc, &resource->uav);
|
|
|
|
ok(hr == S_OK, "Failed to create view, hr %#lx.\n", hr);
|
|
|
|
}
|
|
|
|
|
2022-03-21 18:42:17 -07:00
|
|
|
static struct resource *d3d11_runner_create_resource(struct shader_runner *r, const struct resource_params *params)
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
2022-03-19 10:35:33 -07:00
|
|
|
struct d3d11_shader_runner *runner = d3d11_shader_runner(r);
|
|
|
|
ID3D11Device *device = runner->device;
|
2022-03-21 18:42:17 -07:00
|
|
|
struct d3d11_resource *resource;
|
2022-01-26 17:40:33 -08:00
|
|
|
|
2022-03-21 18:42:17 -07:00
|
|
|
resource = calloc(1, sizeof(*resource));
|
2022-06-08 16:18:35 -07:00
|
|
|
init_resource(&resource->r, params);
|
2022-01-26 17:40:33 -08:00
|
|
|
|
2022-03-21 18:42:17 -07:00
|
|
|
switch (params->type)
|
|
|
|
{
|
2022-06-08 16:18:37 -07:00
|
|
|
case RESOURCE_TYPE_RENDER_TARGET:
|
2024-04-14 17:33:15 -07:00
|
|
|
case RESOURCE_TYPE_DEPTH_STENCIL:
|
2022-03-21 18:42:17 -07:00
|
|
|
case RESOURCE_TYPE_TEXTURE:
|
2024-01-23 15:26:11 -08:00
|
|
|
if (params->dimension == RESOURCE_DIMENSION_BUFFER)
|
|
|
|
init_resource_srv_buffer(runner, resource, params);
|
2024-04-09 20:51:06 -07:00
|
|
|
else if (!init_resource_2d(runner, resource, params))
|
|
|
|
return NULL;
|
2022-03-21 18:42:17 -07:00
|
|
|
break;
|
2023-05-17 14:09:20 -07:00
|
|
|
|
2024-01-22 15:20:18 -08:00
|
|
|
case RESOURCE_TYPE_UAV:
|
|
|
|
if (params->dimension == RESOURCE_DIMENSION_BUFFER)
|
|
|
|
init_resource_uav_buffer(runner, resource, params);
|
2024-04-09 20:51:06 -07:00
|
|
|
else if (!init_resource_2d(runner, resource, params))
|
|
|
|
return NULL;
|
2023-05-17 14:09:20 -07:00
|
|
|
break;
|
|
|
|
|
2022-03-21 18:42:18 -07:00
|
|
|
case RESOURCE_TYPE_VERTEX_BUFFER:
|
2024-05-31 06:46:38 -07:00
|
|
|
resource->buffer = create_buffer(device, D3D11_BIND_VERTEX_BUFFER, params->data_size, params->is_raw,
|
|
|
|
params->stride, params->data);
|
2023-05-17 14:09:20 -07:00
|
|
|
resource->resource = (ID3D11Resource *)resource->buffer;
|
2022-03-21 18:42:18 -07:00
|
|
|
break;
|
2022-03-21 18:42:17 -07:00
|
|
|
}
|
2022-01-26 17:40:33 -08:00
|
|
|
|
2022-03-21 18:42:17 -07:00
|
|
|
return &resource->r;
|
2022-01-26 17:40:33 -08:00
|
|
|
}
|
|
|
|
|
2022-03-21 18:42:17 -07:00
|
|
|
static void d3d11_runner_destroy_resource(struct shader_runner *r, struct resource *res)
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
2022-03-21 18:42:17 -07:00
|
|
|
struct d3d11_resource *resource = d3d11_resource(res);
|
2022-01-26 17:40:33 -08:00
|
|
|
|
2022-03-21 18:42:18 -07:00
|
|
|
ID3D11Resource_Release(resource->resource);
|
2022-06-08 16:18:37 -07:00
|
|
|
if (resource->rtv)
|
|
|
|
ID3D11RenderTargetView_Release(resource->rtv);
|
2024-04-14 17:33:15 -07:00
|
|
|
if (resource->dsv)
|
|
|
|
ID3D11DepthStencilView_Release(resource->dsv);
|
2022-03-21 18:42:18 -07:00
|
|
|
if (resource->srv)
|
|
|
|
ID3D11ShaderResourceView_Release(resource->srv);
|
2022-06-08 16:18:35 -07:00
|
|
|
if (resource->uav)
|
|
|
|
ID3D11UnorderedAccessView_Release(resource->uav);
|
2022-03-21 18:42:17 -07:00
|
|
|
free(resource);
|
2022-01-26 17:40:33 -08:00
|
|
|
}
|
|
|
|
|
2021-08-13 14:37:31 -07:00
|
|
|
static ID3D11SamplerState *create_sampler(ID3D11Device *device, const struct sampler *sampler)
|
|
|
|
{
|
|
|
|
ID3D11SamplerState *d3d11_sampler;
|
|
|
|
D3D11_SAMPLER_DESC desc = {0};
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
/* Members of D3D11_FILTER are compatible with D3D12_FILTER. */
|
|
|
|
desc.Filter = (D3D11_FILTER)sampler->filter;
|
|
|
|
/* Members of D3D11_TEXTURE_ADDRESS_MODE are compatible with D3D12_TEXTURE_ADDRESS_MODE. */
|
|
|
|
desc.AddressU = (D3D11_TEXTURE_ADDRESS_MODE)sampler->u_address;
|
|
|
|
desc.AddressV = (D3D11_TEXTURE_ADDRESS_MODE)sampler->v_address;
|
|
|
|
desc.AddressW = (D3D11_TEXTURE_ADDRESS_MODE)sampler->w_address;
|
2024-02-22 18:30:16 -08:00
|
|
|
desc.ComparisonFunc = sampler->func;
|
2021-08-13 14:37:31 -07:00
|
|
|
desc.MaxLOD = D3D11_FLOAT32_MAX;
|
|
|
|
|
|
|
|
hr = ID3D11Device_CreateSamplerState(device, &desc, &d3d11_sampler);
|
|
|
|
ok(hr == S_OK, "Failed to create sampler state, hr %#lx.\n", hr);
|
|
|
|
return d3d11_sampler;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool d3d11_runner_dispatch(struct shader_runner *r, unsigned int x, unsigned int y, unsigned int z)
|
|
|
|
{
|
|
|
|
struct d3d11_shader_runner *runner = d3d11_shader_runner(r);
|
|
|
|
ID3D11DeviceContext *context = runner->immediate_context;
|
|
|
|
ID3D11Device *device = runner->device;
|
|
|
|
ID3D11ComputeShader *cs;
|
|
|
|
ID3D10Blob *cs_code;
|
|
|
|
HRESULT hr;
|
|
|
|
size_t i;
|
|
|
|
|
2023-07-12 22:41:14 -07:00
|
|
|
if (!(cs_code = compile_shader(runner, runner->r.cs_source, "cs")))
|
2021-08-13 14:37:31 -07:00
|
|
|
return false;
|
|
|
|
|
|
|
|
hr = ID3D11Device_CreateComputeShader(device, ID3D10Blob_GetBufferPointer(cs_code),
|
|
|
|
ID3D10Blob_GetBufferSize(cs_code), NULL, &cs);
|
|
|
|
ok(hr == S_OK, "Failed to create compute shader, hr %#lx.\n", hr);
|
|
|
|
|
|
|
|
if (runner->r.uniform_count)
|
|
|
|
{
|
|
|
|
ID3D11Buffer *cb;
|
|
|
|
|
|
|
|
cb = create_buffer(device, D3D11_BIND_CONSTANT_BUFFER,
|
2024-05-31 06:46:38 -07:00
|
|
|
runner->r.uniform_count * sizeof(*runner->r.uniforms), false, 0, runner->r.uniforms);
|
2021-08-13 14:37:31 -07:00
|
|
|
ID3D11DeviceContext_CSSetConstantBuffers(context, 0, 1, &cb);
|
|
|
|
ID3D11Buffer_Release(cb);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < runner->r.resource_count; ++i)
|
|
|
|
{
|
|
|
|
struct d3d11_resource *resource = d3d11_resource(runner->r.resources[i]);
|
|
|
|
|
|
|
|
switch (resource->r.type)
|
|
|
|
{
|
|
|
|
case RESOURCE_TYPE_TEXTURE:
|
|
|
|
ID3D11DeviceContext_CSSetShaderResources(context, resource->r.slot, 1, &resource->srv);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RESOURCE_TYPE_UAV:
|
|
|
|
ID3D11DeviceContext_CSSetUnorderedAccessViews(context, resource->r.slot, 1, &resource->uav, NULL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RESOURCE_TYPE_RENDER_TARGET:
|
2024-04-14 17:33:15 -07:00
|
|
|
case RESOURCE_TYPE_DEPTH_STENCIL:
|
2021-08-13 14:37:31 -07:00
|
|
|
case RESOURCE_TYPE_VERTEX_BUFFER:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < runner->r.sampler_count; ++i)
|
|
|
|
{
|
|
|
|
struct sampler *sampler = &runner->r.samplers[i];
|
|
|
|
ID3D11SamplerState *d3d11_sampler;
|
|
|
|
|
|
|
|
d3d11_sampler = create_sampler(device, sampler);
|
|
|
|
ID3D11DeviceContext_CSSetSamplers(context, sampler->slot, 1, &d3d11_sampler);
|
|
|
|
ID3D11SamplerState_Release(d3d11_sampler);
|
|
|
|
}
|
|
|
|
|
|
|
|
ID3D11DeviceContext_CSSetShader(context, cs, NULL, 0);
|
|
|
|
ID3D11DeviceContext_Dispatch(context, x, y, z);
|
|
|
|
|
|
|
|
ID3D11ComputeShader_Release(cs);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2024-04-14 17:33:15 -07:00
|
|
|
static void d3d11_runner_clear(struct shader_runner *r, struct resource *res, const struct vec4 *clear_value)
|
|
|
|
{
|
|
|
|
struct d3d11_shader_runner *runner = d3d11_shader_runner(r);
|
|
|
|
ID3D11DeviceContext *context = runner->immediate_context;
|
|
|
|
struct d3d11_resource *resource = d3d11_resource(res);
|
|
|
|
|
|
|
|
switch (resource->r.type)
|
|
|
|
{
|
2024-04-14 17:37:37 -07:00
|
|
|
case RESOURCE_TYPE_RENDER_TARGET:
|
|
|
|
ID3D11DeviceContext_ClearRenderTargetView(context, resource->rtv, (const float *)clear_value);
|
|
|
|
break;
|
|
|
|
|
2024-04-14 17:33:15 -07:00
|
|
|
case RESOURCE_TYPE_DEPTH_STENCIL:
|
|
|
|
ID3D11DeviceContext_ClearDepthStencilView(context, resource->dsv, D3D11_CLEAR_DEPTH, clear_value->x, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
fatal_error("Clears are not implemented for resource type %u.\n", resource->r.type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-14 03:52:32 -07:00
|
|
|
static bool d3d11_runner_draw(struct shader_runner *r,
|
2024-04-21 19:55:44 -07:00
|
|
|
D3D_PRIMITIVE_TOPOLOGY primitive_topology, unsigned int vertex_count, unsigned int instance_count)
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
2024-04-18 19:33:56 -07:00
|
|
|
ID3D10Blob *vs_code, *ps_code, *hs_code = NULL, *ds_code = NULL, *gs_code = NULL;
|
2022-06-08 16:18:35 -07:00
|
|
|
ID3D11UnorderedAccessView *uavs[D3D11_PS_CS_UAV_REGISTER_COUNT] = {0};
|
2022-06-08 16:18:37 -07:00
|
|
|
ID3D11RenderTargetView *rtvs[D3D11_PS_CS_UAV_REGISTER_COUNT] = {0};
|
2022-03-19 10:35:33 -07:00
|
|
|
struct d3d11_shader_runner *runner = d3d11_shader_runner(r);
|
2022-03-21 18:42:16 -07:00
|
|
|
ID3D11DeviceContext *context = runner->immediate_context;
|
2022-06-08 16:18:35 -07:00
|
|
|
unsigned int min_uav_slot = ARRAY_SIZE(uavs);
|
2024-04-14 17:33:15 -07:00
|
|
|
ID3D11DepthStencilState *ds_state = NULL;
|
|
|
|
D3D11_DEPTH_STENCIL_DESC ds_desc = {0};
|
2022-03-19 10:35:33 -07:00
|
|
|
ID3D11Device *device = runner->device;
|
2024-04-14 17:33:15 -07:00
|
|
|
ID3D11DepthStencilView *dsv = NULL;
|
2022-06-08 16:18:37 -07:00
|
|
|
unsigned int rtv_count = 0;
|
2024-04-18 19:33:56 -07:00
|
|
|
ID3D11GeometryShader *gs;
|
2022-01-26 17:40:33 -08:00
|
|
|
ID3D11Buffer *cb = NULL;
|
2022-03-21 18:42:15 -07:00
|
|
|
ID3D11VertexShader *vs;
|
2024-04-07 21:37:32 -07:00
|
|
|
ID3D11DomainShader *ds;
|
2022-01-26 17:40:33 -08:00
|
|
|
ID3D11PixelShader *ps;
|
2024-04-07 21:37:32 -07:00
|
|
|
ID3D11HullShader *hs;
|
|
|
|
bool succeeded;
|
2022-01-26 17:40:33 -08:00
|
|
|
unsigned int i;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2024-04-07 21:37:32 -07:00
|
|
|
vs_code = compile_shader(runner, runner->r.vs_source, "vs");
|
|
|
|
ps_code = compile_shader(runner, runner->r.ps_source, "ps");
|
|
|
|
succeeded = vs_code && ps_code;
|
2022-01-26 17:40:33 -08:00
|
|
|
|
2024-04-07 21:37:32 -07:00
|
|
|
if (runner->r.hs_source)
|
|
|
|
{
|
|
|
|
hs_code = compile_shader(runner, runner->r.hs_source, "hs");
|
|
|
|
succeeded = succeeded && hs_code;
|
|
|
|
}
|
|
|
|
if (runner->r.ds_source)
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
2024-04-07 21:37:32 -07:00
|
|
|
ds_code = compile_shader(runner, runner->r.ds_source, "ds");
|
|
|
|
succeeded = succeeded && ds_code;
|
|
|
|
}
|
2024-04-18 19:33:56 -07:00
|
|
|
if (runner->r.gs_source)
|
|
|
|
{
|
|
|
|
gs_code = compile_shader(runner, runner->r.gs_source, "gs");
|
|
|
|
succeeded = succeeded && gs_code;
|
|
|
|
}
|
2024-04-07 21:37:32 -07:00
|
|
|
|
|
|
|
if (!succeeded)
|
|
|
|
{
|
|
|
|
if (ps_code)
|
|
|
|
ID3D10Blob_Release(ps_code);
|
|
|
|
if (vs_code)
|
|
|
|
ID3D10Blob_Release(vs_code);
|
|
|
|
if (hs_code)
|
|
|
|
ID3D10Blob_Release(hs_code);
|
|
|
|
if (ds_code)
|
|
|
|
ID3D10Blob_Release(ds_code);
|
2024-04-18 19:33:56 -07:00
|
|
|
if (gs_code)
|
|
|
|
ID3D10Blob_Release(gs_code);
|
2022-04-14 03:52:32 -07:00
|
|
|
return false;
|
2022-01-26 17:40:33 -08:00
|
|
|
}
|
|
|
|
|
2022-03-21 18:42:15 -07:00
|
|
|
hr = ID3D11Device_CreateVertexShader(device, ID3D10Blob_GetBufferPointer(vs_code),
|
|
|
|
ID3D10Blob_GetBufferSize(vs_code), NULL, &vs);
|
|
|
|
ok(hr == S_OK, "Failed to create vertex shader, hr %#lx.\n", hr);
|
|
|
|
|
2022-01-26 17:40:33 -08:00
|
|
|
hr = ID3D11Device_CreatePixelShader(device, ID3D10Blob_GetBufferPointer(ps_code),
|
|
|
|
ID3D10Blob_GetBufferSize(ps_code), NULL, &ps);
|
|
|
|
ok(hr == S_OK, "Failed to create pixel shader, hr %#lx.\n", hr);
|
|
|
|
|
2024-04-07 21:37:32 -07:00
|
|
|
if (hs_code)
|
|
|
|
{
|
|
|
|
hr = ID3D11Device_CreateHullShader(device, ID3D10Blob_GetBufferPointer(hs_code),
|
|
|
|
ID3D10Blob_GetBufferSize(hs_code), NULL, &hs);
|
|
|
|
ok(hr == S_OK, "Failed to create hull shader, hr %#lx.\n", hr);
|
|
|
|
}
|
|
|
|
if (ds_code)
|
|
|
|
{
|
|
|
|
hr = ID3D11Device_CreateDomainShader(device, ID3D10Blob_GetBufferPointer(ds_code),
|
|
|
|
ID3D10Blob_GetBufferSize(ds_code), NULL, &ds);
|
|
|
|
ok(hr == S_OK, "Failed to create domain shader, hr %#lx.\n", hr);
|
|
|
|
}
|
2024-04-18 19:33:56 -07:00
|
|
|
if (gs_code)
|
|
|
|
{
|
|
|
|
hr = ID3D11Device_CreateGeometryShader(device, ID3D10Blob_GetBufferPointer(gs_code),
|
|
|
|
ID3D10Blob_GetBufferSize(gs_code), NULL, &gs);
|
|
|
|
ok(hr == S_OK, "Failed to create geometry shader, hr %#lx.\n", hr);
|
|
|
|
}
|
2024-04-07 21:37:32 -07:00
|
|
|
|
|
|
|
ID3D10Blob_Release(ps_code);
|
|
|
|
if (hs_code)
|
|
|
|
ID3D10Blob_Release(hs_code);
|
|
|
|
if (ds_code)
|
|
|
|
ID3D10Blob_Release(ds_code);
|
2024-04-18 19:33:56 -07:00
|
|
|
if (gs_code)
|
|
|
|
ID3D10Blob_Release(gs_code);
|
2024-04-07 21:37:32 -07:00
|
|
|
|
2022-03-19 10:35:33 -07:00
|
|
|
if (runner->r.uniform_count)
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
|
|
|
cb = create_buffer(device, D3D11_BIND_CONSTANT_BUFFER,
|
2024-05-31 06:46:38 -07:00
|
|
|
runner->r.uniform_count * sizeof(*runner->r.uniforms), false, 0, runner->r.uniforms);
|
2024-02-26 15:02:39 -08:00
|
|
|
ID3D11DeviceContext_VSSetConstantBuffers(context, 0, 1, &cb);
|
2022-03-21 18:42:16 -07:00
|
|
|
ID3D11DeviceContext_PSSetConstantBuffers(context, 0, 1, &cb);
|
2024-04-07 21:37:32 -07:00
|
|
|
if (hs_code)
|
|
|
|
ID3D11DeviceContext_HSSetConstantBuffers(context, 0, 1, &cb);
|
|
|
|
if (ds_code)
|
|
|
|
ID3D11DeviceContext_DSSetConstantBuffers(context, 0, 1, &cb);
|
2024-04-18 19:33:56 -07:00
|
|
|
if (gs_code)
|
|
|
|
ID3D11DeviceContext_GSSetConstantBuffers(context, 0, 1, &cb);
|
2022-01-26 17:40:33 -08:00
|
|
|
}
|
|
|
|
|
2022-03-21 18:42:17 -07:00
|
|
|
for (i = 0; i < runner->r.resource_count; ++i)
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
2022-03-21 18:42:17 -07:00
|
|
|
struct d3d11_resource *resource = d3d11_resource(runner->r.resources[i]);
|
2022-03-21 18:42:18 -07:00
|
|
|
unsigned int stride = get_vb_stride(&runner->r, resource->r.slot);
|
|
|
|
unsigned int offset = 0;
|
2022-01-26 17:40:33 -08:00
|
|
|
|
2022-03-21 18:42:17 -07:00
|
|
|
switch (resource->r.type)
|
|
|
|
{
|
2022-06-08 16:18:37 -07:00
|
|
|
case RESOURCE_TYPE_RENDER_TARGET:
|
|
|
|
rtvs[resource->r.slot] = resource->rtv;
|
|
|
|
rtv_count = max(rtv_count, resource->r.slot + 1);
|
|
|
|
break;
|
|
|
|
|
2024-04-14 17:33:15 -07:00
|
|
|
case RESOURCE_TYPE_DEPTH_STENCIL:
|
|
|
|
dsv = resource->dsv;
|
|
|
|
ds_desc.DepthEnable = TRUE;
|
|
|
|
ds_desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
|
|
|
|
ds_desc.DepthFunc = runner->r.depth_func;
|
|
|
|
hr = ID3D11Device_CreateDepthStencilState(device, &ds_desc, &ds_state);
|
|
|
|
ok(hr == S_OK, "Failed to create depth/stencil state, hr %#lx.\n", hr);
|
|
|
|
ID3D11DeviceContext_OMSetDepthStencilState(context, ds_state, 0);
|
|
|
|
break;
|
|
|
|
|
2022-03-21 18:42:17 -07:00
|
|
|
case RESOURCE_TYPE_TEXTURE:
|
|
|
|
ID3D11DeviceContext_PSSetShaderResources(context, resource->r.slot, 1, &resource->srv);
|
|
|
|
break;
|
2022-03-21 18:42:18 -07:00
|
|
|
|
2022-06-08 16:18:35 -07:00
|
|
|
case RESOURCE_TYPE_UAV:
|
|
|
|
uavs[resource->r.slot] = resource->uav;
|
|
|
|
min_uav_slot = min(min_uav_slot, resource->r.slot);
|
|
|
|
break;
|
|
|
|
|
2022-03-21 18:42:18 -07:00
|
|
|
case RESOURCE_TYPE_VERTEX_BUFFER:
|
|
|
|
ID3D11DeviceContext_IASetVertexBuffers(context, resource->r.slot, 1,
|
|
|
|
(ID3D11Buffer **)&resource->resource, &stride, &offset);
|
|
|
|
break;
|
2022-03-21 18:42:17 -07:00
|
|
|
}
|
2022-01-26 17:40:33 -08:00
|
|
|
}
|
|
|
|
|
2024-04-14 17:33:15 -07:00
|
|
|
ID3D11DeviceContext_OMSetRenderTargetsAndUnorderedAccessViews(context, rtv_count, rtvs, dsv,
|
2022-06-08 16:18:35 -07:00
|
|
|
min_uav_slot, ARRAY_SIZE(uavs) - min_uav_slot, &uavs[min_uav_slot], NULL);
|
|
|
|
|
2022-03-19 10:35:33 -07:00
|
|
|
for (i = 0; i < runner->r.sampler_count; ++i)
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
2022-03-19 10:35:33 -07:00
|
|
|
struct sampler *sampler = &runner->r.samplers[i];
|
2022-01-26 17:40:33 -08:00
|
|
|
ID3D11SamplerState *d3d11_sampler;
|
2021-08-13 14:37:31 -07:00
|
|
|
|
|
|
|
d3d11_sampler = create_sampler(device, sampler);
|
2022-03-21 18:42:16 -07:00
|
|
|
ID3D11DeviceContext_PSSetSamplers(context, sampler->slot, 1, &d3d11_sampler);
|
2022-01-26 17:40:33 -08:00
|
|
|
ID3D11SamplerState_Release(d3d11_sampler);
|
|
|
|
}
|
|
|
|
|
2022-03-21 18:42:16 -07:00
|
|
|
if (runner->r.input_element_count)
|
|
|
|
{
|
|
|
|
D3D11_INPUT_ELEMENT_DESC *descs;
|
|
|
|
ID3D11InputLayout *input_layout;
|
|
|
|
|
|
|
|
descs = calloc(runner->r.input_element_count, sizeof(*descs));
|
|
|
|
for (i = 0; i < runner->r.input_element_count; ++i)
|
|
|
|
{
|
|
|
|
const struct input_element *element = &runner->r.input_elements[i];
|
|
|
|
D3D11_INPUT_ELEMENT_DESC *desc = &descs[i];
|
|
|
|
|
|
|
|
desc->SemanticName = element->name;
|
|
|
|
desc->SemanticIndex = element->index;
|
|
|
|
desc->Format = element->format;
|
|
|
|
desc->InputSlot = element->slot;
|
|
|
|
desc->AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
|
|
|
|
desc->InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = ID3D11Device_CreateInputLayout(device, descs, runner->r.input_element_count,
|
|
|
|
ID3D10Blob_GetBufferPointer(vs_code), ID3D10Blob_GetBufferSize(vs_code), &input_layout);
|
|
|
|
ok(hr == S_OK, "Failed to create input layout, hr %#lx.\n", hr);
|
|
|
|
ID3D11DeviceContext_IASetInputLayout(context, input_layout);
|
|
|
|
ID3D11InputLayout_Release(input_layout);
|
|
|
|
}
|
|
|
|
|
2024-04-07 21:37:32 -07:00
|
|
|
ID3D10Blob_Release(vs_code);
|
|
|
|
|
2024-04-03 22:00:26 -07:00
|
|
|
if (r->sample_mask)
|
|
|
|
ID3D11DeviceContext_OMSetBlendState(context, NULL, NULL, r->sample_mask);
|
2022-03-21 18:42:20 -07:00
|
|
|
ID3D11DeviceContext_IASetPrimitiveTopology(context, primitive_topology);
|
2022-03-21 18:42:16 -07:00
|
|
|
ID3D11DeviceContext_VSSetShader(context, vs, NULL, 0);
|
|
|
|
ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0);
|
2024-04-07 21:37:32 -07:00
|
|
|
if (hs_code)
|
|
|
|
ID3D11DeviceContext_HSSetShader(context, hs, NULL, 0);
|
|
|
|
if (ds_code)
|
|
|
|
ID3D11DeviceContext_DSSetShader(context, ds, NULL, 0);
|
2024-04-18 19:33:56 -07:00
|
|
|
if (gs_code)
|
|
|
|
ID3D11DeviceContext_GSSetShader(context, gs, NULL, 0);
|
2023-04-10 11:45:15 -07:00
|
|
|
ID3D11DeviceContext_RSSetState(context, runner->rasterizer_state);
|
2022-01-26 17:40:33 -08:00
|
|
|
|
2024-04-21 19:55:44 -07:00
|
|
|
ID3D11DeviceContext_DrawInstanced(context, vertex_count, instance_count, 0, 0);
|
2022-01-26 17:40:33 -08:00
|
|
|
|
|
|
|
ID3D11PixelShader_Release(ps);
|
2022-03-21 18:42:15 -07:00
|
|
|
ID3D11VertexShader_Release(vs);
|
2024-04-07 21:37:32 -07:00
|
|
|
if (hs_code)
|
|
|
|
ID3D11HullShader_Release(hs);
|
|
|
|
if (ds_code)
|
|
|
|
ID3D11DomainShader_Release(ds);
|
2024-04-18 19:33:56 -07:00
|
|
|
if (gs_code)
|
|
|
|
ID3D11GeometryShader_Release(gs);
|
2022-01-26 17:40:33 -08:00
|
|
|
if (cb)
|
|
|
|
ID3D11Buffer_Release(cb);
|
2024-04-14 17:33:15 -07:00
|
|
|
if (ds_state)
|
|
|
|
ID3D11DepthStencilState_Release(ds_state);
|
2022-04-14 03:52:32 -07:00
|
|
|
|
|
|
|
return true;
|
2022-01-26 17:40:33 -08:00
|
|
|
}
|
|
|
|
|
2022-05-17 06:45:38 -07:00
|
|
|
struct d3d11_resource_readback
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
2022-05-17 06:45:38 -07:00
|
|
|
struct resource_readback rb;
|
2022-01-26 17:40:33 -08:00
|
|
|
ID3D11Resource *resource;
|
|
|
|
};
|
|
|
|
|
2022-06-08 16:18:37 -07:00
|
|
|
static struct resource_readback *d3d11_runner_get_resource_readback(struct shader_runner *r, struct resource *res)
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
2022-05-17 06:45:41 -07:00
|
|
|
struct d3d11_shader_runner *runner = d3d11_shader_runner(r);
|
|
|
|
struct d3d11_resource_readback *rb = malloc(sizeof(*rb));
|
2024-04-09 20:51:06 -07:00
|
|
|
ID3D11Resource *resolved_resource = NULL, *src_resource;
|
2022-06-08 16:18:37 -07:00
|
|
|
struct d3d11_resource *resource = d3d11_resource(res);
|
2022-01-26 17:40:33 -08:00
|
|
|
D3D11_TEXTURE2D_DESC texture_desc;
|
2022-05-17 06:45:38 -07:00
|
|
|
D3D11_MAPPED_SUBRESOURCE map_desc;
|
2023-05-17 14:09:20 -07:00
|
|
|
D3D11_BUFFER_DESC buffer_desc;
|
2024-04-09 20:51:06 -07:00
|
|
|
bool is_ms = false;
|
2022-01-26 17:40:33 -08:00
|
|
|
HRESULT hr;
|
|
|
|
|
2024-04-09 20:51:06 -07:00
|
|
|
src_resource = resource->resource;
|
2023-05-17 14:09:20 -07:00
|
|
|
switch (resource->r.type)
|
|
|
|
{
|
|
|
|
case RESOURCE_TYPE_RENDER_TARGET:
|
2024-04-14 17:33:15 -07:00
|
|
|
case RESOURCE_TYPE_DEPTH_STENCIL:
|
2023-05-17 14:09:20 -07:00
|
|
|
case RESOURCE_TYPE_UAV:
|
2024-01-22 15:20:18 -08:00
|
|
|
if (resource->r.dimension == RESOURCE_DIMENSION_BUFFER)
|
|
|
|
{
|
|
|
|
ID3D11Buffer_GetDesc(resource->buffer, &buffer_desc);
|
|
|
|
buffer_desc.Usage = D3D11_USAGE_STAGING;
|
|
|
|
buffer_desc.BindFlags = 0;
|
|
|
|
buffer_desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
|
|
|
|
buffer_desc.MiscFlags = 0;
|
|
|
|
hr = ID3D11Device_CreateBuffer(runner->device, &buffer_desc, NULL, (ID3D11Buffer **)&rb->resource);
|
|
|
|
ok(hr == S_OK, "Failed to create buffer, hr %#lx.\n", hr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ID3D11Texture2D_GetDesc(resource->texture, &texture_desc);
|
2024-04-09 20:51:06 -07:00
|
|
|
is_ms = texture_desc.SampleDesc.Count > 1;
|
|
|
|
texture_desc.SampleDesc.Count = 1;
|
|
|
|
texture_desc.SampleDesc.Quality = 0;
|
2024-01-22 15:20:18 -08:00
|
|
|
texture_desc.Usage = D3D11_USAGE_STAGING;
|
|
|
|
texture_desc.BindFlags = 0;
|
|
|
|
texture_desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
|
|
|
|
texture_desc.MiscFlags = 0;
|
|
|
|
hr = ID3D11Device_CreateTexture2D(runner->device, &texture_desc, NULL, (ID3D11Texture2D **)&rb->resource);
|
|
|
|
ok(hr == S_OK, "Failed to create texture, hr %#lx.\n", hr);
|
2024-04-09 20:51:06 -07:00
|
|
|
if (is_ms)
|
|
|
|
{
|
|
|
|
texture_desc.Usage = D3D11_USAGE_DEFAULT;
|
|
|
|
hr = ID3D11Device_CreateTexture2D(runner->device, &texture_desc, NULL,
|
|
|
|
(ID3D11Texture2D **)&resolved_resource);
|
|
|
|
ok(hr == S_OK, "Failed to create multisampled texture, hr %#lx.\n", hr);
|
|
|
|
ID3D11DeviceContext_ResolveSubresource(runner->immediate_context, resolved_resource, 0,
|
|
|
|
resource->resource, 0, texture_desc.Format);
|
|
|
|
src_resource = resolved_resource;
|
|
|
|
}
|
2024-01-22 15:20:18 -08:00
|
|
|
}
|
2023-05-17 14:09:20 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RESOURCE_TYPE_VERTEX_BUFFER:
|
|
|
|
case RESOURCE_TYPE_TEXTURE:
|
|
|
|
assert(0);
|
|
|
|
}
|
2022-01-26 17:40:33 -08:00
|
|
|
|
2024-03-12 23:36:59 -07:00
|
|
|
if (resource->is_uav_counter)
|
|
|
|
ID3D11DeviceContext_CopyStructureCount(runner->immediate_context, (ID3D11Buffer *)rb->resource, 0, resource->uav);
|
|
|
|
else
|
2024-04-09 20:51:06 -07:00
|
|
|
ID3D11DeviceContext_CopyResource(runner->immediate_context, rb->resource, src_resource);
|
2022-05-17 06:45:38 -07:00
|
|
|
hr = ID3D11DeviceContext_Map(runner->immediate_context, rb->resource, 0, D3D11_MAP_READ, 0, &map_desc);
|
2022-01-26 17:40:33 -08:00
|
|
|
ok(hr == S_OK, "Failed to map texture, hr %#lx.\n", hr);
|
2022-05-17 06:45:38 -07:00
|
|
|
|
2024-04-09 20:51:06 -07:00
|
|
|
if (resolved_resource)
|
|
|
|
ID3D11Resource_Release(resolved_resource);
|
|
|
|
|
2022-05-17 06:45:38 -07:00
|
|
|
rb->rb.data = map_desc.pData;
|
|
|
|
rb->rb.row_pitch = map_desc.RowPitch;
|
2023-05-17 14:09:20 -07:00
|
|
|
rb->rb.width = resource->r.width;
|
|
|
|
rb->rb.height = resource->r.height;
|
2022-05-17 06:45:38 -07:00
|
|
|
rb->rb.depth = 1;
|
2022-05-17 06:45:41 -07:00
|
|
|
return &rb->rb;
|
2022-01-26 17:40:33 -08:00
|
|
|
}
|
|
|
|
|
2022-05-17 06:45:41 -07:00
|
|
|
static void d3d11_runner_release_readback(struct shader_runner *r, struct resource_readback *rb)
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
2022-05-17 06:45:41 -07:00
|
|
|
struct d3d11_resource_readback *d3d11_rb = CONTAINING_RECORD(rb, struct d3d11_resource_readback, rb);
|
2022-03-19 10:35:33 -07:00
|
|
|
struct d3d11_shader_runner *runner = d3d11_shader_runner(r);
|
2022-01-26 17:40:33 -08:00
|
|
|
|
2022-05-17 06:45:41 -07:00
|
|
|
ID3D11DeviceContext_Unmap(runner->immediate_context, d3d11_rb->resource, 0);
|
|
|
|
ID3D11Resource_Release(d3d11_rb->resource);
|
|
|
|
free(d3d11_rb);
|
2022-01-26 17:40:33 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct shader_runner_ops d3d11_runner_ops =
|
|
|
|
{
|
2022-03-21 18:42:17 -07:00
|
|
|
.create_resource = d3d11_runner_create_resource,
|
|
|
|
.destroy_resource = d3d11_runner_destroy_resource,
|
2021-08-13 14:37:31 -07:00
|
|
|
.dispatch = d3d11_runner_dispatch,
|
2024-04-14 17:33:15 -07:00
|
|
|
.clear = d3d11_runner_clear,
|
2022-03-21 18:42:19 -07:00
|
|
|
.draw = d3d11_runner_draw,
|
2022-06-08 16:18:37 -07:00
|
|
|
.get_resource_readback = d3d11_runner_get_resource_readback,
|
2022-05-17 06:45:41 -07:00
|
|
|
.release_readback = d3d11_runner_release_readback,
|
2022-01-26 17:40:33 -08:00
|
|
|
};
|
|
|
|
|
2023-02-21 15:46:36 -08:00
|
|
|
void run_shader_tests_d3d11(void)
|
2022-01-26 17:40:33 -08:00
|
|
|
{
|
2022-03-19 10:35:33 -07:00
|
|
|
struct d3d11_shader_runner runner;
|
2022-01-26 17:40:33 -08:00
|
|
|
HMODULE dxgi_module, d3d11_module;
|
|
|
|
|
|
|
|
d3d11_module = LoadLibraryA("d3d11.dll");
|
|
|
|
dxgi_module = LoadLibraryA("dxgi.dll");
|
|
|
|
if (d3d11_module && dxgi_module)
|
|
|
|
{
|
|
|
|
pCreateDXGIFactory1 = (void *)GetProcAddress(dxgi_module, "CreateDXGIFactory1");
|
|
|
|
pD3D11CreateDevice = (void *)GetProcAddress(d3d11_module, "D3D11CreateDevice");
|
|
|
|
|
|
|
|
init_adapter_info();
|
2022-04-22 11:56:30 -07:00
|
|
|
if (init_test_context(&runner))
|
|
|
|
{
|
2024-02-19 07:47:11 -08:00
|
|
|
run_shader_tests(&runner.r, &runner.caps, &d3d11_runner_ops, NULL);
|
2022-04-22 11:56:30 -07:00
|
|
|
destroy_test_context(&runner);
|
|
|
|
}
|
2022-01-26 17:40:33 -08:00
|
|
|
}
|
|
|
|
FreeLibrary(d3d11_module);
|
|
|
|
FreeLibrary(dxgi_module);
|
|
|
|
}
|
2023-01-18 04:53:51 -08:00
|
|
|
|
|
|
|
#endif
|