Added patch to implement semi-stub for d3d11_device_CheckFormatSupport.

This commit is contained in:
Sebastian Lackner 2016-08-29 03:14:37 +02:00
parent 5a40e8f8b3
commit 398d920e3a
5 changed files with 386 additions and 43 deletions

View File

@ -369,6 +369,7 @@ patch_enable_all ()
enable_wined3d_QUERY_Stubs="$1"
enable_wined3d_Silence_FIXMEs="$1"
enable_wined3d_WINED3DFMT_R32G32_UINT="$1"
enable_wined3d_check_format_support="$1"
enable_winedevice_Fix_Relocation="$1"
enable_winemenubuilder_Desktop_Icon_Path="$1"
enable_winemp3_acm_MPEG3_StreamOpen="$1"
@ -1282,6 +1283,9 @@ patch_enable ()
wined3d-WINED3DFMT_R32G32_UINT)
enable_wined3d_WINED3DFMT_R32G32_UINT="$2"
;;
wined3d-check_format_support)
enable_wined3d_check_format_support="$2"
;;
winedevice-Fix_Relocation)
enable_winedevice_Fix_Relocation="$2"
;;
@ -7295,6 +7299,20 @@ if test "$enable_wined3d_WINED3DFMT_R32G32_UINT" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-check_format_support
# |
# | Modified files:
# | * dlls/d3d11/device.c, dlls/d3d11/tests/d3d11.c, dlls/wined3d/device.c, dlls/wined3d/wined3d.spec, include/wine/wined3d.h
# |
if test "$enable_wined3d_check_format_support" -eq 1; then
patch_apply wined3d-check_format_support/0001-wined3d-Add-wined3d_check_device_format_support.patch
patch_apply wined3d-check_format_support/0002-d3d11-Implement-ID3D11Device_CheckFormatSupport.patch
(
echo '+ { "Michael Müller", "wined3d: Add wined3d_check_device_format_support.", 1 },';
echo '+ { "Michael Müller", "d3d11: Implement ID3D11Device_CheckFormatSupport.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-CSMT_Main
# |
# | This patchset has the following (direct or indirect) dependencies:

View File

@ -4004,7 +4004,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
wined3d_device_get_transform(device, WINED3D_TS_VIEW, &view_mat);
wined3d_device_get_transform(device, WINED3D_TS_PROJECTION, &proj_mat);
wined3d_device_get_transform(device, WINED3D_TS_WORLD_MATRIX(0), &world_mat);
@@ -3439,8 +3645,10 @@ HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device)
@@ -3515,8 +3721,10 @@ HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device)
HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
{
@ -4015,7 +4015,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
TRACE("device %p.\n", device);
if (!device->inScene)
@@ -3449,6 +3657,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
@@ -3525,6 +3733,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
return WINED3DERR_INVALIDCALL;
}
@ -4023,7 +4023,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
context = context_acquire(device, NULL);
/* We only have to do this if we need to read the, swapbuffers performs a flush for us */
context->gl_info->gl_ops.gl.p_glFlush();
@@ -3456,6 +3665,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
@@ -3532,6 +3741,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
* fails. */
context_release(context);
@ -4031,7 +4031,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
device->inScene = FALSE;
return WINED3D_OK;
}
@@ -3463,6 +3673,10 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
@@ -3539,6 +3749,10 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count,
const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
{
@ -4042,7 +4042,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
TRACE("device %p, rect_count %u, rects %p, flags %#x, color %s, depth %.8e, stencil %u.\n",
device, rect_count, rects, flags, debug_color(color), depth, stencil);
@@ -3474,7 +3688,11 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
@@ -3550,7 +3764,11 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
{
@ -4054,7 +4054,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
if (!ds)
{
WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n");
@@ -3483,8 +3701,13 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
@@ -3559,8 +3777,13 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
}
else if (flags & WINED3DCLEAR_TARGET)
{
@ -4068,7 +4068,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
{
WARN("Silently ignoring depth and target clear with mismatching sizes\n");
return WINED3D_OK;
@@ -3530,7 +3753,9 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device,
@@ -3606,7 +3829,9 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device,
enum wined3d_primitive_type primitive_type)
{
GLenum gl_primitive_type, prev;
@ -4078,7 +4078,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
TRACE("device %p, primitive_type %s\n", device, debug_d3dprimitivetype(primitive_type));
gl_primitive_type = gl_primitive_type_from_d3d(primitive_type);
@@ -3538,8 +3763,13 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device,
@@ -3614,8 +3839,13 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device,
device->update_state->gl_primitive_type = gl_primitive_type;
if (device->recording)
device->recording->changed.primitive_type = TRUE;
@ -4092,7 +4092,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
}
void CDECL wined3d_device_get_primitive_type(const struct wined3d_device *device,
@@ -3599,10 +3829,16 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
@@ -3675,10 +3905,16 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
start_idx, index_count, start_instance, instance_count, TRUE);
}
@ -4109,7 +4109,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
struct wined3d_const_bo_address data;
struct wined3d_context *context;
struct wined3d_map_desc src;
@@ -3627,6 +3863,14 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
@@ -3703,6 +3939,14 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
}
context = context_acquire(device, NULL);
@ -4124,7 +4124,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
/* Only a prepare, since we're uploading entire volumes. */
wined3d_texture_prepare_texture(dst_texture, context, FALSE);
@@ -3634,6 +3878,7 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
@@ -3710,6 +3954,7 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
for (i = 0; i < level_count; ++i)
{
@ -4132,7 +4132,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
if (FAILED(hr = wined3d_resource_map(&src_texture->resource,
src_level + i, &src, NULL, WINED3D_MAP_READONLY)))
goto done;
@@ -3650,16 +3895,94 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
@@ -3726,16 +3971,94 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
done:
context_release(context);
return hr;
@ -4227,7 +4227,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture);
@@ -3696,6 +4019,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
@@ -3772,6 +4095,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
return WINED3DERR_INVALIDCALL;
}
@ -4235,7 +4235,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
level_count = min(wined3d_texture_get_level_count(src_texture),
wined3d_texture_get_level_count(dst_texture));
@@ -3718,9 +4042,21 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
@@ -3794,9 +4118,21 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
context_release(context);
/* Update every surface level of the texture. */
@ -4257,7 +4257,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
{
unsigned int src_levels = src_texture->level_count;
unsigned int dst_levels = dst_texture->level_count;
@@ -3753,6 +4089,38 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
@@ -3829,6 +4165,38 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
FIXME("Unsupported texture type %#x.\n", type);
return WINED3DERR_INVALIDCALL;
}
@ -4296,7 +4296,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
}
HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes)
@@ -3800,8 +4168,13 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device
@@ -3876,8 +4244,13 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device
if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE]
|| state->render_states[WINED3D_RS_STENCILENABLE])
{
@ -4310,7 +4310,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
if (ds && rt && (ds->width < rt->width || ds->height < rt->height))
{
@@ -3990,6 +4363,9 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4066,6 +4439,9 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
struct wined3d_texture *dst_texture, *src_texture;
RECT dst_rect, src_rect;
HRESULT hr;
@ -4320,7 +4320,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
TRACE("device %p, dst_resource %p, dst_sub_resource_idx %u, dst_x %u, dst_y %u, dst_z %u, "
"src_resource %p, src_sub_resource_idx %u, src_box %s.\n",
@@ -4077,6 +4453,16 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4153,6 +4529,16 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
if (src_box)
{
@ -4337,7 +4337,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
SetRect(&src_rect, src_box->left, src_box->top, src_box->right, src_box->bottom);
}
else
@@ -4090,6 +4476,25 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4166,6 +4552,25 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
SetRect(&dst_rect, dst_x, dst_y, dst_x + (src_rect.right - src_rect.left),
dst_y + (src_rect.bottom - src_rect.top));
@ -4363,7 +4363,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
if (FAILED(hr = wined3d_texture_blt(dst_texture, dst_sub_resource_idx, &dst_rect,
src_texture, src_sub_resource_idx, &src_rect, 0, NULL, WINED3D_TEXF_POINT)))
WARN("Failed to blit, hr %#x.\n", hr);
@@ -4102,6 +4507,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4178,6 +4583,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
unsigned int depth_pitch)
{
struct wined3d_texture_sub_resource *sub_resource;
@ -4371,7 +4371,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
const struct wined3d_gl_info *gl_info;
struct wined3d_const_bo_address addr;
unsigned int width, height, level;
@@ -4110,6 +4516,9 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4186,6 +4592,9 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
struct wined3d_surface *surface;
POINT dst_point;
RECT src_rect;
@ -4381,7 +4381,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
TRACE("device %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u.\n",
device, resource, sub_resource_idx, debug_box(box), data, row_pitch, depth_pitch);
@@ -4143,6 +4552,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4219,6 +4628,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx);
return;
}
@ -4389,7 +4389,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
surface = sub_resource->u.surface;
level = sub_resource_idx % texture->level_count;
@@ -4153,6 +4563,17 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4229,6 +4639,17 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
src_rect.top = 0;
if (box)
{
@ -4407,7 +4407,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
if (box->left >= box->right || box->right > width
|| box->top >= box->bottom || box->bottom > height
|| box->front >= box->back)
@@ -4160,6 +4581,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4236,6 +4657,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
WARN("Invalid box %s specified.\n", debug_box(box));
return;
}
@ -4415,7 +4415,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
src_rect.right = box->right - box->left;
src_rect.bottom = box->bottom - box->top;
@@ -4194,6 +4616,11 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4270,6 +4692,11 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
wined3d_texture_invalidate_location(texture, sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB);
@ -4427,7 +4427,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
}
HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device,
@@ -4202,8 +4629,13 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
@@ -4278,8 +4705,13 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
{
const struct blit_shader *blitter;
struct wined3d_resource *resource;
@ -4441,7 +4441,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
TRACE("device %p, view %p, rect %s, flags %#x, color %s, depth %.8e, stencil %u.\n",
device, view, wine_dbgstr_rect(rect), flags, debug_color(color), depth, stencil);
@@ -4242,10 +4674,15 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
@@ -4318,10 +4750,15 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
return WINED3DERR_INVALIDCALL;
}
@ -4457,7 +4457,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
}
struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device,
@@ -4259,20 +4696,31 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co
@@ -4335,20 +4772,31 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co
return NULL;
}
@ -4489,7 +4489,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n",
device, view_idx, view, set_viewport);
@@ -4309,13 +4757,21 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
@@ -4385,13 +4833,21 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
}
@ -4511,7 +4511,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
wined3d_cs_emit_set_rendertarget_view(device->cs, view_idx, view);
/* Release after the assignment, to prevent device_resource_released()
* from seeing the surface as still in use. */
@@ -4327,18 +4783,29 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
@@ -4403,18 +4859,29 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view)
{
@ -4541,7 +4541,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
wined3d_rendertarget_view_incref(view);
wined3d_cs_emit_set_depth_stencil_view(device->cs, view);
if (prev)
@@ -4572,19 +5039,26 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device)
@@ -4648,19 +5115,26 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device)
}
}
@ -4568,7 +4568,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
LIST_FOR_EACH_ENTRY(shader, &device->shaders, struct wined3d_shader, shader_list_entry)
{
device->shader_backend->shader_destroy(shader);
@@ -4613,12 +5087,30 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d
@@ -4689,12 +5163,30 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d
HeapFree(GetProcessHeap(), 0, swapchain->context);
swapchain->context = NULL;
@ -4599,7 +4599,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
HRESULT hr;
if (FAILED(hr = device->shader_backend->shader_alloc_private(device,
@@ -4635,6 +5127,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
@@ -4711,6 +5203,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
return hr;
}
@ -4607,7 +4607,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
/* Recreate the primary swapchain's context */
swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(*swapchain->context));
if (!swapchain->context)
@@ -4647,10 +5140,15 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
@@ -4723,10 +5216,15 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
target = swapchain->back_buffers ? swapchain->back_buffers[0] : swapchain->front_buffer;
if (!(context = context_create(swapchain, target, swapchain->ds_format)))
@ -4623,7 +4623,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
HeapFree(GetProcessHeap(), 0, swapchain->context);
return E_FAIL;
}
@@ -4660,6 +5158,12 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
@@ -4736,6 +5234,12 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
create_dummy_textures(device, context);
create_default_samplers(device);
context_release(context);
@ -4636,7 +4636,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
return WINED3D_OK;
}
@@ -4678,6 +5182,14 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4754,6 +5258,14 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
TRACE("device %p, swapchain_desc %p, mode %p, callback %p, reset_state %#x.\n",
device, swapchain_desc, mode, callback, reset_state);
@ -4651,7 +4651,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
if (!(swapchain = wined3d_device_get_swapchain(device, 0)))
{
ERR("Failed to get the first implicit swapchain.\n");
@@ -4696,10 +5208,16 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4772,10 +5284,16 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
wined3d_texture_decref(device->cursor_texture);
device->cursor_texture = NULL;
}
@ -4668,7 +4668,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
{
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
@@ -4708,10 +5226,22 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4784,10 +5302,22 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
}
wined3d_device_set_depth_stencil_view(device, NULL);
@ -4691,7 +4691,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
}
if (reset_state)
@@ -4876,27 +5406,48 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4952,27 +5482,48 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
if (device->d3d_initialized)
delete_opengl_contexts(device, swapchain);
@ -4740,7 +4740,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect);
}
@@ -4904,7 +5455,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4980,7 +5531,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
{
if (reset_state)
hr = create_primary_opengl_context(device, swapchain);
@ -4752,7 +4752,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
}
/* All done. There is no need to reload resources or shaders, this will happen automatically on the
@@ -4986,11 +5541,19 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
@@ -5062,11 +5617,19 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
@ -4772,7 +4772,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
ERR("Resource %p is still in use as depth/stencil buffer.\n", resource);
switch (type)
@@ -5126,8 +5689,17 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
@@ -5202,8 +5765,17 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
device->blitter = adapter->blitter;
@ -4790,7 +4790,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
device->update_state = &device->state;
if (!(device->cs = wined3d_cs_create(device)))
@@ -5221,3 +5793,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -5297,3 +5869,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
else
return CallWindowProcA(proc, window, message, wparam, lparam);
}

View File

@ -0,0 +1,164 @@
From 73895e9d37b40608589bbe25c2e6b7defcc1cf7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 28 Aug 2016 04:07:01 +0200
Subject: wined3d: Add wined3d_check_device_format_support.
---
dlls/wined3d/device.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/wined3d.spec | 1 +
include/wine/wined3d.h | 33 ++++++++++++++++++++
3 files changed, 110 insertions(+)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index c2a8c55..03ef744 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3330,6 +3330,82 @@ struct wined3d_texture * CDECL wined3d_device_get_texture(const struct wined3d_d
return device->state.textures[stage];
}
+void CDECL wined3d_check_device_format_support(struct wined3d_device *device,
+ enum wined3d_format_id check_format_id, UINT *support)
+{
+ const struct wined3d_format *format = wined3d_get_format(&device->adapter->gl_info, check_format_id);
+ const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
+
+ UINT support_flags = 0;
+
+ if (format->flags[WINED3D_GL_RES_TYPE_BUFFER] & WINED3DFMT_FLAG_TEXTURE)
+ {
+ support_flags |= WINED3D_FORMAT_SUPPORT_BUFFER;
+ support_flags |= WINED3D_FORMAT_SUPPORT_IA_VERTEX_BUFFER;
+ support_flags |= WINED3D_FORMAT_SUPPORT_IA_INDEX_BUFFER;
+ support_flags |= WINED3D_FORMAT_SUPPORT_SO_BUFFER;
+ }
+
+ if (format->flags[WINED3D_GL_RES_TYPE_TEX_1D] & WINED3DFMT_FLAG_TEXTURE)
+ support_flags |= WINED3D_FORMAT_SUPPORT_TEXTURE1D;
+
+ if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_TEXTURE)
+ {
+ support_flags |= WINED3D_FORMAT_SUPPORT_TEXTURE2D;
+
+ if (gl_info->supported[EXT_TEXTURE_ARRAY])
+ support_flags |= WINED3D_FORMAT_SUPPORT_TEXTURECUBE;
+
+ /* OpenGL requires that all officially supported formats support mip mapping */
+ support_flags |= WINED3D_FORMAT_SUPPORT_MIP;
+
+ if (support_flags & gl_info->supported[SGIS_GENERATE_MIPMAP])
+ support_flags |= WINED3D_FORMAT_SUPPORT_MIP_AUTOGEN;
+
+ /* For the following flags it should be sufficient to check only 2d textures */
+ if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_RENDERTARGET)
+ support_flags |= WINED3D_FORMAT_SUPPORT_RENDER_TARGET;
+
+ if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)
+ support_flags |= WINED3D_FORMAT_SUPPORT_BLENDABLE;
+
+ if ((format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_DEPTH) &&
+ (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_STENCIL))
+ support_flags |= WINED3D_FORMAT_SUPPORT_DEPTH_STENCIL;
+
+ if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)
+ support_flags |= WINED3D_FORMAT_SUPPORT_BLENDABLE;
+
+ /* not sure how to test the following flags - assuming yes */
+ support_flags |= WINED3D_FORMAT_SUPPORT_SHADER_LOAD;
+ support_flags |= WINED3D_FORMAT_SUPPORT_SHADER_SAMPLE;
+ support_flags |= WINED3D_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON;
+ support_flags |= WINED3D_FORMAT_SUPPORT_SHADER_GATHER;
+ support_flags |= WINED3D_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON;
+
+ support_flags |= WINED3D_FORMAT_SUPPORT_CPU_LOCKABLE;
+ support_flags |= WINED3D_FORMAT_SUPPORT_DISPLAY;
+ support_flags |= WINED3D_FORMAT_SUPPORT_BACK_BUFFER_CAST;
+ support_flags |= WINED3D_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW;
+ support_flags |= WINED3D_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON;
+ }
+
+ if (format->flags[WINED3D_GL_RES_TYPE_TEX_3D] & WINED3DFMT_FLAG_TEXTURE)
+ support_flags |= WINED3D_FORMAT_SUPPORT_TEXTURE3D;
+
+ if (gl_info->supported[ARB_MULTISAMPLE])
+ {
+ /* TODO: check if multisampling for this format is supported */
+ support_flags |= WINED3D_FORMAT_SUPPORT_MULTISAMPLE_LOAD;
+ support_flags |= WINED3D_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE;
+
+ if (support_flags & WINED3D_FORMAT_SUPPORT_RENDER_TARGET)
+ support_flags |= WINED3D_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET;
+ }
+
+ *support = support_flags;
+}
+
HRESULT CDECL wined3d_device_get_device_caps(const struct wined3d_device *device, WINED3DCAPS *caps)
{
TRACE("device %p, caps %p.\n", device, caps);
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 0db371d..758d3b0 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -5,6 +5,7 @@
@ cdecl wined3d_check_depth_stencil_match(ptr long long long long long)
@ cdecl wined3d_check_device_format(ptr long long long long long long)
@ cdecl wined3d_check_device_format_conversion(ptr long long long long)
+@ cdecl wined3d_check_device_format_support(ptr long ptr)
@ cdecl wined3d_check_device_multisample_type(ptr long long long long long ptr)
@ cdecl wined3d_check_device_type(ptr long long long long long)
@ cdecl wined3d_create(long)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 81dffea..a2c9657 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -797,6 +797,37 @@ enum wined3d_display_rotation
WINED3D_DISPLAY_ROTATION_270 = 4,
};
+enum wined3d_format_support
+{
+ WINED3D_FORMAT_SUPPORT_BUFFER = 0x0000001,
+ WINED3D_FORMAT_SUPPORT_IA_VERTEX_BUFFER = 0x0000002,
+ WINED3D_FORMAT_SUPPORT_IA_INDEX_BUFFER = 0x0000004,
+ WINED3D_FORMAT_SUPPORT_SO_BUFFER = 0x0000008,
+ WINED3D_FORMAT_SUPPORT_TEXTURE1D = 0x0000010,
+ WINED3D_FORMAT_SUPPORT_TEXTURE2D = 0x0000020,
+ WINED3D_FORMAT_SUPPORT_TEXTURE3D = 0x0000040,
+ WINED3D_FORMAT_SUPPORT_TEXTURECUBE = 0x0000080,
+ WINED3D_FORMAT_SUPPORT_SHADER_LOAD = 0x0000100,
+ WINED3D_FORMAT_SUPPORT_SHADER_SAMPLE = 0x0000200,
+ WINED3D_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON = 0x0000400,
+ WINED3D_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT = 0x0000800,
+ WINED3D_FORMAT_SUPPORT_MIP = 0x0001000,
+ WINED3D_FORMAT_SUPPORT_MIP_AUTOGEN = 0x0002000,
+ WINED3D_FORMAT_SUPPORT_RENDER_TARGET = 0x0004000,
+ WINED3D_FORMAT_SUPPORT_BLENDABLE = 0x0008000,
+ WINED3D_FORMAT_SUPPORT_DEPTH_STENCIL = 0x0010000,
+ WINED3D_FORMAT_SUPPORT_CPU_LOCKABLE = 0x0020000,
+ WINED3D_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE = 0x0040000,
+ WINED3D_FORMAT_SUPPORT_DISPLAY = 0x0080000,
+ WINED3D_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT = 0x0100000,
+ WINED3D_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET = 0x0200000,
+ WINED3D_FORMAT_SUPPORT_MULTISAMPLE_LOAD = 0x0400000,
+ WINED3D_FORMAT_SUPPORT_SHADER_GATHER = 0x0800000,
+ WINED3D_FORMAT_SUPPORT_BACK_BUFFER_CAST = 0x1000000,
+ WINED3D_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW = 0x2000000,
+ WINED3D_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON = 0x4000000,
+};
+
#define WINED3DCOLORWRITEENABLE_RED (1u << 0)
#define WINED3DCOLORWRITEENABLE_GREEN (1u << 1)
#define WINED3DCOLORWRITEENABLE_BLUE (1u << 2)
@@ -2095,6 +2126,8 @@ HRESULT __cdecl wined3d_check_device_format(const struct wined3d *wined3d, UINT
HRESULT __cdecl wined3d_check_device_format_conversion(const struct wined3d *wined3d, UINT adapter_idx,
enum wined3d_device_type device_type, enum wined3d_format_id source_format_id,
enum wined3d_format_id target_format_id);
+void CDECL wined3d_check_device_format_support(struct wined3d_device *device,
+ enum wined3d_format_id check_format_id, UINT *support);
HRESULT __cdecl wined3d_check_device_multisample_type(const struct wined3d *wined3d, UINT adapter_idx,
enum wined3d_device_type device_type, enum wined3d_format_id surface_format_id, BOOL windowed,
enum wined3d_multisample_type multisample_type, DWORD *quality_levels);
--
2.9.0

View File

@ -0,0 +1,160 @@
From 2986a5c8ca18b64090f36531dea421719f007d7a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 28 Aug 2016 04:08:38 +0200
Subject: d3d11: Implement ID3D11Device_CheckFormatSupport.
FIXME: Add flag conversion in d3d11_device_CheckFormatSupport.
---
dlls/d3d11/device.c | 19 ++++++++++++--
dlls/d3d11/tests/d3d11.c | 67 ++++++++++++++++++++++++++++++++++++++----------
2 files changed, 70 insertions(+), 16 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 9a42c8b..24c29fb 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -2701,9 +2701,24 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_OpenSharedResource(ID3D11Device *i
static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device *iface, DXGI_FORMAT format,
UINT *format_support)
{
- FIXME("iface %p, format %u, format_support %p stub!\n", iface, format, format_support);
+ struct d3d_device *device = impl_from_ID3D11Device(iface);
+ enum wined3d_format_id d3d_format;
- return E_NOTIMPL;
+ FIXME("iface %p, format %s, format_support %p semi-stub!\n",
+ iface, debug_dxgi_format(format), format_support);
+
+ if (!format_support)
+ return E_INVALIDARG;
+
+ d3d_format = wined3dformat_from_dxgi_format(format);
+ if (d3d_format == WINED3DFMT_UNKNOWN)
+ return E_FAIL;
+
+ wined3d_mutex_lock();
+ wined3d_check_device_format_support(device->wined3d_device, d3d_format, format_support);
+ wined3d_mutex_unlock();
+
+ return S_OK;
}
static HRESULT STDMETHODCALLTYPE d3d11_device_CheckMultisampleQualityLevels(ID3D11Device *iface,
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index c2b2535..b90c3a5 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -10381,6 +10381,7 @@ struct format_support
DXGI_FORMAT format;
D3D_FEATURE_LEVEL fl_required;
D3D_FEATURE_LEVEL fl_optional;
+ BOOL todo;
};
static void check_format_support(const unsigned int *format_support, D3D_FEATURE_LEVEL feature_level,
@@ -10396,6 +10397,7 @@ static void check_format_support(const unsigned int *format_support, D3D_FEATURE
if (formats[i].fl_required <= feature_level)
{
+ todo_wine_if(formats[i].todo)
ok(supported, "Format %#x - %s not supported, feature_level %#x, format support %#x.\n",
format, feature_name, feature_level, format_support[format]);
continue;
@@ -10412,33 +10414,70 @@ static void check_format_support(const unsigned int *format_support, D3D_FEATURE
static void test_required_format_support(void)
{
unsigned int format_support[DXGI_FORMAT_B4G4R4A4_UNORM + 1];
+ D3D_FEATURE_LEVEL feature_level;
+ struct device_desc device_desc;
ID3D11Device *device;
DXGI_FORMAT format;
unsigned int i;
+ UINT supported;
ULONG refcount;
HRESULT hr;
static const struct format_support index_buffers[] =
{
- {DXGI_FORMAT_R32_UINT, D3D_FEATURE_LEVEL_9_2},
- {DXGI_FORMAT_R16_UINT, D3D_FEATURE_LEVEL_9_1},
+ {DXGI_FORMAT_R32_UINT, D3D_FEATURE_LEVEL_9_2, 0, TRUE},
+ {DXGI_FORMAT_R16_UINT, D3D_FEATURE_LEVEL_9_1, 0, FALSE},
};
static const struct format_support display[] =
{
- {DXGI_FORMAT_R8G8B8A8_UNORM, D3D_FEATURE_LEVEL_9_1},
- {DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, D3D_FEATURE_LEVEL_9_1},
- {DXGI_FORMAT_B8G8R8A8_UNORM, D3D_FEATURE_LEVEL_9_1},
- {DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, D3D_FEATURE_LEVEL_9_1},
- {DXGI_FORMAT_R16G16B16A16_FLOAT, D3D_FEATURE_LEVEL_10_0},
- {DXGI_FORMAT_R10G10B10A2_UNORM, D3D_FEATURE_LEVEL_10_0},
- {DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_0},
+ {DXGI_FORMAT_R8G8B8A8_UNORM, D3D_FEATURE_LEVEL_9_1, 0, FALSE},
+ {DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, D3D_FEATURE_LEVEL_9_1, 0, FALSE},
+ {DXGI_FORMAT_B8G8R8A8_UNORM, D3D_FEATURE_LEVEL_9_1, 0, FALSE},
+ {DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, D3D_FEATURE_LEVEL_9_1, 0, FALSE},
+ {DXGI_FORMAT_R16G16B16A16_FLOAT, D3D_FEATURE_LEVEL_10_0, 0, FALSE},
+ {DXGI_FORMAT_R10G10B10A2_UNORM, D3D_FEATURE_LEVEL_10_0, 0, FALSE},
+ {DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_0, TRUE},
};
+ feature_level = D3D_FEATURE_LEVEL_9_1;
+ device_desc.feature_level = &feature_level;
+ device_desc.flags = 0;
+ if ((device = create_device(&device_desc)))
+ {
+ UINT expected = D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER | D3D11_FORMAT_SUPPORT_TEXTURE2D |
+ D3D11_FORMAT_SUPPORT_TEXTURE3D | D3D11_FORMAT_SUPPORT_TEXTURECUBE | D3D11_FORMAT_SUPPORT_SHADER_LOAD |
+ D3D11_FORMAT_SUPPORT_SHADER_SAMPLE | D3D11_FORMAT_SUPPORT_MIP | D3D11_FORMAT_SUPPORT_MIP_AUTOGEN |
+ D3D11_FORMAT_SUPPORT_RENDER_TARGET | D3D11_FORMAT_SUPPORT_BLENDABLE | D3D11_FORMAT_SUPPORT_CPU_LOCKABLE |
+ D3D11_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE | D3D11_FORMAT_SUPPORT_DISPLAY |
+ D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET | D3D11_FORMAT_SUPPORT_BACK_BUFFER_CAST;
+
+ /* crashes on Windows, even though MSDN states the function returns E_INVALIDARG */
+ if (0)
+ {
+ hr = ID3D11Device_CheckFormatSupport(device, DXGI_FORMAT_R8G8B8A8_UNORM, NULL);
+ ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %#x.\n", hr);
+ }
+
+ hr = ID3D11Device_CheckFormatSupport(device, DXGI_FORMAT_UNKNOWN, &supported);
+ ok(hr == E_FAIL, "Expected E_FAIL, got %#x.\n", hr);
+
+ hr = ID3D11Device_CheckFormatSupport(device, 0xdeadbeef, &supported);
+ ok(hr == E_FAIL, "Expected E_FAIL, got %#x.\n", hr);
+
+ hr = ID3D11Device_CheckFormatSupport(device, DXGI_FORMAT_R8G8B8A8_UNORM, &supported);
+ ok(hr == S_OK, "Expected S_OK, got %#x.\n", hr);
+ ok((supported & expected) == expected, "Expected the following features to be supported: %#x.\n",
+ (supported ^ expected) & expected);
+
+ ID3D11Device_Release(device);
+ }
+ else
+ skip("Failed to create device for feature level %#x.\n", feature_level);
+
for (i = 0; i < sizeof(d3d11_feature_levels) / sizeof(*d3d11_feature_levels); ++i)
{
- D3D_FEATURE_LEVEL feature_level = d3d11_feature_levels[i];
- struct device_desc device_desc;
+ feature_level = d3d11_feature_levels[i];
device_desc.feature_level = &feature_level;
device_desc.flags = 0;
@@ -10452,9 +10491,9 @@ static void test_required_format_support(void)
for (format = DXGI_FORMAT_UNKNOWN; format <= DXGI_FORMAT_B4G4R4A4_UNORM; ++format)
{
hr = ID3D11Device_CheckFormatSupport(device, format, &format_support[format]);
- todo_wine ok(hr == S_OK || (hr == E_FAIL && !format_support[format]),
- "Got unexpected result for format %#x: hr %#x, format_support %#x.\n",
- format, hr, format_support[format]);
+ ok(hr == S_OK || (hr == E_FAIL && !format_support[format]),
+ "Got unexpected result for format %#x: hr %#x, format_support %#x.\n",
+ format, hr, format_support[format]);
}
if (hr == E_NOTIMPL)
{
--
2.9.0

View File

@ -0,0 +1 @@
Fixes: Implement semi-stub for d3d11_device_CheckFormatSupport