[PATCH v2 2/3] d3dcompiler/tests: Port some tests to shader model 4.
Zebediah Figura
z.figura12 at gmail.com
Tue Feb 18 14:31:26 CST 2020
In particular, port those for which there is an interesting difference in
code generation.
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
It might make more sense to put this in a separate file, à la ddraw, since
almost no code is shared between d3d9 and d3d11 parts.
dlls/d3dcompiler_43/tests/hlsl.c | 484 ++++++++++++++++++++++++++++++-
1 file changed, 468 insertions(+), 16 deletions(-)
diff --git a/dlls/d3dcompiler_43/tests/hlsl.c b/dlls/d3dcompiler_43/tests/hlsl.c
index 9114ec98e1d..5cb64253e88 100644
--- a/dlls/d3dcompiler_43/tests/hlsl.c
+++ b/dlls/d3dcompiler_43/tests/hlsl.c
@@ -20,6 +20,7 @@
#include "wine/test.h"
#include "d3dx9.h"
#include "d3dcompiler.h"
+#include "d3d11.h"
#include <math.h>
@@ -27,6 +28,10 @@ static pD3DCompile ppD3DCompile;
static HRESULT (WINAPI *pD3DXGetShaderConstantTable)(const DWORD *byte_code, ID3DXConstantTable **constant_table);
+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);
+
struct vec2
{
float x, y;
@@ -568,63 +573,68 @@ static void test_fail(void)
{
static const char *tests[] =
{
- "float4 test(float2 pos: TEXCOORD0) : COLOR\n"
+ "float4 test() : SV_TARGET\n"
"{\n"
" return y;\n"
"}",
- "float4 test(float2 pos: TEXCOORD0) : COLOR\n"
+ "float4 test() : SV_TARGET\n"
"{\n"
" float4 x = float4(0, 0, 0, 0);\n"
" x.xzzx = float4(1, 2, 3, 4);\n"
" return x;\n"
"}",
- "float4 test(float2 pos: TEXCOORD0) : COLOR\n"
+ "float4 test(float2 pos: TEXCOORD0) : SV_TARGET\n"
"{\n"
" float4 x = pos;\n"
" return x;\n"
"}",
- "float4 test(float2 pos, TEXCOORD0) ; COLOR\n"
+ "float4 test(float2 pos, TEXCOORD0) ; SV_TARGET\n"
"{\n"
" pos = float4 x;\n"
" mul(float4(5, 4, 3, 2), mvp) = x;\n"
" return float4;\n"
"}",
- "float4 563r(float2 45s: TEXCOORD0) : COLOR\n"
+ "float4 563r(float2 45s: TEXCOORD0) : SV_TARGET\n"
"{\n"
" float2 x = 45s;\n"
" return float4(x.x, x.y, 0, 0);\n"
"}",
- "float4 test(float2 pos: TEXCOORD0) : COLOR\n"
+ "float4 test() : SV_TARGET\n"
"{\n"
" struct { int b,c; } x = {0};\n"
" return y;\n"
"}",
- "float4 test(float2 pos: TEXCOORD0) : COLOR\n"
+ "float4 test() : SV_TARGET\n"
"{\n"
" struct {} x = {};\n"
" return y;\n"
"}",
};
+ static const char *targets[] = {"ps_2_0", "ps_3_0", "ps_4_0"};
+
ID3D10Blob *compiled, *errors;
- unsigned int i;
+ unsigned int i, j;
HRESULT hr;
- for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ for (j = 0; j < ARRAY_SIZE(targets); ++j)
{
- compiled = errors = NULL;
- hr = ppD3DCompile(tests[i], strlen(tests[i]), NULL, NULL, NULL, "test", "ps_2_0", 0, 0, &compiled, &errors);
- todo_wine ok(hr == E_FAIL, "Test %u, got unexpected hr %#x.\n", i, hr);
- todo_wine_if (i == 1) ok(!!errors, "Test %u, expected non-NULL error blob.\n", i);
- ok(!compiled, "Test %u, expected no compiled shader blob.\n", i);
- if (errors)
- ID3D10Blob_Release(errors);
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ compiled = errors = NULL;
+ hr = ppD3DCompile(tests[i], strlen(tests[i]), NULL, NULL, NULL, "test", targets[j], 0, 0, &compiled, &errors);
+ todo_wine ok(hr == E_FAIL, "Test %u, target %s, got unexpected hr %#x.\n", i, targets[j], hr);
+ todo_wine_if (i == 1) ok(!!errors, "Test %u, target %s, expected non-NULL error blob.\n", i, targets[j]);
+ ok(!compiled, "Test %u, target %s, expected no compiled shader blob.\n", i, targets[j]);
+ if (errors)
+ ID3D10Blob_Release(errors);
+ }
}
}
@@ -642,6 +652,436 @@ static BOOL load_d3dcompiler(void)
return TRUE;
}
+struct d3d11_test_context
+{
+ ID3D11Device *device;
+ HWND window;
+ IDXGISwapChain *swapchain;
+ ID3D11Texture2D *rt;
+ ID3D11RenderTargetView *rtv;
+ ID3D11DeviceContext *immediate_context;
+
+ ID3D11InputLayout *input_layout;
+ ID3D11VertexShader *vs;
+ const DWORD *vs_code;
+ ID3D11Buffer *vs_cb;
+ ID3D11Buffer *vb;
+
+ ID3D11PixelShader *ps;
+ ID3D11Buffer *ps_cb;
+};
+
+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,
+ };
+ ID3D11Device *device;
+
+ if (SUCCEEDED(pD3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0,
+ feature_level, ARRAY_SIZE(feature_level), D3D11_SDK_VERSION, &device, NULL, NULL)))
+ return device;
+ if (SUCCEEDED(pD3D11CreateDevice(NULL, D3D_DRIVER_TYPE_WARP, NULL, 0,
+ feature_level, ARRAY_SIZE(feature_level), D3D11_SDK_VERSION, &device, NULL, NULL)))
+ return device;
+ if (SUCCEEDED(pD3D11CreateDevice(NULL, D3D_DRIVER_TYPE_REFERENCE, NULL, 0,
+ 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(SUCCEEDED(hr), "Failed to get DXGI device, hr %#x.\n", hr);
+ hr = IDXGIDevice_GetAdapter(dxgi_device, &adapter);
+ ok(SUCCEEDED(hr), "Failed to get adapter, hr %#x.\n", hr);
+ IDXGIDevice_Release(dxgi_device);
+ hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory);
+ ok(SUCCEEDED(hr), "Failed to get factory, hr %#x.\n", hr);
+ IDXGIAdapter_Release(adapter);
+
+ dxgi_desc.BufferDesc.Width = 640;
+ dxgi_desc.BufferDesc.Height = 480;
+ 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(SUCCEEDED(hr), "Failed to create swapchain, hr %#x.\n", hr);
+ IDXGIFactory_Release(factory);
+
+ return swapchain;
+}
+
+#define init_d3d11_test_context(a) init_d3d11_test_context_(__LINE__, a)
+static BOOL init_d3d11_test_context_(unsigned int line, struct d3d11_test_context *context)
+{
+ const D3D11_TEXTURE2D_DESC texture_desc =
+ {
+ .Width = 640,
+ .Height = 480,
+ .MipLevels = 1,
+ .ArraySize = 1,
+ .Format = DXGI_FORMAT_R32G32B32A32_FLOAT,
+ .SampleDesc.Count = 1,
+ .Usage = D3D11_USAGE_DEFAULT,
+ .BindFlags = D3D11_BIND_RENDER_TARGET,
+ };
+ unsigned int rt_width, rt_height;
+ D3D11_VIEWPORT vp;
+ HRESULT hr;
+ RECT rect;
+
+ memset(context, 0, sizeof(*context));
+
+ if (!(context->device = create_device()))
+ {
+ skip_(__FILE__, line)("Failed to create device.\n");
+ return FALSE;
+ }
+
+ rt_width = 640;
+ rt_height = 480;
+ SetRect(&rect, 0, 0, rt_width, rt_height);
+ AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW | WS_VISIBLE, FALSE);
+ context->window = CreateWindowA("static", "d3d11_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ 0, 0, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, NULL, NULL);
+ context->swapchain = create_swapchain(context->device, context->window);
+
+ hr = ID3D11Device_CreateTexture2D(context->device, &texture_desc, NULL, &context->rt);
+ ok_(__FILE__, line)(hr == S_OK, "Failed to create texture, hr %#x.\n", hr);
+
+ hr = ID3D11Device_CreateRenderTargetView(context->device, (ID3D11Resource *)context->rt, NULL, &context->rtv);
+ ok_(__FILE__, line)(hr == S_OK, "Failed to create rendertarget view, hr %#x.\n", hr);
+
+ ID3D11Device_GetImmediateContext(context->device, &context->immediate_context);
+
+ ID3D11DeviceContext_OMSetRenderTargets(context->immediate_context, 1, &context->rtv, NULL);
+
+ vp.TopLeftX = 0.0f;
+ vp.TopLeftY = 0.0f;
+ vp.Width = rt_width;
+ vp.Height = rt_height;
+ vp.MinDepth = 0.0f;
+ vp.MaxDepth = 1.0f;
+ ID3D11DeviceContext_RSSetViewports(context->immediate_context, 1, &vp);
+
+ return TRUE;
+}
+
+#define release_d3d11_test_context(context) release_d3d11_test_context_(__LINE__, context)
+static void release_d3d11_test_context_(unsigned int line, struct d3d11_test_context *context)
+{
+ ULONG ref;
+
+ if (context->input_layout)
+ ID3D11InputLayout_Release(context->input_layout);
+ if (context->vs)
+ ID3D11VertexShader_Release(context->vs);
+ if (context->vs_cb)
+ ID3D11Buffer_Release(context->vs_cb);
+ if (context->vb)
+ ID3D11Buffer_Release(context->vb);
+ if (context->ps)
+ ID3D11PixelShader_Release(context->ps);
+ if (context->ps_cb)
+ ID3D11Buffer_Release(context->ps_cb);
+
+ ID3D11DeviceContext_Release(context->immediate_context);
+ ID3D11RenderTargetView_Release(context->rtv);
+ ID3D11Texture2D_Release(context->rt);
+ IDXGISwapChain_Release(context->swapchain);
+ DestroyWindow(context->window);
+
+ ref = ID3D11Device_Release(context->device);
+ ok_(__FILE__, line)(!ref, "Device has %u references left.\n", ref);
+}
+
+#define create_buffer(a, b, c, d) create_buffer_(__LINE__, a, b, c, d)
+static ID3D11Buffer *create_buffer_(unsigned int line, ID3D11Device *device,
+ unsigned int bind_flags, unsigned int size, const void *data)
+{
+ D3D11_SUBRESOURCE_DATA resource_data = {.pSysMem = data};
+ D3D11_BUFFER_DESC buffer_desc =
+ {
+ .ByteWidth = size,
+ .Usage = D3D11_USAGE_DEFAULT,
+ .BindFlags = bind_flags,
+ };
+ ID3D11Buffer *buffer;
+ HRESULT hr;
+
+ hr = ID3D11Device_CreateBuffer(device, &buffer_desc, data ? &resource_data : NULL, &buffer);
+ ok_(__FILE__, line)(hr == S_OK, "Failed to create buffer, hr %#x.\n", hr);
+ return buffer;
+}
+
+#define draw_quad_d3d11(context, ps_code) draw_quad_d3d11_(__LINE__, context, ps_code)
+static void draw_quad_d3d11_(unsigned int line, struct d3d11_test_context *context, ID3D10Blob *ps_code)
+{
+ static const D3D11_INPUT_ELEMENT_DESC default_layout_desc[] =
+ {
+ {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
+ };
+
+ static const char vs_source[] =
+ "float4 main(float4 position : POSITION) : SV_POSITION\n"
+ "{\n"
+ " return position;\n"
+ "}";
+
+ static const struct vec2 quad[] =
+ {
+ {-1.0f, -1.0f},
+ {-1.0f, 1.0f},
+ { 1.0f, -1.0f},
+ { 1.0f, 1.0f},
+ };
+
+ ID3D11Device *device = context->device;
+ unsigned int stride, offset;
+ ID3D11PixelShader *ps;
+ HRESULT hr;
+
+ if (!context->vs)
+ {
+ ID3D10Blob *vs_code = compile_shader_(line, vs_source, "vs_4_0");
+
+ hr = ID3D11Device_CreateInputLayout(device, default_layout_desc, ARRAY_SIZE(default_layout_desc),
+ ID3D10Blob_GetBufferPointer(vs_code), ID3D10Blob_GetBufferSize(vs_code), &context->input_layout);
+ ok_(__FILE__, line)(hr == S_OK, "Failed to create input layout, hr %#x.\n", hr);
+
+ hr = ID3D11Device_CreateVertexShader(device, ID3D10Blob_GetBufferPointer(vs_code),
+ ID3D10Blob_GetBufferSize(vs_code), NULL, &context->vs);
+ ok_(__FILE__, line)(hr == S_OK, "Failed to create vertex shader, hr %#x.\n", hr);
+ }
+
+ if (!context->vb)
+ context->vb = create_buffer_(line, device, D3D11_BIND_VERTEX_BUFFER, sizeof(quad), quad);
+
+ hr = ID3D11Device_CreatePixelShader(device, ID3D10Blob_GetBufferPointer(ps_code),
+ ID3D10Blob_GetBufferSize(ps_code), NULL, &ps);
+ ok_(__FILE__, line)(hr == S_OK, "Failed to create pixel shader, hr %#x.\n", hr);
+
+ ID3D11DeviceContext_IASetInputLayout(context->immediate_context, context->input_layout);
+ ID3D11DeviceContext_IASetPrimitiveTopology(context->immediate_context, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
+ stride = sizeof(*quad);
+ offset = 0;
+ ID3D11DeviceContext_IASetVertexBuffers(context->immediate_context, 0, 1, &context->vb, &stride, &offset);
+ ID3D11DeviceContext_VSSetShader(context->immediate_context, context->vs, NULL, 0);
+ ID3D11DeviceContext_PSSetShader(context->immediate_context, ps, NULL, 0);
+
+ ID3D11DeviceContext_Draw(context->immediate_context, 4, 0);
+
+ ID3D11PixelShader_Release(ps);
+}
+
+#define get_readback_vec4_d3d11(context, x, y) get_readback_vec4_d3d11_(__LINE__, context, x, y)
+static struct vec4 get_readback_vec4_d3d11_(unsigned int line, struct d3d11_test_context *context,
+ unsigned int x, unsigned int y)
+{
+ ID3D11Device *device = context->device;
+ D3D11_MAPPED_SUBRESOURCE map_desc;
+ D3D11_TEXTURE2D_DESC texture_desc;
+ ID3D11Resource *rb_texture;
+ struct vec4 ret;
+ HRESULT hr;
+
+ ID3D11Texture2D_GetDesc(context->rt, &texture_desc);
+ texture_desc.Usage = D3D11_USAGE_STAGING;
+ texture_desc.BindFlags = 0;
+ texture_desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
+ texture_desc.MiscFlags = 0;
+ hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, (ID3D11Texture2D **)&rb_texture);
+ ok_(__FILE__, line)(hr == S_OK, "Failed to create texture, hr %#x.\n", hr);
+
+ ID3D11DeviceContext_CopyResource(context->immediate_context, rb_texture, (ID3D11Resource *)context->rt);
+ hr = ID3D11DeviceContext_Map(context->immediate_context, rb_texture, 0, D3D11_MAP_READ, 0, &map_desc);
+ ok_(__FILE__, line)(hr == S_OK, "Failed to map texture, hr %#x.\n", hr);
+
+ ret = *((struct vec4 *)((BYTE *)map_desc.pData + y * map_desc.RowPitch) + x);
+
+ ID3D11DeviceContext_Unmap(context->immediate_context, rb_texture, 0);
+ ID3D11Resource_Release(rb_texture);
+
+ return ret;
+}
+
+static void test_sm4_swizzle(void)
+{
+ static const struct vec4 uniform = {0.0303f, 0.0f, 0.0f, 0.0202f};
+ struct d3d11_test_context test_context;
+ ID3D10Blob *ps_code;
+ ID3D11Buffer *cb;
+ struct vec4 v;
+
+ static const char ps_source[] =
+ "uniform float4 color;\n"
+ "float4 main() : SV_TARGET\n"
+ "{\n"
+ " float4 ret = color;\n"
+ " ret.gb = ret.ra;\n"
+ " ret.ra = float2(0.0101, 0.0404);\n"
+ " return ret;\n"
+ "}";
+
+ if (!init_d3d11_test_context(&test_context))
+ return;
+
+ todo_wine ps_code = compile_shader(ps_source, "ps_4_0");
+ if (ps_code)
+ {
+ cb = create_buffer(test_context.device, D3D11_BIND_CONSTANT_BUFFER, sizeof(uniform), &uniform);
+ ID3D11DeviceContext_PSSetConstantBuffers(test_context.immediate_context, 0, 1, &cb);
+ draw_quad_d3d11(&test_context, ps_code);
+
+ v = get_readback_vec4_d3d11(&test_context, 0, 0);
+ ok(compare_vec4(&v, 0.0101f, 0.0303f, 0.0202f, 0.0404f, 0),
+ "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
+
+ ID3D11Buffer_Release(cb);
+ ID3D10Blob_Release(ps_code);
+ }
+ release_d3d11_test_context(&test_context);
+}
+
+static void test_sm4_math(void)
+{
+ static const float uniforms[8] = {2.5f, 0.3f, 0.2f, 0.7f, 0.1f, 1.5f};
+ struct d3d11_test_context test_context;
+ ID3D10Blob *ps_code;
+ ID3D11Buffer *cb;
+ struct vec4 v;
+
+ static const char ps_source[] =
+ "float4 main(uniform float u, uniform float v, uniform float w, uniform float x,\n"
+ " uniform float y, uniform float z) : SV_TARGET\n"
+ "{\n"
+ " return float4(x * y - z / w + --u / -v,\n"
+ " z * x / y + w / -v,\n"
+ " u + v - w,\n"
+ " x / y / w);\n"
+ "}";
+
+ if (!init_d3d11_test_context(&test_context))
+ return;
+
+ todo_wine ps_code = compile_shader(ps_source, "ps_4_0");
+ if (ps_code)
+ {
+ cb = create_buffer(test_context.device, D3D11_BIND_CONSTANT_BUFFER, sizeof(uniforms), uniforms);
+ ID3D11DeviceContext_PSSetConstantBuffers(test_context.immediate_context, 0, 1, &cb);
+ draw_quad_d3d11(&test_context, ps_code);
+
+ v = get_readback_vec4_d3d11(&test_context, 0, 0);
+ ok(compare_vec4(&v, -12.43f, 9.833333f, 1.6f, 35.0f, 1),
+ "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
+
+ ID3D11Buffer_Release(cb);
+ ID3D10Blob_Release(ps_code);
+ }
+ release_d3d11_test_context(&test_context);
+}
+
+static void test_sm4_conditionals(void)
+{
+ struct d3d11_test_context test_context;
+ ID3D10Blob *ps_code;
+ unsigned int i;
+ struct vec4 v;
+
+ static const char ps_source[] =
+ "float4 main(float4 pos : SV_POSITION) : SV_TARGET\n"
+ "{\n"
+ " if(pos.x > 200.0)\n"
+ " return float4(0.1, 0.2, 0.3, 0.4);\n"
+ " else\n"
+ " return float4(0.9, 0.8, 0.7, 0.6);\n"
+ "}";
+
+ if (!init_d3d11_test_context(&test_context))
+ return;
+
+ todo_wine ps_code = compile_shader(ps_source, "ps_4_0");
+ if (ps_code)
+ {
+ draw_quad_d3d11(&test_context, ps_code);
+
+ for (i = 0; i < 200; i += 40)
+ {
+ v = get_readback_vec4_d3d11(&test_context, i, 0);
+ ok(compare_vec4(&v, 0.9f, 0.8f, 0.7f, 0.6f, 0),
+ "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
+ }
+
+ for (i = 240; i < 640; i += 40)
+ {
+ v = get_readback_vec4_d3d11(&test_context, i, 0);
+ ok(compare_vec4(&v, 0.1f, 0.2f, 0.3f, 0.4f, 0),
+ "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
+ }
+
+ ID3D10Blob_Release(ps_code);
+ }
+ release_d3d11_test_context(&test_context);
+}
+
+static void test_sm4_trig(void)
+{
+ struct d3d11_test_context test_context;
+ ID3D10Blob *ps_code;
+ unsigned int i;
+ struct vec4 v;
+
+ static const char ps_source[] =
+ "float4 main(float4 pos : SV_POSITION) : SV_TARGET\n"
+ "{\n"
+ " return float4(sin(pos.x - 0.5), cos(pos.x - 0.5), 0, 0);\n"
+ "}";
+
+ if (!init_d3d11_test_context(&test_context))
+ return;
+
+ todo_wine ps_code = compile_shader(ps_source, "ps_4_0");
+ if (ps_code)
+ {
+ draw_quad_d3d11(&test_context, ps_code);
+
+ for (i = 0; i < 640; i += 20)
+ {
+ v = get_readback_vec4_d3d11(&test_context, i, 0);
+ ok(compare_vec4(&v, sinf(i), cosf(i), 0.0f, 0.0f, 4096),
+ "Test %u: Got {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n",
+ i, v.x, v.y, v.z, v.w, sinf(i), cos(i), 0.0f, 0.0f);
+ }
+
+ ID3D10Blob_Release(ps_code);
+ }
+ release_d3d11_test_context(&test_context);
+}
+
START_TEST(hlsl)
{
HMODULE mod;
@@ -665,4 +1105,16 @@ START_TEST(hlsl)
test_float_vectors();
test_trig();
test_fail();
+
+ if (!(mod = LoadLibraryA("d3d11.dll")))
+ {
+ skip("Direct3D 11 is not available.\n");
+ return;
+ }
+ pD3D11CreateDevice = (void *)GetProcAddress(mod, "D3D11CreateDevice");
+
+ test_sm4_swizzle();
+ test_sm4_math();
+ test_sm4_conditionals();
+ test_sm4_trig();
}
--
2.25.0
More information about the wine-devel
mailing list