Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/shader.c | 21 +++++++++++++++++++++ dlls/wined3d/shader_sm4.c | 7 ++++++- dlls/wined3d/wined3d_private.h | 8 ++++++++ 3 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index c8939459d0eb..4986f3ca213b 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -1917,6 +1917,23 @@ static void shader_dump_sync_flags(struct wined3d_string_buffer *buffer, DWORD s shader_addline(buffer, "_unknown_flags(%#x)", sync_flags); }
+static void shader_dump_precise_flags(struct wined3d_string_buffer *buffer, DWORD precise_flags) +{ + if (!precise_flags) + return; + + shader_addline(buffer, " [precise"); + if (precise_flags != WINED3DSI_PRECISE_XYZW) + { + shader_addline(buffer, "(%s%s%s%s)", + precise_flags & WINED3DSI_PRECISE_X ? "x" : "", + precise_flags & WINED3DSI_PRECISE_Y ? "y" : "", + precise_flags & WINED3DSI_PRECISE_Z ? "z" : "", + precise_flags & WINED3DSI_PRECISE_W ? "w" : ""); + } + shader_addline(buffer, "]"); +} + static void shader_dump_uav_flags(struct wined3d_string_buffer *buffer, DWORD uav_flags) { if (uav_flags & WINED3DSUF_GLOBALLY_COHERENT) @@ -3080,6 +3097,10 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe { shader_dump_sync_flags(&buffer, ins.flags); } + else + { + shader_dump_precise_flags(&buffer, ins.flags); + }
if (wined3d_shader_instruction_has_texel_offset(&ins)) shader_addline(&buffer, "(%d,%d,%d)", ins.texel_offset.u, ins.texel_offset.v, ins.texel_offset.w); diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c index f11af7630253..b56f16a64e1d 100644 --- a/dlls/wined3d/shader_sm4.c +++ b/dlls/wined3d/shader_sm4.c @@ -61,6 +61,9 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_bytecode); #define WINED3D_SM4_GLOBAL_FLAGS_SHIFT 11 #define WINED3D_SM4_GLOBAL_FLAGS_MASK (0xffu << WINED3D_SM4_GLOBAL_FLAGS_SHIFT)
+#define WINED3D_SM5_PRECISE_SHIFT 19 +#define WINED3D_SM5_PRECISE_MASK (0xfu << WINED3D_SM5_PRECISE_SHIFT) + #define WINED3D_SM5_CONTROL_POINT_COUNT_SHIFT 11 #define WINED3D_SM5_CONTROL_POINT_COUNT_MASK (0xffu << WINED3D_SM5_CONTROL_POINT_COUNT_SHIFT)
@@ -1643,6 +1646,7 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi unsigned int i, len; SIZE_T remaining; const DWORD *p; + DWORD precise;
list_move_head(&priv->src_free, &priv->src);
@@ -1717,12 +1721,13 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi shader_sm4_read_instruction_modifier(previous_token = *p++, ins);
ins->flags = (opcode_token & WINED3D_SM4_INSTRUCTION_FLAGS_MASK) >> WINED3D_SM4_INSTRUCTION_FLAGS_SHIFT; - if (ins->flags & WINED3D_SM4_INSTRUCTION_FLAG_SATURATE) { ins->flags &= ~WINED3D_SM4_INSTRUCTION_FLAG_SATURATE; instruction_dst_modifier = WINED3DSPDM_SATURATE; } + precise = (opcode_token & WINED3D_SM5_PRECISE_MASK) >> WINED3D_SM5_PRECISE_SHIFT; + ins->flags |= precise << WINED3DSI_PRECISE_SHIFT;
for (i = 0; i < ins->dst_count; ++i) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 10bb607292fa..ab13a29530a2 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -618,6 +618,14 @@ enum wined3d_tessellator_partitioning #define WINED3DSI_SAMPLE_INFO_UINT 0x1 #define WINED3DSI_SAMPLER_COMPARISON_MODE 0x1
+#define WINED3DSI_PRECISE_X 0x100 +#define WINED3DSI_PRECISE_Y 0x200 +#define WINED3DSI_PRECISE_Z 0x400 +#define WINED3DSI_PRECISE_W 0x800 +#define WINED3DSI_PRECISE_XYZW (WINED3DSI_PRECISE_X | WINED3DSI_PRECISE_Y \ + | WINED3DSI_PRECISE_Z | WINED3DSI_PRECISE_W) +#define WINED3DSI_PRECISE_SHIFT 8 + enum wined3d_shader_rel_op { WINED3D_SHADER_REL_OP_GT = 1,
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d10core/tests/device.c | 85 ++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 57 deletions(-)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 3fdac8cb0ecc..52991f2927e0 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -488,6 +488,21 @@ static void check_dsv_desc_(unsigned int line, const D3D10_DEPTH_STENCIL_VIEW_DE } }
+static void set_viewport(ID3D10Device *device, int x, int y, + unsigned int width, unsigned int height, float min_depth, float max_depth) +{ + D3D10_VIEWPORT vp; + + vp.TopLeftX = x; + vp.TopLeftY = y; + vp.Width = width; + vp.Height = height; + vp.MinDepth = min_depth; + vp.MaxDepth = max_depth; + + ID3D10Device_RSSetViewports(device, 1, &vp); +} + #define create_buffer(a, b, c, d) create_buffer_(__LINE__, a, b, c, d) static ID3D10Buffer *create_buffer_(unsigned int line, ID3D10Device *device, unsigned int bind_flags, unsigned int size, const void *data) @@ -1091,7 +1106,6 @@ static BOOL init_test_context_(unsigned int line, struct d3d10core_test_context const struct swapchain_desc *swapchain_desc) { unsigned int rt_width, rt_height; - D3D10_VIEWPORT vp; HRESULT hr; RECT rect;
@@ -1119,13 +1133,7 @@ static BOOL init_test_context_(unsigned int line, struct d3d10core_test_context
ID3D10Device_OMSetRenderTargets(context->device, 1, &context->backbuffer_rtv, NULL);
- vp.TopLeftX = 0; - vp.TopLeftY = 0; - vp.Width = rt_width; - vp.Height = rt_height; - vp.MinDepth = 0.0f; - vp.MaxDepth = 1.0f; - ID3D10Device_RSSetViewports(context->device, 1, &vp); + set_viewport(context->device, 0, 0, rt_width, rt_height, 0.0f, 1.0f);
return TRUE; } @@ -4289,7 +4297,6 @@ static void test_occlusion_query(void) unsigned int data_size, i; ID3D10Texture2D *texture; ID3D10Device *device; - D3D10_VIEWPORT vp; union { UINT64 uint; @@ -4380,13 +4387,7 @@ static void test_occlusion_query(void) ok(SUCCEEDED(hr), "Failed to create render target view, hr %#x.\n", hr);
ID3D10Device_OMSetRenderTargets(device, 1, &rtv, NULL); - vp.TopLeftX = 0; - vp.TopLeftY = 0; - vp.Width = texture_desc.Width; - vp.Height = texture_desc.Height; - vp.MinDepth = 0.0f; - vp.MaxDepth = 1.0f; - ID3D10Device_RSSetViewports(device, 1, &vp); + set_viewport(device, 0, 0, texture_desc.Width, texture_desc.Height, 0.0f, 1.0f);
ID3D10Asynchronous_Begin(query); for (i = 0; i < 100; i++) @@ -5555,7 +5556,6 @@ static void test_blend(void) ID3D10VertexShader *vs; ID3D10PixelShader *ps; ID3D10Device *device; - D3D10_VIEWPORT vp; ID3D10Buffer *vb; DWORD color; HRESULT hr; @@ -5719,13 +5719,7 @@ static void test_blend(void)
ID3D10Device_OMSetRenderTargets(device, 1, &offscreen_rtv, NULL);
- vp.TopLeftX = 0; - vp.TopLeftY = 0; - vp.Width = 128; - vp.Height = 128; - vp.MinDepth = 0.0f; - vp.MaxDepth = 1.0f; - ID3D10Device_RSSetViewports(device, 1, &vp); + set_viewport(device, 0, 0, 128, 128, 0.0f, 1.0f);
ID3D10Device_ClearRenderTargetView(device, offscreen_rtv, red);
@@ -7747,7 +7741,6 @@ static void test_multiple_render_targets(void) ID3D10VertexShader *vs; ID3D10PixelShader *ps; ID3D10Device *device; - D3D10_VIEWPORT vp; ID3D10Buffer *vb; ULONG refcount; HRESULT hr; @@ -7864,13 +7857,7 @@ static void test_multiple_render_targets(void) ID3D10Device_VSSetShader(device, vs); ID3D10Device_PSSetShader(device, ps);
- vp.TopLeftX = 0; - vp.TopLeftY = 0; - vp.Width = 640; - vp.Height = 480; - vp.MinDepth = 0.0f; - vp.MaxDepth = 1.0f; - ID3D10Device_RSSetViewports(device, 1, &vp); + set_viewport(device, 0, 0, 640, 480, 0.0f, 1.0f);
for (i = 0; i < ARRAY_SIZE(rtv); ++i) ID3D10Device_ClearRenderTargetView(device, rtv[i], red); @@ -9955,18 +9942,17 @@ static void test_swapchain_views(void)
static void test_swapchain_flip(void) { - IDXGISwapChain *swapchain; ID3D10Texture2D *backbuffer_0, *backbuffer_1, *backbuffer_2, *offscreen; - ID3D10RenderTargetView *backbuffer_0_rtv, *offscreen_rtv; ID3D10ShaderResourceView *backbuffer_0_srv, *backbuffer_1_srv; + ID3D10RenderTargetView *backbuffer_0_rtv, *offscreen_rtv; D3D10_TEXTURE2D_DESC texture_desc; - ID3D10VertexShader *vs; - ID3D10PixelShader *ps; ID3D10InputLayout *input_layout; - ID3D10Buffer *vb; unsigned int stride, offset; + IDXGISwapChain *swapchain; + ID3D10VertexShader *vs; + ID3D10PixelShader *ps; ID3D10Device *device; - D3D10_VIEWPORT vp; + ID3D10Buffer *vb; ULONG refcount; DWORD color; HWND window; @@ -10103,13 +10089,7 @@ static void test_swapchain_flip(void) hr = ID3D10Device_CreateRenderTargetView(device, (ID3D10Resource *)offscreen, NULL, &offscreen_rtv); ok(SUCCEEDED(hr), "Failed to create rendertarget view, hr %#x.\n", hr); ID3D10Device_OMSetRenderTargets(device, 1, &offscreen_rtv, NULL); - vp.TopLeftX = 0; - vp.TopLeftY = 0; - vp.Width = 640; - vp.Height = 480; - vp.MinDepth = 0.0f; - vp.MaxDepth = 1.0f; - ID3D10Device_RSSetViewports(device, 1, &vp); + set_viewport(device, 0, 0, 640, 480, 0.0f, 1.0f);
vb = create_buffer(device, D3D10_BIND_VERTEX_BUFFER, sizeof(quad), quad);
@@ -10419,12 +10399,10 @@ static void test_initial_depth_stencil_state(void) /* check if depth function is D3D10_COMPARISON_LESS */ ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, white); ID3D10Device_ClearDepthStencilView(device, dsv, D3D10_CLEAR_DEPTH, 0.5f, 0); - vp.MinDepth = vp.MaxDepth = 0.4f; - ID3D10Device_RSSetViewports(device, 1, &vp); + set_viewport(device, vp.TopLeftX, vp.TopLeftY, vp.Width, vp.Height, 0.4f, 0.4f); draw_color_quad(&test_context, &green); draw_color_quad(&test_context, &red); - vp.MinDepth = vp.MaxDepth = 0.6f; - ID3D10Device_RSSetViewports(device, 1, &vp); + set_viewport(device, vp.TopLeftX, vp.TopLeftY, vp.Width, vp.Height, 0.6f, 0.6f); draw_color_quad(&test_context, &red); check_texture_color(test_context.backbuffer, 0xff00ff00, 1); check_texture_float(texture, 0.4f, 1); @@ -10444,7 +10422,6 @@ static void test_draw_depth_only(void) ID3D10Texture2D *texture; ID3D10Device *device; unsigned int i, j; - D3D10_VIEWPORT vp; struct vec4 depth; ID3D10Buffer *cb; HRESULT hr; @@ -10540,13 +10517,7 @@ static void test_draw_depth_only(void) depth.x = 1.0f / 16.0f * (j + 4 * i); ID3D10Device_UpdateSubresource(device, (ID3D10Resource *)cb, 0, NULL, &depth, 0, 0);
- vp.TopLeftX = 160 * j; - vp.TopLeftY = 120 * i; - vp.Width = 160; - vp.Height = 120; - vp.MinDepth = 0.0f; - vp.MaxDepth = 1.0f; - ID3D10Device_RSSetViewports(device, 1, &vp); + set_viewport(device, 160 * j, 120 * i, 160, 120, 0.0f, 1.0f);
draw_quad(&test_context); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d10core/tests/device.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 52991f2927e0..b28c8a398a13 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -7733,10 +7733,10 @@ static void test_depth_stencil_sampling(void)
static void test_multiple_render_targets(void) { + ID3D10RenderTargetView *rtv[4], *tmp_rtv[4]; D3D10_TEXTURE2D_DESC texture_desc; ID3D10InputLayout *input_layout; unsigned int stride, offset, i; - ID3D10RenderTargetView *rtv[4]; ID3D10Texture2D *rt[4]; ID3D10VertexShader *vs; ID3D10PixelShader *ps; @@ -7861,9 +7861,21 @@ static void test_multiple_render_targets(void)
for (i = 0; i < ARRAY_SIZE(rtv); ++i) ID3D10Device_ClearRenderTargetView(device, rtv[i], red); - ID3D10Device_Draw(device, 4, 0); + check_texture_color(rt[0], 0xffffffff, 2); + check_texture_color(rt[1], 0x7f7f7f7f, 2); + check_texture_color(rt[2], 0x33333333, 2); + check_texture_color(rt[3], 0xff7f3300, 2);
+ for (i = 0; i < ARRAY_SIZE(rtv); ++i) + ID3D10Device_ClearRenderTargetView(device, rtv[i], red); + for (i = 0; i < ARRAY_SIZE(tmp_rtv); ++i) + { + memset(tmp_rtv, 0, sizeof(tmp_rtv)); + tmp_rtv[i] = rtv[i]; + ID3D10Device_OMSetRenderTargets(device, 4, tmp_rtv, NULL); + ID3D10Device_Draw(device, 4, 0); + } check_texture_color(rt[0], 0xffffffff, 2); check_texture_color(rt[1], 0x7f7f7f7f, 2); check_texture_color(rt[2], 0x33333333, 2); @@ -7874,9 +7886,10 @@ static void test_multiple_render_targets(void) ID3D10VertexShader_Release(vs); ID3D10InputLayout_Release(input_layout); for (i = 0; i < ARRAY_SIZE(rtv); ++i) + { ID3D10RenderTargetView_Release(rtv[i]); - for (i = 0; i < ARRAY_SIZE(rt); ++i) ID3D10Texture2D_Release(rt[i]); + } refcount = ID3D10Device_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com ---
We enumerate and support only HAL adapters in DXGI. The "Ignoring adapter type" message was printed twice each time a device is created.
--- dlls/dxgi/device.c | 2 -- dlls/dxgi/utils.c | 2 -- 2 files changed, 4 deletions(-)
diff --git a/dlls/dxgi/device.c b/dlls/dxgi/device.c index c266caea2fc3..5a810fa810f4 100644 --- a/dlls/dxgi/device.c +++ b/dlls/dxgi/device.c @@ -422,8 +422,6 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l return E_FAIL; }
- FIXME("Ignoring adapter type.\n"); - hr = wined3d_device_create(dxgi_factory->wined3d, dxgi_adapter->ordinal, WINED3D_DEVICE_TYPE_HAL, NULL, 0, 4, wined3d_device_parent, &device->wined3d_device); if (FAILED(hr)) diff --git a/dlls/dxgi/utils.c b/dlls/dxgi/utils.c index 74f0ae0529dc..063ec5a762ac 100644 --- a/dlls/dxgi/utils.c +++ b/dlls/dxgi/utils.c @@ -645,8 +645,6 @@ D3D_FEATURE_LEVEL dxgi_check_feature_level_support(struct dxgi_factory *factory, WINED3DCAPS caps; HRESULT hr;
- FIXME("Ignoring adapter type.\n"); - wined3d_mutex_lock(); hr = wined3d_get_device_caps(factory->wined3d, adapter->ordinal, WINED3D_DEVICE_TYPE_HAL, &caps); wined3d_mutex_unlock();
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
In order to avoid GL errors when glBeginTransformFeedback() is called. This is required only because we do not fully support stream output component ranges.
Signed-off-by: Józef Kucia jkucia@codeweavers.com ---
This isn't pretty, and it should be reverted when we fully support component ranges.
--- dlls/wined3d/glsl_shader.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index e29730cce24b..5d1f11865865 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -804,11 +804,12 @@ static void append_transform_feedback_skip_components(const char **varyings, } }
-static void shader_glsl_generate_transform_feedback_varyings(const struct wined3d_stream_output_desc *so_desc, +static BOOL shader_glsl_generate_transform_feedback_varyings(const struct wined3d_stream_output_desc *so_desc, struct wined3d_string_buffer *buffer, const char **varyings, unsigned int *varying_count, char *strings, unsigned int *strings_length, GLenum buffer_mode) { unsigned int i, buffer_idx, count, length, highest_output_slot, stride; + BOOL have_varyings_to_record = FALSE;
count = length = 0; highest_output_slot = 0; @@ -858,6 +859,8 @@ static void shader_glsl_generate_transform_feedback_varyings(const struct wined3 string_buffer_sprintf(buffer, "shader_in_out.reg%u", e->register_idx); append_transform_feedback_varying(varyings, &count, &strings, &length, buffer); } + + have_varyings_to_record = TRUE; }
if (buffer_idx < so_desc->buffer_stride_count @@ -882,10 +885,12 @@ static void shader_glsl_generate_transform_feedback_varyings(const struct wined3 *varying_count = count; if (strings_length) *strings_length = length; + + return have_varyings_to_record; }
static void shader_glsl_init_transform_feedback(const struct wined3d_context *context, - struct shader_glsl_priv *priv, GLuint program_id, const struct wined3d_shader *shader) + struct shader_glsl_priv *priv, GLuint program_id, struct wined3d_shader *shader) { const struct wined3d_stream_output_desc *so_desc = &shader->u.gs.so_desc; const struct wined3d_gl_info *gl_info = context->gl_info; @@ -941,7 +946,12 @@ static void shader_glsl_init_transform_feedback(const struct wined3d_context *co
buffer = string_buffer_get(&priv->string_buffers);
- shader_glsl_generate_transform_feedback_varyings(so_desc, buffer, NULL, &count, NULL, &length, mode); + if (!shader_glsl_generate_transform_feedback_varyings(so_desc, buffer, NULL, &count, NULL, &length, mode)) + { + FIXME("No varyings to record, disabling transform feedback.\n"); + shader->u.gs.so_desc.element_count = 0; + return; + }
if (!(varyings = heap_calloc(count, sizeof(*varyings)))) {
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
It's harmless.
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d11/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index a8251aad27a0..c94fbdec239f 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -3518,7 +3518,7 @@ static UINT STDMETHODCALLTYPE d3d11_device_GetCreationFlags(ID3D11Device *iface)
static HRESULT STDMETHODCALLTYPE d3d11_device_GetDeviceRemovedReason(ID3D11Device *iface) { - FIXME("iface %p stub!\n", iface); + WARN("iface %p stub!\n", iface);
return S_OK; }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com