mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
removed, mainlined. generation of mips implemented in 0daea6d2a08b76ff3548d8e16c44cf629d8afa9b, bb3b55ce22f96d443c2053f6b1eb24e087ca1377
This commit is contained in:
parent
ebab0ccb03
commit
3585affaa9
@ -437,7 +437,6 @@ patch_enable_all ()
|
||||
enable_wined3d_DXTn="$1"
|
||||
enable_wined3d_Dual_Source_Blending="$1"
|
||||
enable_wined3d_GTX_560M="$1"
|
||||
enable_wined3d_GenerateMips="$1"
|
||||
enable_wined3d_Indexed_Vertex_Blending="$1"
|
||||
enable_wined3d_Limit_Vram="$1"
|
||||
enable_wined3d_QUERY_Stubs="$1"
|
||||
@ -1564,9 +1563,6 @@ patch_enable ()
|
||||
wined3d-GTX_560M)
|
||||
enable_wined3d_GTX_560M="$2"
|
||||
;;
|
||||
wined3d-GenerateMips)
|
||||
enable_wined3d_GenerateMips="$2"
|
||||
;;
|
||||
wined3d-Indexed_Vertex_Blending)
|
||||
enable_wined3d_Indexed_Vertex_Blending="$2"
|
||||
;;
|
||||
@ -2177,9 +2173,6 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
|
||||
if test "$enable_wined3d_Dual_Source_Blending" -gt 1; then
|
||||
abort "Patchset wined3d-Dual_Source_Blending disabled, but wined3d-CSMT_Helper depends on that."
|
||||
fi
|
||||
if test "$enable_wined3d_GenerateMips" -gt 1; then
|
||||
abort "Patchset wined3d-GenerateMips disabled, but wined3d-CSMT_Helper depends on that."
|
||||
fi
|
||||
if test "$enable_wined3d_QUERY_Stubs" -gt 1; then
|
||||
abort "Patchset wined3d-QUERY_Stubs disabled, but wined3d-CSMT_Helper depends on that."
|
||||
fi
|
||||
@ -2197,19 +2190,11 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
|
||||
enable_wined3d_Accounting=1
|
||||
enable_wined3d_DXTn=1
|
||||
enable_wined3d_Dual_Source_Blending=1
|
||||
enable_wined3d_GenerateMips=1
|
||||
enable_wined3d_QUERY_Stubs=1
|
||||
enable_wined3d_Silence_FIXMEs=1
|
||||
enable_wined3d_UAV_Counters=1
|
||||
fi
|
||||
|
||||
if test "$enable_wined3d_GenerateMips" -eq 1; then
|
||||
if test "$enable_wined3d_Dual_Source_Blending" -gt 1; then
|
||||
abort "Patchset wined3d-Dual_Source_Blending disabled, but wined3d-GenerateMips depends on that."
|
||||
fi
|
||||
enable_wined3d_Dual_Source_Blending=1
|
||||
fi
|
||||
|
||||
if test "$enable_wined3d_Dual_Source_Blending" -eq 1; then
|
||||
if test "$enable_wined3d_Viewports" -gt 1; then
|
||||
abort "Patchset wined3d-Viewports disabled, but wined3d-Dual_Source_Blending depends on that."
|
||||
@ -9203,26 +9188,6 @@ if test "$enable_wined3d_Dual_Source_Blending" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wined3d-GenerateMips
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * wined3d-Core_Context, wined3d-Viewports, wined3d-Dual_Source_Blending
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/d3d11/device.c, dlls/d3d11/tests/d3d11.c, dlls/wined3d/cs.c, dlls/wined3d/device.c, dlls/wined3d/texture.c,
|
||||
# | dlls/wined3d/wined3d.spec, dlls/wined3d/wined3d_private.h, include/wine/wined3d.h
|
||||
# |
|
||||
if test "$enable_wined3d_GenerateMips" -eq 1; then
|
||||
patch_apply wined3d-GenerateMips/0001-d3d11-tests-Add-basic-test-for-mipmap-level-generati.patch
|
||||
patch_apply wined3d-GenerateMips/0002-wined3d-Implement-generation-of-mip-maps-for-shader-.patch
|
||||
patch_apply wined3d-GenerateMips/0003-d3d11-Implement-d3d10_device_GenerateMips.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Michael Müller", "d3d11/tests: Add basic test for mipmap level generation.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "wined3d: Implement generation of mip maps for shader resource views.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "d3d11: Implement d3d10_device_GenerateMips.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wined3d-QUERY_Stubs
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
@ -9273,7 +9238,7 @@ fi
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * wined3d-1DTextures, d3d11-Deferred_Context, d3d9-Tests, makedep-PARENTSPEC, ntdll-DllOverrides_WOW64, ntdll-
|
||||
# | Loader_Machine_Type, ntdll-DllRedirects, wined3d-Accounting, wined3d-DXTn, wined3d-Core_Context, wined3d-Viewports,
|
||||
# | wined3d-Dual_Source_Blending, wined3d-GenerateMips, wined3d-QUERY_Stubs, wined3d-Silence_FIXMEs, wined3d-UAV_Counters
|
||||
# | wined3d-Dual_Source_Blending, wined3d-QUERY_Stubs, wined3d-Silence_FIXMEs, wined3d-UAV_Counters
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * configure.ac, dlls/wined3d-csmt/Makefile.in, dlls/wined3d-csmt/version.rc
|
||||
@ -9436,7 +9401,7 @@ fi
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * wined3d-1DTextures, d3d11-Deferred_Context, d3d9-Tests, makedep-PARENTSPEC, ntdll-DllOverrides_WOW64, ntdll-
|
||||
# | Loader_Machine_Type, ntdll-DllRedirects, wined3d-Accounting, wined3d-DXTn, wined3d-Core_Context, wined3d-Viewports,
|
||||
# | wined3d-Dual_Source_Blending, wined3d-GenerateMips, wined3d-QUERY_Stubs, wined3d-Silence_FIXMEs, wined3d-UAV_Counters,
|
||||
# | wined3d-Dual_Source_Blending, wined3d-QUERY_Stubs, wined3d-Silence_FIXMEs, wined3d-UAV_Counters,
|
||||
# | wined3d-CSMT_Helper
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
|
@ -1,140 +0,0 @@
|
||||
From 11060b421e2879d9307be95cba69117d6adf69aa Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sat, 16 Sep 2017 05:13:04 +0200
|
||||
Subject: d3d11/tests: Add basic test for mipmap level generation.
|
||||
|
||||
---
|
||||
dlls/d3d11/tests/d3d11.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 111 insertions(+)
|
||||
|
||||
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
|
||||
index 3c8ff15d6eb..0dc1c94d883 100644
|
||||
--- a/dlls/d3d11/tests/d3d11.c
|
||||
+++ b/dlls/d3d11/tests/d3d11.c
|
||||
@@ -25243,6 +25243,116 @@ static void test_dual_blending(void)
|
||||
release_test_context(&test_context);
|
||||
}
|
||||
|
||||
+static void test_mipmap_generation(void)
|
||||
+{
|
||||
+ D3D11_SHADER_RESOURCE_VIEW_DESC srv_desc;
|
||||
+ struct d3d11_test_context test_context;
|
||||
+ D3D11_TEXTURE2D_DESC texture_desc;
|
||||
+ ID3D11ShaderResourceView *srv;
|
||||
+ ID3D11DeviceContext *context;
|
||||
+ ID3D11Texture2D *texture;
|
||||
+ ID3D11Device *device;
|
||||
+ DWORD color[64*64];
|
||||
+ HRESULT hr;
|
||||
+ int i;
|
||||
+
|
||||
+ if (!init_test_context(&test_context, NULL))
|
||||
+ return;
|
||||
+
|
||||
+ device = test_context.device;
|
||||
+ context = test_context.immediate_context;
|
||||
+
|
||||
+ texture_desc.Width = 64;
|
||||
+ texture_desc.Height = 64;
|
||||
+ texture_desc.MipLevels = 3;
|
||||
+ texture_desc.ArraySize = 2;
|
||||
+ texture_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
+ texture_desc.SampleDesc.Count = 1;
|
||||
+ texture_desc.SampleDesc.Quality = 0;
|
||||
+ texture_desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
+ texture_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
|
||||
+ texture_desc.CPUAccessFlags = 0;
|
||||
+ texture_desc.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS;
|
||||
+
|
||||
+ hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &texture);
|
||||
+ ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
|
||||
+
|
||||
+ hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)texture, NULL, &srv);
|
||||
+ ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#x.\n", hr);
|
||||
+
|
||||
+ for (i = 0; i < texture_desc.Width * texture_desc.Height; i++)
|
||||
+ color[i] = 0xff00ff00;
|
||||
+ ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource*)texture, 0, NULL, color, 64 * 4, 64 * 64 * 4);
|
||||
+
|
||||
+ for (i = 0; i < texture_desc.Width * texture_desc.Height; i++)
|
||||
+ color[i] = 0x00ffff00;
|
||||
+ ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource*)texture, 3, NULL, color, 64 * 4, 64 * 64 * 4);
|
||||
+
|
||||
+ check_texture_sub_resource_color(texture, 0, NULL, 0xff00ff00, 0);
|
||||
+ check_texture_sub_resource_color(texture, 1, NULL, 0x00000000, 0);
|
||||
+ check_texture_sub_resource_color(texture, 2, NULL, 0x00000000, 0);
|
||||
+ check_texture_sub_resource_color(texture, 3, NULL, 0x00ffff00, 0);
|
||||
+ check_texture_sub_resource_color(texture, 4, NULL, 0x00000000, 0);
|
||||
+ check_texture_sub_resource_color(texture, 5, NULL, 0x00000000, 0);
|
||||
+
|
||||
+ ID3D11DeviceContext_GenerateMips(context, srv);
|
||||
+
|
||||
+ check_texture_sub_resource_color(texture, 0, NULL, 0xff00ff00, 0);
|
||||
+ todo_wine check_texture_sub_resource_color(texture, 1, NULL, 0xff00ff00, 0);
|
||||
+ todo_wine check_texture_sub_resource_color(texture, 2, NULL, 0xff00ff00, 0);
|
||||
+ check_texture_sub_resource_color(texture, 3, NULL, 0x00ffff00, 0);
|
||||
+ todo_wine check_texture_sub_resource_color(texture, 4, NULL, 0x00ffff00, 0);
|
||||
+ todo_wine check_texture_sub_resource_color(texture, 5, NULL, 0x00ffff00, 0);
|
||||
+
|
||||
+ ID3D11ShaderResourceView_Release(srv);
|
||||
+ ID3D11Texture2D_Release(texture);
|
||||
+
|
||||
+ hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &texture);
|
||||
+ ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
|
||||
+
|
||||
+ srv_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
+ srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
|
||||
+ srv_desc.Texture2DArray.MostDetailedMip = 1;
|
||||
+ srv_desc.Texture2DArray.MipLevels = -1;
|
||||
+ srv_desc.Texture2DArray.FirstArraySlice = 0;
|
||||
+ srv_desc.Texture2DArray.ArraySize = 1;
|
||||
+
|
||||
+ hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)texture, &srv_desc, &srv);
|
||||
+ ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#x.\n", hr);
|
||||
+
|
||||
+ for (i = 0; i < texture_desc.Width * texture_desc.Height; i++)
|
||||
+ color[i] = 0xff00ff00;
|
||||
+ ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource*)texture, 0, NULL, color, 64 * 4, 64 * 64 * 4);
|
||||
+ ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource*)texture, 3, NULL, color, 64 * 4, 64 * 64 * 4);
|
||||
+
|
||||
+ for (i = 0; i < texture_desc.Width * texture_desc.Height; i++)
|
||||
+ color[i] = 0xffff0000;
|
||||
+ ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource*)texture, 1, NULL, color, 32 * 4, 32 * 32 * 4);
|
||||
+ ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource*)texture, 4, NULL, color, 32 * 4, 32 * 32 * 4);
|
||||
+
|
||||
+ check_texture_sub_resource_color(texture, 0, NULL, 0xff00ff00, 0);
|
||||
+ check_texture_sub_resource_color(texture, 1, NULL, 0xffff0000, 0);
|
||||
+ check_texture_sub_resource_color(texture, 2, NULL, 0x00000000, 0);
|
||||
+ check_texture_sub_resource_color(texture, 3, NULL, 0xff00ff00, 0);
|
||||
+ check_texture_sub_resource_color(texture, 4, NULL, 0xffff0000, 0);
|
||||
+ check_texture_sub_resource_color(texture, 5, NULL, 0x00000000, 0);
|
||||
+
|
||||
+ ID3D11DeviceContext_GenerateMips(context, srv);
|
||||
+
|
||||
+ check_texture_sub_resource_color(texture, 0, NULL, 0xff00ff00, 0);
|
||||
+ check_texture_sub_resource_color(texture, 1, NULL, 0xffff0000, 0);
|
||||
+ if (!is_warp_device(device)) /* broken on WARP device */
|
||||
+ todo_wine check_texture_sub_resource_color(texture, 2, NULL, 0xffff0000, 0);
|
||||
+ check_texture_sub_resource_color(texture, 3, NULL, 0xff00ff00, 0);
|
||||
+ check_texture_sub_resource_color(texture, 4, NULL, 0xffff0000, 0);
|
||||
+ check_texture_sub_resource_color(texture, 5, NULL, 0x00000000, 0);
|
||||
+
|
||||
+ ID3D11ShaderResourceView_Release(srv);
|
||||
+ ID3D11Texture2D_Release(texture);
|
||||
+
|
||||
+ release_test_context(&test_context);
|
||||
+}
|
||||
+
|
||||
|
||||
START_TEST(d3d11)
|
||||
{
|
||||
@@ -25370,6 +25480,7 @@ START_TEST(d3d11)
|
||||
test_early_depth_stencil();
|
||||
test_conservative_depth_output();
|
||||
test_dual_blending();
|
||||
+ test_mipmap_generation();
|
||||
test_format_compatibility();
|
||||
test_clip_distance();
|
||||
test_combined_clip_and_cull_distances();
|
||||
--
|
||||
2.14.2
|
@ -1,281 +0,0 @@
|
||||
From ec757263776955ee6ca680109b47eb3bc6163845 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sat, 16 Sep 2017 18:05:31 +0200
|
||||
Subject: wined3d: Implement generation of mip maps for shader resource views.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 14 ++++++-
|
||||
dlls/d3d11/tests/d3d11.c | 10 ++---
|
||||
dlls/wined3d/cs.c | 84 ++++++++++++++++++++++++++++++++++++++++++
|
||||
dlls/wined3d/device.c | 7 ++++
|
||||
dlls/wined3d/texture.c | 9 ++++-
|
||||
dlls/wined3d/wined3d.spec | 1 +
|
||||
dlls/wined3d/wined3d_private.h | 2 +
|
||||
include/wine/wined3d.h | 1 +
|
||||
8 files changed, 119 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index f71d4a3e910..bbdc97868db 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -2528,14 +2528,18 @@ static void STDMETHODCALLTYPE d3d11_imme
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_immediate_context_GenerateMips(ID3D11DeviceContext *iface,
|
||||
- ID3D11ShaderResourceView *view)
|
||||
+ ID3D11ShaderResourceView *shader_view)
|
||||
{
|
||||
- struct d3d_shader_resource_view *srv = unsafe_impl_from_ID3D11ShaderResourceView(view);
|
||||
+ struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface);
|
||||
+ struct d3d_shader_resource_view *view = unsafe_impl_from_ID3D11ShaderResourceView(shader_view);
|
||||
|
||||
- TRACE("iface %p, view %p.\n", iface, view);
|
||||
+ TRACE("iface %p, shader_view %p.\n", iface, shader_view);
|
||||
+
|
||||
+ if (!view)
|
||||
+ return;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
- wined3d_shader_resource_view_generate_mipmaps(srv->wined3d_view);
|
||||
+ wined3d_device_generate_mips_view(device->wined3d_device, view->wined3d_view);
|
||||
wined3d_mutex_unlock();
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d11_immediate_context_SetResourceMinLOD(ID3D11DeviceContext *iface,
|
||||
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
|
||||
index 154771f4240..8906b9efa7a 100644
|
||||
--- a/dlls/d3d11/tests/d3d11.c
|
||||
+++ b/dlls/d3d11/tests/d3d11.c
|
||||
@@ -22701,11 +22701,11 @@ static void test_mipmap_generation(void)
|
||||
ID3D11DeviceContext_GenerateMips(context, srv);
|
||||
|
||||
check_texture_sub_resource_color(texture, 0, NULL, 0xff00ff00, 0);
|
||||
- todo_wine check_texture_sub_resource_color(texture, 1, NULL, 0xff00ff00, 0);
|
||||
- todo_wine check_texture_sub_resource_color(texture, 2, NULL, 0xff00ff00, 0);
|
||||
+ check_texture_sub_resource_color(texture, 1, NULL, 0xff00ff00, 0);
|
||||
+ check_texture_sub_resource_color(texture, 2, NULL, 0xff00ff00, 0);
|
||||
check_texture_sub_resource_color(texture, 3, NULL, 0x00ffff00, 0);
|
||||
- todo_wine check_texture_sub_resource_color(texture, 4, NULL, 0x00ffff00, 0);
|
||||
- todo_wine check_texture_sub_resource_color(texture, 5, NULL, 0x00ffff00, 0);
|
||||
+ check_texture_sub_resource_color(texture, 4, NULL, 0x00ffff00, 0);
|
||||
+ check_texture_sub_resource_color(texture, 5, NULL, 0x00ffff00, 0);
|
||||
|
||||
ID3D11ShaderResourceView_Release(srv);
|
||||
ID3D11Texture2D_Release(texture);
|
||||
@@ -22745,7 +22745,7 @@ static void test_mipmap_generation(void)
|
||||
check_texture_sub_resource_color(texture, 0, NULL, 0xff00ff00, 0);
|
||||
check_texture_sub_resource_color(texture, 1, NULL, 0xffff0000, 0);
|
||||
if (!is_warp_device(device)) /* broken on WARP device */
|
||||
- todo_wine check_texture_sub_resource_color(texture, 2, NULL, 0xffff0000, 0);
|
||||
+ check_texture_sub_resource_color(texture, 2, NULL, 0xffff0000, 0);
|
||||
check_texture_sub_resource_color(texture, 3, NULL, 0xff00ff00, 0);
|
||||
check_texture_sub_resource_color(texture, 4, NULL, 0xffff0000, 0);
|
||||
check_texture_sub_resource_color(texture, 5, NULL, 0x00000000, 0);
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 6b37e9d6f03..70fb19382ea 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -73,6 +73,7 @@ enum wined3d_cs_op
|
||||
WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW,
|
||||
WINED3D_CS_OP_COPY_UAV_COUNTER,
|
||||
WINED3D_CS_OP_GENERATE_MIPMAPS,
|
||||
+ WINED3D_CS_OP_GENERATE_MIPS,
|
||||
WINED3D_CS_OP_STOP,
|
||||
};
|
||||
|
||||
@@ -435,6 +436,12 @@ struct wined3d_cs_generate_mipmaps
|
||||
struct wined3d_shader_resource_view *view;
|
||||
};
|
||||
|
||||
+struct wined3d_cs_generate_mips
|
||||
+{
|
||||
+ enum wined3d_cs_op opcode;
|
||||
+ struct wined3d_shader_resource_view *view;
|
||||
+};
|
||||
+
|
||||
struct wined3d_cs_stop
|
||||
{
|
||||
enum wined3d_cs_op opcode;
|
||||
@@ -2388,6 +2395,82 @@ void wined3d_cs_emit_generate_mipmaps(st
|
||||
cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT);
|
||||
}
|
||||
|
||||
+static void wined3d_cs_exec_generate_mips(struct wined3d_cs *cs, const void *data)
|
||||
+{
|
||||
+ const struct wined3d_cs_generate_mips *op = data;
|
||||
+ struct wined3d_shader_resource_view *view = op->view;
|
||||
+ struct wined3d_resource *resource = view->resource;
|
||||
+ const struct wined3d_gl_info *gl_info;
|
||||
+ struct wined3d_texture *texture;
|
||||
+ struct wined3d_context *context;
|
||||
+ GLenum target;
|
||||
+ int i, j;
|
||||
+
|
||||
+ if (resource->type != WINED3D_RTYPE_TEXTURE_1D &&
|
||||
+ resource->type != WINED3D_RTYPE_TEXTURE_2D &&
|
||||
+ resource->type != WINED3D_RTYPE_TEXTURE_3D)
|
||||
+ {
|
||||
+ FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(resource->type));
|
||||
+ goto end;
|
||||
+ }
|
||||
+
|
||||
+ texture = texture_from_resource(resource);
|
||||
+ context = context_acquire(cs->device, NULL, 0);
|
||||
+ gl_info = context->gl_info;
|
||||
+
|
||||
+ for (i = view->desc.u.texture.layer_idx; i < view->desc.u.texture.layer_idx + view->desc.u.texture.layer_count; i++)
|
||||
+ {
|
||||
+ wined3d_texture_load_location(texture, i * texture->level_count + view->desc.u.texture.level_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
+ }
|
||||
+
|
||||
+ if (view->gl_view.name)
|
||||
+ {
|
||||
+ context_bind_texture(context, view->gl_view.target, view->gl_view.name);
|
||||
+ target = view->gl_view.target;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ wined3d_texture_bind(texture, context, FALSE);
|
||||
+ target = texture->target;
|
||||
+ }
|
||||
+
|
||||
+ if (gl_info->fbo_ops.glGenerateMipmap)
|
||||
+ {
|
||||
+ gl_info->fbo_ops.glGenerateMipmap(target);
|
||||
+ checkGLcall("glGenerateMipmap");
|
||||
+ }
|
||||
+ else
|
||||
+ FIXME("Your OpenGL driver does not support glGenerateMipmap.\n");
|
||||
+
|
||||
+ for (i = view->desc.u.texture.layer_idx; i < view->desc.u.texture.layer_idx + view->desc.u.texture.layer_count; i++)
|
||||
+ {
|
||||
+ for (j = view->desc.u.texture.level_idx + 1; j < view->desc.u.texture.level_idx + view->desc.u.texture.level_count; j++)
|
||||
+ {
|
||||
+ wined3d_texture_validate_location(texture, i * texture->level_count + j, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
+ wined3d_texture_invalidate_location(texture, i * texture->level_count + j, ~WINED3D_LOCATION_TEXTURE_RGB);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ wined3d_texture_dirtify(context);
|
||||
+ context_release(context);
|
||||
+
|
||||
+end:
|
||||
+ wined3d_resource_release(view->resource);
|
||||
+}
|
||||
+
|
||||
+void wined3d_cs_emit_generate_mips(struct wined3d_cs *cs, struct wined3d_shader_resource_view *view)
|
||||
+{
|
||||
+ struct wined3d_cs_generate_mips *op;
|
||||
+
|
||||
+ op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
|
||||
+ op->opcode = WINED3D_CS_OP_GENERATE_MIPS;
|
||||
+ op->view = view;
|
||||
+
|
||||
+ wined3d_resource_acquire(view->resource);
|
||||
+
|
||||
+ cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT);
|
||||
+}
|
||||
+
|
||||
static void wined3d_cs_emit_stop(struct wined3d_cs *cs)
|
||||
{
|
||||
struct wined3d_cs_stop *op;
|
||||
@@ -2448,6 +2531,7 @@ static void (* const wined3d_cs_op_handl
|
||||
/* WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW */ wined3d_cs_exec_clear_unordered_access_view,
|
||||
/* WINED3D_CS_OP_COPY_UAV_COUNTER */ wined3d_cs_exec_copy_uav_counter,
|
||||
/* WINED3D_CS_OP_GENERATE_MIPMAPS */ wined3d_cs_exec_generate_mipmaps,
|
||||
+ /* WINED3D_CS_OP_GENERATE_MIPS */ wined3d_cs_exec_generate_mips,
|
||||
};
|
||||
|
||||
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 1194513879c..bf17029b89e 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -4363,6 +4363,13 @@ void CDECL wined3d_device_resolve_sub_re
|
||||
src_texture, src_sub_resource_idx, &src_rect, 0, NULL, WINED3D_TEXF_POINT);
|
||||
}
|
||||
|
||||
+void CDECL wined3d_device_generate_mips_view(struct wined3d_device *device, struct wined3d_shader_resource_view *view)
|
||||
+{
|
||||
+ TRACE("device %p, view %p.\n", device, view);
|
||||
+
|
||||
+ wined3d_cs_emit_generate_mips(device->cs, view);
|
||||
+}
|
||||
+
|
||||
HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device,
|
||||
struct wined3d_rendertarget_view *view, const RECT *rect, DWORD flags,
|
||||
const struct wined3d_color *color, float depth, DWORD stencil)
|
||||
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
|
||||
index 14f5c4ecc7a..c91d40d18a9 100644
|
||||
--- a/dlls/wined3d/texture.c
|
||||
+++ b/dlls/wined3d/texture.c
|
||||
@@ -765,8 +765,7 @@ void wined3d_texture_bind(struct wined3d_texture *texture,
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
-void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture,
|
||||
- struct wined3d_context *context, BOOL srgb)
|
||||
+void wined3d_texture_dirtify(struct wined3d_context *context)
|
||||
{
|
||||
/* We don't need a specific texture unit, but after binding the texture
|
||||
* the current unit is dirty. Read the unit back instead of switching to
|
||||
@@ -787,7 +786,13 @@ void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture,
|
||||
* a shader. */
|
||||
context_invalidate_compute_state(context, STATE_COMPUTE_SHADER_RESOURCE_BINDING);
|
||||
context_invalidate_state(context, STATE_GRAPHICS_SHADER_RESOURCE_BINDING);
|
||||
+}
|
||||
|
||||
+/* Context activation is done by the caller. */
|
||||
+void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture,
|
||||
+ struct wined3d_context *context, BOOL srgb)
|
||||
+{
|
||||
+ wined3d_texture_dirtify(context);
|
||||
wined3d_texture_bind(texture, context, srgb);
|
||||
}
|
||||
|
||||
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
|
||||
index e4d5f2ed9ac..22c76a49281 100644
|
||||
--- a/dlls/wined3d/wined3d.spec
|
||||
+++ b/dlls/wined3d/wined3d.spec
|
||||
@@ -55,6 +55,7 @@
|
||||
@ cdecl wined3d_device_end_scene(ptr)
|
||||
@ cdecl wined3d_device_end_stateblock(ptr ptr)
|
||||
@ cdecl wined3d_device_evict_managed_resources(ptr)
|
||||
+@ cdecl wined3d_device_generate_mips_view(ptr ptr)
|
||||
@ cdecl wined3d_device_get_available_texture_mem(ptr)
|
||||
@ cdecl wined3d_device_get_base_vertex_index(ptr)
|
||||
@ cdecl wined3d_device_get_blend_state(ptr)
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 81628d21e8f..4960b513931 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -3234,6 +3234,7 @@ void wined3d_texture_bind(struct wined3d
|
||||
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture,
|
||||
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
|
||||
+void wined3d_texture_dirtify(struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
HRESULT wined3d_texture_check_box_dimensions(const struct wined3d_texture *texture,
|
||||
unsigned int level, const struct wined3d_box *box) DECLSPEC_HIDDEN;
|
||||
GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN;
|
||||
@@ -3612,6 +3613,7 @@ void wined3d_cs_emit_unload_resource(str
|
||||
void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource,
|
||||
unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch,
|
||||
unsigned int slice_pitch) DECLSPEC_HIDDEN;
|
||||
+void wined3d_cs_emit_generate_mips(struct wined3d_cs *cs, struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN;
|
||||
void wined3d_cs_init_object(struct wined3d_cs *cs,
|
||||
void (*callback)(void *object), void *object) DECLSPEC_HIDDEN;
|
||||
HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx,
|
||||
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
|
||||
index 37aee84308f..961762d2cf0 100644
|
||||
--- a/include/wine/wined3d.h
|
||||
+++ b/include/wine/wined3d.h
|
||||
@@ -2465,6 +2465,7 @@ void __cdecl wined3d_device_update_sub_resource(struct wined3d_device *device, s
|
||||
HRESULT __cdecl wined3d_device_update_texture(struct wined3d_device *device,
|
||||
struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture);
|
||||
HRESULT __cdecl wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes);
|
||||
+void CDECL wined3d_device_generate_mips_view(struct wined3d_device *device, struct wined3d_shader_resource_view *view);
|
||||
|
||||
HRESULT __cdecl wined3d_palette_create(struct wined3d_device *device, DWORD flags,
|
||||
unsigned int entry_count, const PALETTEENTRY *entries, struct wined3d_palette **palette);
|
||||
--
|
||||
2.14.1
|
@ -1,33 +0,0 @@
|
||||
From 2f249a6a8c5906813d05470df61928d43eb289c8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Wed, 20 Sep 2017 21:33:30 +0200
|
||||
Subject: d3d11: Implement d3d10_device_GenerateMips.
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 12 +++++++++++-
|
||||
1 file changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 22adf361feb..d389c2625a0 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -4251,12 +4251,16 @@ static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device1 *
|
||||
static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device1 *iface,
|
||||
ID3D10ShaderResourceView *view)
|
||||
{
|
||||
+ struct d3d_device *device = impl_from_ID3D10Device(iface);
|
||||
struct d3d_shader_resource_view *srv = unsafe_impl_from_ID3D10ShaderResourceView(view);
|
||||
|
||||
TRACE("iface %p, view %p.\n", iface, view);
|
||||
|
||||
+ if (!srv)
|
||||
+ return;
|
||||
+
|
||||
wined3d_mutex_lock();
|
||||
- wined3d_shader_resource_view_generate_mipmaps(srv->wined3d_view);
|
||||
+ wined3d_device_generate_mips_view(device->wined3d_device, srv->wined3d_view);
|
||||
wined3d_mutex_unlock();
|
||||
}
|
||||
|
||||
--
|
||||
2.14.1
|
@ -1,2 +0,0 @@
|
||||
Fixes: Support for GenerateMips
|
||||
Depends: wined3d-Dual_Source_Blending
|
Loading…
x
Reference in New Issue
Block a user