Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
June 2018
- 68 participants
- 1149 messages
[PATCH 5/5] d3d11/tests: Add test for negative viewport coordinates.
by Matteo Bruni
From: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
---
I haven't tested it but I suspect
https://lists.freedesktop.org/archives/mesa-dev/2018-June/196667.html
fixes this test on Intel.
dlls/d3d11/tests/d3d11.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 1043722eb58..c641372bc8e 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -24602,6 +24602,57 @@ static void test_fractional_viewports(void)
release_test_context(&test_context);
}
+static void test_negative_viewports(const D3D_FEATURE_LEVEL feature_level)
+{
+ struct d3d11_test_context test_context;
+ ID3D11DeviceContext *context;
+ BOOL quirk;
+ RECT rect;
+
+ static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f};
+ static const struct vec4 green = {0.0f, 1.0f, 0.0f, 1.0f};
+
+ if (!init_test_context(&test_context, &feature_level))
+ return;
+ context = test_context.immediate_context;
+
+ set_viewport(context, 0.0f, 0.0f, 640.0f, 480.0f, 0.0f, 1.0f);
+ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, white);
+ draw_color_quad(&test_context, &green);
+ check_texture_color(test_context.backbuffer, 0xff00ff00, 0);
+
+ set_viewport(context, -0.0f, -0.0f, 640.0f, 480.0f, 0.0f, 1.0f);
+ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, white);
+ draw_color_quad(&test_context, &green);
+ check_texture_color(test_context.backbuffer, 0xff00ff00, 0);
+
+ /* For feature levels greater than or equal to 11_0, a negative top left
+ * corner shifts the bottom right corner by a whole integer. It seems that
+ * floor() is used to round viewport corners to integers.
+ */
+ quirk = feature_level >= D3D_FEATURE_LEVEL_11_0;
+
+ set_viewport(context, -0.4f, -0.4f, 640.0f, 480.0f, 0.0f, 1.0f);
+ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, white);
+ draw_color_quad(&test_context, &green);
+ SetRect(&rect, 0, 0, 639, 479);
+ check_texture_sub_resource_color(test_context.backbuffer, 0, &rect, 0xff00ff00, 1);
+ SetRect(&rect, 639, 479, 640, 480);
+ todo_wine_if(quirk)
+ check_texture_sub_resource_color(test_context.backbuffer, 0, &rect, quirk ? 0xffffffff : 0xff00ff00, 1);
+
+ set_viewport(context, -1.0f / 128.0f, -1.0 / 128.0f, 640.0f, 480.0f, 0.0f, 1.0f);
+ ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, white);
+ draw_color_quad(&test_context, &green);
+ SetRect(&rect, 0, 0, 639, 479);
+ check_texture_sub_resource_color(test_context.backbuffer, 0, &rect, 0xff00ff00, 1);
+ SetRect(&rect, 639, 479, 640, 480);
+ todo_wine_if(quirk)
+ check_texture_sub_resource_color(test_context.backbuffer, 0, &rect, quirk ? 0xffffffff : 0xff00ff00, 1);
+
+ release_test_context(&test_context);
+}
+
static void test_early_depth_stencil(void)
{
ID3D11DepthStencilState *depth_stencil_state;
@@ -27669,6 +27720,7 @@ START_TEST(d3d11)
test_gather_c();
test_depth_bias();
test_fractional_viewports();
+ run_for_each_feature_level_in_range(D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_11_0, test_negative_viewports);
test_early_depth_stencil();
test_conservative_depth_output();
test_format_compatibility();
--
2.16.1
June 5, 2018
[PATCH 4/5] d3d9: Get rid of an unnecessary wined3d_device_set_base_vertex_index() call.
by Matteo Bruni
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
---
It will be set again before calling the next draw_primitive() and
AFAICS can't be accessed in the meantime.
dlls/d3d9/device.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 4016b0ccaa2..e32bc14af5b 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -2946,7 +2946,6 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitiveUP(IDirect3DDevice9Ex *ifa
wined3d_device_set_stream_source(device->wined3d_device, 0, NULL, 0, 0);
wined3d_device_set_index_buffer(device->wined3d_device, NULL, WINED3DFMT_UNKNOWN, 0);
- wined3d_device_set_base_vertex_index(device->wined3d_device, 0);
if (SUCCEEDED(hr))
d3d9_rts_flag_auto_gen_mipmap(device);
--
2.16.1
June 5, 2018
[PATCH 3/5] wined3d: Set stream stride and offset even when buffer is NULL.
by Matteo Bruni
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
---
dlls/d3d8/device.c | 8 ++++++++
dlls/d3d9/device.c | 8 ++++++++
dlls/d3d9/tests/device.c | 2 +-
dlls/d3d9/tests/visual.c | 2 +-
dlls/wined3d/device.c | 6 ++----
5 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 616886bcafa..e4869c2618e 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -3102,6 +3102,14 @@ static HRESULT WINAPI d3d8_device_SetStreamSource(IDirect3DDevice8 *iface,
iface, stream_idx, buffer, stride);
wined3d_mutex_lock();
+ if (!stride)
+ {
+ struct wined3d_buffer *wined3d_buffer;
+ unsigned int cur_offset;
+
+ hr = wined3d_device_get_stream_source(device->wined3d_device, stream_idx, &wined3d_buffer,
+ &cur_offset, &stride);
+ }
hr = wined3d_device_set_stream_source(device->wined3d_device, stream_idx,
buffer_impl ? buffer_impl->wined3d_buffer : NULL, 0, stride);
wined3d_mutex_unlock();
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 2f3ad2880d6..4016b0ccaa2 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -3349,6 +3349,14 @@ static HRESULT WINAPI d3d9_device_SetStreamSource(IDirect3DDevice9Ex *iface,
iface, stream_idx, buffer, offset, stride);
wined3d_mutex_lock();
+ if (!stride)
+ {
+ struct wined3d_buffer *wined3d_buffer;
+ unsigned int cur_offset;
+
+ hr = wined3d_device_get_stream_source(device->wined3d_device, stream_idx, &wined3d_buffer,
+ &cur_offset, &stride);
+ }
hr = wined3d_device_set_stream_source(device->wined3d_device, stream_idx,
buffer_impl ? buffer_impl->wined3d_buffer : NULL, offset, stride);
wined3d_mutex_unlock();
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index b71058de486..66bf5b00c50 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -2973,7 +2973,7 @@ static void test_draw_primitive(void)
ok(SUCCEEDED(hr), "GetStreamSource failed, hr %#x.\n", hr);
ok(!current_vb, "Unexpected vb %p.\n", current_vb);
ok(!offset, "Unexpected offset %u.\n", offset);
- todo_wine ok(!stride, "Unexpected stride %u.\n", stride);
+ ok(!stride, "Unexpected stride %u.\n", stride);
/* NULL index buffer, valid vertex declaration, NULL stream source. */
hr = IDirect3DDevice9_SetIndices(device, NULL);
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 1e213abeb18..95982e05155 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -23132,7 +23132,7 @@ static void test_drawindexedprimitiveup(void)
ok(SUCCEEDED(hr), "GetStreamSource failed, hr %#x.\n", hr);
ok(!vb, "Unexpected vb %p.\n", vb);
ok(!offset, "Unexpected offset %u.\n", offset);
- todo_wine ok(!stride, "Unexpected stride %u.\n", stride);
+ ok(!stride, "Unexpected stride %u.\n", stride);
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0f, 0);
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 8ef74b6ef0f..6776c5c5e0c 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1389,12 +1389,10 @@ HRESULT CDECL wined3d_device_set_stream_source(struct wined3d_device *device, UI
}
stream->buffer = buffer;
+ stream->stride = stride;
+ stream->offset = offset;
if (buffer)
- {
- stream->stride = stride;
- stream->offset = offset;
wined3d_buffer_incref(buffer);
- }
if (!device->recording)
wined3d_cs_emit_set_stream_source(device->cs, stream_idx, buffer, offset, stride);
--
2.16.1
June 5, 2018
[PATCH 2/5] d3d9/tests: Test how state is reset after DrawPrimitive[Indexed]UP().
by Matteo Bruni
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
---
dlls/d3d9/tests/device.c | 38 +++++++++++++++++++++++++++++++++-----
dlls/d3d9/tests/visual.c | 8 ++++++++
2 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index bd1890f45c5..b71058de486 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -2861,10 +2861,11 @@ static void test_draw_primitive(void)
D3DDECL_END()
};
+ IDirect3DVertexBuffer9 *vertex_buffer, *current_vb;
+ IDirect3DIndexBuffer9 *index_buffer, *current_ib;
IDirect3DVertexDeclaration9 *vertex_declaration;
- IDirect3DVertexBuffer9 *vertex_buffer;
- IDirect3DIndexBuffer9 *index_buffer;
IDirect3DDevice9 *device;
+ UINT offset, stride;
IDirect3D9 *d3d9;
ULONG refcount;
HWND window;
@@ -2918,16 +2919,31 @@ static void test_draw_primitive(void)
hr = IDirect3DDevice9_DrawPrimitive(device, D3DPT_TRIANGLELIST, 0, 2);
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ hr = IDirect3DDevice9_GetStreamSource(device, 0, ¤t_vb, &offset, &stride);
+ ok(SUCCEEDED(hr), "GetStreamSource failed, hr %#x.\n", hr);
+ ok(current_vb == vertex_buffer, "Unexpected vb %p.\n", current_vb);
+ ok(!offset, "Unexpected offset %u.\n", offset);
+ ok(stride == sizeof(*quad), "Unexpected stride %u.\n", stride);
+ IDirect3DVertexBuffer9_Release(current_vb);
+
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLELIST, 2, quad, sizeof(*quad));
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ hr = IDirect3DDevice9_GetStreamSource(device, 0, ¤t_vb, &offset, &stride);
+ ok(SUCCEEDED(hr), "GetStreamSource failed, hr %#x.\n", hr);
+ todo_wine ok(!current_vb, "Unexpected vb %p.\n", current_vb);
+ ok(!offset, "Unexpected offset %u.\n", offset);
+ ok(stride == sizeof(*quad), "Unexpected stride %u.\n", stride);
+ if (current_vb)
+ IDirect3DVertexBuffer9_Release(current_vb);
+
hr = IDirect3DDevice9_SetIndices(device, NULL);
ok(SUCCEEDED(hr), "SetIndices failed, hr %#x.\n", hr);
hr = IDirect3DDevice9_DrawIndexedPrimitive(device, D3DPT_TRIANGLELIST, 0 /* BaseVertexIndex */,
0 /* MinIndex */, 4 /* NumVerts */, 0 /* StartIndex */, 2 /*PrimCount */);
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
- /* Valid index buffer, NULL vertex declaration. Should fail */
+ /* Valid index buffer, NULL vertex declaration. */
hr = IDirect3DDevice9_SetIndices(device, index_buffer);
ok(SUCCEEDED(hr), "SetIndices failed, hr %#x.\n", hr);
hr = IDirect3DDevice9_DrawIndexedPrimitive(device, D3DPT_TRIANGLELIST, 0 /* BaseVertexIndex */,
@@ -2938,6 +2954,12 @@ static void test_draw_primitive(void)
indices, D3DFMT_INDEX16, quad, sizeof(*quad));
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ hr = IDirect3DDevice9_GetIndices(device, ¤t_ib);
+ ok(SUCCEEDED(hr), "GetIndices failed, hr %#x.\n", hr);
+ todo_wine ok(!current_ib, "Unexpected index buffer %p.\n", current_vb);
+ if (current_ib)
+ IDirect3DIndexBuffer9_Release(current_ib);
+
hr = IDirect3DDevice9_SetVertexDeclaration(device, vertex_declaration);
ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr);
@@ -2947,14 +2969,20 @@ static void test_draw_primitive(void)
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLELIST, 2, quad, sizeof(*quad));
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed, hr %#x.\n", hr);
- /* NULL index buffer, valid vertex vertex declaration. Should succeed */
+ hr = IDirect3DDevice9_GetStreamSource(device, 0, ¤t_vb, &offset, &stride);
+ ok(SUCCEEDED(hr), "GetStreamSource failed, hr %#x.\n", hr);
+ ok(!current_vb, "Unexpected vb %p.\n", current_vb);
+ ok(!offset, "Unexpected offset %u.\n", offset);
+ todo_wine ok(!stride, "Unexpected stride %u.\n", stride);
+
+ /* NULL index buffer, valid vertex declaration, NULL stream source. */
hr = IDirect3DDevice9_SetIndices(device, NULL);
ok(SUCCEEDED(hr), "SetIndices failed, hr %#x.\n", hr);
hr = IDirect3DDevice9_DrawIndexedPrimitive(device, D3DPT_TRIANGLELIST, 0 /* BaseVertexIndex */,
0 /* MinIndex */, 4 /* NumVerts */, 0 /* StartIndex */, 2 /*PrimCount */);
todo_wine ok(SUCCEEDED(hr), "DrawIndexedPrimitive failed, hr %#x.\n", hr);
- /* Valid index buffer and vertex declaration. Should succeed */
+ /* Valid index buffer and vertex declaration, NULL stream source. */
hr = IDirect3DDevice9_SetIndices(device, index_buffer);
ok(SUCCEEDED(hr), "SetIndices failed, hr %#x.\n", hr);
hr = IDirect3DDevice9_DrawIndexedPrimitive(device, D3DPT_TRIANGLELIST, 0 /* BaseVertexIndex */,
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 835c8377e47..1e213abeb18 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -23078,7 +23078,9 @@ static void test_drawindexedprimitiveup(void)
{{ 1.0f, 1.0f, 0.1f}, 0xff00ff00},
};
static const unsigned short indices[] = {0, 1, 2, 3, 4, 5, 6, 7};
+ IDirect3DVertexBuffer9 *vb;
IDirect3DDevice9 *device;
+ UINT offset, stride;
IDirect3D9 *d3d;
ULONG refcount;
D3DCOLOR color;
@@ -23126,6 +23128,12 @@ static void test_drawindexedprimitiveup(void)
color = getPixelColor(device, 480, 360);
ok(color_match(color, 0x00bf4000, 1), "Got unexpected color 0x%08x.\n", color);
+ hr = IDirect3DDevice9_GetStreamSource(device, 0, &vb, &offset, &stride);
+ ok(SUCCEEDED(hr), "GetStreamSource failed, hr %#x.\n", hr);
+ ok(!vb, "Unexpected vb %p.\n", vb);
+ ok(!offset, "Unexpected offset %u.\n", offset);
+ todo_wine ok(!stride, "Unexpected stride %u.\n", stride);
+
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0f, 0);
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
--
2.16.1
June 5, 2018
[PATCH 1/5] wined3d: Declare the correct number and type of fragment shader color outputs.
by Matteo Bruni
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
---
dlls/wined3d/glsl_shader.c | 116 ++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 109 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index a99762b151f..bc714f8de78 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -7613,6 +7613,53 @@ static void shader_glsl_enable_extensions(struct wined3d_string_buffer *buffer,
shader_addline(buffer, "#extension GL_EXT_texture_array : enable\n");
}
+static void shader_glsl_generate_color_output(struct wined3d_string_buffer *buffer,
+ const struct wined3d_gl_info *gl_info, const struct wined3d_shader *shader)
+{
+ const struct wined3d_shader_signature *output_signature = &shader->output_signature;
+ unsigned int i;
+
+ if (output_signature->element_count)
+ {
+ for (i = 0; i < output_signature->element_count; ++i)
+ {
+ const struct wined3d_shader_signature_element *output = &output_signature->elements[i];
+
+ if (strncasecmp(output->semantic_name, "SV_Target", sizeof("SV_Target")))
+ continue;
+ switch (output->component_type)
+ {
+ case WINED3D_TYPE_UINT:
+ shader_addline(buffer, "color_out%u = floatBitsToUint(ps_out[%u]);\n",
+ output->semantic_idx, output->semantic_idx);
+ break;
+ case WINED3D_TYPE_INT:
+ shader_addline(buffer, "color_out%u = floatBitsToInt(ps_out[%u]);\n",
+ output->semantic_idx, output->semantic_idx);
+ break;
+
+ default:
+ FIXME("Unhandled type %#x.\n", output->component_type);
+ /* Fall through. */
+ case WINED3D_TYPE_UNKNOWN:
+ case WINED3D_TYPE_FLOAT:
+ shader_addline(buffer, "color_out%u = ps_out[%u];\n",
+ output->semantic_idx, output->semantic_idx);
+ }
+ }
+ }
+ else
+ {
+ DWORD mask = shader->reg_maps.rt_mask;
+
+ while (mask)
+ {
+ i = wined3d_bit_scan(&mask);
+ shader_addline(buffer, "color_out%u = ps_out[%u];\n", i, i);
+ }
+ }
+}
+
static void shader_glsl_generate_ps_epilogue(const struct wined3d_gl_info *gl_info,
struct wined3d_string_buffer *buffer, const struct wined3d_shader *shader,
const struct ps_compile_args *args)
@@ -7634,6 +7681,26 @@ static void shader_glsl_generate_ps_epilogue(const struct wined3d_gl_info *gl_in
if (reg_maps->sample_mask)
shader_addline(buffer, "gl_SampleMask[0] = floatBitsToInt(sample_mask);\n");
+
+ if (!needs_legacy_glsl_syntax(gl_info))
+ shader_glsl_generate_color_output(buffer, gl_info, shader);
+}
+
+static const char *shader_glsl_get_ps_output_format(enum wined3d_component_type component_type)
+{
+ static const char formats[][6] =
+ {
+ "", /* WINED3D_TYPE_UNKNOWN */
+ "uvec4", /* WINED3D_TYPE_UINT */
+ "ivec4", /* WINED3D_TYPE_INT */
+ "vec4", /* WINED3D_TYPE_FLOAT */
+ };
+ if (component_type < WINED3D_TYPE_UNKNOWN || component_type > WINED3D_TYPE_FLOAT)
+ {
+ WARN("Unexpected component_type %#x.\n", component_type);
+ return formats[WINED3D_TYPE_FLOAT];
+ }
+ return formats[component_type];
}
/* Context activation is done by the caller. */
@@ -7816,9 +7883,35 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
if (!needs_legacy_glsl_syntax(gl_info))
{
- if (shader_glsl_use_explicit_attrib_location(gl_info))
- shader_addline(buffer, "layout(location = 0) ");
- shader_addline(buffer, "out vec4 ps_out[%u];\n", gl_info->limits.buffers);
+ const struct wined3d_shader_signature *output_signature = &shader->output_signature;
+
+ shader_addline(buffer, "vec4 ps_out[%u];\n", gl_info->limits.buffers);
+ if (output_signature->element_count)
+ {
+ for (i = 0; i < output_signature->element_count; ++i)
+ {
+ const struct wined3d_shader_signature_element *output = &output_signature->elements[i];
+
+ if (strncasecmp(output->semantic_name, "SV_Target", sizeof("SV_Target")))
+ continue;
+ if (shader_glsl_use_explicit_attrib_location(gl_info))
+ shader_addline(buffer, "layout(location = %u) ", output->semantic_idx);
+ shader_addline(buffer, "out %s color_out%u;\n",
+ shader_glsl_get_ps_output_format(output->component_type), output->semantic_idx);
+ }
+ }
+ else
+ {
+ DWORD mask = reg_maps->rt_mask;
+
+ while (mask)
+ {
+ i = wined3d_bit_scan(&mask);
+ if (shader_glsl_use_explicit_attrib_location(gl_info))
+ shader_addline(buffer, "layout(location = %u) ", i);
+ shader_addline(buffer, "out vec4 color_out%u;\n", i);
+ }
+ }
}
if (shader->limits->constant_float + extra_constants_needed >= gl_info->limits.glsl_ps_float_constants)
@@ -9536,9 +9629,10 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv *
if (!needs_legacy_glsl_syntax(gl_info))
{
+ shader_addline(buffer, "vec4 ps_out[1];\n");
if (shader_glsl_use_explicit_attrib_location(gl_info))
shader_addline(buffer, "layout(location = 0) ");
- shader_addline(buffer, "out vec4 ps_out[1];\n");
+ shader_addline(buffer, "out vec4 color_out0;\n");
}
shader_addline(buffer, "vec4 tmp0, tmp1;\n");
@@ -9878,6 +9972,8 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv *
shader_glsl_generate_fog_code(buffer, gl_info, settings->fog);
shader_glsl_generate_alpha_test(buffer, gl_info, alpha_test_func);
+ if (!needs_legacy_glsl_syntax(gl_info))
+ shader_addline(buffer, "color_out0 = ps_out[0];\n");
shader_addline(buffer, "}\n");
@@ -10419,13 +10515,17 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
}
}
checkGLcall("glBindAttribLocation");
- string_buffer_release(&priv->string_buffers, tmp_name);
if (!needs_legacy_glsl_syntax(gl_info))
{
- GL_EXTCALL(glBindFragDataLocation(program_id, 0, "ps_out"));
- checkGLcall("glBindFragDataLocation");
+ for (i = 0; i < MAX_RENDER_TARGET_VIEWS; ++i)
+ {
+ string_buffer_sprintf(tmp_name, "color_out%u", i);
+ GL_EXTCALL(glBindFragDataLocation(program_id, i, tmp_name->buffer));
+ checkGLcall("glBindFragDataLocation");
+ }
}
+ string_buffer_release(&priv->string_buffers, tmp_name);
}
if (hshader)
@@ -12793,6 +12893,8 @@ static GLuint glsl_blitter_generate_program(struct wined3d_glsl_blitter *blitter
shader_glsl_add_version_declaration(buffer, gl_info);
shader_addline(buffer, "uniform sampler%s sampler;\n", tex_type);
declare_in_varying(gl_info, buffer, FALSE, "vec3 out_texcoord;\n");
+ /* TODO: Declare the out variable with the correct type (and put it in the
+ * blitter args). */
if (!needs_legacy_glsl_syntax(gl_info))
shader_addline(buffer, "out vec4 ps_out[1];\n");
--
2.16.1
June 5, 2018
[PATCH 3/3] msvcrt: Implement quick_exit and _crt_at_quick_exit
by Fabian Maurer
Code taken from onexit logic and adapted-
Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de>
---
dlls/msvcrt/exit.c | 48 ++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcrt/exit.c b/dlls/msvcrt/exit.c
index 313a06ecd0..070a6753e8 100644
--- a/dlls/msvcrt/exit.c
+++ b/dlls/msvcrt/exit.c
@@ -30,8 +30,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
#define UNLOCK_EXIT _munlock(_EXIT_LOCK1)
static MSVCRT__onexit_t *MSVCRT_atexit_table = NULL;
+static MSVCRT__onexit_t *MSVCRT_atquickexit_table = NULL;
static int MSVCRT_atexit_table_size = 0;
+static int MSVCRT_atquickexit_table_size = 0;
static int MSVCRT_atexit_registered = 0; /* Points to free slot */
+static int MSVCRT_atquickexit_registered = 0; /* Points to free slot */
static MSVCRT_purecall_handler purecall_handler = NULL;
typedef struct MSVCRT__onexit_table_t
@@ -78,6 +81,22 @@ static void __MSVCRT__call_atexit(void)
}
}
+/* INTERNAL: call atexit functions */
+static void __MSVCRT__call_atquickexit(void)
+{
+ TRACE("%d atquickexit functions to call\n", MSVCRT_atquickexit_registered);
+
+ /* Last registered gets executed first */
+ while (MSVCRT_atquickexit_registered > 0)
+ {
+ MSVCRT_atquickexit_registered--;
+ TRACE("next is %p\n",MSVCRT_atquickexit_table[MSVCRT_atquickexit_registered]);
+ if (MSVCRT_atquickexit_table[MSVCRT_atquickexit_registered])
+ (*MSVCRT_atquickexit_table[MSVCRT_atquickexit_registered])();
+ TRACE("returned\n");
+ }
+}
+
/*********************************************************************
* __dllonexit (MSVCRT.@)
*/
@@ -125,7 +144,8 @@ void CDECL MSVCRT__exit(int exitcode)
*/
void CDECL MSVCRT_quick_exit(int exitcode)
{
- FIXME("partial stub: (%d)\n", exitcode);
+ TRACE("(%d)\n", exitcode);
+ __MSVCRT__call_atquickexit();
MSVCRT__exit(exitcode);
}
@@ -363,7 +383,31 @@ int CDECL MSVCRT_atexit(void (*func)(void))
*/
int CDECL MSVCRT__crt_at_quick_exit(void (*func)(void))
{
- FIXME("stub: (%p)\n", func);
+ TRACE("(%p)\n",func);
+
+ if (!func)
+ return -1;
+
+ LOCK_EXIT;
+ if (MSVCRT_atquickexit_registered > MSVCRT_atquickexit_table_size - 1)
+ {
+ MSVCRT__onexit_t *newtable;
+ TRACE("expanding table\n");
+ newtable = MSVCRT_calloc(MSVCRT_atquickexit_table_size + 32, sizeof(void *));
+ if (!newtable)
+ {
+ TRACE("failed!\n");
+ UNLOCK_EXIT;
+ return -1;
+ }
+ memcpy (newtable, MSVCRT_atquickexit_table, MSVCRT_atquickexit_table_size*sizeof(void *));
+ MSVCRT_atquickexit_table_size += 32;
+ MSVCRT_free (MSVCRT_atquickexit_table);
+ MSVCRT_atquickexit_table = newtable;
+ }
+ MSVCRT_atquickexit_table[MSVCRT_atquickexit_registered] = (MSVCRT__onexit_t)func;
+ MSVCRT_atquickexit_registered++;
+ UNLOCK_EXIT;
return 0;
}
--
2.17.1
June 5, 2018
[PATCH 2/3] msvcrt: Add quick_exit
by Fabian Maurer
Follow-up issue to bug 45295.
Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de>
---
.../api-ms-win-crt-runtime-l1-1-0.spec | 2 +-
dlls/msvcrt/exit.c | 10 ++++++++++
dlls/ucrtbase/ucrtbase.spec | 2 +-
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/dlls/api-ms-win-crt-runtime-l1-1-0/api-ms-win-crt-runtime-l1-1-0.spec b/dlls/api-ms-win-crt-runtime-l1-1-0/api-ms-win-crt-runtime-l1-1-0.spec
index 4bc8df768d..74d682b33b 100644
--- a/dlls/api-ms-win-crt-runtime-l1-1-0/api-ms-win-crt-runtime-l1-1-0.spec
+++ b/dlls/api-ms-win-crt-runtime-l1-1-0/api-ms-win-crt-runtime-l1-1-0.spec
@@ -97,7 +97,7 @@
@ cdecl fesetround(long) ucrtbase.fesetround
@ stub fetestexcept
@ cdecl perror(str) ucrtbase.perror
-@ stub quick_exit
+@ cdecl quick_exit(long) ucrtbase.quick_exit
@ cdecl raise(long) ucrtbase.raise
@ cdecl set_terminate(ptr) ucrtbase.set_terminate
@ cdecl signal(long long) ucrtbase.signal
diff --git a/dlls/msvcrt/exit.c b/dlls/msvcrt/exit.c
index bba2a653ed..313a06ecd0 100644
--- a/dlls/msvcrt/exit.c
+++ b/dlls/msvcrt/exit.c
@@ -120,6 +120,16 @@ void CDECL MSVCRT__exit(int exitcode)
ExitProcess(exitcode);
}
+/*********************************************************************
+ * quick_exit (MSVCRT.@)
+ */
+void CDECL MSVCRT_quick_exit(int exitcode)
+{
+ FIXME("partial stub: (%d)\n", exitcode);
+ MSVCRT__exit(exitcode);
+}
+
+
/* Print out an error message with an option to debug */
static void DoMessageBoxW(const MSVCRT_wchar_t *lead, const MSVCRT_wchar_t *message)
{
diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec
index 3cb355506a..9d993e90b7 100644
--- a/dlls/ucrtbase/ucrtbase.spec
+++ b/dlls/ucrtbase/ucrtbase.spec
@@ -2454,7 +2454,7 @@
@ cdecl putwchar(long) MSVCRT__fputwchar
@ cdecl qsort(ptr long long ptr) MSVCRT_qsort
@ cdecl qsort_s(ptr long long ptr ptr) MSVCRT_qsort_s
-@ stub quick_exit
+@ cdecl quick_exit(long) MSVCRT_quick_exit
@ cdecl raise(long) MSVCRT_raise
@ cdecl rand() MSVCRT_rand
@ cdecl rand_s(ptr) MSVCRT_rand_s
--
2.17.1
June 5, 2018
[PATCH 1/3] msvcrt: Add _crt_at_quick_exit stub
by Fabian Maurer
Fixes bug 45295.
Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de>
---
.../api-ms-win-crt-runtime-l1-1-0.spec | 2 +-
dlls/msvcrt/exit.c | 10 +++++++++-
dlls/ucrtbase/ucrtbase.spec | 2 +-
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/api-ms-win-crt-runtime-l1-1-0/api-ms-win-crt-runtime-l1-1-0.spec b/dlls/api-ms-win-crt-runtime-l1-1-0/api-ms-win-crt-runtime-l1-1-0.spec
index 24014a65ba..4bc8df768d 100644
--- a/dlls/api-ms-win-crt-runtime-l1-1-0/api-ms-win-crt-runtime-l1-1-0.spec
+++ b/dlls/api-ms-win-crt-runtime-l1-1-0/api-ms-win-crt-runtime-l1-1-0.spec
@@ -28,7 +28,7 @@
@ cdecl _control87(long long) ucrtbase._control87
@ cdecl _controlfp(long long) ucrtbase._controlfp
@ cdecl _controlfp_s(ptr long long) ucrtbase._controlfp_s
-@ stub _crt_at_quick_exit
+@ cdecl _crt_at_quick_exit(ptr) ucrtbase._crt_at_quick_exit
@ cdecl _crt_atexit(ptr) ucrtbase._crt_atexit
@ cdecl _crt_debugger_hook(long) ucrtbase._crt_debugger_hook
@ cdecl _endthread() ucrtbase._endthread
diff --git a/dlls/msvcrt/exit.c b/dlls/msvcrt/exit.c
index 7e1805569c..bba2a653ed 100644
--- a/dlls/msvcrt/exit.c
+++ b/dlls/msvcrt/exit.c
@@ -348,6 +348,15 @@ int CDECL MSVCRT_atexit(void (*func)(void))
return MSVCRT__onexit((MSVCRT__onexit_t)func) == (MSVCRT__onexit_t)func ? 0 : -1;
}
+/*********************************************************************
+ * _crt_at_quick_exit (UCRTBASE.@)
+ */
+int CDECL MSVCRT__crt_at_quick_exit(void (*func)(void))
+{
+ FIXME("stub: (%p)\n", func);
+ return 0;
+}
+
#if _MSVCR_VER>=140
/*********************************************************************
@@ -359,7 +368,6 @@ int CDECL MSVCRT__crt_atexit(void (*func)(void))
return MSVCRT__onexit((MSVCRT__onexit_t)func) == (MSVCRT__onexit_t)func ? 0 : -1;
}
-
/*********************************************************************
* _initialize_onexit_table (UCRTBASE.@)
*/
diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec
index 236b0d526d..3cb355506a 100644
--- a/dlls/ucrtbase/ucrtbase.spec
+++ b/dlls/ucrtbase/ucrtbase.spec
@@ -240,7 +240,7 @@
@ cdecl _cputws(wstr)
@ cdecl _creat(str long) MSVCRT__creat
@ cdecl _create_locale(long str) MSVCRT__create_locale
-@ stub _crt_at_quick_exit
+@ cdecl _crt_at_quick_exit(ptr) MSVCRT__crt_at_quick_exit
@ cdecl _crt_atexit(ptr) MSVCRT__crt_atexit
@ cdecl _crt_debugger_hook(long) MSVCRT__crt_debugger_hook
@ cdecl _ctime32(ptr) MSVCRT__ctime32
--
2.17.1
June 5, 2018
Re: [PATCH 2/2] d3dx9/tests: Use ARRAY_SIZE() in the initialization of registerset_data[]
by Matteo Bruni
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
June 5, 2018
Re: [PATCH 1/2] d3dx9/tests: Use the available ARRAY_SIZE() macro
by Matteo Bruni
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
June 5, 2018