Wine-devel
Threads by month
- ----- 2026 -----
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
April 2020
- 87 participants
- 854 discussions
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
include/ntdef.h | 33 +++++++++++++++++++++++++++++++++
include/windef.h | 15 +++++++++++----
2 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/include/ntdef.h b/include/ntdef.h
index 014102ac74..d85aa6feb5 100644
--- a/include/ntdef.h
+++ b/include/ntdef.h
@@ -19,6 +19,8 @@
#ifndef _NTDEF_
#define _NTDEF_
+#include <basetsd.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -48,4 +50,35 @@ typedef enum _WAIT_TYPE {
#define NT_WARNING(status) ((((NTSTATUS)(status)) & 0xc0000000) == 0x80000000)
#define NT_ERROR(status) ((((NTSTATUS)(status)) & 0xc0000000) == 0xc0000000)
+#define BASETYPES
+typedef unsigned char UCHAR, *PUCHAR;
+typedef unsigned short USHORT, *PUSHORT;
+#ifdef _MSC_VER
+typedef unsigned long ULONG, *PULONG;
+#else
+typedef unsigned int ULONG, *PULONG;
+#endif
+
+typedef struct _RTL_BALANCED_NODE
+{
+ union
+ {
+ struct _RTL_BALANCED_NODE *Children[2];
+ struct
+ {
+ struct _RTL_BALANCED_NODE *Left;
+ struct _RTL_BALANCED_NODE *Right;
+ } DUMMYSTRUCTNAME;
+ } DUMMYUNIONNAME;
+
+ union
+ {
+ UCHAR Red : 1;
+ UCHAR Balance : 2;
+ ULONG_PTR ParentValue;
+ } DUMMYUNIONNAME2;
+} RTL_BALANCED_NODE, *PRTL_BALANCED_NODE;
+
+#define RTL_BALANCED_NODE_RESERVED_PARENT_MASK 3
+
#endif /* _NTDEF_ */
diff --git a/include/windef.h b/include/windef.h
index 0074d5cf6c..3c61cad4c5 100644
--- a/include/windef.h
+++ b/include/windef.h
@@ -239,13 +239,22 @@ extern "C" {
/* Standard data types */
+#ifndef BASETYPES
+#define BASETYPES
+typedef unsigned char UCHAR, *PUCHAR;
+typedef unsigned short USHORT, *PUSHORT;
+#ifdef _MSC_VER
+typedef unsigned long ULONG, *PULONG;
+#else
+typedef unsigned int ULONG, *PULONG;
+#endif
+#endif
+
typedef void *LPVOID;
typedef const void *LPCVOID;
typedef int BOOL, *PBOOL, *LPBOOL;
typedef unsigned char BYTE, *PBYTE, *LPBYTE;
-typedef unsigned char UCHAR, *PUCHAR;
typedef unsigned short WORD, *PWORD, *LPWORD;
-typedef unsigned short USHORT, *PUSHORT;
typedef int INT, *PINT, *LPINT;
typedef unsigned int UINT, *PUINT;
typedef float FLOAT, *PFLOAT;
@@ -253,11 +262,9 @@ typedef char *PSZ;
#ifdef _MSC_VER
typedef long *LPLONG;
typedef unsigned long DWORD, *PDWORD, *LPDWORD;
-typedef unsigned long ULONG, *PULONG;
#else
typedef int *LPLONG;
typedef unsigned int DWORD, *PDWORD, *LPDWORD;
-typedef unsigned int ULONG, *PULONG;
#endif
/* Macros to map Winelib names to the correct implementation name */
--
2.26.2
1
1
23 Apr '20
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/qcap/filewriter.c | 69 ++++++++++++++++++++++++++++++++++++
dlls/qcap/tests/filewriter.c | 2 +-
2 files changed, 70 insertions(+), 1 deletion(-)
diff --git a/dlls/qcap/filewriter.c b/dlls/qcap/filewriter.c
index 2b1d219a08..e56b5f68a4 100644
--- a/dlls/qcap/filewriter.c
+++ b/dlls/qcap/filewriter.c
@@ -28,6 +28,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(qcap);
struct file_writer
{
struct strmbase_filter filter;
+ IFileSinkFilter IFileSinkFilter_iface;
struct strmbase_sink sink;
};
@@ -60,6 +61,19 @@ static inline struct file_writer *impl_from_strmbase_filter(struct strmbase_filt
return CONTAINING_RECORD(iface, struct file_writer, filter);
}
+static HRESULT file_writer_query_interface(struct strmbase_filter *iface, REFIID iid, void **out)
+{
+ struct file_writer *filter = impl_from_strmbase_filter(iface);
+
+ if (IsEqualGUID(iid, &IID_IFileSinkFilter))
+ *out = &filter->IFileSinkFilter_iface;
+ else
+ return E_NOINTERFACE;
+
+ IUnknown_AddRef((IUnknown *)*out);
+ return S_OK;
+}
+
static struct strmbase_pin *file_writer_get_pin(struct strmbase_filter *iface, unsigned int index)
{
struct file_writer *filter = impl_from_strmbase_filter(iface);
@@ -80,10 +94,64 @@ static void file_writer_destroy(struct strmbase_filter *iface)
static struct strmbase_filter_ops filter_ops =
{
+ .filter_query_interface = file_writer_query_interface,
.filter_get_pin = file_writer_get_pin,
.filter_destroy = file_writer_destroy,
};
+static inline struct file_writer *impl_from_IFileSinkFilter(IFileSinkFilter *iface)
+{
+ return CONTAINING_RECORD(iface, struct file_writer, IFileSinkFilter_iface);
+}
+
+static HRESULT WINAPI filesinkfilter_QueryInterface(IFileSinkFilter *iface, REFIID iid, void **out)
+{
+ struct file_writer *filter = impl_from_IFileSinkFilter(iface);
+ return IUnknown_QueryInterface(filter->filter.outer_unk, iid, out);
+}
+
+static ULONG WINAPI filesinkfilter_AddRef(IFileSinkFilter *iface)
+{
+ struct file_writer *filter = impl_from_IFileSinkFilter(iface);
+ return IUnknown_AddRef(filter->filter.outer_unk);
+}
+
+static ULONG WINAPI filesinkfilter_Release(IFileSinkFilter *iface)
+{
+ struct file_writer *filter = impl_from_IFileSinkFilter(iface);
+ return IUnknown_Release(filter->filter.outer_unk);
+}
+
+static HRESULT WINAPI filesinkfilter_SetFileName(IFileSinkFilter *iface,
+ LPCOLESTR filename, const AM_MEDIA_TYPE *mt)
+{
+ struct file_writer *filter = impl_from_IFileSinkFilter(iface);
+
+ FIXME("filter %p, filename %s, mt %p, stub!\n", filter, debugstr_w(filename), mt);
+ strmbase_dump_media_type(mt);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI filesinkfilter_GetCurFile(IFileSinkFilter *iface,
+ LPOLESTR *filename, AM_MEDIA_TYPE *mt)
+{
+ struct file_writer *filter = impl_from_IFileSinkFilter(iface);
+
+ FIXME("filter %p, filename %p, mt %p, stub!\n", filter, filename, mt);
+
+ return E_NOTIMPL;
+}
+
+static const IFileSinkFilterVtbl filesinkfilter_vtbl =
+{
+ filesinkfilter_QueryInterface,
+ filesinkfilter_AddRef,
+ filesinkfilter_Release,
+ filesinkfilter_SetFileName,
+ filesinkfilter_GetCurFile,
+};
+
HRESULT file_writer_create(IUnknown *outer, IUnknown **out)
{
static const WCHAR sink_name[] = {'i','n',0};
@@ -93,6 +161,7 @@ HRESULT file_writer_create(IUnknown *outer, IUnknown **out)
return E_OUTOFMEMORY;
strmbase_filter_init(&object->filter, outer, &CLSID_FileWriter, &filter_ops);
+ object->IFileSinkFilter_iface.lpVtbl = &filesinkfilter_vtbl;
strmbase_sink_init(&object->sink, &object->filter, sink_name, &sink_ops, NULL);
diff --git a/dlls/qcap/tests/filewriter.c b/dlls/qcap/tests/filewriter.c
index 8201a4d0c7..5d8ce45e0d 100644
--- a/dlls/qcap/tests/filewriter.c
+++ b/dlls/qcap/tests/filewriter.c
@@ -61,7 +61,7 @@ static void test_interfaces(void)
todo_wine check_interface(filter, &IID_IAMFilterMiscFlags, TRUE);
check_interface(filter, &IID_IBaseFilter, TRUE);
- todo_wine check_interface(filter, &IID_IFileSinkFilter, TRUE);
+ check_interface(filter, &IID_IFileSinkFilter, TRUE);
todo_wine check_interface(filter, &IID_IFileSinkFilter2, TRUE);
check_interface(filter, &IID_IMediaFilter, TRUE);
check_interface(filter, &IID_IPersist, TRUE);
--
2.26.2
2
4
[PATCH 2/3] windowscodecs: Fix IWICBitmapDecoder::CopyPalette for a not initialized case in the GIF decoder.
by Dmitry Timoshkov 23 Apr '20
by Dmitry Timoshkov 23 Apr '20
23 Apr '20
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/windowscodecs/gifformat.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/dlls/windowscodecs/gifformat.c b/dlls/windowscodecs/gifformat.c
index 9c212c8eb8..6f82d921ab 100644
--- a/dlls/windowscodecs/gifformat.c
+++ b/dlls/windowscodecs/gifformat.c
@@ -1187,6 +1187,9 @@ static HRESULT WINAPI GifDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalet
TRACE("(%p,%p)\n", iface, palette);
+ if (!This->gif)
+ return WINCODEC_ERR_WRONGSTATE;
+
cm = This->gif->SColorMap;
if (cm)
{
--
2.26.2
1
0
23 Apr '20
Based on patch by Chip Davis.
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
With PE builds by default and GCC using -mabi and native clang not
really working, platforms where we can't use long are mostly
theoretical. On the other hand, on cross compilers, using ints where
long is expected causes troubles for things like builtin functions. This
was already addressed for clang in mingw mode in ee9beb58639, but
incompatible long is an error in msvc mode.
dlls/msvcirt/tests/msvcirt.c | 8 ++++----
dlls/msvcrt/tests/file.c | 12 ++++++------
dlls/msvcrt/tests/misc.c | 8 ++++----
dlls/msvcrt/tests/time.c | 10 +++++-----
include/msvcrt/corecrt.h | 5 +++++
5 files changed, 24 insertions(+), 19 deletions(-)
1
0
22 Apr '20
And use intrinsic versions on x86.
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
include/winbase.h | 101 ++++++++++++++++++++++------------------------
1 file changed, 49 insertions(+), 52 deletions(-)
1
0
---
dlls/netapi32/tests/access.c | 2 ++
1 file changed, 2 insertions(+)
2
1
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/surface.c | 136 -----------------------------------------
dlls/wined3d/texture.c | 133 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 133 insertions(+), 136 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 0dd8c4266b6..d8bf9ce04e6 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -600,142 +600,6 @@ void texture2d_load_fb_texture(struct wined3d_texture_gl *texture_gl,
context_restore(context, restore_texture, restore_idx);
}
-/* Context activation is done by the caller. */
-static void raw_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_context *context)
-{
- struct wined3d_blitter *next;
-
- if ((next = blitter->next))
- next->ops->blitter_destroy(next, context);
-
- heap_free(blitter);
-}
-
-/* Context activation is done by the caller. */
-static void raw_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device,
- unsigned int rt_count, const struct wined3d_fb_state *fb, unsigned int rect_count, const RECT *clear_rects,
- const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
-{
- struct wined3d_blitter *next;
-
- if (!(next = blitter->next))
- {
- ERR("No blitter to handle clear.\n");
- return;
- }
-
- TRACE("Forwarding to blitter %p.\n", next);
- next->ops->blitter_clear(next, device, rt_count, fb, rect_count,
- clear_rects, draw_rect, flags, colour, depth, stencil);
-}
-
-/* Context activation is done by the caller. */
-static DWORD raw_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_op op,
- struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
- DWORD src_location, const RECT *src_rect, struct wined3d_texture *dst_texture,
- unsigned int dst_sub_resource_idx, DWORD dst_location, const RECT *dst_rect,
- const struct wined3d_color_key *colour_key, enum wined3d_texture_filter_type filter)
-{
- struct wined3d_texture_gl *src_texture_gl = wined3d_texture_gl(src_texture);
- struct wined3d_texture_gl *dst_texture_gl = wined3d_texture_gl(dst_texture);
- struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
- const struct wined3d_gl_info *gl_info = context_gl->gl_info;
- unsigned int src_level, src_layer, dst_level, dst_layer;
- struct wined3d_blitter *next;
- GLuint src_name, dst_name;
- DWORD location;
-
- /* If we would need to copy from a renderbuffer or drawable, we'd probably
- * be better off using the FBO blitter directly, since we'd need to use it
- * to copy the resource contents to the texture anyway. */
- if (op != WINED3D_BLIT_OP_RAW_BLIT
- || (src_texture->resource.format->id == dst_texture->resource.format->id
- && (!(src_location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
- || !(dst_location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)))))
- {
- if (!(next = blitter->next))
- {
- ERR("No blitter to handle blit op %#x.\n", op);
- return dst_location;
- }
-
- TRACE("Forwarding to blitter %p.\n", next);
- return next->ops->blitter_blit(next, op, context, src_texture, src_sub_resource_idx, src_location,
- src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, colour_key, filter);
- }
-
- TRACE("Blit using ARB_copy_image.\n");
-
- src_level = src_sub_resource_idx % src_texture->level_count;
- src_layer = src_sub_resource_idx / src_texture->level_count;
-
- dst_level = dst_sub_resource_idx % dst_texture->level_count;
- dst_layer = dst_sub_resource_idx / dst_texture->level_count;
-
- location = src_location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB);
- if (!location)
- location = src_texture->flags & WINED3D_TEXTURE_IS_SRGB
- ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB;
- if (!wined3d_texture_load_location(src_texture, src_sub_resource_idx, context, location))
- ERR("Failed to load the source sub-resource into %s.\n", wined3d_debug_location(location));
- src_name = wined3d_texture_gl_get_texture_name(src_texture_gl,
- context, location == WINED3D_LOCATION_TEXTURE_SRGB);
-
- location = dst_location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB);
- if (!location)
- location = dst_texture->flags & WINED3D_TEXTURE_IS_SRGB
- ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB;
- if (texture2d_is_full_rect(dst_texture, dst_level, dst_rect))
- {
- if (!wined3d_texture_prepare_location(dst_texture, dst_sub_resource_idx, context, location))
- ERR("Failed to prepare the destination sub-resource into %s.\n", wined3d_debug_location(location));
- }
- else
- {
- if (!wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, location))
- ERR("Failed to load the destination sub-resource into %s.\n", wined3d_debug_location(location));
- }
- dst_name = wined3d_texture_gl_get_texture_name(dst_texture_gl,
- context, location == WINED3D_LOCATION_TEXTURE_SRGB);
-
- GL_EXTCALL(glCopyImageSubData(src_name, src_texture_gl->target, src_level,
- src_rect->left, src_rect->top, src_layer, dst_name, dst_texture_gl->target, dst_level,
- dst_rect->left, dst_rect->top, dst_layer, src_rect->right - src_rect->left,
- src_rect->bottom - src_rect->top, 1));
- checkGLcall("copy image data");
-
- wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, location);
- wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~location);
- if (!wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, dst_location))
- ERR("Failed to load the destination sub-resource into %s.\n", wined3d_debug_location(dst_location));
-
- return dst_location | location;
-}
-
-static const struct wined3d_blitter_ops raw_blitter_ops =
-{
- raw_blitter_destroy,
- raw_blitter_clear,
- raw_blitter_blit,
-};
-
-void wined3d_raw_blitter_create(struct wined3d_blitter **next, const struct wined3d_gl_info *gl_info)
-{
- struct wined3d_blitter *blitter;
-
- if (!gl_info->supported[ARB_COPY_IMAGE])
- return;
-
- if (!(blitter = heap_alloc(sizeof(*blitter))))
- return;
-
- TRACE("Created blitter %p.\n", blitter);
-
- blitter->ops = &raw_blitter_ops;
- blitter->next = *next;
- *next = blitter;
-}
-
/* Context activation is done by the caller. */
static void cpu_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_context *context)
{
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 0036607005c..aacc965ffcf 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -5592,3 +5592,136 @@ void wined3d_fbo_blitter_create(struct wined3d_blitter **next, const struct wine
blitter->next = *next;
*next = blitter;
}
+
+static void raw_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_context *context)
+{
+ struct wined3d_blitter *next;
+
+ if ((next = blitter->next))
+ next->ops->blitter_destroy(next, context);
+
+ heap_free(blitter);
+}
+
+static void raw_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device,
+ unsigned int rt_count, const struct wined3d_fb_state *fb, unsigned int rect_count, const RECT *clear_rects,
+ const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
+{
+ struct wined3d_blitter *next;
+
+ if (!(next = blitter->next))
+ {
+ ERR("No blitter to handle clear.\n");
+ return;
+ }
+
+ TRACE("Forwarding to blitter %p.\n", next);
+ next->ops->blitter_clear(next, device, rt_count, fb, rect_count,
+ clear_rects, draw_rect, flags, colour, depth, stencil);
+}
+
+static DWORD raw_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_op op,
+ struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
+ DWORD src_location, const RECT *src_rect, struct wined3d_texture *dst_texture,
+ unsigned int dst_sub_resource_idx, DWORD dst_location, const RECT *dst_rect,
+ const struct wined3d_color_key *colour_key, enum wined3d_texture_filter_type filter)
+{
+ struct wined3d_texture_gl *src_texture_gl = wined3d_texture_gl(src_texture);
+ struct wined3d_texture_gl *dst_texture_gl = wined3d_texture_gl(dst_texture);
+ struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
+ const struct wined3d_gl_info *gl_info = context_gl->gl_info;
+ unsigned int src_level, src_layer, dst_level, dst_layer;
+ struct wined3d_blitter *next;
+ GLuint src_name, dst_name;
+ DWORD location;
+
+ /* If we would need to copy from a renderbuffer or drawable, we'd probably
+ * be better off using the FBO blitter directly, since we'd need to use it
+ * to copy the resource contents to the texture anyway. */
+ if (op != WINED3D_BLIT_OP_RAW_BLIT
+ || (src_texture->resource.format->id == dst_texture->resource.format->id
+ && (!(src_location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
+ || !(dst_location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)))))
+ {
+ if (!(next = blitter->next))
+ {
+ ERR("No blitter to handle blit op %#x.\n", op);
+ return dst_location;
+ }
+
+ TRACE("Forwarding to blitter %p.\n", next);
+ return next->ops->blitter_blit(next, op, context, src_texture, src_sub_resource_idx, src_location,
+ src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, colour_key, filter);
+ }
+
+ TRACE("Blit using ARB_copy_image.\n");
+
+ src_level = src_sub_resource_idx % src_texture->level_count;
+ src_layer = src_sub_resource_idx / src_texture->level_count;
+
+ dst_level = dst_sub_resource_idx % dst_texture->level_count;
+ dst_layer = dst_sub_resource_idx / dst_texture->level_count;
+
+ location = src_location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB);
+ if (!location)
+ location = src_texture->flags & WINED3D_TEXTURE_IS_SRGB
+ ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB;
+ if (!wined3d_texture_load_location(src_texture, src_sub_resource_idx, context, location))
+ ERR("Failed to load the source sub-resource into %s.\n", wined3d_debug_location(location));
+ src_name = wined3d_texture_gl_get_texture_name(src_texture_gl,
+ context, location == WINED3D_LOCATION_TEXTURE_SRGB);
+
+ location = dst_location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB);
+ if (!location)
+ location = dst_texture->flags & WINED3D_TEXTURE_IS_SRGB
+ ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB;
+ if (texture2d_is_full_rect(dst_texture, dst_level, dst_rect))
+ {
+ if (!wined3d_texture_prepare_location(dst_texture, dst_sub_resource_idx, context, location))
+ ERR("Failed to prepare the destination sub-resource into %s.\n", wined3d_debug_location(location));
+ }
+ else
+ {
+ if (!wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, location))
+ ERR("Failed to load the destination sub-resource into %s.\n", wined3d_debug_location(location));
+ }
+ dst_name = wined3d_texture_gl_get_texture_name(dst_texture_gl,
+ context, location == WINED3D_LOCATION_TEXTURE_SRGB);
+
+ GL_EXTCALL(glCopyImageSubData(src_name, src_texture_gl->target, src_level,
+ src_rect->left, src_rect->top, src_layer, dst_name, dst_texture_gl->target, dst_level,
+ dst_rect->left, dst_rect->top, dst_layer, src_rect->right - src_rect->left,
+ src_rect->bottom - src_rect->top, 1));
+ checkGLcall("copy image data");
+
+ wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, location);
+ wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~location);
+ if (!wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, dst_location))
+ ERR("Failed to load the destination sub-resource into %s.\n", wined3d_debug_location(dst_location));
+
+ return dst_location | location;
+}
+
+static const struct wined3d_blitter_ops raw_blitter_ops =
+{
+ raw_blitter_destroy,
+ raw_blitter_clear,
+ raw_blitter_blit,
+};
+
+void wined3d_raw_blitter_create(struct wined3d_blitter **next, const struct wined3d_gl_info *gl_info)
+{
+ struct wined3d_blitter *blitter;
+
+ if (!gl_info->supported[ARB_COPY_IMAGE])
+ return;
+
+ if (!(blitter = heap_alloc(sizeof(*blitter))))
+ return;
+
+ TRACE("Created blitter %p.\n", blitter);
+
+ blitter->ops = &raw_blitter_ops;
+ blitter->next = *next;
+ *next = blitter;
+}
--
2.20.1
1
0
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/surface.c | 370 -------------------------------
dlls/wined3d/texture.c | 382 +++++++++++++++++++++++++++++++++
dlls/wined3d/wined3d_private.h | 9 -
3 files changed, 382 insertions(+), 379 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 2c072454f32..0dd8c4266b6 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -57,265 +57,6 @@ static BOOL texture2d_is_full_rect(const struct wined3d_texture *texture, unsign
return TRUE;
}
-static void texture2d_depth_blt_fbo(const struct wined3d_device *device, struct wined3d_context *context,
- struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, DWORD src_location,
- const RECT *src_rect, struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx,
- DWORD dst_location, const RECT *dst_rect)
-{
- struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
- const struct wined3d_gl_info *gl_info = context_gl->gl_info;
- DWORD src_mask, dst_mask;
- GLbitfield gl_mask;
-
- TRACE("device %p, src_texture %p, src_sub_resource_idx %u, src_location %s, src_rect %s, "
- "dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s.\n", device,
- src_texture, src_sub_resource_idx, wined3d_debug_location(src_location), wine_dbgstr_rect(src_rect),
- dst_texture, dst_sub_resource_idx, wined3d_debug_location(dst_location), wine_dbgstr_rect(dst_rect));
-
- src_mask = src_texture->resource.format_flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
- dst_mask = dst_texture->resource.format_flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
-
- if (src_mask != dst_mask)
- {
- ERR("Incompatible formats %s and %s.\n",
- debug_d3dformat(src_texture->resource.format->id),
- debug_d3dformat(dst_texture->resource.format->id));
- return;
- }
-
- if (!src_mask)
- {
- ERR("Not a depth / stencil format: %s.\n",
- debug_d3dformat(src_texture->resource.format->id));
- return;
- }
-
- gl_mask = 0;
- if (src_mask & WINED3DFMT_FLAG_DEPTH)
- gl_mask |= GL_DEPTH_BUFFER_BIT;
- if (src_mask & WINED3DFMT_FLAG_STENCIL)
- gl_mask |= GL_STENCIL_BUFFER_BIT;
-
- /* Make sure the locations are up-to-date. Loading the destination
- * surface isn't required if the entire surface is overwritten. */
- wined3d_texture_load_location(src_texture, src_sub_resource_idx, context, src_location);
- if (!texture2d_is_full_rect(dst_texture, dst_sub_resource_idx % dst_texture->level_count, dst_rect))
- wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, dst_location);
- else
- wined3d_texture_prepare_location(dst_texture, dst_sub_resource_idx, context, dst_location);
-
- wined3d_context_gl_apply_fbo_state_blit(context_gl, GL_READ_FRAMEBUFFER, NULL, 0,
- &src_texture->resource, src_sub_resource_idx, src_location);
- wined3d_context_gl_check_fbo_status(context_gl, GL_READ_FRAMEBUFFER);
-
- wined3d_context_gl_apply_fbo_state_blit(context_gl, GL_DRAW_FRAMEBUFFER, NULL, 0,
- &dst_texture->resource, dst_sub_resource_idx, dst_location);
- wined3d_context_gl_set_draw_buffer(context_gl, GL_NONE);
- wined3d_context_gl_check_fbo_status(context_gl, GL_DRAW_FRAMEBUFFER);
- context_invalidate_state(context, STATE_FRAMEBUFFER);
-
- if (gl_mask & GL_DEPTH_BUFFER_BIT)
- {
- gl_info->gl_ops.gl.p_glDepthMask(GL_TRUE);
- context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ZWRITEENABLE));
- }
- if (gl_mask & GL_STENCIL_BUFFER_BIT)
- {
- if (gl_info->supported[EXT_STENCIL_TWO_SIDE])
- {
- gl_info->gl_ops.gl.p_glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
- context_invalidate_state(context, STATE_RENDER(WINED3D_RS_TWOSIDEDSTENCILMODE));
- }
- gl_info->gl_ops.gl.p_glStencilMask(~0U);
- context_invalidate_state(context, STATE_RENDER(WINED3D_RS_STENCILWRITEMASK));
- }
-
- gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST);
- context_invalidate_state(context, STATE_RASTERIZER);
-
- gl_info->fbo_ops.glBlitFramebuffer(src_rect->left, src_rect->top, src_rect->right, src_rect->bottom,
- dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, gl_mask, GL_NEAREST);
- checkGLcall("glBlitFramebuffer()");
-}
-
-/* Blit between surface locations. Onscreen on different swapchains is not supported.
- * Depth / stencil is not supported. Context activation is done by the caller. */
-void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_context *context,
- enum wined3d_texture_filter_type filter, struct wined3d_texture *src_texture,
- unsigned int src_sub_resource_idx, DWORD src_location, const RECT *src_rect,
- struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, DWORD dst_location,
- const RECT *dst_rect)
-{
- struct wined3d_texture *required_texture, *restore_texture;
- const struct wined3d_gl_info *gl_info;
- struct wined3d_context_gl *context_gl;
- unsigned int restore_idx;
- BOOL scaled_resolve;
- GLenum gl_filter;
- GLenum buffer;
- RECT s, d;
-
- TRACE("device %p, context %p, filter %s, src_texture %p, src_sub_resource_idx %u, src_location %s, "
- "src_rect %s, dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s.\n",
- device, context, debug_d3dtexturefiltertype(filter), src_texture, src_sub_resource_idx,
- wined3d_debug_location(src_location), wine_dbgstr_rect(src_rect), dst_texture,
- dst_sub_resource_idx, wined3d_debug_location(dst_location), wine_dbgstr_rect(dst_rect));
-
- scaled_resolve = wined3d_texture_gl_is_multisample_location(wined3d_texture_gl(src_texture), src_location)
- && (abs(src_rect->bottom - src_rect->top) != abs(dst_rect->bottom - dst_rect->top)
- || abs(src_rect->right - src_rect->left) != abs(dst_rect->right - dst_rect->left));
-
- if (filter == WINED3D_TEXF_LINEAR)
- gl_filter = scaled_resolve ? GL_SCALED_RESOLVE_NICEST_EXT : GL_LINEAR;
- else
- gl_filter = scaled_resolve ? GL_SCALED_RESOLVE_FASTEST_EXT : GL_NEAREST;
-
- /* Make sure the locations are up-to-date. Loading the destination
- * surface isn't required if the entire surface is overwritten. (And is
- * in fact harmful if we're being called by surface_load_location() with
- * the purpose of loading the destination surface.) */
- wined3d_texture_load_location(src_texture, src_sub_resource_idx, context, src_location);
- if (!texture2d_is_full_rect(dst_texture, dst_sub_resource_idx % dst_texture->level_count, dst_rect))
- wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, dst_location);
- else
- wined3d_texture_prepare_location(dst_texture, dst_sub_resource_idx, context, dst_location);
-
- /* Acquire a context for the front-buffer, even though we may be blitting
- * to/from a back-buffer. Since context_acquire() doesn't take the
- * resource location into account, it may consider the back-buffer to be
- * offscreen. */
- if (src_location == WINED3D_LOCATION_DRAWABLE)
- required_texture = src_texture->swapchain->front_buffer;
- else if (dst_location == WINED3D_LOCATION_DRAWABLE)
- required_texture = dst_texture->swapchain->front_buffer;
- else
- required_texture = NULL;
-
- restore_texture = context->current_rt.texture;
- restore_idx = context->current_rt.sub_resource_idx;
- if (restore_texture != required_texture)
- context = context_acquire(device, required_texture, 0);
- else
- restore_texture = NULL;
-
- context_gl = wined3d_context_gl(context);
- if (!context_gl->valid)
- {
- context_release(context);
- WARN("Invalid context, skipping blit.\n");
- return;
- }
-
- gl_info = context_gl->gl_info;
-
- if (src_location == WINED3D_LOCATION_DRAWABLE)
- {
- TRACE("Source texture %p is onscreen.\n", src_texture);
- buffer = wined3d_texture_get_gl_buffer(src_texture);
- s = *src_rect;
- wined3d_texture_translate_drawable_coords(src_texture, context_gl->window, &s);
- src_rect = &s;
- }
- else
- {
- TRACE("Source texture %p is offscreen.\n", src_texture);
- buffer = GL_COLOR_ATTACHMENT0;
- }
-
- wined3d_context_gl_apply_fbo_state_blit(context_gl, GL_READ_FRAMEBUFFER,
- &src_texture->resource, src_sub_resource_idx, NULL, 0, src_location);
- gl_info->gl_ops.gl.p_glReadBuffer(buffer);
- checkGLcall("glReadBuffer()");
- wined3d_context_gl_check_fbo_status(context_gl, GL_READ_FRAMEBUFFER);
-
- if (dst_location == WINED3D_LOCATION_DRAWABLE)
- {
- TRACE("Destination texture %p is onscreen.\n", dst_texture);
- buffer = wined3d_texture_get_gl_buffer(dst_texture);
- d = *dst_rect;
- wined3d_texture_translate_drawable_coords(dst_texture, context_gl->window, &d);
- dst_rect = &d;
- }
- else
- {
- TRACE("Destination texture %p is offscreen.\n", dst_texture);
- buffer = GL_COLOR_ATTACHMENT0;
- }
-
- wined3d_context_gl_apply_fbo_state_blit(context_gl, GL_DRAW_FRAMEBUFFER,
- &dst_texture->resource, dst_sub_resource_idx, NULL, 0, dst_location);
- wined3d_context_gl_set_draw_buffer(context_gl, buffer);
- wined3d_context_gl_check_fbo_status(context_gl, GL_DRAW_FRAMEBUFFER);
- context_invalidate_state(context, STATE_FRAMEBUFFER);
-
- gl_info->gl_ops.gl.p_glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- context_invalidate_state(context, STATE_BLEND);
-
- gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST);
- context_invalidate_state(context, STATE_RASTERIZER);
-
- gl_info->fbo_ops.glBlitFramebuffer(src_rect->left, src_rect->top, src_rect->right, src_rect->bottom,
- dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, GL_COLOR_BUFFER_BIT, gl_filter);
- checkGLcall("glBlitFramebuffer()");
-
- if (dst_location == WINED3D_LOCATION_DRAWABLE && dst_texture->swapchain->front_buffer == dst_texture)
- gl_info->gl_ops.gl.p_glFlush();
-
- if (restore_texture)
- context_restore(context, restore_texture, restore_idx);
-}
-
-BOOL fbo_blitter_supported(enum wined3d_blit_op blit_op, const struct wined3d_gl_info *gl_info,
- const struct wined3d_resource *src_resource, DWORD src_location,
- const struct wined3d_resource *dst_resource, DWORD dst_location)
-{
- const struct wined3d_format *src_format = src_resource->format;
- const struct wined3d_format *dst_format = dst_resource->format;
-
- if ((wined3d_settings.offscreen_rendering_mode != ORM_FBO) || !gl_info->fbo_ops.glBlitFramebuffer)
- return FALSE;
-
- /* Source and/or destination need to be on the GL side */
- 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:
- if (!((src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_FBO_ATTACHABLE)
- || (src_resource->bind_flags & WINED3D_BIND_RENDER_TARGET)))
- return FALSE;
- if (!((dst_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_FBO_ATTACHABLE)
- || (dst_resource->bind_flags & WINED3D_BIND_RENDER_TARGET)))
- return FALSE;
- if ((src_format->id != dst_format->id || dst_location == WINED3D_LOCATION_DRAWABLE)
- && (!is_identity_fixup(src_format->color_fixup) || !is_identity_fixup(dst_format->color_fixup)))
- return FALSE;
- break;
-
- case WINED3D_BLIT_OP_DEPTH_BLIT:
- if (!(src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)))
- return FALSE;
- if (!(dst_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)))
- return FALSE;
- /* Accept pure swizzle fixups for depth formats. In general we
- * ignore the stencil component (if present) at the moment and the
- * swizzle is not relevant with just the depth component. */
- if (is_complex_fixup(src_format->color_fixup) || is_complex_fixup(dst_format->color_fixup)
- || is_scaling_fixup(src_format->color_fixup) || is_scaling_fixup(dst_format->color_fixup))
- return FALSE;
- break;
-
- default:
- return FALSE;
- }
-
- return TRUE;
-}
-
/* See also float_16_to_32() in wined3d_private.h */
static inline unsigned short float_32_to_16(const float *in)
{
@@ -859,117 +600,6 @@ void texture2d_load_fb_texture(struct wined3d_texture_gl *texture_gl,
context_restore(context, restore_texture, restore_idx);
}
-/* Context activation is done by the caller. */
-static void fbo_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_context *context)
-{
- struct wined3d_blitter *next;
-
- if ((next = blitter->next))
- next->ops->blitter_destroy(next, context);
-
- heap_free(blitter);
-}
-
-static void fbo_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device,
- unsigned int rt_count, const struct wined3d_fb_state *fb, unsigned int rect_count, const RECT *clear_rects,
- const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
-{
- struct wined3d_blitter *next;
-
- if ((next = blitter->next))
- next->ops->blitter_clear(next, device, rt_count, fb, rect_count,
- clear_rects, draw_rect, flags, colour, depth, stencil);
-}
-
-static DWORD fbo_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_op op,
- struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
- DWORD src_location, const RECT *src_rect, struct wined3d_texture *dst_texture,
- unsigned int dst_sub_resource_idx, DWORD dst_location, const RECT *dst_rect,
- const struct wined3d_color_key *colour_key, enum wined3d_texture_filter_type filter)
-{
- struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
- struct wined3d_resource *src_resource, *dst_resource;
- enum wined3d_blit_op blit_op = op;
- struct wined3d_device *device;
- struct wined3d_blitter *next;
-
- TRACE("blitter %p, op %#x, context %p, src_texture %p, src_sub_resource_idx %u, src_location %s, src_rect %s, "
- "dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s, colour_key %p, filter %s.\n",
- blitter, op, context, src_texture, src_sub_resource_idx, wined3d_debug_location(src_location),
- wine_dbgstr_rect(src_rect), dst_texture, dst_sub_resource_idx, wined3d_debug_location(dst_location),
- wine_dbgstr_rect(dst_rect), colour_key, debug_d3dtexturefiltertype(filter));
-
- src_resource = &src_texture->resource;
- dst_resource = &dst_texture->resource;
-
- device = dst_resource->device;
-
- if (blit_op == WINED3D_BLIT_OP_RAW_BLIT && dst_resource->format->id == src_resource->format->id)
- {
- if (dst_resource->format_flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
- blit_op = WINED3D_BLIT_OP_DEPTH_BLIT;
- else
- blit_op = WINED3D_BLIT_OP_COLOR_BLIT;
- }
-
- if (!fbo_blitter_supported(blit_op, context_gl->gl_info,
- src_resource, src_location, dst_resource, dst_location))
- {
- if (!(next = blitter->next))
- {
- ERR("No blitter to handle blit op %#x.\n", op);
- return dst_location;
- }
-
- TRACE("Forwarding to blitter %p.\n", next);
- return next->ops->blitter_blit(next, op, context, src_texture, src_sub_resource_idx, src_location,
- src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, colour_key, filter);
- }
-
- if (blit_op == WINED3D_BLIT_OP_COLOR_BLIT)
- {
- TRACE("Colour blit.\n");
- texture2d_blt_fbo(device, context, filter, src_texture, src_sub_resource_idx, src_location,
- src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect);
- return dst_location;
- }
-
- if (blit_op == WINED3D_BLIT_OP_DEPTH_BLIT)
- {
- TRACE("Depth/stencil blit.\n");
- texture2d_depth_blt_fbo(device, context, src_texture, src_sub_resource_idx, src_location,
- src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect);
- return dst_location;
- }
-
- ERR("This blitter does not implement blit op %#x.\n", blit_op);
- return dst_location;
-}
-
-static const struct wined3d_blitter_ops fbo_blitter_ops =
-{
- fbo_blitter_destroy,
- fbo_blitter_clear,
- fbo_blitter_blit,
-};
-
-void wined3d_fbo_blitter_create(struct wined3d_blitter **next, const struct wined3d_gl_info *gl_info)
-{
- struct wined3d_blitter *blitter;
-
- if ((wined3d_settings.offscreen_rendering_mode != ORM_FBO) || !gl_info->fbo_ops.glBlitFramebuffer)
- return;
-
- if (!(blitter = heap_alloc(sizeof(*blitter))))
- return;
-
- TRACE("Created blitter %p.\n", blitter);
-
- blitter->ops = &fbo_blitter_ops;
- blitter->next = *next;
- *next = blitter;
-}
-
/* Context activation is done by the caller. */
static void raw_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_context *context)
{
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index c11490057c3..0036607005c 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -48,6 +48,19 @@ struct wined3d_rect_f
float b;
};
+static bool texture2d_is_full_rect(const struct wined3d_texture *texture, unsigned int level, const RECT *r)
+{
+ unsigned int t;
+
+ t = wined3d_texture_get_level_width(texture, level);
+ if ((r->left && r->right) || abs(r->right - r->left) != t)
+ return false;
+ t = wined3d_texture_get_level_height(texture, level);
+ if ((r->top && r->bottom) || abs(r->bottom - r->top) != t)
+ return false;
+ return true;
+}
+
static BOOL wined3d_texture_use_pbo(const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info)
{
if (!gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]
@@ -265,6 +278,265 @@ void texture2d_get_blt_info(const struct wined3d_texture_gl *texture_gl,
}
}
+static bool fbo_blitter_supported(enum wined3d_blit_op blit_op, const struct wined3d_gl_info *gl_info,
+ const struct wined3d_resource *src_resource, DWORD src_location,
+ const struct wined3d_resource *dst_resource, DWORD dst_location)
+{
+ const struct wined3d_format *src_format = src_resource->format;
+ const struct wined3d_format *dst_format = dst_resource->format;
+
+ if ((wined3d_settings.offscreen_rendering_mode != ORM_FBO) || !gl_info->fbo_ops.glBlitFramebuffer)
+ return false;
+
+ /* Source and/or destination need to be on the GL side. */
+ 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:
+ if (!((src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_FBO_ATTACHABLE)
+ || (src_resource->bind_flags & WINED3D_BIND_RENDER_TARGET)))
+ return false;
+ if (!((dst_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_FBO_ATTACHABLE)
+ || (dst_resource->bind_flags & WINED3D_BIND_RENDER_TARGET)))
+ return false;
+ if ((src_format->id != dst_format->id || dst_location == WINED3D_LOCATION_DRAWABLE)
+ && (!is_identity_fixup(src_format->color_fixup) || !is_identity_fixup(dst_format->color_fixup)))
+ return false;
+ break;
+
+ case WINED3D_BLIT_OP_DEPTH_BLIT:
+ if (!(src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)))
+ return false;
+ if (!(dst_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)))
+ return false;
+ /* Accept pure swizzle fixups for depth formats. In general we
+ * ignore the stencil component (if present) at the moment and the
+ * swizzle is not relevant with just the depth component. */
+ if (is_complex_fixup(src_format->color_fixup) || is_complex_fixup(dst_format->color_fixup)
+ || is_scaling_fixup(src_format->color_fixup) || is_scaling_fixup(dst_format->color_fixup))
+ return false;
+ break;
+
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+/* Blit between surface locations. Onscreen on different swapchains is not supported.
+ * Depth / stencil is not supported. Context activation is done by the caller. */
+static void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_context *context,
+ enum wined3d_texture_filter_type filter, struct wined3d_texture *src_texture,
+ unsigned int src_sub_resource_idx, DWORD src_location, const RECT *src_rect,
+ struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, DWORD dst_location,
+ const RECT *dst_rect)
+{
+ struct wined3d_texture *required_texture, *restore_texture;
+ const struct wined3d_gl_info *gl_info;
+ struct wined3d_context_gl *context_gl;
+ unsigned int restore_idx;
+ bool scaled_resolve;
+ GLenum gl_filter;
+ GLenum buffer;
+ RECT s, d;
+
+ TRACE("device %p, context %p, filter %s, src_texture %p, src_sub_resource_idx %u, src_location %s, "
+ "src_rect %s, dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s.\n",
+ device, context, debug_d3dtexturefiltertype(filter), src_texture, src_sub_resource_idx,
+ wined3d_debug_location(src_location), wine_dbgstr_rect(src_rect), dst_texture,
+ dst_sub_resource_idx, wined3d_debug_location(dst_location), wine_dbgstr_rect(dst_rect));
+
+ scaled_resolve = wined3d_texture_gl_is_multisample_location(wined3d_texture_gl(src_texture), src_location)
+ && (abs(src_rect->bottom - src_rect->top) != abs(dst_rect->bottom - dst_rect->top)
+ || abs(src_rect->right - src_rect->left) != abs(dst_rect->right - dst_rect->left));
+
+ if (filter == WINED3D_TEXF_LINEAR)
+ gl_filter = scaled_resolve ? GL_SCALED_RESOLVE_NICEST_EXT : GL_LINEAR;
+ else
+ gl_filter = scaled_resolve ? GL_SCALED_RESOLVE_FASTEST_EXT : GL_NEAREST;
+
+ /* Make sure the locations are up-to-date. Loading the destination
+ * surface isn't required if the entire surface is overwritten. (And is
+ * in fact harmful if we're being called by surface_load_location() with
+ * the purpose of loading the destination surface.) */
+ wined3d_texture_load_location(src_texture, src_sub_resource_idx, context, src_location);
+ if (!texture2d_is_full_rect(dst_texture, dst_sub_resource_idx % dst_texture->level_count, dst_rect))
+ wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, dst_location);
+ else
+ wined3d_texture_prepare_location(dst_texture, dst_sub_resource_idx, context, dst_location);
+
+ /* Acquire a context for the front-buffer, even though we may be blitting
+ * to/from a back-buffer. Since context_acquire() doesn't take the
+ * resource location into account, it may consider the back-buffer to be
+ * offscreen. */
+ if (src_location == WINED3D_LOCATION_DRAWABLE)
+ required_texture = src_texture->swapchain->front_buffer;
+ else if (dst_location == WINED3D_LOCATION_DRAWABLE)
+ required_texture = dst_texture->swapchain->front_buffer;
+ else
+ required_texture = NULL;
+
+ restore_texture = context->current_rt.texture;
+ restore_idx = context->current_rt.sub_resource_idx;
+ if (restore_texture != required_texture)
+ context = context_acquire(device, required_texture, 0);
+ else
+ restore_texture = NULL;
+
+ context_gl = wined3d_context_gl(context);
+ if (!context_gl->valid)
+ {
+ context_release(context);
+ WARN("Invalid context, skipping blit.\n");
+ return;
+ }
+
+ gl_info = context_gl->gl_info;
+
+ if (src_location == WINED3D_LOCATION_DRAWABLE)
+ {
+ TRACE("Source texture %p is onscreen.\n", src_texture);
+ buffer = wined3d_texture_get_gl_buffer(src_texture);
+ s = *src_rect;
+ wined3d_texture_translate_drawable_coords(src_texture, context_gl->window, &s);
+ src_rect = &s;
+ }
+ else
+ {
+ TRACE("Source texture %p is offscreen.\n", src_texture);
+ buffer = GL_COLOR_ATTACHMENT0;
+ }
+
+ wined3d_context_gl_apply_fbo_state_blit(context_gl, GL_READ_FRAMEBUFFER,
+ &src_texture->resource, src_sub_resource_idx, NULL, 0, src_location);
+ gl_info->gl_ops.gl.p_glReadBuffer(buffer);
+ checkGLcall("glReadBuffer()");
+ wined3d_context_gl_check_fbo_status(context_gl, GL_READ_FRAMEBUFFER);
+
+ if (dst_location == WINED3D_LOCATION_DRAWABLE)
+ {
+ TRACE("Destination texture %p is onscreen.\n", dst_texture);
+ buffer = wined3d_texture_get_gl_buffer(dst_texture);
+ d = *dst_rect;
+ wined3d_texture_translate_drawable_coords(dst_texture, context_gl->window, &d);
+ dst_rect = &d;
+ }
+ else
+ {
+ TRACE("Destination texture %p is offscreen.\n", dst_texture);
+ buffer = GL_COLOR_ATTACHMENT0;
+ }
+
+ wined3d_context_gl_apply_fbo_state_blit(context_gl, GL_DRAW_FRAMEBUFFER,
+ &dst_texture->resource, dst_sub_resource_idx, NULL, 0, dst_location);
+ wined3d_context_gl_set_draw_buffer(context_gl, buffer);
+ wined3d_context_gl_check_fbo_status(context_gl, GL_DRAW_FRAMEBUFFER);
+ context_invalidate_state(context, STATE_FRAMEBUFFER);
+
+ gl_info->gl_ops.gl.p_glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ context_invalidate_state(context, STATE_BLEND);
+
+ gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST);
+ context_invalidate_state(context, STATE_RASTERIZER);
+
+ gl_info->fbo_ops.glBlitFramebuffer(src_rect->left, src_rect->top, src_rect->right, src_rect->bottom,
+ dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, GL_COLOR_BUFFER_BIT, gl_filter);
+ checkGLcall("glBlitFramebuffer()");
+
+ if (dst_location == WINED3D_LOCATION_DRAWABLE && dst_texture->swapchain->front_buffer == dst_texture)
+ gl_info->gl_ops.gl.p_glFlush();
+
+ if (restore_texture)
+ context_restore(context, restore_texture, restore_idx);
+}
+
+static void texture2d_depth_blt_fbo(const struct wined3d_device *device, struct wined3d_context *context,
+ struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, DWORD src_location,
+ const RECT *src_rect, struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx,
+ DWORD dst_location, const RECT *dst_rect)
+{
+ struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
+ const struct wined3d_gl_info *gl_info = context_gl->gl_info;
+ DWORD src_mask, dst_mask;
+ GLbitfield gl_mask;
+
+ TRACE("device %p, src_texture %p, src_sub_resource_idx %u, src_location %s, src_rect %s, "
+ "dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s.\n", device,
+ src_texture, src_sub_resource_idx, wined3d_debug_location(src_location), wine_dbgstr_rect(src_rect),
+ dst_texture, dst_sub_resource_idx, wined3d_debug_location(dst_location), wine_dbgstr_rect(dst_rect));
+
+ src_mask = src_texture->resource.format_flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
+ dst_mask = dst_texture->resource.format_flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
+
+ if (src_mask != dst_mask)
+ {
+ ERR("Incompatible formats %s and %s.\n",
+ debug_d3dformat(src_texture->resource.format->id),
+ debug_d3dformat(dst_texture->resource.format->id));
+ return;
+ }
+
+ if (!src_mask)
+ {
+ ERR("Not a depth / stencil format: %s.\n",
+ debug_d3dformat(src_texture->resource.format->id));
+ return;
+ }
+
+ gl_mask = 0;
+ if (src_mask & WINED3DFMT_FLAG_DEPTH)
+ gl_mask |= GL_DEPTH_BUFFER_BIT;
+ if (src_mask & WINED3DFMT_FLAG_STENCIL)
+ gl_mask |= GL_STENCIL_BUFFER_BIT;
+
+ /* Make sure the locations are up-to-date. Loading the destination
+ * surface isn't required if the entire surface is overwritten. */
+ wined3d_texture_load_location(src_texture, src_sub_resource_idx, context, src_location);
+ if (!texture2d_is_full_rect(dst_texture, dst_sub_resource_idx % dst_texture->level_count, dst_rect))
+ wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, dst_location);
+ else
+ wined3d_texture_prepare_location(dst_texture, dst_sub_resource_idx, context, dst_location);
+
+ wined3d_context_gl_apply_fbo_state_blit(context_gl, GL_READ_FRAMEBUFFER, NULL, 0,
+ &src_texture->resource, src_sub_resource_idx, src_location);
+ wined3d_context_gl_check_fbo_status(context_gl, GL_READ_FRAMEBUFFER);
+
+ wined3d_context_gl_apply_fbo_state_blit(context_gl, GL_DRAW_FRAMEBUFFER, NULL, 0,
+ &dst_texture->resource, dst_sub_resource_idx, dst_location);
+ wined3d_context_gl_set_draw_buffer(context_gl, GL_NONE);
+ wined3d_context_gl_check_fbo_status(context_gl, GL_DRAW_FRAMEBUFFER);
+ context_invalidate_state(context, STATE_FRAMEBUFFER);
+
+ if (gl_mask & GL_DEPTH_BUFFER_BIT)
+ {
+ gl_info->gl_ops.gl.p_glDepthMask(GL_TRUE);
+ context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ZWRITEENABLE));
+ }
+ if (gl_mask & GL_STENCIL_BUFFER_BIT)
+ {
+ if (gl_info->supported[EXT_STENCIL_TWO_SIDE])
+ {
+ gl_info->gl_ops.gl.p_glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
+ context_invalidate_state(context, STATE_RENDER(WINED3D_RS_TWOSIDEDSTENCILMODE));
+ }
+ gl_info->gl_ops.gl.p_glStencilMask(~0U);
+ context_invalidate_state(context, STATE_RENDER(WINED3D_RS_STENCILWRITEMASK));
+ }
+
+ gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST);
+ context_invalidate_state(context, STATE_RASTERIZER);
+
+ gl_info->fbo_ops.glBlitFramebuffer(src_rect->left, src_rect->top, src_rect->right, src_rect->bottom,
+ dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, gl_mask, GL_NEAREST);
+ checkGLcall("glBlitFramebuffer()");
+}
+
static void wined3d_texture_evict_sysmem(struct wined3d_texture *texture)
{
struct wined3d_texture_sub_resource *sub_resource;
@@ -5210,3 +5482,113 @@ void wined3d_ffp_blitter_create(struct wined3d_blitter **next, const struct wine
blitter->next = *next;
*next = blitter;
}
+
+static void fbo_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_context *context)
+{
+ struct wined3d_blitter *next;
+
+ if ((next = blitter->next))
+ next->ops->blitter_destroy(next, context);
+
+ heap_free(blitter);
+}
+
+static void fbo_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device,
+ unsigned int rt_count, const struct wined3d_fb_state *fb, unsigned int rect_count, const RECT *clear_rects,
+ const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
+{
+ struct wined3d_blitter *next;
+
+ if ((next = blitter->next))
+ next->ops->blitter_clear(next, device, rt_count, fb, rect_count,
+ clear_rects, draw_rect, flags, colour, depth, stencil);
+}
+
+static DWORD fbo_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_op op,
+ struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
+ DWORD src_location, const RECT *src_rect, struct wined3d_texture *dst_texture,
+ unsigned int dst_sub_resource_idx, DWORD dst_location, const RECT *dst_rect,
+ const struct wined3d_color_key *colour_key, enum wined3d_texture_filter_type filter)
+{
+ struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
+ struct wined3d_resource *src_resource, *dst_resource;
+ enum wined3d_blit_op blit_op = op;
+ struct wined3d_device *device;
+ struct wined3d_blitter *next;
+
+ TRACE("blitter %p, op %#x, context %p, src_texture %p, src_sub_resource_idx %u, src_location %s, src_rect %s, "
+ "dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s, colour_key %p, filter %s.\n",
+ blitter, op, context, src_texture, src_sub_resource_idx, wined3d_debug_location(src_location),
+ wine_dbgstr_rect(src_rect), dst_texture, dst_sub_resource_idx, wined3d_debug_location(dst_location),
+ wine_dbgstr_rect(dst_rect), colour_key, debug_d3dtexturefiltertype(filter));
+
+ src_resource = &src_texture->resource;
+ dst_resource = &dst_texture->resource;
+
+ device = dst_resource->device;
+
+ if (blit_op == WINED3D_BLIT_OP_RAW_BLIT && dst_resource->format->id == src_resource->format->id)
+ {
+ if (dst_resource->format_flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
+ blit_op = WINED3D_BLIT_OP_DEPTH_BLIT;
+ else
+ blit_op = WINED3D_BLIT_OP_COLOR_BLIT;
+ }
+
+ if (!fbo_blitter_supported(blit_op, context_gl->gl_info,
+ src_resource, src_location, dst_resource, dst_location))
+ {
+ if (!(next = blitter->next))
+ {
+ ERR("No blitter to handle blit op %#x.\n", op);
+ return dst_location;
+ }
+
+ TRACE("Forwarding to blitter %p.\n", next);
+ return next->ops->blitter_blit(next, op, context, src_texture, src_sub_resource_idx, src_location,
+ src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, colour_key, filter);
+ }
+
+ if (blit_op == WINED3D_BLIT_OP_COLOR_BLIT)
+ {
+ TRACE("Colour blit.\n");
+ texture2d_blt_fbo(device, context, filter, src_texture, src_sub_resource_idx, src_location,
+ src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect);
+ return dst_location;
+ }
+
+ if (blit_op == WINED3D_BLIT_OP_DEPTH_BLIT)
+ {
+ TRACE("Depth/stencil blit.\n");
+ texture2d_depth_blt_fbo(device, context, src_texture, src_sub_resource_idx, src_location,
+ src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect);
+ return dst_location;
+ }
+
+ ERR("This blitter does not implement blit op %#x.\n", blit_op);
+ return dst_location;
+}
+
+static const struct wined3d_blitter_ops fbo_blitter_ops =
+{
+ fbo_blitter_destroy,
+ fbo_blitter_clear,
+ fbo_blitter_blit,
+};
+
+void wined3d_fbo_blitter_create(struct wined3d_blitter **next, const struct wined3d_gl_info *gl_info)
+{
+ struct wined3d_blitter *blitter;
+
+ if ((wined3d_settings.offscreen_rendering_mode != ORM_FBO) || !gl_info->fbo_ops.glBlitFramebuffer)
+ return;
+
+ if (!(blitter = heap_alloc(sizeof(*blitter))))
+ return;
+
+ TRACE("Created blitter %p.\n", blitter);
+
+ blitter->ops = &fbo_blitter_ops;
+ blitter->next = *next;
+ *next = blitter;
+}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b78fbde0f47..bd42e3f18b4 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2437,10 +2437,6 @@ struct wined3d_blitter *wined3d_glsl_blitter_create(struct wined3d_blitter **nex
void wined3d_raw_blitter_create(struct wined3d_blitter **next,
const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
-BOOL fbo_blitter_supported(enum wined3d_blit_op blit_op, const struct wined3d_gl_info *gl_info,
- const struct wined3d_resource *src_resource, DWORD src_location,
- const struct wined3d_resource *dst_resource, DWORD dst_location) DECLSPEC_HIDDEN;
-
BOOL wined3d_clip_blit(const RECT *clip_rect, RECT *clipped, RECT *other) DECLSPEC_HIDDEN;
HGLRC context_create_wgl_attribs(const struct wined3d_gl_info *gl_info, HDC hdc, HGLRC share_ctx) DECLSPEC_HIDDEN;
@@ -3872,11 +3868,6 @@ HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_
const struct wined3d_box *dst_box, struct wined3d_texture *src_texture,
unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, DWORD flags,
const struct wined3d_blt_fx *blt_fx, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
-void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_context *context,
- enum wined3d_texture_filter_type filter, struct wined3d_texture *src_texture,
- unsigned int src_sub_resource_idx, DWORD src_location, const RECT *src_rect,
- struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, DWORD dst_location,
- const RECT *dst_rect) DECLSPEC_HIDDEN;
void texture2d_get_blt_info(const struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx,
const RECT *rect, struct wined3d_blt_info *info) DECLSPEC_HIDDEN;
void texture2d_load_fb_texture(struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx,
--
2.20.1
1
0
[PATCH 3/5] wined3d: Move the OpenGL fixed-function blitter to texture.c.
by Henri Verbeet 22 Apr '20
by Henri Verbeet 22 Apr '20
22 Apr '20
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/surface.c | 390 -----------------------------------------
dlls/wined3d/texture.c | 389 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 389 insertions(+), 390 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 06912203122..2c072454f32 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1106,396 +1106,6 @@ void wined3d_raw_blitter_create(struct wined3d_blitter **next, const struct wine
*next = blitter;
}
-/* Context activation is done by the caller. */
-static void ffp_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_context *context)
-{
- struct wined3d_blitter *next;
-
- if ((next = blitter->next))
- next->ops->blitter_destroy(next, context);
-
- heap_free(blitter);
-}
-
-static BOOL ffp_blit_supported(enum wined3d_blit_op blit_op, const struct wined3d_context *context,
- const struct wined3d_resource *src_resource, DWORD src_location,
- const struct wined3d_resource *dst_resource, DWORD dst_location)
-{
- const struct wined3d_format *src_format = src_resource->format;
- const struct wined3d_format *dst_format = dst_resource->format;
- BOOL decompress;
-
- if (src_resource->type != WINED3D_RTYPE_TEXTURE_2D)
- return FALSE;
-
- decompress = (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))
- {
- TRACE("Source or destination resource is not GPU accessible.\n");
- 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))
- blit_op = WINED3D_BLIT_OP_DEPTH_BLIT;
- else
- blit_op = WINED3D_BLIT_OP_COLOR_BLIT;
- }
-
- switch (blit_op)
- {
- case WINED3D_BLIT_OP_COLOR_BLIT_CKEY:
- if (context->d3d_info->shader_color_key)
- {
- TRACE("Color keying requires converted textures.\n");
- return FALSE;
- }
- case WINED3D_BLIT_OP_COLOR_BLIT:
- case WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST:
- if (!wined3d_context_gl_const(context)->gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
- return FALSE;
-
- if (TRACE_ON(d3d))
- {
- TRACE("Checking support for fixup:\n");
- dump_color_fixup_desc(src_format->color_fixup);
- }
-
- /* We only support identity conversions. */
- if (!is_identity_fixup(src_format->color_fixup)
- || !is_identity_fixup(dst_format->color_fixup))
- {
- if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER
- && dst_format->id == src_format->id && dst_location == WINED3D_LOCATION_DRAWABLE)
- {
- WARN("Claiming fixup support because of ORM_BACKBUFFER.\n");
- }
- else
- {
- TRACE("Fixups are not supported.\n");
- return FALSE;
- }
- }
-
- if (!(dst_resource->bind_flags & WINED3D_BIND_RENDER_TARGET))
- {
- TRACE("Can only blit to render targets.\n");
- return FALSE;
- }
- return TRUE;
-
- default:
- TRACE("Unsupported blit operation %#x.\n", blit_op);
- return FALSE;
- }
-}
-
-static BOOL ffp_blitter_use_cpu_clear(struct wined3d_rendertarget_view *view)
-{
- struct wined3d_resource *resource;
- struct wined3d_texture *texture;
- DWORD locations;
-
- resource = view->resource;
- if (resource->type == WINED3D_RTYPE_BUFFER)
- return !(resource->access & WINED3D_RESOURCE_ACCESS_GPU);
-
- texture = texture_from_resource(resource);
- locations = texture->sub_resources[view->sub_resource_idx].locations;
- if (locations & (resource->map_binding | WINED3D_LOCATION_DISCARDED))
- return !(resource->access & WINED3D_RESOURCE_ACCESS_GPU)
- || (texture->flags & WINED3D_TEXTURE_PIN_SYSMEM);
-
- return !(resource->access & WINED3D_RESOURCE_ACCESS_GPU)
- && !(texture->flags & WINED3D_TEXTURE_CONVERTED);
-}
-
-static void ffp_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device,
- unsigned int rt_count, const struct wined3d_fb_state *fb, unsigned int rect_count, const RECT *clear_rects,
- const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
-{
- struct wined3d_rendertarget_view *view, *previous = NULL;
- BOOL have_identical_size = TRUE;
- struct wined3d_fb_state tmp_fb;
- unsigned int next_rt_count = 0;
- struct wined3d_blitter *next;
- DWORD next_flags = 0;
- unsigned int i;
-
- if (flags & WINED3DCLEAR_TARGET)
- {
- for (i = 0; i < rt_count; ++i)
- {
- if (!(view = fb->render_targets[i]))
- continue;
-
- if (ffp_blitter_use_cpu_clear(view)
- || (!(view->resource->bind_flags & WINED3D_BIND_RENDER_TARGET)
- && (wined3d_settings.offscreen_rendering_mode != ORM_FBO
- || !(view->format_flags & WINED3DFMT_FLAG_FBO_ATTACHABLE))))
- {
- next_flags |= WINED3DCLEAR_TARGET;
- flags &= ~WINED3DCLEAR_TARGET;
- next_rt_count = rt_count;
- rt_count = 0;
- break;
- }
-
- /* FIXME: We should reject colour fills on formats with fixups,
- * but this would break P8 colour fills for example. */
- }
- }
-
- if ((flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) && (view = fb->depth_stencil)
- && (!view->format->depth_size || (flags & WINED3DCLEAR_ZBUFFER))
- && (!view->format->stencil_size || (flags & WINED3DCLEAR_STENCIL))
- && ffp_blitter_use_cpu_clear(view))
- {
- next_flags |= flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL);
- flags &= ~(WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL);
- }
-
- if (flags)
- {
- for (i = 0; i < rt_count; ++i)
- {
- if (!(view = fb->render_targets[i]))
- continue;
-
- if (previous && (previous->width != view->width || previous->height != view->height))
- have_identical_size = FALSE;
- previous = view;
- }
- if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
- {
- view = fb->depth_stencil;
-
- if (previous && (previous->width != view->width || previous->height != view->height))
- have_identical_size = FALSE;
- }
-
- if (have_identical_size)
- {
- device_clear_render_targets(device, rt_count, fb, rect_count,
- clear_rects, draw_rect, flags, colour, depth, stencil);
- }
- else
- {
- for (i = 0; i < rt_count; ++i)
- {
- if (!(view = fb->render_targets[i]))
- continue;
-
- tmp_fb.render_targets[0] = view;
- tmp_fb.depth_stencil = NULL;
- device_clear_render_targets(device, 1, &tmp_fb, rect_count,
- clear_rects, draw_rect, WINED3DCLEAR_TARGET, colour, depth, stencil);
- }
- if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
- {
- tmp_fb.render_targets[0] = NULL;
- tmp_fb.depth_stencil = fb->depth_stencil;
- device_clear_render_targets(device, 0, &tmp_fb, rect_count,
- clear_rects, draw_rect, flags & ~WINED3DCLEAR_TARGET, colour, depth, stencil);
- }
- }
- }
-
- if (next_flags && (next = blitter->next))
- next->ops->blitter_clear(next, device, next_rt_count, fb, rect_count,
- clear_rects, draw_rect, next_flags, colour, depth, stencil);
-}
-
-static DWORD ffp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_op op,
- struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
- DWORD src_location, const RECT *src_rect, struct wined3d_texture *dst_texture,
- unsigned int dst_sub_resource_idx, DWORD dst_location, const RECT *dst_rect,
- const struct wined3d_color_key *color_key, enum wined3d_texture_filter_type filter)
-{
- struct wined3d_texture_gl *src_texture_gl = wined3d_texture_gl(src_texture);
- struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
- const struct wined3d_gl_info *gl_info = context_gl->gl_info;
- struct wined3d_resource *src_resource, *dst_resource;
- struct wined3d_texture *staging_texture = NULL;
- struct wined3d_color_key old_blt_key;
- struct wined3d_device *device;
- struct wined3d_blitter *next;
- DWORD old_color_key_flags;
- RECT r;
-
- src_resource = &src_texture->resource;
- dst_resource = &dst_texture->resource;
- device = dst_resource->device;
-
- if (!ffp_blit_supported(op, context, src_resource, src_location, dst_resource, dst_location))
- {
- if ((next = blitter->next))
- return next->ops->blitter_blit(next, op, context, src_texture, src_sub_resource_idx, src_location,
- src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, color_key, filter);
- }
-
- TRACE("Blt from texture %p, %u to rendertarget %p, %u.\n",
- src_texture, src_sub_resource_idx, dst_texture, dst_sub_resource_idx);
-
- old_blt_key = src_texture->async.src_blt_color_key;
- old_color_key_flags = src_texture->async.color_key_flags;
- wined3d_texture_set_color_key(src_texture, WINED3D_CKEY_SRC_BLT, color_key);
-
- if (!(src_texture->resource.access & WINED3D_RESOURCE_ACCESS_GPU))
- {
- struct wined3d_resource_desc desc;
- struct wined3d_box upload_box;
- unsigned int src_level;
- HRESULT hr;
-
- TRACE("Source texture is not GPU accessible, creating a staging texture.\n");
-
- src_level = src_sub_resource_idx % src_texture->level_count;
- desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
- desc.format = src_texture->resource.format->id;
- desc.multisample_type = src_texture->resource.multisample_type;
- desc.multisample_quality = src_texture->resource.multisample_quality;
- desc.usage = WINED3DUSAGE_PRIVATE;
- desc.bind_flags = 0;
- desc.access = WINED3D_RESOURCE_ACCESS_GPU;
- desc.width = wined3d_texture_get_level_width(src_texture, src_level);
- desc.height = wined3d_texture_get_level_height(src_texture, src_level);
- desc.depth = 1;
- desc.size = 0;
-
- if (FAILED(hr = wined3d_texture_create(device, &desc, 1, 1, 0,
- NULL, NULL, &wined3d_null_parent_ops, &staging_texture)))
- {
- ERR("Failed to create staging texture, hr %#x.\n", hr);
- return dst_location;
- }
-
- wined3d_box_set(&upload_box, 0, 0, desc.width, desc.height, 0, desc.depth);
- wined3d_texture_upload_from_texture(staging_texture, 0, 0, 0, 0,
- src_texture, src_sub_resource_idx, &upload_box);
-
- src_texture = staging_texture;
- src_texture_gl = wined3d_texture_gl(src_texture);
- src_sub_resource_idx = 0;
- }
- else
- {
- /* Make sure the surface is up-to-date. This should probably use
- * surface_load_location() and worry about the destination surface
- * too, unless we're overwriting it completely. */
- wined3d_texture_load(src_texture, context, FALSE);
- }
-
- wined3d_context_gl_apply_ffp_blit_state(context_gl, device);
-
- if (dst_location == WINED3D_LOCATION_DRAWABLE)
- {
- r = *dst_rect;
- wined3d_texture_translate_drawable_coords(dst_texture, context_gl->window, &r);
- dst_rect = &r;
- }
-
- if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
- {
- GLenum buffer;
-
- if (dst_location == WINED3D_LOCATION_DRAWABLE)
- {
- TRACE("Destination texture %p is onscreen.\n", dst_texture);
- buffer = wined3d_texture_get_gl_buffer(dst_texture);
- }
- else
- {
- TRACE("Destination texture %p is offscreen.\n", dst_texture);
- buffer = GL_COLOR_ATTACHMENT0;
- }
- wined3d_context_gl_apply_fbo_state_blit(context_gl, GL_DRAW_FRAMEBUFFER,
- dst_resource, dst_sub_resource_idx, NULL, 0, dst_location);
- wined3d_context_gl_set_draw_buffer(context_gl, buffer);
- wined3d_context_gl_check_fbo_status(context_gl, GL_DRAW_FRAMEBUFFER);
- context_invalidate_state(context, STATE_FRAMEBUFFER);
- }
-
- gl_info->gl_ops.gl.p_glEnable(src_texture_gl->target);
- checkGLcall("glEnable(target)");
-
- if (op == WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST || color_key)
- {
- gl_info->gl_ops.gl.p_glEnable(GL_ALPHA_TEST);
- checkGLcall("glEnable(GL_ALPHA_TEST)");
- }
-
- if (color_key)
- {
- /* For P8 surfaces, the alpha component contains the palette index.
- * Which means that the colorkey is one of the palette entries. In
- * other cases pixels that should be masked away have alpha set to 0. */
- if (src_texture->resource.format->id == WINED3DFMT_P8_UINT)
- gl_info->gl_ops.gl.p_glAlphaFunc(GL_NOTEQUAL,
- (float)src_texture->async.src_blt_color_key.color_space_low_value / 255.0f);
- else
- gl_info->gl_ops.gl.p_glAlphaFunc(GL_NOTEQUAL, 0.0f);
- checkGLcall("glAlphaFunc");
- }
-
- wined3d_context_gl_draw_textured_quad(context_gl, src_texture_gl,
- src_sub_resource_idx, src_rect, dst_rect, filter);
-
- if (op == WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST || color_key)
- {
- gl_info->gl_ops.gl.p_glDisable(GL_ALPHA_TEST);
- checkGLcall("glDisable(GL_ALPHA_TEST)");
- }
-
- gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
- checkGLcall("glDisable(GL_TEXTURE_2D)");
- if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
- {
- gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
- checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
- }
- if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
- {
- gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
- checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
- }
-
- if (dst_texture->swapchain && dst_texture->swapchain->front_buffer == dst_texture)
- gl_info->gl_ops.gl.p_glFlush();
-
- /* Restore the color key parameters */
- wined3d_texture_set_color_key(src_texture, WINED3D_CKEY_SRC_BLT,
- (old_color_key_flags & WINED3D_CKEY_SRC_BLT) ? &old_blt_key : NULL);
-
- if (staging_texture)
- wined3d_texture_decref(staging_texture);
-
- return dst_location;
-}
-
-static const struct wined3d_blitter_ops ffp_blitter_ops =
-{
- ffp_blitter_destroy,
- ffp_blitter_clear,
- ffp_blitter_blit,
-};
-
-void wined3d_ffp_blitter_create(struct wined3d_blitter **next, const struct wined3d_gl_info *gl_info)
-{
- struct wined3d_blitter *blitter;
-
- if (!(blitter = heap_alloc(sizeof(*blitter))))
- return;
-
- TRACE("Created blitter %p.\n", blitter);
-
- blitter->ops = &ffp_blitter_ops;
- blitter->next = *next;
- *next = blitter;
-}
-
/* Context activation is done by the caller. */
static void cpu_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_context *context)
{
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index ac3601d4f47..c11490057c3 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -4821,3 +4821,392 @@ HRESULT wined3d_texture_vk_init(struct wined3d_texture_vk *texture_vk, struct wi
return wined3d_texture_init(&texture_vk->t, desc, layer_count, level_count,
flags, device, parent, parent_ops, &texture_vk[1], &wined3d_texture_vk_ops);
}
+
+static void ffp_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_context *context)
+{
+ struct wined3d_blitter *next;
+
+ if ((next = blitter->next))
+ next->ops->blitter_destroy(next, context);
+
+ heap_free(blitter);
+}
+
+static bool ffp_blit_supported(enum wined3d_blit_op blit_op, const struct wined3d_context *context,
+ const struct wined3d_resource *src_resource, DWORD src_location,
+ const struct wined3d_resource *dst_resource, DWORD dst_location)
+{
+ const struct wined3d_format *src_format = src_resource->format;
+ const struct wined3d_format *dst_format = dst_resource->format;
+ bool decompress;
+
+ if (src_resource->type != WINED3D_RTYPE_TEXTURE_2D)
+ return false;
+
+ decompress = (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))
+ {
+ TRACE("Source or destination resource is not GPU accessible.\n");
+ 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))
+ blit_op = WINED3D_BLIT_OP_DEPTH_BLIT;
+ else
+ blit_op = WINED3D_BLIT_OP_COLOR_BLIT;
+ }
+
+ switch (blit_op)
+ {
+ case WINED3D_BLIT_OP_COLOR_BLIT_CKEY:
+ if (context->d3d_info->shader_color_key)
+ {
+ TRACE("Colour keying requires converted textures.\n");
+ return false;
+ }
+ case WINED3D_BLIT_OP_COLOR_BLIT:
+ case WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST:
+ if (!wined3d_context_gl_const(context)->gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
+ return false;
+
+ if (TRACE_ON(d3d))
+ {
+ TRACE("Checking support for fixup:\n");
+ dump_color_fixup_desc(src_format->color_fixup);
+ }
+
+ /* We only support identity conversions. */
+ if (!is_identity_fixup(src_format->color_fixup)
+ || !is_identity_fixup(dst_format->color_fixup))
+ {
+ if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER
+ && dst_format->id == src_format->id && dst_location == WINED3D_LOCATION_DRAWABLE)
+ {
+ WARN("Claiming fixup support because of ORM_BACKBUFFER.\n");
+ }
+ else
+ {
+ TRACE("Fixups are not supported.\n");
+ return false;
+ }
+ }
+
+ if (!(dst_resource->bind_flags & WINED3D_BIND_RENDER_TARGET))
+ {
+ TRACE("Can only blit to render targets.\n");
+ return false;
+ }
+ return true;
+
+ default:
+ TRACE("Unsupported blit operation %#x.\n", blit_op);
+ return false;
+ }
+}
+
+static bool ffp_blitter_use_cpu_clear(struct wined3d_rendertarget_view *view)
+{
+ struct wined3d_resource *resource;
+ struct wined3d_texture *texture;
+ DWORD locations;
+
+ resource = view->resource;
+ if (resource->type == WINED3D_RTYPE_BUFFER)
+ return !(resource->access & WINED3D_RESOURCE_ACCESS_GPU);
+
+ texture = texture_from_resource(resource);
+ locations = texture->sub_resources[view->sub_resource_idx].locations;
+ if (locations & (resource->map_binding | WINED3D_LOCATION_DISCARDED))
+ return !(resource->access & WINED3D_RESOURCE_ACCESS_GPU)
+ || (texture->flags & WINED3D_TEXTURE_PIN_SYSMEM);
+
+ return !(resource->access & WINED3D_RESOURCE_ACCESS_GPU)
+ && !(texture->flags & WINED3D_TEXTURE_CONVERTED);
+}
+
+static void ffp_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device,
+ unsigned int rt_count, const struct wined3d_fb_state *fb, unsigned int rect_count, const RECT *clear_rects,
+ const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
+{
+ struct wined3d_rendertarget_view *view, *previous = NULL;
+ bool have_identical_size = TRUE;
+ struct wined3d_fb_state tmp_fb;
+ unsigned int next_rt_count = 0;
+ struct wined3d_blitter *next;
+ DWORD next_flags = 0;
+ unsigned int i;
+
+ if (flags & WINED3DCLEAR_TARGET)
+ {
+ for (i = 0; i < rt_count; ++i)
+ {
+ if (!(view = fb->render_targets[i]))
+ continue;
+
+ if (ffp_blitter_use_cpu_clear(view)
+ || (!(view->resource->bind_flags & WINED3D_BIND_RENDER_TARGET)
+ && (wined3d_settings.offscreen_rendering_mode != ORM_FBO
+ || !(view->format_flags & WINED3DFMT_FLAG_FBO_ATTACHABLE))))
+ {
+ next_flags |= WINED3DCLEAR_TARGET;
+ flags &= ~WINED3DCLEAR_TARGET;
+ next_rt_count = rt_count;
+ rt_count = 0;
+ break;
+ }
+
+ /* FIXME: We should reject colour fills on formats with fixups,
+ * but this would break P8 colour fills for example. */
+ }
+ }
+
+ if ((flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) && (view = fb->depth_stencil)
+ && (!view->format->depth_size || (flags & WINED3DCLEAR_ZBUFFER))
+ && (!view->format->stencil_size || (flags & WINED3DCLEAR_STENCIL))
+ && ffp_blitter_use_cpu_clear(view))
+ {
+ next_flags |= flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL);
+ flags &= ~(WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL);
+ }
+
+ if (flags)
+ {
+ for (i = 0; i < rt_count; ++i)
+ {
+ if (!(view = fb->render_targets[i]))
+ continue;
+
+ if (previous && (previous->width != view->width || previous->height != view->height))
+ have_identical_size = false;
+ previous = view;
+ }
+ if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
+ {
+ view = fb->depth_stencil;
+
+ if (previous && (previous->width != view->width || previous->height != view->height))
+ have_identical_size = false;
+ }
+
+ if (have_identical_size)
+ {
+ device_clear_render_targets(device, rt_count, fb, rect_count,
+ clear_rects, draw_rect, flags, colour, depth, stencil);
+ }
+ else
+ {
+ for (i = 0; i < rt_count; ++i)
+ {
+ if (!(view = fb->render_targets[i]))
+ continue;
+
+ tmp_fb.render_targets[0] = view;
+ tmp_fb.depth_stencil = NULL;
+ device_clear_render_targets(device, 1, &tmp_fb, rect_count,
+ clear_rects, draw_rect, WINED3DCLEAR_TARGET, colour, depth, stencil);
+ }
+ if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
+ {
+ tmp_fb.render_targets[0] = NULL;
+ tmp_fb.depth_stencil = fb->depth_stencil;
+ device_clear_render_targets(device, 0, &tmp_fb, rect_count,
+ clear_rects, draw_rect, flags & ~WINED3DCLEAR_TARGET, colour, depth, stencil);
+ }
+ }
+ }
+
+ if (next_flags && (next = blitter->next))
+ next->ops->blitter_clear(next, device, next_rt_count, fb, rect_count,
+ clear_rects, draw_rect, next_flags, colour, depth, stencil);
+}
+
+static DWORD ffp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_op op,
+ struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
+ DWORD src_location, const RECT *src_rect, struct wined3d_texture *dst_texture,
+ unsigned int dst_sub_resource_idx, DWORD dst_location, const RECT *dst_rect,
+ const struct wined3d_color_key *colour_key, enum wined3d_texture_filter_type filter)
+{
+ struct wined3d_texture_gl *src_texture_gl = wined3d_texture_gl(src_texture);
+ struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
+ const struct wined3d_gl_info *gl_info = context_gl->gl_info;
+ struct wined3d_resource *src_resource, *dst_resource;
+ struct wined3d_texture *staging_texture = NULL;
+ struct wined3d_color_key old_blt_key;
+ struct wined3d_device *device;
+ struct wined3d_blitter *next;
+ DWORD old_colour_key_flags;
+ RECT r;
+
+ src_resource = &src_texture->resource;
+ dst_resource = &dst_texture->resource;
+ device = dst_resource->device;
+
+ if (!ffp_blit_supported(op, context, src_resource, src_location, dst_resource, dst_location))
+ {
+ if ((next = blitter->next))
+ return next->ops->blitter_blit(next, op, context, src_texture, src_sub_resource_idx, src_location,
+ src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, colour_key, filter);
+ }
+
+ TRACE("Blt from texture %p, %u to rendertarget %p, %u.\n",
+ src_texture, src_sub_resource_idx, dst_texture, dst_sub_resource_idx);
+
+ old_blt_key = src_texture->async.src_blt_color_key;
+ old_colour_key_flags = src_texture->async.color_key_flags;
+ wined3d_texture_set_color_key(src_texture, WINED3D_CKEY_SRC_BLT, colour_key);
+
+ if (!(src_texture->resource.access & WINED3D_RESOURCE_ACCESS_GPU))
+ {
+ struct wined3d_resource_desc desc;
+ struct wined3d_box upload_box;
+ unsigned int src_level;
+ HRESULT hr;
+
+ TRACE("Source texture is not GPU accessible, creating a staging texture.\n");
+
+ src_level = src_sub_resource_idx % src_texture->level_count;
+ desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
+ desc.format = src_texture->resource.format->id;
+ desc.multisample_type = src_texture->resource.multisample_type;
+ desc.multisample_quality = src_texture->resource.multisample_quality;
+ desc.usage = WINED3DUSAGE_PRIVATE;
+ desc.bind_flags = 0;
+ desc.access = WINED3D_RESOURCE_ACCESS_GPU;
+ desc.width = wined3d_texture_get_level_width(src_texture, src_level);
+ desc.height = wined3d_texture_get_level_height(src_texture, src_level);
+ desc.depth = 1;
+ desc.size = 0;
+
+ if (FAILED(hr = wined3d_texture_create(device, &desc, 1, 1, 0,
+ NULL, NULL, &wined3d_null_parent_ops, &staging_texture)))
+ {
+ ERR("Failed to create staging texture, hr %#x.\n", hr);
+ return dst_location;
+ }
+
+ wined3d_box_set(&upload_box, 0, 0, desc.width, desc.height, 0, desc.depth);
+ wined3d_texture_upload_from_texture(staging_texture, 0, 0, 0, 0,
+ src_texture, src_sub_resource_idx, &upload_box);
+
+ src_texture = staging_texture;
+ src_texture_gl = wined3d_texture_gl(src_texture);
+ src_sub_resource_idx = 0;
+ }
+ else
+ {
+ /* Make sure the surface is up-to-date. This should probably use
+ * surface_load_location() and worry about the destination surface
+ * too, unless we're overwriting it completely. */
+ wined3d_texture_load(src_texture, context, FALSE);
+ }
+
+ wined3d_context_gl_apply_ffp_blit_state(context_gl, device);
+
+ if (dst_location == WINED3D_LOCATION_DRAWABLE)
+ {
+ r = *dst_rect;
+ wined3d_texture_translate_drawable_coords(dst_texture, context_gl->window, &r);
+ dst_rect = &r;
+ }
+
+ if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
+ {
+ GLenum buffer;
+
+ if (dst_location == WINED3D_LOCATION_DRAWABLE)
+ {
+ TRACE("Destination texture %p is onscreen.\n", dst_texture);
+ buffer = wined3d_texture_get_gl_buffer(dst_texture);
+ }
+ else
+ {
+ TRACE("Destination texture %p is offscreen.\n", dst_texture);
+ buffer = GL_COLOR_ATTACHMENT0;
+ }
+ wined3d_context_gl_apply_fbo_state_blit(context_gl, GL_DRAW_FRAMEBUFFER,
+ dst_resource, dst_sub_resource_idx, NULL, 0, dst_location);
+ wined3d_context_gl_set_draw_buffer(context_gl, buffer);
+ wined3d_context_gl_check_fbo_status(context_gl, GL_DRAW_FRAMEBUFFER);
+ context_invalidate_state(context, STATE_FRAMEBUFFER);
+ }
+
+ gl_info->gl_ops.gl.p_glEnable(src_texture_gl->target);
+ checkGLcall("glEnable(target)");
+
+ if (op == WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST || colour_key)
+ {
+ gl_info->gl_ops.gl.p_glEnable(GL_ALPHA_TEST);
+ checkGLcall("glEnable(GL_ALPHA_TEST)");
+ }
+
+ if (colour_key)
+ {
+ /* For P8 surfaces, the alpha component contains the palette index.
+ * Which means that the colourkey is one of the palette entries. In
+ * other cases pixels that should be masked away have alpha set to 0. */
+ if (src_texture->resource.format->id == WINED3DFMT_P8_UINT)
+ gl_info->gl_ops.gl.p_glAlphaFunc(GL_NOTEQUAL,
+ (float)src_texture->async.src_blt_color_key.color_space_low_value / 255.0f);
+ else
+ gl_info->gl_ops.gl.p_glAlphaFunc(GL_NOTEQUAL, 0.0f);
+ checkGLcall("glAlphaFunc");
+ }
+
+ wined3d_context_gl_draw_textured_quad(context_gl, src_texture_gl,
+ src_sub_resource_idx, src_rect, dst_rect, filter);
+
+ if (op == WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST || colour_key)
+ {
+ gl_info->gl_ops.gl.p_glDisable(GL_ALPHA_TEST);
+ checkGLcall("glDisable(GL_ALPHA_TEST)");
+ }
+
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
+ checkGLcall("glDisable(GL_TEXTURE_2D)");
+ if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
+ {
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
+ checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
+ }
+ if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
+ {
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
+ checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
+ }
+
+ if (dst_texture->swapchain && dst_texture->swapchain->front_buffer == dst_texture)
+ gl_info->gl_ops.gl.p_glFlush();
+
+ /* Restore the colour key parameters */
+ wined3d_texture_set_color_key(src_texture, WINED3D_CKEY_SRC_BLT,
+ (old_colour_key_flags & WINED3D_CKEY_SRC_BLT) ? &old_blt_key : NULL);
+
+ if (staging_texture)
+ wined3d_texture_decref(staging_texture);
+
+ return dst_location;
+}
+
+static const struct wined3d_blitter_ops ffp_blitter_ops =
+{
+ ffp_blitter_destroy,
+ ffp_blitter_clear,
+ ffp_blitter_blit,
+};
+
+void wined3d_ffp_blitter_create(struct wined3d_blitter **next, const struct wined3d_gl_info *gl_info)
+{
+ struct wined3d_blitter *blitter;
+
+ if (!(blitter = heap_alloc(sizeof(*blitter))))
+ return;
+
+ TRACE("Created blitter %p.\n", blitter);
+
+ blitter->ops = &ffp_blitter_ops;
+ blitter->next = *next;
+ *next = blitter;
+}
--
2.20.1
1
0
[PATCH 2/5] wined3d: Add a miscellaneous state template for the Vulkan adapter.
by Henri Verbeet 22 Apr '20
by Henri Verbeet 22 Apr '20
22 Apr '20
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/adapter_gl.c | 1 +
dlls/wined3d/adapter_vk.c | 172 +++++++++++++++++++++++++++++++++
dlls/wined3d/device.c | 2 +-
dlls/wined3d/directx.c | 172 +++++++++++++++++++++++++++++++++
dlls/wined3d/state.c | 2 +-
dlls/wined3d/wined3d_private.h | 3 +-
6 files changed, 349 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
index ba0026ba586..eaeb13b46cc 100644
--- a/dlls/wined3d/adapter_gl.c
+++ b/dlls/wined3d/adapter_gl.c
@@ -5115,6 +5115,7 @@ static void wined3d_adapter_gl_init_d3d_info(struct wined3d_adapter_gl *adapter_
adapter_gl->a.shader_backend->shader_get_caps(&adapter_gl->a, &shader_caps);
adapter_gl->a.vertex_pipe->vp_get_caps(&adapter_gl->a, &vertex_caps);
+ adapter_gl->a.misc_state_template = misc_state_template_gl;
adapter_gl->a.fragment_pipe->get_caps(&adapter_gl->a, &fragment_caps);
d3d_info->limits.vs_version = shader_caps.vs_version;
diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c
index c718919a04a..efb1ae8ba22 100644
--- a/dlls/wined3d/adapter_vk.c
+++ b/dlls/wined3d/adapter_vk.c
@@ -24,6 +24,177 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
+static const struct wined3d_state_entry_template misc_state_template_vk[] =
+{
+ {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_VERTEX), {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_VERTEX), state_nop}},
+ {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_HULL), {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_HULL), state_nop}},
+ {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_DOMAIN), {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_DOMAIN), state_nop}},
+ {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_GEOMETRY), {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_GEOMETRY), state_nop}},
+ {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_PIXEL), {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_PIXEL), state_nop}},
+ {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_COMPUTE), {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_COMPUTE), state_nop}},
+ {STATE_GRAPHICS_SHADER_RESOURCE_BINDING, {STATE_GRAPHICS_SHADER_RESOURCE_BINDING, state_nop}},
+ {STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING, {STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING, state_nop}},
+ {STATE_COMPUTE_SHADER_RESOURCE_BINDING, {STATE_COMPUTE_SHADER_RESOURCE_BINDING, state_nop}},
+ {STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING, {STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING, state_nop}},
+ {STATE_STREAM_OUTPUT, {STATE_STREAM_OUTPUT, state_nop}},
+ {STATE_BLEND, {STATE_BLEND, state_nop}},
+ {STATE_BLEND_FACTOR, {STATE_BLEND_FACTOR, state_nop}},
+ {STATE_STREAMSRC, {STATE_STREAMSRC, state_nop}},
+ {STATE_VDECL, {STATE_VDECL, state_nop}},
+ {STATE_RASTERIZER, {STATE_RASTERIZER, state_nop}},
+ {STATE_SCISSORRECT, {STATE_SCISSORRECT, state_nop}},
+ {STATE_POINTSPRITECOORDORIGIN, {STATE_POINTSPRITECOORDORIGIN, state_nop}},
+
+ {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), state_nop}},
+ {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), state_nop}},
+ {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), state_nop}},
+ {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), state_nop}},
+ {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), state_nop}},
+ {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), state_nop}},
+ {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), state_nop}},
+ {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), state_nop}},
+ {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00)}},
+ {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), state_nop}},
+ {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE)}},
+ {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), state_nop}},
+ {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE)}},
+ {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), state_nop}},
+ {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE)}},
+ {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), state_nop}},
+ {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE)}},
+ {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), state_nop}},
+ {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE)}},
+ {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), state_nop}},
+ {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE)}},
+ {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), state_nop}},
+ {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE)}},
+ {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), state_nop}},
+ {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE)}},
+
+ {STATE_VIEWPORT, {STATE_VIEWPORT, state_nop}},
+ {STATE_INDEXBUFFER, {STATE_INDEXBUFFER, state_nop}},
+ {STATE_RENDER(WINED3D_RS_ANTIALIAS), {STATE_RENDER(WINED3D_RS_ANTIALIAS), state_nop}},
+ {STATE_RENDER(WINED3D_RS_TEXTUREPERSPECTIVE), {STATE_RENDER(WINED3D_RS_TEXTUREPERSPECTIVE), state_nop}},
+ {STATE_RENDER(WINED3D_RS_ZENABLE), {STATE_RENDER(WINED3D_RS_ZENABLE), state_nop}},
+ {STATE_RENDER(WINED3D_RS_WRAPU), {STATE_RENDER(WINED3D_RS_WRAPU), state_nop}},
+ {STATE_RENDER(WINED3D_RS_WRAPV), {STATE_RENDER(WINED3D_RS_WRAPV), state_nop}},
+ {STATE_RENDER(WINED3D_RS_LINEPATTERN), {STATE_RENDER(WINED3D_RS_LINEPATTERN), state_nop}},
+ {STATE_RENDER(WINED3D_RS_MONOENABLE), {STATE_RENDER(WINED3D_RS_MONOENABLE), state_nop}},
+ {STATE_RENDER(WINED3D_RS_ROP2), {STATE_RENDER(WINED3D_RS_ROP2), state_nop}},
+ {STATE_RENDER(WINED3D_RS_PLANEMASK), {STATE_RENDER(WINED3D_RS_PLANEMASK), state_nop}},
+ {STATE_RENDER(WINED3D_RS_ZWRITEENABLE), {STATE_RENDER(WINED3D_RS_ZENABLE)}},
+ {STATE_RENDER(WINED3D_RS_LASTPIXEL), {STATE_RENDER(WINED3D_RS_LASTPIXEL), state_nop}},
+ {STATE_RENDER(WINED3D_RS_ZFUNC), {STATE_RENDER(WINED3D_RS_ZENABLE)}},
+ {STATE_RENDER(WINED3D_RS_DITHERENABLE), {STATE_RENDER(WINED3D_RS_DITHERENABLE), state_nop}},
+ {STATE_RENDER(WINED3D_RS_SUBPIXEL), {STATE_RENDER(WINED3D_RS_SUBPIXEL), state_nop}},
+ {STATE_RENDER(WINED3D_RS_SUBPIXELX), {STATE_RENDER(WINED3D_RS_SUBPIXELX), state_nop}},
+ {STATE_RENDER(WINED3D_RS_STIPPLEDALPHA), {STATE_RENDER(WINED3D_RS_STIPPLEDALPHA), state_nop}},
+ {STATE_RENDER(WINED3D_RS_STIPPLEENABLE), {STATE_RENDER(WINED3D_RS_STIPPLEENABLE), state_nop}},
+ {STATE_RENDER(WINED3D_RS_MIPMAPLODBIAS), {STATE_RENDER(WINED3D_RS_MIPMAPLODBIAS), state_nop}},
+ {STATE_RENDER(WINED3D_RS_ANISOTROPY), {STATE_RENDER(WINED3D_RS_ANISOTROPY), state_nop}},
+ {STATE_RENDER(WINED3D_RS_FLUSHBATCH), {STATE_RENDER(WINED3D_RS_FLUSHBATCH), state_nop}},
+ {STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT), {STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT), state_nop}},
+ {STATE_RENDER(WINED3D_RS_STENCILENABLE), {STATE_RENDER(WINED3D_RS_ZENABLE)}},
+ {STATE_RENDER(WINED3D_RS_STENCILFAIL), {STATE_RENDER(WINED3D_RS_ZENABLE)}},
+ {STATE_RENDER(WINED3D_RS_STENCILZFAIL), {STATE_RENDER(WINED3D_RS_ZENABLE)}},
+ {STATE_RENDER(WINED3D_RS_STENCILPASS), {STATE_RENDER(WINED3D_RS_ZENABLE)}},
+ {STATE_RENDER(WINED3D_RS_STENCILFUNC), {STATE_RENDER(WINED3D_RS_ZENABLE)}},
+ {STATE_RENDER(WINED3D_RS_STENCILREF), {STATE_RENDER(WINED3D_RS_ZENABLE)}},
+ {STATE_RENDER(WINED3D_RS_STENCILMASK), {STATE_RENDER(WINED3D_RS_ZENABLE)}},
+ {STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), {STATE_RENDER(WINED3D_RS_ZENABLE)}},
+ {STATE_RENDER(WINED3D_RS_TWOSIDEDSTENCILMODE), {STATE_RENDER(WINED3D_RS_ZENABLE)}},
+ {STATE_RENDER(WINED3D_RS_BACK_STENCILFAIL), {STATE_RENDER(WINED3D_RS_ZENABLE)}},
+ {STATE_RENDER(WINED3D_RS_BACK_STENCILZFAIL), {STATE_RENDER(WINED3D_RS_ZENABLE)}},
+ {STATE_RENDER(WINED3D_RS_BACK_STENCILPASS), {STATE_RENDER(WINED3D_RS_ZENABLE)}},
+ {STATE_RENDER(WINED3D_RS_BACK_STENCILFUNC), {STATE_RENDER(WINED3D_RS_ZENABLE)}},
+ {STATE_RENDER(WINED3D_RS_WRAP0), {STATE_RENDER(WINED3D_RS_WRAP0), state_nop}},
+ {STATE_RENDER(WINED3D_RS_WRAP1), {STATE_RENDER(WINED3D_RS_WRAP0)}},
+ {STATE_RENDER(WINED3D_RS_WRAP2), {STATE_RENDER(WINED3D_RS_WRAP0)}},
+ {STATE_RENDER(WINED3D_RS_WRAP3), {STATE_RENDER(WINED3D_RS_WRAP0)}},
+ {STATE_RENDER(WINED3D_RS_WRAP4), {STATE_RENDER(WINED3D_RS_WRAP0)}},
+ {STATE_RENDER(WINED3D_RS_WRAP5), {STATE_RENDER(WINED3D_RS_WRAP0)}},
+ {STATE_RENDER(WINED3D_RS_WRAP6), {STATE_RENDER(WINED3D_RS_WRAP0)}},
+ {STATE_RENDER(WINED3D_RS_WRAP7), {STATE_RENDER(WINED3D_RS_WRAP0)}},
+ {STATE_RENDER(WINED3D_RS_WRAP8), {STATE_RENDER(WINED3D_RS_WRAP0)}},
+ {STATE_RENDER(WINED3D_RS_WRAP9), {STATE_RENDER(WINED3D_RS_WRAP0)}},
+ {STATE_RENDER(WINED3D_RS_WRAP10), {STATE_RENDER(WINED3D_RS_WRAP0)}},
+ {STATE_RENDER(WINED3D_RS_WRAP11), {STATE_RENDER(WINED3D_RS_WRAP0)}},
+ {STATE_RENDER(WINED3D_RS_WRAP12), {STATE_RENDER(WINED3D_RS_WRAP0)}},
+ {STATE_RENDER(WINED3D_RS_WRAP13), {STATE_RENDER(WINED3D_RS_WRAP0)}},
+ {STATE_RENDER(WINED3D_RS_WRAP14), {STATE_RENDER(WINED3D_RS_WRAP0)}},
+ {STATE_RENDER(WINED3D_RS_WRAP15), {STATE_RENDER(WINED3D_RS_WRAP0)}},
+ {STATE_RENDER(WINED3D_RS_EXTENTS), {STATE_RENDER(WINED3D_RS_EXTENTS), state_nop}},
+ {STATE_RENDER(WINED3D_RS_COLORKEYBLENDENABLE), {STATE_RENDER(WINED3D_RS_COLORKEYBLENDENABLE), state_nop}},
+ {STATE_RENDER(WINED3D_RS_SOFTWAREVERTEXPROCESSING), {STATE_RENDER(WINED3D_RS_SOFTWAREVERTEXPROCESSING), state_nop}},
+ {STATE_RENDER(WINED3D_RS_PATCHEDGESTYLE), {STATE_RENDER(WINED3D_RS_PATCHEDGESTYLE), state_nop}},
+ {STATE_RENDER(WINED3D_RS_PATCHSEGMENTS), {STATE_RENDER(WINED3D_RS_PATCHSEGMENTS), state_nop}},
+ {STATE_RENDER(WINED3D_RS_POSITIONDEGREE), {STATE_RENDER(WINED3D_RS_POSITIONDEGREE), state_nop}},
+ {STATE_RENDER(WINED3D_RS_NORMALDEGREE), {STATE_RENDER(WINED3D_RS_NORMALDEGREE), state_nop}},
+ {STATE_RENDER(WINED3D_RS_MINTESSELLATIONLEVEL), {STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION)}},
+ {STATE_RENDER(WINED3D_RS_MAXTESSELLATIONLEVEL), {STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION)}},
+ {STATE_RENDER(WINED3D_RS_ADAPTIVETESS_X), {STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION)}},
+ {STATE_RENDER(WINED3D_RS_ADAPTIVETESS_Y), {STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION)}},
+ {STATE_RENDER(WINED3D_RS_ADAPTIVETESS_Z), {STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION)}},
+ {STATE_RENDER(WINED3D_RS_ADAPTIVETESS_W), {STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION)}},
+ {STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION), {STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION), state_nop}},
+ {STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS), {STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS), state_nop}},
+ {STATE_RENDER(WINED3D_RS_MULTISAMPLEMASK), {STATE_RENDER(WINED3D_RS_MULTISAMPLEMASK), state_nop}},
+ {STATE_RENDER(WINED3D_RS_DEBUGMONITORTOKEN), {STATE_RENDER(WINED3D_RS_DEBUGMONITORTOKEN), state_nop}},
+ {STATE_RENDER(WINED3D_RS_ZVISIBLE), {STATE_RENDER(WINED3D_RS_ZVISIBLE), state_nop}},
+ /* Samplers */
+ {STATE_SAMPLER(0), {STATE_SAMPLER(0), state_nop}},
+ {STATE_SAMPLER(1), {STATE_SAMPLER(1), state_nop}},
+ {STATE_SAMPLER(2), {STATE_SAMPLER(2), state_nop}},
+ {STATE_SAMPLER(3), {STATE_SAMPLER(3), state_nop}},
+ {STATE_SAMPLER(4), {STATE_SAMPLER(4), state_nop}},
+ {STATE_SAMPLER(5), {STATE_SAMPLER(5), state_nop}},
+ {STATE_SAMPLER(6), {STATE_SAMPLER(6), state_nop}},
+ {STATE_SAMPLER(7), {STATE_SAMPLER(7), state_nop}},
+ {STATE_SAMPLER(8), {STATE_SAMPLER(8), state_nop}},
+ {STATE_SAMPLER(9), {STATE_SAMPLER(9), state_nop}},
+ {STATE_SAMPLER(10), {STATE_SAMPLER(10), state_nop}},
+ {STATE_SAMPLER(11), {STATE_SAMPLER(11), state_nop}},
+ {STATE_SAMPLER(12), {STATE_SAMPLER(12), state_nop}},
+ {STATE_SAMPLER(13), {STATE_SAMPLER(13), state_nop}},
+ {STATE_SAMPLER(14), {STATE_SAMPLER(14), state_nop}},
+ {STATE_SAMPLER(15), {STATE_SAMPLER(15), state_nop}},
+ {STATE_SAMPLER(16), /* Vertex sampler 0 */ {STATE_SAMPLER(16), state_nop}},
+ {STATE_SAMPLER(17), /* Vertex sampler 1 */ {STATE_SAMPLER(17), state_nop}},
+ {STATE_SAMPLER(18), /* Vertex sampler 2 */ {STATE_SAMPLER(18), state_nop}},
+ {STATE_SAMPLER(19), /* Vertex sampler 3 */ {STATE_SAMPLER(19), state_nop}},
+ {STATE_BASEVERTEXINDEX, {STATE_STREAMSRC}},
+ {STATE_FRAMEBUFFER, {STATE_FRAMEBUFFER, state_nop}},
+ {STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), {STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), state_nop}},
+ {STATE_SHADER(WINED3D_SHADER_TYPE_HULL), {STATE_SHADER(WINED3D_SHADER_TYPE_HULL), state_nop}},
+ {STATE_SHADER(WINED3D_SHADER_TYPE_DOMAIN), {STATE_SHADER(WINED3D_SHADER_TYPE_DOMAIN), state_nop}},
+ {STATE_SHADER(WINED3D_SHADER_TYPE_GEOMETRY), {STATE_SHADER(WINED3D_SHADER_TYPE_GEOMETRY), state_nop}},
+ {STATE_SHADER(WINED3D_SHADER_TYPE_COMPUTE), {STATE_SHADER(WINED3D_SHADER_TYPE_COMPUTE), state_nop}},
+ {0}, /* Terminate */
+};
+
static inline const struct wined3d_adapter_vk *wined3d_adapter_vk_const(const struct wined3d_adapter *adapter)
{
return CONTAINING_RECORD(adapter, struct wined3d_adapter_vk, a);
@@ -1556,6 +1727,7 @@ static BOOL wined3d_adapter_vk_init(struct wined3d_adapter_vk *adapter_vk,
adapter->vertex_pipe = &none_vertex_pipe;
adapter->fragment_pipe = &none_fragment_pipe;
+ adapter->misc_state_template = misc_state_template_vk;
adapter->shader_backend = &none_shader_backend;
wined3d_adapter_vk_init_d3d_info(adapter, wined3d_creation_flags);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index ee007568d46..b81cc2f53fe 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5596,7 +5596,7 @@ HRESULT wined3d_device_init(struct wined3d_device *device, struct wined3d *wined
if (vertex_pipeline->vp_states && fragment_pipeline->states
&& FAILED(hr = compile_state_table(device->state_table, device->multistate_funcs,
&adapter->d3d_info, adapter->gl_info.supported, vertex_pipeline,
- fragment_pipeline, misc_state_template)))
+ fragment_pipeline, adapter->misc_state_template)))
{
ERR("Failed to compile state table, hr %#x.\n", hr);
wine_rb_destroy(&device->samplers, NULL, NULL);
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 5fe0856e514..c44d06f2b5b 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -2295,6 +2295,177 @@ HRESULT CDECL wined3d_device_create(struct wined3d *wined3d, struct wined3d_adap
return WINED3D_OK;
}
+static const struct wined3d_state_entry_template misc_state_template_no3d[] =
+{
+ {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_VERTEX), {STATE_VDECL}},
+ {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_HULL), {STATE_VDECL}},
+ {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_DOMAIN), {STATE_VDECL}},
+ {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_GEOMETRY), {STATE_VDECL}},
+ {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_PIXEL), {STATE_VDECL}},
+ {STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_COMPUTE), {STATE_VDECL}},
+ {STATE_GRAPHICS_SHADER_RESOURCE_BINDING, {STATE_VDECL}},
+ {STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING, {STATE_VDECL}},
+ {STATE_COMPUTE_SHADER_RESOURCE_BINDING, {STATE_VDECL}},
+ {STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING, {STATE_VDECL}},
+ {STATE_STREAM_OUTPUT, {STATE_VDECL}},
+ {STATE_BLEND, {STATE_VDECL}},
+ {STATE_BLEND_FACTOR, {STATE_VDECL}},
+ {STATE_STREAMSRC, {STATE_VDECL}},
+ {STATE_VDECL, {STATE_VDECL, state_nop}},
+ {STATE_RASTERIZER, {STATE_VDECL}},
+ {STATE_SCISSORRECT, {STATE_VDECL}},
+ {STATE_POINTSPRITECOORDORIGIN, {STATE_VDECL}},
+
+ {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT01), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT10), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT11), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT01), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT10), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT11), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT01), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT10), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT11), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT01), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT10), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT11), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT01), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT10), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT11), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT01), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT10), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT11), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT01), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT10), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT11), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT01), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT10), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT11), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), {STATE_VDECL}},
+ {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_VDECL}},
+
+ {STATE_VIEWPORT, {STATE_VDECL}},
+ {STATE_INDEXBUFFER, {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_ANTIALIAS), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_TEXTUREPERSPECTIVE), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_ZENABLE), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAPU), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAPV), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_LINEPATTERN), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_MONOENABLE), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_ROP2), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_PLANEMASK), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_ZWRITEENABLE), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_LASTPIXEL), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_ZFUNC), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_DITHERENABLE), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_SUBPIXEL), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_SUBPIXELX), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_STIPPLEDALPHA), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_STIPPLEENABLE), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_MIPMAPLODBIAS), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_ANISOTROPY), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_FLUSHBATCH), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_STENCILENABLE), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_STENCILFAIL), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_STENCILZFAIL), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_STENCILPASS), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_STENCILFUNC), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_STENCILREF), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_STENCILMASK), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_TWOSIDEDSTENCILMODE), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_BACK_STENCILFAIL), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_BACK_STENCILZFAIL), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_BACK_STENCILPASS), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_BACK_STENCILFUNC), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAP0), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAP1), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAP2), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAP3), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAP4), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAP5), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAP6), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAP7), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAP8), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAP9), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAP10), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAP11), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAP12), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAP13), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAP14), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_WRAP15), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_EXTENTS), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_COLORKEYBLENDENABLE), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_SOFTWAREVERTEXPROCESSING), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_PATCHEDGESTYLE), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_PATCHSEGMENTS), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_POSITIONDEGREE), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_NORMALDEGREE), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_MINTESSELLATIONLEVEL), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_MAXTESSELLATIONLEVEL), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_ADAPTIVETESS_X), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_ADAPTIVETESS_Y), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_ADAPTIVETESS_Z), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_ADAPTIVETESS_W), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_MULTISAMPLEMASK), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_DEBUGMONITORTOKEN), {STATE_VDECL}},
+ {STATE_RENDER(WINED3D_RS_ZVISIBLE), {STATE_VDECL}},
+ /* Samplers */
+ {STATE_SAMPLER(0), {STATE_VDECL}},
+ {STATE_SAMPLER(1), {STATE_VDECL}},
+ {STATE_SAMPLER(2), {STATE_VDECL}},
+ {STATE_SAMPLER(3), {STATE_VDECL}},
+ {STATE_SAMPLER(4), {STATE_VDECL}},
+ {STATE_SAMPLER(5), {STATE_VDECL}},
+ {STATE_SAMPLER(6), {STATE_VDECL}},
+ {STATE_SAMPLER(7), {STATE_VDECL}},
+ {STATE_SAMPLER(8), {STATE_VDECL}},
+ {STATE_SAMPLER(9), {STATE_VDECL}},
+ {STATE_SAMPLER(10), {STATE_VDECL}},
+ {STATE_SAMPLER(11), {STATE_VDECL}},
+ {STATE_SAMPLER(12), {STATE_VDECL}},
+ {STATE_SAMPLER(13), {STATE_VDECL}},
+ {STATE_SAMPLER(14), {STATE_VDECL}},
+ {STATE_SAMPLER(15), {STATE_VDECL}},
+ {STATE_SAMPLER(16), /* Vertex sampler 0 */ {STATE_VDECL}},
+ {STATE_SAMPLER(17), /* Vertex sampler 1 */ {STATE_VDECL}},
+ {STATE_SAMPLER(18), /* Vertex sampler 2 */ {STATE_VDECL}},
+ {STATE_SAMPLER(19), /* Vertex sampler 3 */ {STATE_VDECL}},
+ {STATE_BASEVERTEXINDEX, {STATE_VDECL}},
+ {STATE_FRAMEBUFFER, {STATE_VDECL}},
+ {STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), {STATE_VDECL}},
+ {STATE_SHADER(WINED3D_SHADER_TYPE_HULL), {STATE_VDECL}},
+ {STATE_SHADER(WINED3D_SHADER_TYPE_DOMAIN), {STATE_VDECL}},
+ {STATE_SHADER(WINED3D_SHADER_TYPE_GEOMETRY), {STATE_VDECL}},
+ {STATE_SHADER(WINED3D_SHADER_TYPE_COMPUTE), {STATE_VDECL}},
+ {0}, /* Terminate */
+};
+
static void adapter_no3d_destroy(struct wined3d_adapter *adapter)
{
wined3d_adapter_cleanup(adapter);
@@ -2753,6 +2924,7 @@ static struct wined3d_adapter *wined3d_adapter_no3d_create(unsigned int ordinal,
adapter->vertex_pipe = &none_vertex_pipe;
adapter->fragment_pipe = &none_fragment_pipe;
+ adapter->misc_state_template = misc_state_template_no3d;
adapter->shader_backend = &none_shader_backend;
wined3d_adapter_no3d_init_d3d_info(adapter, wined3d_creation_flags);
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index b37554cdb01..03718b616c6 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -4577,7 +4577,7 @@ static void state_so_warn(struct wined3d_context *context, const struct wined3d_
WARN("Transform feedback not supported.\n");
}
-const struct wined3d_state_entry_template misc_state_template[] =
+const struct wined3d_state_entry_template misc_state_template_gl[] =
{
{ STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_VERTEX), { STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_VERTEX), state_cb, }, ARB_UNIFORM_BUFFER_OBJECT },
{ STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_VERTEX), { STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_VERTEX), state_cb_warn, }, WINED3D_GL_EXT_NONE },
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 02418d88171..b78fbde0f47 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2378,7 +2378,7 @@ struct wined3d_vertex_pipe_ops
const struct wined3d_state_entry_template *vp_states;
};
-extern const struct wined3d_state_entry_template misc_state_template[] DECLSPEC_HIDDEN;
+extern const struct wined3d_state_entry_template misc_state_template_gl[] DECLSPEC_HIDDEN;
extern const struct wined3d_fragment_pipe_ops none_fragment_pipe DECLSPEC_HIDDEN;
extern const struct wined3d_fragment_pipe_ops ffp_fragment_pipeline DECLSPEC_HIDDEN;
extern const struct wined3d_fragment_pipe_ops atifs_fragment_pipeline DECLSPEC_HIDDEN;
@@ -3037,6 +3037,7 @@ struct wined3d_adapter
const struct wined3d_vertex_pipe_ops *vertex_pipe;
const struct wined3d_fragment_pipe_ops *fragment_pipe;
+ const struct wined3d_state_entry_template *misc_state_template;
const struct wined3d_shader_backend_ops *shader_backend;
const struct wined3d_adapter_ops *adapter_ops;
};
--
2.20.1
1
0