Remove wined3d-Interpolation_Modifiers patchset

This is fixed upstream for some time.
This commit is contained in:
Alistair Leslie-Hughes 2019-05-06 16:22:58 +10:00
parent 0a153ac1a0
commit 7332164d55
4 changed files with 0 additions and 581 deletions

View File

@ -1,223 +0,0 @@
From 2956c590a5d4c5cc205e94b1e2f31be1f71c9350 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 8 Sep 2017 00:06:15 +0200
Subject: d3d11/tests: Add test for nointerpolation modifier.
---
dlls/d3d11/tests/d3d11.c | 195 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 195 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 7df2d3789a4..63188c4fe89 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -22867,6 +22867,200 @@ static void test_mipmap_generation(void)
release_test_context(&test_context);
}
+static void test_interpolation(void)
+{
+ struct d3d11_test_context test_context;
+ D3D11_TEXTURE2D_DESC texture_desc;
+ ID3D11InputLayout *input_layout;
+ ID3D11Texture2D *render_target;
+ ID3D11RenderTargetView *rtv[2];
+ ID3D11DeviceContext *context;
+ ID3D11VertexShader *vs;
+ ID3D11PixelShader *ps;
+ ID3D11Device *device;
+ UINT offset, stride;
+ ID3D11Buffer *vb;
+ DWORD color;
+ HRESULT hr;
+
+ static const struct
+ {
+ struct vec4 position;
+ DWORD color;
+ }
+ triangle[] =
+ {
+ {{-1.0f, -1.0f, 0.0f, 1.0f}, 0xff0000ff},
+ {{ 0.0f, 1.0f, 0.0f, 1.0f}, 0x0000ffff},
+ {{ 1.0f, -1.0f, 0.0f, 1.0f}, 0x00ff00ff},
+ };
+
+ static const D3D11_INPUT_ELEMENT_DESC layout_desc[] =
+ {
+ {"POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
+ {"COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, 16, D3D11_INPUT_PER_VERTEX_DATA, 0},
+ };
+
+ static const DWORD vs_code[] =
+ {
+#if 0
+ struct output
+ {
+ float4 position : SV_POSITION;
+ float4 color0 : COLOR0;
+ float4 color1 : COLOR1;
+ };
+
+ output main(float4 position : POSITION, float4 color : COLOR)
+ {
+ output o;
+
+ o.position = position;
+ o.color0 = color;
+ o.color1 = color;
+
+ return o;
+ }
+#endif
+ 0x43425844, 0x8673452e, 0xedbba3e0, 0x79351b0d, 0xacbebd3e, 0x00000001, 0x00000178, 0x00000003,
+ 0x0000002c, 0x0000007c, 0x000000e8, 0x4e475349, 0x00000048, 0x00000002, 0x00000008, 0x00000038,
+ 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000041, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000001, 0x00000f0f, 0x49534f50, 0x4e4f4954, 0x4c4f4300, 0xab00524f, 0x4e47534f,
+ 0x00000064, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000,
+ 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000000f, 0x0000005c,
+ 0x00000001, 0x00000000, 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5469536f, 0x006e6f69,
+ 0x4f4c4f43, 0xabab0052, 0x52444853, 0x00000088, 0x00010040, 0x00000022, 0x0300005f, 0x001010f2,
+ 0x00000000, 0x0300005f, 0x001010f2, 0x00000001, 0x04000067, 0x001020f2, 0x00000000, 0x00000001,
+ 0x03000065, 0x001020f2, 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x05000036, 0x001020f2,
+ 0x00000000, 0x00101e46, 0x00000000, 0x05000036, 0x001020f2, 0x00000001, 0x00101e46, 0x00000001,
+ 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000001, 0x0100003e,
+ };
+ static const DWORD ps_code[] =
+ {
+#if 0
+ struct input
+ {
+ float4 position : SV_POSITION;
+ linear float4 color0 : COLOR0;
+ nointerpolation float4 color1 : COLOR1;
+ };
+
+ struct output
+ {
+ float4 target0 : SV_Target0;
+ float4 target1 : SV_Target1;
+ };
+
+ void main(const in input i, out output o)
+ {
+ o.target0 = i.color0;
+ o.target1 = i.color1;
+ }
+#endif
+ 0x43425844, 0x97f004eb, 0x5129291d, 0xa12354d7, 0xe07ae35c, 0x00000001, 0x00000150, 0x00000003,
+ 0x0000002c, 0x00000098, 0x000000e4, 0x4e475349, 0x00000064, 0x00000003, 0x00000008, 0x00000050,
+ 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000001, 0x00000f0f, 0x0000005c, 0x00000001, 0x00000000, 0x00000003, 0x00000002,
+ 0x00000f0f, 0x505f5653, 0x5469536f, 0x006e6f69, 0x4f4c4f43, 0xabab0052, 0x4e47534f, 0x00000044,
+ 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f,
+ 0x00000038, 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x0000000f, 0x545f5653, 0x65677261,
+ 0xabab0074, 0x52444853, 0x00000064, 0x00000040, 0x00000019, 0x03001062, 0x001010f2, 0x00000001,
+ 0x03000862, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x03000065, 0x001020f2,
+ 0x00000001, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000001, 0x05000036, 0x001020f2,
+ 0x00000001, 0x00101e46, 0x00000002, 0x0100003e
+ };
+
+ static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f};
+
+ if (!init_test_context(&test_context, NULL))
+ return;
+
+ device = test_context.device;
+ context = test_context.immediate_context;
+
+ hr = ID3D11Device_CreateVertexShader(device, vs_code, sizeof(vs_code), NULL, &vs);
+ ok(SUCCEEDED(hr), "Failed to create vertex shader, hr %#x.\n", hr);
+ hr = ID3D11Device_CreatePixelShader(device, ps_code, sizeof(ps_code), NULL, &ps);
+ ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr);
+
+ ID3D11Texture2D_GetDesc(test_context.backbuffer, &texture_desc);
+ hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &render_target);
+ ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+
+ rtv[0] = test_context.backbuffer_rtv;
+ hr = ID3D11Device_CreateRenderTargetView(device, (ID3D11Resource *)render_target, NULL, &rtv[1]);
+ ok(SUCCEEDED(hr), "Failed to create render target view, hr %#x.\n", hr);
+
+ ID3D11DeviceContext_VSSetShader(context, vs, NULL, 0);
+ ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0);
+
+ hr = ID3D11Device_CreateInputLayout(device, layout_desc, ARRAY_SIZE(layout_desc),
+ vs_code, sizeof(vs_code), &input_layout);
+ ok(SUCCEEDED(hr), "Failed to create input layout, hr %#x.\n", hr);
+ vb = create_buffer(device, D3D11_BIND_VERTEX_BUFFER, sizeof(triangle), triangle);
+
+ ID3D11DeviceContext_IASetInputLayout(context, input_layout);
+ ID3D11DeviceContext_IASetPrimitiveTopology(context, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+ stride = sizeof(*triangle);
+ offset = 0;
+ ID3D11DeviceContext_IASetVertexBuffers(context, 0, 1, &vb, &stride, &offset);
+ ID3D11DeviceContext_OMSetRenderTargets(context, 2, rtv, NULL);
+
+ ID3D11DeviceContext_ClearRenderTargetView(context, rtv[0], white);
+ ID3D11DeviceContext_ClearRenderTargetView(context, rtv[1], white);
+ ID3D11DeviceContext_Draw(context, 3, 0);
+
+ color = get_texture_color(test_context.backbuffer, 0, 0);
+ ok(compare_color(color, 0xffffffff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(test_context.backbuffer, 640, 0);
+ ok(compare_color(color, 0xffffffff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(test_context.backbuffer, 320, 2);
+ ok(compare_color(color, 0x0001feff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(test_context.backbuffer, 0, 479);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(test_context.backbuffer, 639, 479);
+ ok(compare_color(color, 0x00ff00ff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(test_context.backbuffer, 319, 479);
+ ok(compare_color(color, 0x807f00ff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(test_context.backbuffer, 319, 400);
+ ok(compare_color(color, 0x6b6a2aff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(test_context.backbuffer, 319, 200);
+ ok(compare_color(color, 0x353594ff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(test_context.backbuffer, 350, 300);
+ ok(compare_color(color, 0x445c5fff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(test_context.backbuffer, 320, 300);
+ ok(compare_color(color, 0x50505fff, 1), "Got unexpected color 0x%08x.\n", color);
+
+ color = get_texture_color(render_target, 0, 0);
+ ok(compare_color(color, 0xffffffff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(render_target, 640, 0);
+ ok(compare_color(color, 0xffffffff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(render_target, 320, 2);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(render_target, 0, 479);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(render_target, 639, 479);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(render_target, 319, 479);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(render_target, 319, 400);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(render_target, 319, 200);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(render_target, 350, 300);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ color = get_texture_color(render_target, 320, 300);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+
+ ID3D11InputLayout_Release(input_layout);
+ ID3D11RenderTargetView_Release(rtv[1]);
+ ID3D11Texture2D_Release(render_target);
+ ID3D11Buffer_Release(vb);
+ ID3D11PixelShader_Release(ps);
+ ID3D11VertexShader_Release(vs);
+ release_test_context(&test_context);
+}
+
START_TEST(d3d11)
{
test_create_device();
@@ -22975,4 +23169,5 @@ START_TEST(d3d11)
test_conservative_depth_output();
test_dual_blending();
test_mipmap_generation();
+ test_interpolation();
}
--
2.14.2

View File

@ -1,190 +0,0 @@
From dd625cdc1acbb2a9db07cbda8761903f940e31f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B3zef=20Kucia?= <jkucia@codeweavers.com>
Date: Fri, 8 Sep 2017 01:43:04 +0200
Subject: wined3d: Add support for interpolation modifiers in sm4/sm5 pixel
shader inputs.
---
dlls/d3d11/tests/d3d11.c | 14 +++++------
dlls/wined3d/glsl_shader.c | 56 ++++++++++++++++++++++++++++++++++++++----
dlls/wined3d/shader.c | 14 +++++++++++
dlls/wined3d/wined3d_private.h | 2 ++
4 files changed, 74 insertions(+), 12 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 1fdf26715b0..76ee6642f3b 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -21778,21 +21778,21 @@ static void test_interpolation(void)
color = get_texture_color(render_target, 640, 0);
ok(compare_color(color, 0xffffffff, 1), "Got unexpected color 0x%08x.\n", color);
color = get_texture_color(render_target, 320, 2);
- todo_wine ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
color = get_texture_color(render_target, 0, 479);
ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
color = get_texture_color(render_target, 639, 479);
- todo_wine ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
color = get_texture_color(render_target, 319, 479);
- todo_wine ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
color = get_texture_color(render_target, 319, 400);
- todo_wine ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
color = get_texture_color(render_target, 319, 200);
- todo_wine ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
color = get_texture_color(render_target, 350, 300);
- todo_wine ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
color = get_texture_color(render_target, 320, 300);
- todo_wine ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
+ ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
ID3D11InputLayout_Release(input_layout);
ID3D11RenderTargetView_Release(rtv[1]);
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index a74f609e212..417f267fddc 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -386,7 +386,9 @@ static const char *shader_glsl_get_prefix(enum wined3d_shader_type type)
static unsigned int shader_glsl_get_version(const struct wined3d_gl_info *gl_info)
{
- if (gl_info->glsl_version >= MAKEDWORD_VERSION(1, 50))
+ if (gl_info->glsl_version >= MAKEDWORD_VERSION(4, 40))
+ return 440;
+ else if (gl_info->glsl_version >= MAKEDWORD_VERSION(1, 50))
return 150;
else if (gl_info->glsl_version >= MAKEDWORD_VERSION(1, 30))
return 130;
@@ -2123,8 +2125,51 @@ static const char *shader_glsl_shader_output_name(const struct wined3d_gl_info *
return shader_glsl_use_interface_blocks(gl_info) ? "shader_out.reg" : "ps_link";
}
+static const char *shader_glsl_get_interpolation(const struct wined3d_gl_info *gl_info, enum wined3d_shader_interpolation_mode mode)
+{
+ const char *inter;
+
+ switch (mode)
+ {
+ case WINED3DSIM_NONE:
+ case WINED3DSIM_LINEAR:
+ return "";
+ case WINED3DSIM_CONSTANT:
+ inter = "flat";
+ break;
+ case WINED3DSIM_LINEAR_CENTROID:
+ inter = "centroid";
+ break;
+ case WINED3DSIM_LINEAR_NOPERSPECTIVE:
+ inter = "noperspective";
+ break;
+ case WINED3DSIM_LINEAR_NOPERSPECTIVE_CENTROID:
+ inter = "noperspective centroid";
+ break;
+ case WINED3DSIM_LINEAR_SAMPLE:
+ inter = "sample";
+ break;
+ case WINED3DSIM_LINEAR_NOPERSPECTIVE_SAMPLE:
+ inter = "noperspective sample";
+ break;
+ default:
+ FIXME("Unhandled interpolation mode %#x.\n", mode);
+ return "";
+ }
+
+ if (shader_glsl_get_version(gl_info) < 440)
+ {
+ FIXME("Interpolation mode %x requires support for glsl 4.40.\n", mode);
+ return "";
+ }
+
+ return inter;
+}
+
static void shader_glsl_declare_shader_inputs(const struct wined3d_gl_info *gl_info,
- struct wined3d_string_buffer *buffer, unsigned int element_count, BOOL unroll)
+ struct wined3d_string_buffer *buffer, unsigned int element_count,
+ const enum wined3d_shader_interpolation_mode *interpolation_mode,
+ BOOL unroll)
{
if (shader_glsl_use_interface_blocks(gl_info))
{
@@ -2134,7 +2179,7 @@ static void shader_glsl_declare_shader_inputs(const struct wined3d_gl_info *gl_i
shader_addline(buffer, "in shader_in_out {\n");
for (i = 0; i < element_count; ++i)
- shader_addline(buffer, "vec4 reg%u;\n", i);
+ shader_addline(buffer, "%s vec4 reg%u;\n", shader_glsl_get_interpolation(gl_info, interpolation_mode[i]), i);
shader_addline(buffer, "} shader_in;\n");
}
else
@@ -7384,7 +7429,8 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
unsigned int in_count = min(vec4_varyings(version->major, gl_info), shader->limits->packed_input);
if (args->vp_mode == vertexshader && reg_maps->input_registers)
- shader_glsl_declare_shader_inputs(gl_info, buffer, in_count, version->major >= 4);
+ shader_glsl_declare_shader_inputs(gl_info, buffer, in_count,
+ shader->u.ps.interpolation_mode, version->major >= 4);
shader_addline(buffer, "vec4 %s_in[%u];\n", prefix, in_count);
}
@@ -10818,7 +10864,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
/* WINED3DSIH_DCL_INPUT */ shader_glsl_nop,
/* WINED3DSIH_DCL_INPUT_CONTROL_POINT_COUNT */ shader_glsl_nop,
/* WINED3DSIH_DCL_INPUT_PRIMITIVE */ shader_glsl_nop,
- /* WINED3DSIH_DCL_INPUT_PS */ NULL,
+ /* WINED3DSIH_DCL_INPUT_PS */ shader_glsl_nop,
/* WINED3DSIH_DCL_INPUT_PS_SGV */ NULL,
/* WINED3DSIH_DCL_INPUT_PS_SIV */ NULL,
/* WINED3DSIH_DCL_INPUT_SGV */ shader_glsl_nop,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 06f8b0a5e74..687efbc3513 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -1161,6 +1161,20 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
ins.handler_idx, shader_version.type);
}
}
+ else if (ins.handler_idx == WINED3DSIH_DCL_INPUT_PS)
+ {
+ unsigned int reg_idx = ins.declaration.dst.reg.idx[0].offset;
+ if (reg_idx >= ARRAY_SIZE(shader->u.ps.interpolation_mode))
+ {
+ ERR("Invalid register index %u.\n", reg_idx);
+ break;
+ }
+ if (shader_version.type == WINED3D_SHADER_TYPE_PIXEL)
+ shader->u.ps.interpolation_mode[reg_idx] = ins.flags;
+ else
+ FIXME("Invalid instruction %#x for shader type %#x.\n",
+ ins.handler_idx, shader_version.type);
+ }
else if (ins.handler_idx == WINED3DSIH_DCL_OUTPUT_CONTROL_POINT_COUNT)
{
if (shader_version.type == WINED3D_SHADER_TYPE_HULL)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 2d30d748393..0e0db07ad57 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -550,6 +550,7 @@ enum wined3d_shader_dst_modifier
enum wined3d_shader_interpolation_mode
{
+ WINED3DSIM_NONE = 0,
WINED3DSIM_CONSTANT = 1,
WINED3DSIM_LINEAR = 2,
WINED3DSIM_LINEAR_CENTROID = 3,
@@ -3928,6 +3929,7 @@ struct wined3d_pixel_shader
BOOL force_early_depth_stencil;
enum wined3d_shader_register_type depth_output;
+ enum wined3d_shader_interpolation_mode interpolation_mode[MAX_REG_INPUT];
};
struct wined3d_compute_shader
--
2.14.1

View File

@ -1,165 +0,0 @@
From 6c58c594500ae6de458b6f0b725d7912b0beb6fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 1 Oct 2017 15:38:28 +0200
Subject: wined3d: Add quirk for broken auxiliary qualifier matching.
---
dlls/wined3d/directx.c | 96 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/glsl_shader.c | 7 +++
dlls/wined3d/wined3d_private.h | 1 +
3 files changed, 104 insertions(+)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 5bca150305a..2a56bb73411 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -943,6 +943,92 @@ static BOOL match_broken_viewport_subpixel_bits(const struct wined3d_gl_info *gl
return !wined3d_caps_gl_ctx_test_viewport_subpixel_bits(ctx);
}
+static GLuint compile_glsl_shader(const struct wined3d_gl_info *gl_info, GLenum type, const GLchar *src)
+{
+ GLchar log[4096];
+ GLuint shader;
+ GLint status;
+
+ shader = GL_EXTCALL(glCreateShader(type));
+ if (!shader)
+ {
+ ERR("Failed to create shader\n");
+ return 0;
+ }
+
+ GL_EXTCALL(glShaderSource(shader, 1, &src, NULL));
+ GL_EXTCALL(glCompileShader(shader));
+
+ GL_EXTCALL(glGetShaderiv(shader, GL_COMPILE_STATUS, &status));
+ if (!status)
+ {
+ GL_EXTCALL(glGetShaderInfoLog(shader, sizeof(log), NULL, log));
+ ERR("Failed to compile inferface matching shader %x: %s\n", type, (char *)log);
+ GL_EXTCALL(glDeleteShader(shader));
+ return 0;
+ }
+ return shader;
+}
+
+/* Context activation is done by the caller. */
+static BOOL match_broken_interface_matching(const struct wined3d_gl_info *gl_info,
+ struct wined3d_caps_gl_ctx *ctx, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor,
+ enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device)
+{
+ static const char vertex_src[] =
+ "#version 440\n"
+ "in vec4 vs_in0;\n"
+ "out shader_in_out { vec4 reg0; } shader_out;\n"
+ "void main()\n"
+ "{\n"
+ " shader_out.reg0 = (vs_in0.xyzw);\n"
+ "}";
+ static const char frag_src[] =
+ "#version 440\n"
+ "in shader_in_out { centroid vec4 reg0; } shader_in;\n"
+ "out vec4 ps_out0;\n"
+ "void main()\n"
+ "{\n"
+ " ps_out0 = vec4(1.0, 0.0, 1.0, 1.0);\n"
+ "}";
+
+ GLuint vs = 0, ps = 0, prog = 0;
+ GLchar log[4096];
+ BOOL ret = TRUE;
+ GLint status;
+
+ if (!wined3d_settings.glslRequested || gl_info->glsl_version < MAKEDWORD_VERSION(4, 40))
+ return FALSE;
+
+ if (!(vs = compile_glsl_shader(gl_info, GL_VERTEX_SHADER, vertex_src)))
+ return TRUE;
+
+ if (!(ps = compile_glsl_shader(gl_info, GL_FRAGMENT_SHADER, frag_src)))
+ goto done;
+
+ prog = GL_EXTCALL(glCreateProgram());
+ if (!prog) goto done;
+
+ GL_EXTCALL(glAttachShader(prog, vs));
+ GL_EXTCALL(glAttachShader(prog, ps));
+
+ GL_EXTCALL(glLinkProgram(prog));
+ GL_EXTCALL(glGetProgramiv(prog, GL_LINK_STATUS, &status));
+ if (!status)
+ {
+ GL_EXTCALL(glGetProgramInfoLog(prog, sizeof(log), NULL, log));
+ WARN("OpenGL implementation has broken matching for storage qualifiers: %s\n", log);
+ }
+ else
+ ret = FALSE;
+
+done:
+ if (prog) GL_EXTCALL(glDeleteProgram(prog));
+ if (vs) GL_EXTCALL(glDeleteShader(vs));
+ if (ps) GL_EXTCALL(glDeleteShader(ps));
+ return ret;
+}
+
static void quirk_apple_glsl_constants(struct wined3d_gl_info *gl_info)
{
/* MacOS needs uniforms for relative addressing offsets. This can accumulate to quite a few uniforms.
@@ -1080,6 +1166,11 @@ static void quirk_broken_viewport_subpixel_bits(struct wined3d_gl_info *gl_info)
}
}
+static void quirk_broken_interface_matching(struct wined3d_gl_info *gl_info)
+{
+ gl_info->quirks |= WINED3D_QUIRK_BROKEN_STORAGE_MATCHING;
+}
+
struct driver_quirk
{
BOOL (*match)(const struct wined3d_gl_info *gl_info, struct wined3d_caps_gl_ctx *ctx,
@@ -1176,6 +1267,11 @@ static const struct driver_quirk quirk_table[] =
quirk_broken_viewport_subpixel_bits,
"Nvidia viewport subpixel bits bug"
},
+ {
+ match_broken_interface_matching,
+ quirk_broken_interface_matching,
+ "Mesa broken shader interface matching"
+ },
};
/* Certain applications (Steam) complain if we report an outdated driver version. In general,
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index dee797a4e1f..16db7069654 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1888,6 +1888,13 @@ static const char *shader_glsl_get_interpolation(const struct wined3d_gl_info *g
return "";
}
+ if ((gl_info->quirks & WINED3D_QUIRK_BROKEN_STORAGE_MATCHING) &&
+ (strstr(inter, "centroid") || strstr(inter, "sample")))
+ {
+ FIXME("Auxiliary matching for %s broken in host OpenGL implementation, ignoring it.\n", inter);
+ return "";
+ }
+
return inter;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 38cbfbe1c25..09ae7a23b89 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -72,6 +72,7 @@
#define WINED3D_QUIRK_INFO_LOG_SPAM 0x00000080
#define WINED3D_QUIRK_LIMITED_TEX_FILTERING 0x00000100
#define WINED3D_QUIRK_BROKEN_ARB_FOG 0x00000200
+#define WINED3D_QUIRK_BROKEN_STORAGE_MATCHING 0x00000400
enum wined3d_ffp_idx
{
--
2.14.1

View File

@ -1,3 +0,0 @@
Fixes: [43239] Implement support for interpolation modifiers in sm4/sm5 pixel shaders
Depends: wined3d-Dual_Source_Blending
Disabled: true