Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d11/d3d11_private.h | 6 ++++-- dlls/d3d11/shader.c | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h index bc9d6a17b6d9..94e9e39fb3e2 100644 --- a/dlls/d3d11/d3d11_private.h +++ b/dlls/d3d11/d3d11_private.h @@ -45,14 +45,16 @@ #define MAKE_TAG(ch0, ch1, ch2, ch3) \ ((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \ ((DWORD)(ch2) << 16) | ((DWORD)(ch3) << 24 )) +#define TAG_AON9 MAKE_TAG('A', 'o', 'n', '9') #define TAG_DXBC MAKE_TAG('D', 'X', 'B', 'C') #define TAG_ISGN MAKE_TAG('I', 'S', 'G', 'N') -#define TAG_OSGN MAKE_TAG('O', 'S', 'G', 'N') #define TAG_OSG5 MAKE_TAG('O', 'S', 'G', '5') +#define TAG_OSGN MAKE_TAG('O', 'S', 'G', 'N') #define TAG_PCSG MAKE_TAG('P', 'C', 'S', 'G') +#define TAG_RDEF MAKE_TAG('R', 'D', 'E', 'F') #define TAG_SHDR MAKE_TAG('S', 'H', 'D', 'R') #define TAG_SHEX MAKE_TAG('S', 'H', 'E', 'X') -#define TAG_AON9 MAKE_TAG('A', 'o', 'n', '9') +#define TAG_STAT MAKE_TAG('S', 'T', 'A', 'T')
struct d3d_device;
diff --git a/dlls/d3d11/shader.c b/dlls/d3d11/shader.c index 9c0059f7cb48..b15bd5cd64a0 100644 --- a/dlls/d3d11/shader.c +++ b/dlls/d3d11/shader.c @@ -136,6 +136,10 @@ static HRESULT shdr_handler(const char *data, DWORD data_size, DWORD tag, void * } break;
+ case TAG_RDEF: + case TAG_STAT: + break; + default: FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4)); break;
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index c04bd820f7d4..48a8f8c6560d 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4394,7 +4394,7 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi return WINED3D_OK;
resource = view->resource; - if (resource->type != WINED3D_RTYPE_TEXTURE_2D) + if (resource->type != WINED3D_RTYPE_TEXTURE_1D && resource->type != WINED3D_RTYPE_TEXTURE_2D) { FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(resource->type)); return WINED3DERR_INVALIDCALL;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
1D textures are handled by raw and CPU blitter.
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/arb_program_shader.c | 3 +++ dlls/wined3d/cs.c | 12 ++++-------- dlls/wined3d/glsl_shader.c | 3 +++ dlls/wined3d/surface.c | 12 ++++++++++++ 4 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 7d3f547405a8..79883982652a 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -7701,6 +7701,9 @@ static BOOL arbfp_blit_supported(enum wined3d_blit_op blit_op, const struct wine if (!context->gl_info->supported[ARB_FRAGMENT_PROGRAM]) return FALSE;
+ if (src_resource->type != WINED3D_RTYPE_TEXTURE_2D) + return FALSE; + if (blit_op == WINED3D_BLIT_OP_RAW_BLIT && dst_format->id == src_format->id) { if (dst_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index dc07f52723de..71de726a7af5 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -2077,13 +2077,6 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void * buffer_from_resource(op->src_resource), op->src_box.left, op->src_box.right - op->src_box.left); } - else if (op->dst_resource->type == WINED3D_RTYPE_TEXTURE_2D) - { - if (FAILED(texture2d_blt(texture_from_resource(op->dst_resource), op->dst_sub_resource_idx, - &op->dst_box, texture_from_resource(op->src_resource), op->src_sub_resource_idx, - &op->src_box, op->flags, &op->fx, op->filter))) - FIXME("Blit failed.\n"); - } else if (op->dst_resource->type == WINED3D_RTYPE_TEXTURE_3D) { struct wined3d_texture *src_texture, *dst_texture; @@ -2162,7 +2155,10 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void * } else { - FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(op->dst_resource->type)); + if (FAILED(texture2d_blt(texture_from_resource(op->dst_resource), op->dst_sub_resource_idx, + &op->dst_box, texture_from_resource(op->src_resource), op->src_sub_resource_idx, + &op->src_box, op->flags, &op->fx, op->filter))) + FIXME("Blit failed.\n"); }
error: diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 5d1f11865865..2af9b9774db8 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -12481,6 +12481,9 @@ static BOOL glsl_blitter_supported(enum wined3d_blit_op blit_op, const struct wi return FALSE; }
+ if (src_resource->type != WINED3D_RTYPE_TEXTURE_2D) + return FALSE; + if (src_texture->target == GL_TEXTURE_2D_MULTISAMPLE || dst_texture->target == GL_TEXTURE_2D_MULTISAMPLE || src_texture->target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 7a13b5883be1..bfee4d368a6d 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -305,6 +305,9 @@ static BOOL fbo_blitter_supported(enum wined3d_blit_op blit_op, const struct win if (!(src_resource->access & dst_resource->access & WINED3D_RESOURCE_ACCESS_GPU)) return FALSE;
+ if (src_resource->type != WINED3D_RTYPE_TEXTURE_2D) + return FALSE; + switch (blit_op) { case WINED3D_BLIT_OP_COLOR_BLIT: @@ -1509,6 +1512,12 @@ static HRESULT wined3d_texture_blt_special(struct wined3d_texture *dst_texture, dst_texture, dst_sub_resource_idx, wine_dbgstr_rect(dst_rect), src_texture, src_sub_resource_idx, wine_dbgstr_rect(src_rect), flags, fx, debug_d3dtexturefiltertype(filter));
+ if (dst_texture->resource.type != WINED3D_RTYPE_TEXTURE_2D) + { + FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(dst_texture->resource.type)); + return WINED3DERR_INVALIDCALL; + } + /* Get the swapchain. One of the surfaces has to be a primary surface. */ if (!(dst_texture->resource.access & WINED3D_RESOURCE_ACCESS_GPU)) { @@ -2171,6 +2180,9 @@ static BOOL ffp_blit_supported(enum wined3d_blit_op blit_op, const struct wined3 const struct wined3d_format *dst_format = dst_resource->format; BOOL decompress;
+ if (src_resource->type != WINED3D_RTYPE_TEXTURE_2D) + return FALSE; + decompress = src_format && (src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED) && !(dst_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED); if (!decompress && !(src_resource->access & dst_resource->access & WINED3D_RESOURCE_ACCESS_GPU))
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d11/tests/d3d11.c | 166 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 134 insertions(+), 32 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 465e2d5615fb..8ca66346266b 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -678,9 +678,35 @@ struct resource_readback unsigned int width, height, sub_resource_idx; };
+static void init_resource_readback(ID3D11Resource *resource, ID3D11Resource *readback_resource, + unsigned int width, unsigned int height, unsigned int sub_resource_idx, + ID3D11Device *device, struct resource_readback *rb) +{ + HRESULT hr; + + rb->resource = readback_resource; + rb->width = width; + rb->height = height; + rb->sub_resource_idx = sub_resource_idx; + + ID3D11Device_GetImmediateContext(device, &rb->immediate_context); + + ID3D11DeviceContext_CopyResource(rb->immediate_context, rb->resource, resource); + if (FAILED(hr = ID3D11DeviceContext_Map(rb->immediate_context, + rb->resource, sub_resource_idx, D3D11_MAP_READ, 0, &rb->map_desc))) + { + trace("Failed to map resource, hr %#x.\n", hr); + ID3D11Resource_Release(rb->resource); + rb->resource = NULL; + ID3D11DeviceContext_Release(rb->immediate_context); + rb->immediate_context = NULL; + } +} + static void get_buffer_readback(ID3D11Buffer *buffer, struct resource_readback *rb) { D3D11_BUFFER_DESC buffer_desc; + ID3D11Resource *rb_buffer; ID3D11Device *device; HRESULT hr;
@@ -694,30 +720,48 @@ static void get_buffer_readback(ID3D11Buffer *buffer, struct resource_readback * buffer_desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; buffer_desc.MiscFlags = 0; buffer_desc.StructureByteStride = 0; - if (FAILED(hr = ID3D11Device_CreateBuffer(device, &buffer_desc, NULL, (ID3D11Buffer **)&rb->resource))) + if (FAILED(hr = ID3D11Device_CreateBuffer(device, &buffer_desc, NULL, (ID3D11Buffer **)&rb_buffer))) { trace("Failed to create staging buffer, hr %#x.\n", hr); ID3D11Device_Release(device); return; }
- rb->width = buffer_desc.ByteWidth; - rb->height = 1; - rb->sub_resource_idx = 0; + init_resource_readback((ID3D11Resource *)buffer, rb_buffer, + buffer_desc.ByteWidth, 1, 0, device, rb);
- ID3D11Device_GetImmediateContext(device, &rb->immediate_context); + ID3D11Device_Release(device); +} + +static void get_texture1d_readback(ID3D11Texture1D *texture, unsigned int sub_resource_idx, + struct resource_readback *rb) +{ + D3D11_TEXTURE1D_DESC texture_desc; + ID3D11Resource *rb_texture; + unsigned int miplevel; + ID3D11Device *device; + HRESULT hr; + + memset(rb, 0, sizeof(*rb));
- ID3D11DeviceContext_CopyResource(rb->immediate_context, rb->resource, (ID3D11Resource *)buffer); - if (FAILED(hr = ID3D11DeviceContext_Map(rb->immediate_context, rb->resource, 0, - D3D11_MAP_READ, 0, &rb->map_desc))) + ID3D11Texture1D_GetDevice(texture, &device); + + ID3D11Texture1D_GetDesc(texture, &texture_desc); + texture_desc.Usage = D3D11_USAGE_STAGING; + texture_desc.BindFlags = 0; + texture_desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; + texture_desc.MiscFlags = 0; + if (FAILED(hr = ID3D11Device_CreateTexture1D(device, &texture_desc, NULL, (ID3D11Texture1D **)&rb_texture))) { - trace("Failed to map buffer, hr %#x.\n", hr); - ID3D11Resource_Release(rb->resource); - rb->resource = NULL; - ID3D11DeviceContext_Release(rb->immediate_context); - rb->immediate_context = NULL; + trace("Failed to create texture, hr %#x.\n", hr); + ID3D11Device_Release(device); + return; }
+ miplevel = sub_resource_idx % texture_desc.MipLevels; + init_resource_readback((ID3D11Resource *)texture, rb_texture, + max(1, texture_desc.Width >> miplevel), 1, sub_resource_idx, device, rb); + ID3D11Device_Release(device); }
@@ -725,6 +769,7 @@ static void get_texture_readback(ID3D11Texture2D *texture, unsigned int sub_reso struct resource_readback *rb) { D3D11_TEXTURE2D_DESC texture_desc; + ID3D11Resource *rb_texture; unsigned int miplevel; ID3D11Device *device; HRESULT hr; @@ -738,7 +783,7 @@ static void get_texture_readback(ID3D11Texture2D *texture, unsigned int sub_reso texture_desc.BindFlags = 0; texture_desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; texture_desc.MiscFlags = 0; - if (FAILED(hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, (ID3D11Texture2D **)&rb->resource))) + if (FAILED(hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, (ID3D11Texture2D **)&rb_texture))) { trace("Failed to create texture, hr %#x.\n", hr); ID3D11Device_Release(device); @@ -746,22 +791,10 @@ static void get_texture_readback(ID3D11Texture2D *texture, unsigned int sub_reso }
miplevel = sub_resource_idx % texture_desc.MipLevels; - rb->width = max(1, texture_desc.Width >> miplevel); - rb->height = max(1, texture_desc.Height >> miplevel); - rb->sub_resource_idx = sub_resource_idx; - - ID3D11Device_GetImmediateContext(device, &rb->immediate_context); - - ID3D11DeviceContext_CopyResource(rb->immediate_context, rb->resource, (ID3D11Resource *)texture); - if (FAILED(hr = ID3D11DeviceContext_Map(rb->immediate_context, rb->resource, sub_resource_idx, - D3D11_MAP_READ, 0, &rb->map_desc))) - { - trace("Failed to map sub-resource %u, hr %#x.\n", sub_resource_idx, hr); - ID3D11Resource_Release(rb->resource); - rb->resource = NULL; - ID3D11DeviceContext_Release(rb->immediate_context); - rb->immediate_context = NULL; - } + init_resource_readback((ID3D11Resource *)texture, rb_texture, + max(1, texture_desc.Width >> miplevel), + max(1, texture_desc.Height >> miplevel), + sub_resource_idx, device, rb);
ID3D11Device_Release(device); } @@ -868,6 +901,30 @@ static void check_texture_color_(unsigned int line, ID3D11Texture2D *texture, check_texture_sub_resource_color_(line, texture, sub_resource_idx, NULL, expected_color, max_diff); }
+#define check_texture1d_sub_resource_color(a, b, c, d, e) check_texture1d_sub_resource_color_(__LINE__, a, b, c, d, e) +static void check_texture1d_sub_resource_color_(unsigned int line, ID3D11Texture1D *texture, + unsigned int sub_resource_idx, const RECT *rect, DWORD expected_color, BYTE max_diff) +{ + struct resource_readback rb; + + get_texture1d_readback(texture, sub_resource_idx, &rb); + check_readback_data_color_(line, &rb, rect, expected_color, max_diff); + release_resource_readback(&rb); +} + +#define check_texture1d_color(t, c, d) check_texture1d_color_(__LINE__, t, c, d) +static void check_texture1d_color_(unsigned int line, ID3D11Texture1D *texture, + DWORD expected_color, BYTE max_diff) +{ + unsigned int sub_resource_idx, sub_resource_count; + D3D11_TEXTURE1D_DESC texture_desc; + + ID3D11Texture1D_GetDesc(texture, &texture_desc); + sub_resource_count = texture_desc.ArraySize * texture_desc.MipLevels; + for (sub_resource_idx = 0; sub_resource_idx < sub_resource_count; ++sub_resource_idx) + check_texture1d_sub_resource_color_(line, texture, sub_resource_idx, NULL, expected_color, max_diff); +} + #define check_texture_sub_resource_float(a, b, c, d, e) check_texture_sub_resource_float_(__LINE__, a, b, c, d, e) static void check_texture_sub_resource_float_(unsigned int line, ID3D11Texture2D *texture, unsigned int sub_resource_idx, const RECT *rect, float expected_value, BYTE max_diff) @@ -12574,7 +12631,51 @@ static void test_swapchain_flip(void) DestroyWindow(window); }
-static void test_clear_render_target_view(void) +static void test_clear_render_target_view_1d(void) +{ + static const float color[] = {0.1f, 0.5f, 0.3f, 0.75f}; + static const float green[] = {0.0f, 1.0f, 0.0f, 0.5f}; + + struct d3d11_test_context test_context; + D3D11_TEXTURE1D_DESC texture_desc; + ID3D11DeviceContext *context; + ID3D11RenderTargetView *rtv; + ID3D11Texture1D *texture; + ID3D11Device *device; + HRESULT hr; + + if (!init_test_context(&test_context, NULL)) + return; + + device = test_context.device; + context = test_context.immediate_context; + + texture_desc.Width = 64; + texture_desc.MipLevels = 1; + texture_desc.ArraySize = 1; + texture_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + texture_desc.Usage = D3D11_USAGE_DEFAULT; + texture_desc.BindFlags = D3D11_BIND_RENDER_TARGET; + texture_desc.CPUAccessFlags = 0; + texture_desc.MiscFlags = 0; + hr = ID3D11Device_CreateTexture1D(device, &texture_desc, NULL, &texture); + ok(SUCCEEDED(hr), "Failed to create depth texture, hr %#x.\n", hr); + + hr = ID3D11Device_CreateRenderTargetView(device, (ID3D11Resource *)texture, NULL, &rtv); + ok(SUCCEEDED(hr), "Failed to create render target view, hr %#x.\n", hr); + + ID3D11DeviceContext_ClearRenderTargetView(context, rtv, color); + check_texture1d_color(texture, 0xbf4c7f19, 1); + + ID3D11DeviceContext_ClearRenderTargetView(context, rtv, green); + check_texture1d_color(texture, 0x8000ff00, 1); + + ID3D11RenderTargetView_Release(rtv); + ID3D11Texture1D_Release(texture); + release_test_context(&test_context); +} + +static void test_clear_render_target_view_2d(void) { static const DWORD expected_color = 0xbf4c7f19, expected_srgb_color = 0xbf95bc59; static const float color[] = {0.1f, 0.5f, 0.3f, 0.75f}; @@ -26517,7 +26618,8 @@ START_TEST(d3d11) run_for_each_feature_level(test_swapchain_formats); test_swapchain_views(); test_swapchain_flip(); - test_clear_render_target_view(); + test_clear_render_target_view_1d(); + test_clear_render_target_view_2d(); test_clear_depth_stencil_view(); test_clear_buffer_unordered_access_view(); test_initial_depth_stencil_state();
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
ARBfp blitter isn't be created if ARB_fragment_program is not supported.
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/arb_program_shader.c | 3 --- 1 file changed, 3 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 79883982652a..d4cc9d54d2ad 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -7698,9 +7698,6 @@ static BOOL arbfp_blit_supported(enum wined3d_blit_op blit_op, const struct wine enum complex_fixup src_fixup; BOOL decompress;
- if (!context->gl_info->supported[ARB_FRAGMENT_PROGRAM]) - return FALSE; - if (src_resource->type != WINED3D_RTYPE_TEXTURE_2D) return FALSE;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/shader.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 4986f3ca213b..3750deea148a 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -1917,19 +1917,19 @@ 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) +static void shader_dump_precise_flags(struct wined3d_string_buffer *buffer, DWORD flags) { - if (!precise_flags) + if (!(flags & WINED3DSI_PRECISE_XYZW)) return;
shader_addline(buffer, " [precise"); - if (precise_flags != WINED3DSI_PRECISE_XYZW) + if (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" : ""); + flags & WINED3DSI_PRECISE_X ? "x" : "", + flags & WINED3DSI_PRECISE_Y ? "y" : "", + flags & WINED3DSI_PRECISE_Z ? "z" : "", + flags & WINED3DSI_PRECISE_W ? "w" : ""); } shader_addline(buffer, "]"); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com