Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- 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
September 2018
- 70 participants
- 1549 messages
[PATCH 1/2] ntdll: Stub for ProcessCookie in NtQueryInformationProcess.
by Alistair Leslie-Hughes
From: Andrew Wesie <awesie(a)gmail.com>
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/ntdll/process.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c
index b299287..c5057da 100644
--- a/dlls/ntdll/process.c
+++ b/dlls/ntdll/process.c
@@ -572,6 +572,22 @@ NTSTATUS WINAPI NtQueryInformationProcess(
else
ret = STATUS_INFO_LENGTH_MISMATCH;
break;
+ case ProcessCookie:
+ FIXME("ProcessCookie (%p,%p,0x%08x,%p) stub\n",
+ ProcessHandle,ProcessInformation,
+ ProcessInformationLength,ReturnLength);
+
+ if(ProcessHandle == NtCurrentProcess())
+ {
+ len = sizeof(ULONG);
+ if (ProcessInformationLength == len)
+ *(ULONG *)ProcessInformation = 0;
+ else
+ ret = STATUS_INFO_LENGTH_MISMATCH;
+ }
+ else
+ ret = STATUS_INVALID_PARAMETER;
+ break;
default:
FIXME("(%p,info_class=%d,%p,0x%08x,%p) Unknown information class\n",
ProcessHandle,ProcessInformationClass,
--
1.9.1
Sept. 14, 2018
[PATCH] wined3d: Introduce WINED3DFMT_FLAG_VERTEX_ATTRIBUTE.
by Henri Verbeet
To indicate a format can be used for vertex attributes.
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/utils.c | 1 +
dlls/wined3d/vertexdeclaration.c | 2 +-
dlls/wined3d/wined3d_private.h | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 17aa8c07732..d463a086803 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -3692,6 +3692,7 @@ static BOOL init_format_vertex_info(const struct wined3d_adapter *adapter,
format->emit_idx = format_vertex_info[i].emit_idx;
format->gl_vtx_type = format_vertex_info[i].gl_vtx_type;
format->gl_vtx_format = format->component_count;
+ format->flags[WINED3D_GL_RES_TYPE_BUFFER] |= WINED3DFMT_FLAG_VERTEX_ATTRIBUTE;
}
if (gl_info->supported[ARB_VERTEX_ARRAY_BGRA])
diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c
index 89329d42034..863366b9243 100644
--- a/dlls/wined3d/vertexdeclaration.c
+++ b/dlls/wined3d/vertexdeclaration.c
@@ -220,7 +220,7 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara
if (e->input_slot >= MAX_STREAMS)
continue;
- if (!e->format->gl_vtx_format)
+ if (!(e->format->flags[WINED3D_GL_RES_TYPE_BUFFER] & WINED3DFMT_FLAG_VERTEX_ATTRIBUTE))
{
FIXME("The application tries to use an unsupported format (%s), returning E_FAIL.\n",
debug_d3dformat(elements[i].format));
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 2673de0c4eb..aea874f84ea 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -4293,6 +4293,7 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
#define WINED3DFMT_FLAG_INTEGER 0x00200000
#define WINED3DFMT_FLAG_GEN_MIPMAP 0x00400000
#define WINED3DFMT_FLAG_NORMALISED 0x00800000
+#define WINED3DFMT_FLAG_VERTEX_ATTRIBUTE 0x01000000
struct wined3d_rational
{
--
2.11.0
Sept. 13, 2018
[PATCH] advapi32: add stub for TraceSetInformation
by Louis Lenders
fix https://bugs.winehq.org/show_bug.cgi?id=45813
Signed-off-by: Louis Lenders <xerox.xerox2000x(a)gmail.com>
---
dlls/advapi32/advapi32.spec | 2 +-
dlls/advapi32/eventlog.c | 9 +++++++++
.../api-ms-win-eventing-controller-l1-1-0.spec | 2 +-
include/evntrace.h | 15 +++++++++++++++
4 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/dlls/advapi32/advapi32.spec b/dlls/advapi32/advapi32.spec
index bb817a593c..5845ae0878 100644
--- a/dlls/advapi32/advapi32.spec
+++ b/dlls/advapi32/advapi32.spec
@@ -818,7 +818,7 @@
@ varargs TraceMessage(int64 long ptr long)
@ stdcall TraceMessageVa(int64 long ptr long ptr)
# @ stub TraceQueryInformation
-# @ stub TraceSetInformation
+@ stdcall TraceSetInformation(int64 long ptr long)
# @ stub TreeResetNamedSecurityInfoA
@ stdcall TreeResetNamedSecurityInfoW(wstr long long ptr ptr ptr ptr long ptr long ptr)
# @ stub TreeSetNamedSecurityInfoA
diff --git a/dlls/advapi32/eventlog.c b/dlls/advapi32/eventlog.c
index fbab8e8332..32066c5fef 100644
--- a/dlls/advapi32/eventlog.c
+++ b/dlls/advapi32/eventlog.c
@@ -931,3 +931,12 @@ ULONG WINAPI EnumerateTraceGuids(PTRACE_GUID_PROPERTIES *propertiesarray,
FIXME("%p %d %p: stub\n", propertiesarray, arraycount, guidcount);
return ERROR_INVALID_PARAMETER;
}
+
+/******************************************************************************
+ * TraceSetInformation [ADVAPI32.@]
+ */
+ULONG WINAPI TraceSetInformation(TRACEHANDLE handle, TRACE_INFO_CLASS infoclass, VOID* info, ULONG len)
+{
+ FIXME("%s %d %p %d: stub\n", wine_dbgstr_longlong(handle), infoclass, info, len);
+ return ERROR_CALL_NOT_IMPLEMENTED;
+}
diff --git a/dlls/api-ms-win-eventing-controller-l1-1-0/api-ms-win-eventing-controller-l1-1-0.spec b/dlls/api-ms-win-eventing-controller-l1-1-0/api-ms-win-eventing-controller-l1-1-0.spec
index 0b58510b31..60a4ff546e 100644
--- a/dlls/api-ms-win-eventing-controller-l1-1-0/api-ms-win-eventing-controller-l1-1-0.spec
+++ b/dlls/api-ms-win-eventing-controller-l1-1-0/api-ms-win-eventing-controller-l1-1-0.spec
@@ -8,4 +8,4 @@
@ stdcall StartTraceW(ptr wstr ptr) advapi32.StartTraceW
@ stdcall StopTraceW(int64 wstr ptr) advapi32.StopTraceW
@ stub TraceQueryInformation
-@ stub TraceSetInformation
+@ stdcall TraceSetInformation(int64 long ptr long) advapi32.TraceSetInformation
diff --git a/include/evntrace.h b/include/evntrace.h
index 5722b28e47..d55d328ad4 100644
--- a/include/evntrace.h
+++ b/include/evntrace.h
@@ -259,6 +259,21 @@ typedef struct _ENABLE_TRACE_PARAMETERS
ULONG FilterDescCount;
} ENABLE_TRACE_PARAMETERS, *PENABLE_TRACE_PARAMETERS;
+typedef enum _TRACE_QUERY_INFO_CLASS
+{
+ TraceGuidQueryList,
+ TraceGuidQueryInfo,
+ TraceGuidQueryProcess,
+ TraceStackTracingInfo,
+ TraceSystemTraceEnableFlagsInfo,
+ TraceSampledProfileIntervalInfo,
+ TraceProfileSourceConfigInfo,
+ TraceProfileSourceListInfo,
+ TracePmcEventListInfo,
+ TracePmcCounterListInfo,
+ MaxTraceSetInfoClass
+} TRACE_QUERY_INFO_CLASS, TRACE_INFO_CLASS;
+
#define INVALID_PROCESSTRACE_HANDLE ((TRACEHANDLE)~(ULONG_PTR)0)
ULONG WINAPI CloseTrace(TRACEHANDLE);
--
2.17.1
Sept. 13, 2018
Re: [PATCH v5 3/7] shell32/autocomplete: Redesign the window proc to trigger on key presses instead of key release
by Huw Davies
> On 13 Sep 2018, at 20:12, Gabriel Ivăncescu <gabrielopcode(a)gmail.com> wrote:
>
> On Thu, Sep 13, 2018 at 6:47 PM, Gabriel Ivăncescu
> <gabrielopcode(a)gmail.com> wrote:
>> On Thu, Sep 13, 2018 at 1:37 PM, Huw Davies <huw(a)codeweavers.com> wrote:
>>>
>>> Not that it really matters, because this isn't going to go in as it is, but
>>> having noautoappend as a tri-state is fine, except you can't declare it as a
>>> BOOL and use FALSE, TRUE and 2 as its states. You'd want an enum.
>>>
>>> Huw.
>>>
>>
>> I have two questions about the enum. First, is there some sort of
>> naming convention that should be used to avoid future clashes with
>> public definitions (headers)? For example, I know that using all-caps
>> for enum values is common, but that can easily conflict with future
>> public macros or the like, so I personally dislike it. Of course, the
>> Windows API doesn't really use underscores like this_is_an_enum_value
>> for its public definitions, so maybe I should go with that approach?
>> (e.g. noautoappend_displayall as enum value? or some other naming
>> scheme?). Basically I'm asking how to best make the enum "private" for
>> internal linkage purposes in terms of naming convention.
>>
>> Second question is, how should I tell the enum that any value other
>> than zero is "no auto append", including the "displayall" part? (to
>> simplify the code checks since it implies it) For example currently i
>> just check if it's FALSE, because both TRUE and 2 means "don't auto
>> append" (while 2 further means displayall at the beginning). How to
>> best proceed with an enum there? Maybe I should use a short helper
>> function with the enum as parameter that returns BOOL whether it
>> should auto-append or not?
>
> Here's what I have so far:
>
> enum autoappend_flag
> {
> autoappend_flag_yes = 0,
> autoappend_flag_no = 1,
> autoappend_flag_displayempty = -1
> };
Since the actual values are irrelevant don't assign them, just
let the compiler pick the defaults.
> static BOOL autoappend_flag_enabled(enum autoappend_flag flag)
> {
> /* "no" and "displayempty" don't autoappend, only "yes" does */
> return flag == autoappend_flag_yes;
> }
>
> Is this fine like this? I find it natural with accessor but of course
> that's just me :-)
You're making this more complicated than it needs be; testing for
the enabled case is as simple as:
if (flag == autoappend_flag_yes)
there's no need to wrap this in a helper.
Huw.
Sept. 13, 2018
Re: [PATCH v5 3/7] shell32/autocomplete: Redesign the window proc to trigger on key presses instead of key release
by Gabriel Ivăncescu
On Thu, Sep 13, 2018 at 6:47 PM, Gabriel Ivăncescu
<gabrielopcode(a)gmail.com> wrote:
> On Thu, Sep 13, 2018 at 1:37 PM, Huw Davies <huw(a)codeweavers.com> wrote:
>>
>> Not that it really matters, because this isn't going to go in as it is, but
>> having noautoappend as a tri-state is fine, except you can't declare it as a
>> BOOL and use FALSE, TRUE and 2 as its states. You'd want an enum.
>>
>> Huw.
>>
>
> I have two questions about the enum. First, is there some sort of
> naming convention that should be used to avoid future clashes with
> public definitions (headers)? For example, I know that using all-caps
> for enum values is common, but that can easily conflict with future
> public macros or the like, so I personally dislike it. Of course, the
> Windows API doesn't really use underscores like this_is_an_enum_value
> for its public definitions, so maybe I should go with that approach?
> (e.g. noautoappend_displayall as enum value? or some other naming
> scheme?). Basically I'm asking how to best make the enum "private" for
> internal linkage purposes in terms of naming convention.
>
> Second question is, how should I tell the enum that any value other
> than zero is "no auto append", including the "displayall" part? (to
> simplify the code checks since it implies it) For example currently i
> just check if it's FALSE, because both TRUE and 2 means "don't auto
> append" (while 2 further means displayall at the beginning). How to
> best proceed with an enum there? Maybe I should use a short helper
> function with the enum as parameter that returns BOOL whether it
> should auto-append or not?
Here's what I have so far:
enum autoappend_flag
{
autoappend_flag_yes = 0,
autoappend_flag_no = 1,
autoappend_flag_displayempty = -1
};
static BOOL autoappend_flag_enabled(enum autoappend_flag flag)
{
/* "no" and "displayempty" don't autoappend, only "yes" does */
return flag == autoappend_flag_yes;
}
Is this fine like this? I find it natural with accessor but of course
that's just me :-)
Sept. 13, 2018
Re: [PATCH] ole32: Release marshal data before removing apartment from list.
by Sergio Gómez Del Real
I'm not sure how to add a test case here:
The issue is in apartment_release(), but specifically when the count
drops to 0 so that apartment gets destroyed. This function doesn't have
a means to communicate errors when releasing resources fail while
destroying apartment; it just returns a DWORD with the reference count.
As far as I can tell, there isn't any call to apartment_release() that
relies on the DWORD returned; we could return a special value here upon
failure releasing any resource, although I don't think that would be
useful in general (it would only be useful to the test case).
On 12/09/18 16:40, Marvin wrote:
> Thank you for your contribution to Wine!
>
> This is an automated notification to let you know that your patch has
> been reviewed and its status set to "Needs tests".
>
> This means that you need to write some test cases demonstrating that
> the patch is correct.
>
> If you do not understand the reason for this status, disagree with our
> assessment, or are simply not sure how to proceed next, please ask for
> clarification by replying to this email.
Sept. 13, 2018
Re: [PATCH 1/2] comctl32/listbox: Don't update scrollbar during window creation
by Fabian Maurer
On Donnerstag, 13. September 2018 17:58:10 CEST Nikolay Sivov
wrote:
> Tests are a bit artificial, because WM_SIZE is normally sent by the
system.
Yes, but I figured this is the easiest way to show that only the first
WM_SIZE doesn't change WS_VSCROLL when height is 0. The second
does actually update WS_VSCROLL, shouldn't matter if sent by the
system or the test. Sending it directly would take out all the other
variables, I think.
Regards,
Fabian Maurer
Sept. 13, 2018
[PATCH 4/4] d2d1: Return bitmap options.
by Henri Verbeet
From: Nikolay Sivov <nsivov(a)codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/d2d1/bitmap.c | 47 ++++++++++++++-------
dlls/d2d1/d2d1_private.h | 7 +--
dlls/d2d1/device.c | 40 +++++++++++++++---
dlls/d2d1/tests/d2d1.c | 108 +++++++++++++++++++++++++----------------------
4 files changed, 126 insertions(+), 76 deletions(-)
diff --git a/dlls/d2d1/bitmap.c b/dlls/d2d1/bitmap.c
index 8282dca0435..8b5b6aa0a9a 100644
--- a/dlls/d2d1/bitmap.c
+++ b/dlls/d2d1/bitmap.c
@@ -179,9 +179,11 @@ static void STDMETHODCALLTYPE d2d_bitmap_GetColorContext(ID2D1Bitmap1 *iface, ID
static D2D1_BITMAP_OPTIONS STDMETHODCALLTYPE d2d_bitmap_GetOptions(ID2D1Bitmap1 *iface)
{
- FIXME("iface %p stub!\n", iface);
+ struct d2d_bitmap *bitmap = impl_from_ID2D1Bitmap1(iface);
+
+ TRACE("iface %p.\n", iface);
- return D2D1_BITMAP_OPTIONS_NONE;
+ return bitmap->options;
}
static HRESULT STDMETHODCALLTYPE d2d_bitmap_GetSurface(ID2D1Bitmap1 *iface, IDXGISurface **surface)
@@ -262,7 +264,7 @@ static BOOL format_supported(const D2D1_PIXEL_FORMAT *format)
}
static void d2d_bitmap_init(struct d2d_bitmap *bitmap, ID2D1Factory *factory,
- ID3D10ShaderResourceView *view, D2D1_SIZE_U size, const D2D1_BITMAP_PROPERTIES *desc)
+ ID3D10ShaderResourceView *view, D2D1_SIZE_U size, const D2D1_BITMAP_PROPERTIES1 *desc)
{
bitmap->ID2D1Bitmap1_iface.lpVtbl = &d2d_bitmap_vtbl;
bitmap->refcount = 1;
@@ -272,6 +274,7 @@ static void d2d_bitmap_init(struct d2d_bitmap *bitmap, ID2D1Factory *factory,
bitmap->format = desc->pixelFormat;
bitmap->dpi_x = desc->dpiX;
bitmap->dpi_y = desc->dpiY;
+ bitmap->options = desc->bitmapOptions;
if (bitmap->dpi_x == 0.0f && bitmap->dpi_y == 0.0f)
{
@@ -281,7 +284,7 @@ static void d2d_bitmap_init(struct d2d_bitmap *bitmap, ID2D1Factory *factory,
}
HRESULT d2d_bitmap_create(ID2D1Factory *factory, ID3D10Device *device, D2D1_SIZE_U size, const void *src_data,
- UINT32 pitch, const D2D1_BITMAP_PROPERTIES *desc, struct d2d_bitmap **bitmap)
+ UINT32 pitch, const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap)
{
D3D10_SUBRESOURCE_DATA resource_data;
D3D10_TEXTURE2D_DESC texture_desc;
@@ -338,9 +341,9 @@ HRESULT d2d_bitmap_create(ID2D1Factory *factory, ID3D10Device *device, D2D1_SIZE
}
HRESULT d2d_bitmap_create_shared(ID2D1DeviceContext *context, ID3D10Device *target_device,
- REFIID iid, void *data, const D2D1_BITMAP_PROPERTIES *desc, struct d2d_bitmap **bitmap)
+ REFIID iid, void *data, const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap)
{
- D2D1_BITMAP_PROPERTIES d;
+ D2D1_BITMAP_PROPERTIES1 d;
ID2D1Factory *factory;
if (IsEqualGUID(iid, &IID_ID2D1Bitmap))
@@ -369,6 +372,8 @@ HRESULT d2d_bitmap_create_shared(ID2D1DeviceContext *context, ID3D10Device *targ
d.pixelFormat = src_impl->format;
d.dpiX = src_impl->dpi_x;
d.dpiY = src_impl->dpi_y;
+ d.bitmapOptions = src_impl->options;
+ d.colorContext = NULL;
desc = &d;
}
@@ -432,7 +437,22 @@ HRESULT d2d_bitmap_create_shared(ID2D1DeviceContext *context, ID3D10Device *targ
return E_OUTOFMEMORY;
}
- d = *desc;
+
+ if (FAILED(hr = IDXGISurface_GetDesc(surface, &surface_desc)))
+ {
+ WARN("Failed to get surface desc, hr %#x.\n", hr);
+ ID3D10ShaderResourceView_Release(view);
+ return hr;
+ }
+
+ if (!desc)
+ {
+ memset(&d, 0, sizeof(d));
+ d.pixelFormat.format = surface_desc.Format;
+ }
+ else
+ d = *desc;
+
if (d.dpiX == 0.0f || d.dpiY == 0.0f)
{
float dpi_x, dpi_y;
@@ -444,13 +464,6 @@ HRESULT d2d_bitmap_create_shared(ID2D1DeviceContext *context, ID3D10Device *targ
d.dpiY = dpi_y;
}
- if (FAILED(hr = IDXGISurface_GetDesc(surface, &surface_desc)))
- {
- WARN("Failed to get surface desc, hr %#x.\n", hr);
- ID3D10ShaderResourceView_Release(view);
- return hr;
- }
-
pixel_size.width = surface_desc.Width;
pixel_size.height = surface_desc.Height;
@@ -469,10 +482,10 @@ HRESULT d2d_bitmap_create_shared(ID2D1DeviceContext *context, ID3D10Device *targ
}
HRESULT d2d_bitmap_create_from_wic_bitmap(ID2D1Factory *factory, ID3D10Device *device, IWICBitmapSource *bitmap_source,
- const D2D1_BITMAP_PROPERTIES *desc, struct d2d_bitmap **bitmap)
+ const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap)
{
const D2D1_PIXEL_FORMAT *d2d_format;
- D2D1_BITMAP_PROPERTIES bitmap_desc;
+ D2D1_BITMAP_PROPERTIES1 bitmap_desc;
WICPixelFormatGUID wic_format;
unsigned int bpp, data_size;
D2D1_SIZE_U size;
@@ -505,6 +518,8 @@ HRESULT d2d_bitmap_create_from_wic_bitmap(ID2D1Factory *factory, ID3D10Device *d
bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_UNKNOWN;
bitmap_desc.dpiX = 0.0f;
bitmap_desc.dpiY = 0.0f;
+ bitmap_desc.bitmapOptions = 0;
+ bitmap_desc.colorContext = NULL;
}
else
{
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h
index 4148a685bac..5f83f8fde22 100644
--- a/dlls/d2d1/d2d1_private.h
+++ b/dlls/d2d1/d2d1_private.h
@@ -343,14 +343,15 @@ struct d2d_bitmap
D2D1_PIXEL_FORMAT format;
float dpi_x;
float dpi_y;
+ D2D1_BITMAP_OPTIONS options;
};
HRESULT d2d_bitmap_create(ID2D1Factory *factory, ID3D10Device *device, D2D1_SIZE_U size, const void *src_data,
- UINT32 pitch, const D2D1_BITMAP_PROPERTIES *desc, struct d2d_bitmap **bitmap) DECLSPEC_HIDDEN;
+ UINT32 pitch, const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap) DECLSPEC_HIDDEN;
HRESULT d2d_bitmap_create_shared(ID2D1DeviceContext *context, ID3D10Device *device, REFIID iid, void *data,
- const D2D1_BITMAP_PROPERTIES *desc, struct d2d_bitmap **bitmap) DECLSPEC_HIDDEN;
+ const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap) DECLSPEC_HIDDEN;
HRESULT d2d_bitmap_create_from_wic_bitmap(ID2D1Factory *factory, ID3D10Device *device, IWICBitmapSource *bitmap_source,
- const D2D1_BITMAP_PROPERTIES *desc, struct d2d_bitmap **bitmap) DECLSPEC_HIDDEN;
+ const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap) DECLSPEC_HIDDEN;
struct d2d_bitmap *unsafe_impl_from_ID2D1Bitmap(ID2D1Bitmap *iface) DECLSPEC_HIDDEN;
struct d2d_state_block
diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
index 4478a19f9fd..649fcc43117 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -328,14 +328,23 @@ static void STDMETHODCALLTYPE d2d_device_context_GetFactory(ID2D1DeviceContext *
static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateBitmap(ID2D1DeviceContext *iface,
D2D1_SIZE_U size, const void *src_data, UINT32 pitch, const D2D1_BITMAP_PROPERTIES *desc, ID2D1Bitmap **bitmap)
{
- struct d2d_device_context *render_target = impl_from_ID2D1DeviceContext(iface);
+ struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface);
+ D2D1_BITMAP_PROPERTIES1 bitmap_desc;
struct d2d_bitmap *object;
HRESULT hr;
TRACE("iface %p, size {%u, %u}, src_data %p, pitch %u, desc %p, bitmap %p.\n",
iface, size.width, size.height, src_data, pitch, desc, bitmap);
- if (SUCCEEDED(hr = d2d_bitmap_create(render_target->factory, render_target->device, size, src_data, pitch, desc, &object)))
+ if (desc)
+ {
+ memcpy(&bitmap_desc, desc, sizeof(*desc));
+ bitmap_desc.bitmapOptions = 0;
+ bitmap_desc.colorContext = NULL;
+ }
+
+ if (SUCCEEDED(hr = d2d_bitmap_create(context->factory, context->device,
+ size, src_data, pitch, desc ? &bitmap_desc : NULL, &object)))
*bitmap = (ID2D1Bitmap *)&object->ID2D1Bitmap1_iface;
return hr;
@@ -344,15 +353,23 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateBitmap(ID2D1DeviceCont
static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateBitmapFromWicBitmap(ID2D1DeviceContext *iface,
IWICBitmapSource *bitmap_source, const D2D1_BITMAP_PROPERTIES *desc, ID2D1Bitmap **bitmap)
{
- struct d2d_device_context *render_target = impl_from_ID2D1DeviceContext(iface);
+ struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface);
+ D2D1_BITMAP_PROPERTIES1 bitmap_desc;
struct d2d_bitmap *object;
HRESULT hr;
TRACE("iface %p, bitmap_source %p, desc %p, bitmap %p.\n",
iface, bitmap_source, desc, bitmap);
- if (SUCCEEDED(hr = d2d_bitmap_create_from_wic_bitmap(render_target->factory, render_target->device, bitmap_source,
- desc, &object)))
+ if (desc)
+ {
+ memcpy(&bitmap_desc, desc, sizeof(*desc));
+ bitmap_desc.bitmapOptions = 0;
+ bitmap_desc.colorContext = NULL;
+ }
+
+ if (SUCCEEDED(hr = d2d_bitmap_create_from_wic_bitmap(context->factory, context->device,
+ bitmap_source, desc ? &bitmap_desc : NULL, &object)))
*bitmap = (ID2D1Bitmap *)&object->ID2D1Bitmap1_iface;
return hr;
@@ -361,14 +378,23 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateBitmapFromWicBitmap(ID
static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateSharedBitmap(ID2D1DeviceContext *iface,
REFIID iid, void *data, const D2D1_BITMAP_PROPERTIES *desc, ID2D1Bitmap **bitmap)
{
- struct d2d_device_context *render_target = impl_from_ID2D1DeviceContext(iface);
+ struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface);
+ D2D1_BITMAP_PROPERTIES1 bitmap_desc;
struct d2d_bitmap *object;
HRESULT hr;
TRACE("iface %p, iid %s, data %p, desc %p, bitmap %p.\n",
iface, debugstr_guid(iid), data, desc, bitmap);
- if (SUCCEEDED(hr = d2d_bitmap_create_shared(iface, render_target->device, iid, data, desc, &object)))
+ if (desc)
+ {
+ memcpy(&bitmap_desc, desc, sizeof(*desc));
+ bitmap_desc.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW;
+ bitmap_desc.colorContext = NULL;
+ }
+
+ if (SUCCEEDED(hr = d2d_bitmap_create_shared(iface, context->device,
+ iid, data, desc ? &bitmap_desc : NULL, &object)))
*bitmap = (ID2D1Bitmap *)&object->ID2D1Bitmap1_iface;
return hr;
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index eeae75f8413..467d61314d8 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -773,6 +773,56 @@ static ID2D1RenderTarget *create_render_target(IDXGISurface *surface)
return create_render_target_desc(surface, &desc);
}
+#define check_bitmap_surface(b, s, o) check_bitmap_surface_(__LINE__, b, s, o)
+static void check_bitmap_surface_(unsigned int line, ID2D1Bitmap1 *bitmap, BOOL has_surface, DWORD expected_options)
+{
+ D2D1_BITMAP_OPTIONS options;
+ IDXGISurface *surface;
+ HRESULT hr;
+
+ options = ID2D1Bitmap1_GetOptions(bitmap);
+ ok_(__FILE__, line)(options == expected_options, "Unexpected bitmap options %#x, expected %#x.\n",
+ options, expected_options);
+
+ surface = (void *)0xdeadbeef;
+ hr = ID2D1Bitmap1_GetSurface(bitmap, &surface);
+ if (has_surface)
+ {
+ D3D10_TEXTURE2D_DESC desc;
+ ID3D10Texture2D *texture;
+
+ todo_wine
+ ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get bitmap surface, hr %#x.\n", hr);
+ ok_(__FILE__, line)(!!surface, "Expected surface instance.\n");
+
+ if (SUCCEEDED(hr))
+ {
+ /* Correlate with resource configuration. */
+ hr = IDXGISurface_QueryInterface(surface, &IID_ID3D10Texture2D, (void **)&texture);
+ ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get texture pointer, hr %#x.\n", hr);
+
+ ID3D10Texture2D_GetDesc(texture, &desc);
+ ok_(__FILE__, line)(desc.Usage == 0, "Unexpected usage %#x.\n", desc.Usage);
+ ok_(__FILE__, line)(desc.BindFlags == (options & D2D1_BITMAP_OPTIONS_TARGET ?
+ D3D10_BIND_RENDER_TARGET : D3D10_BIND_SHADER_RESOURCE),
+ "Unexpected bind flags %#x, bitmap options %#x.\n", desc.BindFlags, options);
+ ok_(__FILE__, line)(desc.CPUAccessFlags == 0, "Unexpected cpu access flags %#x.\n", desc.CPUAccessFlags);
+ ok_(__FILE__, line)(desc.MiscFlags == 0, "Unexpected misc flags %#x.\n", desc.MiscFlags);
+
+ ID3D10Texture2D_Release(texture);
+
+ IDXGISurface_Release(surface);
+ }
+ }
+ else
+ {
+ todo_wine {
+ ok_(__FILE__, line)(hr == D2DERR_INVALID_CALL, "Unexpected hr %#x.\n", hr);
+ ok_(__FILE__, line)(!surface, "Unexpected surface instance.\n");
+ }
+ }
+}
+
static inline struct geometry_sink *impl_from_ID2D1SimplifiedGeometrySink(ID2D1SimplifiedGeometrySink *iface)
{
return CONTAINING_RECORD(iface, struct geometry_sink, ID2D1SimplifiedGeometrySink_iface);
@@ -4112,11 +4162,19 @@ static void test_shared_bitmap(void)
if (SUCCEEDED(hr))
{
+ ID2D1Bitmap1 *bitmap3;
+
size = ID2D1Bitmap_GetPixelSize(bitmap2);
hr = IDXGISurface_GetDesc(surface2, &surface_desc);
ok(SUCCEEDED(hr), "Failed to get surface description, hr %#x.\n", hr);
ok(size.width == surface_desc.Width && size.height == surface_desc.Height, "Got wrong bitmap size.\n");
+ hr = ID2D1Bitmap_QueryInterface(bitmap2, &IID_ID2D1Bitmap1, (void **)&bitmap3);
+ ok(SUCCEEDED(hr), "Failed to get ID2D1Bitmap1 pointer, hr %#x.\n", hr);
+
+ check_bitmap_surface(bitmap3, TRUE, D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW);
+ ID2D1Bitmap1_Release(bitmap3);
+
ID2D1Bitmap_Release(bitmap2);
/* IDXGISurface1 is supported too. */
@@ -6529,56 +6587,6 @@ static void test_create_device(void)
ok(!refcount, "Factory has %u references left.\n", refcount);
}
-#define check_bitmap_surface(b, s, o) check_bitmap_surface_(__LINE__, b, s, o)
-static void check_bitmap_surface_(unsigned int line, ID2D1Bitmap1 *bitmap, BOOL has_surface, DWORD expected_options)
-{
- D2D1_BITMAP_OPTIONS options;
- IDXGISurface *surface;
- HRESULT hr;
-
- options = ID2D1Bitmap1_GetOptions(bitmap);
- ok_(__FILE__, line)(options == expected_options, "Unexpected bitmap options %#x, expected %#x.\n",
- options, expected_options);
-
- surface = (void *)0xdeadbeef;
- hr = ID2D1Bitmap1_GetSurface(bitmap, &surface);
- if (has_surface)
- {
- D3D10_TEXTURE2D_DESC desc;
- ID3D10Texture2D *texture;
-
- todo_wine
- ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get bitmap surface, hr %#x.\n", hr);
- ok_(__FILE__, line)(!!surface, "Expected surface instance.\n");
-
- if (SUCCEEDED(hr))
- {
- /* Correlate with resource configuration. */
- hr = IDXGISurface_QueryInterface(surface, &IID_ID3D10Texture2D, (void **)&texture);
- ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get texture pointer, hr %#x.\n", hr);
-
- ID3D10Texture2D_GetDesc(texture, &desc);
- ok_(__FILE__, line)(desc.Usage == 0, "Unexpected usage %#x.\n", desc.Usage);
- ok_(__FILE__, line)(desc.BindFlags == (options & D2D1_BITMAP_OPTIONS_TARGET ?
- D3D10_BIND_RENDER_TARGET : D3D10_BIND_SHADER_RESOURCE),
- "Unexpected bind flags %#x, bitmap options %#x.\n", desc.BindFlags, options);
- ok_(__FILE__, line)(desc.CPUAccessFlags == 0, "Unexpected cpu access flags %#x.\n", desc.CPUAccessFlags);
- ok_(__FILE__, line)(desc.MiscFlags == 0, "Unexpected misc flags %#x.\n", desc.MiscFlags);
-
- ID3D10Texture2D_Release(texture);
-
- IDXGISurface_Release(surface);
- }
- }
- else
- {
- todo_wine {
- ok_(__FILE__, line)(hr == D2DERR_INVALID_CALL, "Unexpected hr %#x.\n", hr);
- ok_(__FILE__, line)(!surface, "Unexpected surface instance.\n");
- }
- }
-}
-
#define check_rt_bitmap_surface(r, s, o) check_rt_bitmap_surface_(__LINE__, r, s, o)
static void check_rt_bitmap_surface_(unsigned int line, ID2D1RenderTarget *rt, BOOL has_surface, DWORD options)
{
--
2.11.0
Sept. 13, 2018
[PATCH 3/4] wined3d: Use a table for colour fixups in apply_format_fixups().
by Henri Verbeet
This ends up being slightly more code, but I think the table is much more
readable.
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/utils.c | 200 ++++++++++++++++++++++-------------------
dlls/wined3d/wined3d_private.h | 14 ---
2 files changed, 109 insertions(+), 105 deletions(-)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 3a74fc8f281..17aa8c07732 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -3403,85 +3403,129 @@ static void init_format_filter_info(struct wined3d_adapter *adapter,
}
}
-static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
+static enum fixup_channel_source fixup_source_from_char(char c)
{
- struct wined3d_format *format;
- unsigned int i;
+ switch (c)
+ {
+ default:
+ case '0':
+ return CHANNEL_SOURCE_ZERO;
+ case '1':
+ return CHANNEL_SOURCE_ONE;
+ case 'x':
+ case 'X':
+ return CHANNEL_SOURCE_X;
+ case 'y':
+ case 'Y':
+ return CHANNEL_SOURCE_Y;
+ case 'z':
+ case 'Z':
+ return CHANNEL_SOURCE_Z;
+ case 'w':
+ case 'W':
+ return CHANNEL_SOURCE_W;
+ }
+}
+
+static unsigned int fixup_sign_from_char(char c)
+{
+ if (c == 'x' || c == 'y' || c == 'z' || c == 'w')
+ return 1;
+ return 0;
+}
- format = get_format_internal(adapter, WINED3DFMT_R16_FLOAT);
- format->color_fixup = create_color_fixup_desc(
- 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_W);
+static struct color_fixup_desc create_color_fixup_desc_from_string(const char *s)
+{
+ struct color_fixup_desc fixup;
- format = get_format_internal(adapter, WINED3DFMT_R32_FLOAT);
- format->color_fixup = create_color_fixup_desc(
- 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_W);
+ if (strlen(s) != 4)
+ {
+ ERR("Invalid fixup string %s.\n", wine_dbgstr_a(s));
+ return COLOR_FIXUP_IDENTITY;
+ }
- format = get_format_internal(adapter, WINED3DFMT_R16G16_UNORM);
- format->color_fixup = create_color_fixup_desc(
- 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_W);
+ fixup.x_sign_fixup = fixup_sign_from_char(s[0]);
+ fixup.x_source = fixup_source_from_char(s[0]);
+ fixup.y_sign_fixup = fixup_sign_from_char(s[1]);
+ fixup.y_source = fixup_source_from_char(s[1]);
+ fixup.z_sign_fixup = fixup_sign_from_char(s[2]);
+ fixup.z_source = fixup_source_from_char(s[2]);
+ fixup.w_sign_fixup = fixup_sign_from_char(s[3]);
+ fixup.w_source = fixup_source_from_char(s[3]);
- format = get_format_internal(adapter, WINED3DFMT_R16G16_FLOAT);
- format->color_fixup = create_color_fixup_desc(
- 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_W);
+ return fixup;
+}
- format = get_format_internal(adapter, WINED3DFMT_R32G32_FLOAT);
- format->color_fixup = create_color_fixup_desc(
- 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_W);
+static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
+{
+ struct wined3d_format *format;
+ unsigned int i;
- /* GL_ATI_envmap_bumpmap in theory supports R8G8_SNORM but is no longer supported by
- * any driver. */
- if (gl_info->supported[NV_TEXTURE_SHADER] || gl_info->supported[EXT_TEXTURE_SNORM])
+ static const struct
{
- /* R8G8_SNORM and R16G16_SNORM need a fixup of the undefined blue channel. OpenGL
- * returns 0.0 when sampling from it, DirectX 1.0. So we always have in-shader
- * conversion for this format. */
- format = get_format_internal(adapter, WINED3DFMT_R8G8_SNORM);
- format->color_fixup = create_color_fixup_desc(
- 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE);
- format = get_format_internal(adapter, WINED3DFMT_R16G16_SNORM);
- format->color_fixup = create_color_fixup_desc(
- 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE);
+ enum wined3d_format_id id;
+ const char *fixup;
+ enum wined3d_gl_extension extension;
}
- else
+ fixups[] =
{
- /* Emulate using unsigned formats. This requires load-time conversion in addition to the
- * fixups here. */
- format = get_format_internal(adapter, WINED3DFMT_R8G8_SNORM);
- format->color_fixup = create_color_fixup_desc(
- 1, CHANNEL_SOURCE_X, 1, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE);
- format = get_format_internal(adapter, WINED3DFMT_R16G16_SNORM);
- format->color_fixup = create_color_fixup_desc(
- 1, CHANNEL_SOURCE_X, 1, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE);
- format = get_format_internal(adapter, WINED3DFMT_R8G8B8A8_SNORM);
- format->color_fixup = create_color_fixup_desc(
- 1, CHANNEL_SOURCE_X, 1, CHANNEL_SOURCE_Y, 1, CHANNEL_SOURCE_Z, 1, CHANNEL_SOURCE_W);
- format = get_format_internal(adapter, WINED3DFMT_R5G5_SNORM_L6_UNORM);
- format->color_fixup = create_color_fixup_desc(
- 1, CHANNEL_SOURCE_X, 1, CHANNEL_SOURCE_Z, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE);
- }
+ {WINED3DFMT_R16_FLOAT, "X11W", WINED3D_GL_EXT_NONE},
+ {WINED3DFMT_R32_FLOAT, "X11W", WINED3D_GL_EXT_NONE},
+ {WINED3DFMT_R16G16_UNORM, "XY1W", WINED3D_GL_EXT_NONE},
+ {WINED3DFMT_R16G16_FLOAT, "XY1W", WINED3D_GL_EXT_NONE},
+ {WINED3DFMT_R32G32_FLOAT, "XY1W", WINED3D_GL_EXT_NONE},
- if (!gl_info->supported[NV_TEXTURE_SHADER])
- {
- format = get_format_internal(adapter, WINED3DFMT_R8G8_SNORM_L8X8_UNORM);
- format->color_fixup = create_color_fixup_desc(
- 1, CHANNEL_SOURCE_X, 1, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_Z, 0, CHANNEL_SOURCE_W);
- }
+ {WINED3DFMT_R8G8_SNORM, "xy11", WINED3D_GL_EXT_NONE},
+ {WINED3DFMT_R8G8_SNORM, "XY11", NV_TEXTURE_SHADER},
+ {WINED3DFMT_R8G8_SNORM, "XY11", EXT_TEXTURE_SNORM},
- if (gl_info->supported[ARB_TEXTURE_COMPRESSION_RGTC] || gl_info->supported[EXT_TEXTURE_COMPRESSION_RGTC])
- {
- format = get_format_internal(adapter, WINED3DFMT_ATI1N);
- format->color_fixup = create_color_fixup_desc(
- 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_X);
+ {WINED3DFMT_R16G16_SNORM, "xy11", WINED3D_GL_EXT_NONE},
+ {WINED3DFMT_R16G16_SNORM, "XY11", NV_TEXTURE_SHADER},
+ {WINED3DFMT_R16G16_SNORM, "XY11", EXT_TEXTURE_SNORM},
- format = get_format_internal(adapter, WINED3DFMT_ATI2N);
- format->color_fixup = create_color_fixup_desc(
- 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE);
- }
- else if (gl_info->supported[ATI_TEXTURE_COMPRESSION_3DC])
+ {WINED3DFMT_R8G8B8A8_SNORM, "xyzw", WINED3D_GL_EXT_NONE},
+ {WINED3DFMT_R8G8B8A8_SNORM, "XYZW", NV_TEXTURE_SHADER},
+ {WINED3DFMT_R8G8B8A8_SNORM, "XYZW", EXT_TEXTURE_SNORM},
+
+ {WINED3DFMT_R5G5_SNORM_L6_UNORM, "xzY1", WINED3D_GL_EXT_NONE},
+ {WINED3DFMT_R5G5_SNORM_L6_UNORM, "XYZW", NV_TEXTURE_SHADER},
+ {WINED3DFMT_R5G5_SNORM_L6_UNORM, "XYZW", EXT_TEXTURE_SNORM},
+
+ {WINED3DFMT_R8G8_SNORM_L8X8_UNORM, "xyZW", WINED3D_GL_EXT_NONE},
+ {WINED3DFMT_R8G8_SNORM_L8X8_UNORM, "XYZW", NV_TEXTURE_SHADER},
+
+ {WINED3DFMT_ATI1N, "XXXX", EXT_TEXTURE_COMPRESSION_RGTC},
+ {WINED3DFMT_ATI1N, "XXXX", ARB_TEXTURE_COMPRESSION_RGTC},
+
+ {WINED3DFMT_ATI2N, "XW11", ATI_TEXTURE_COMPRESSION_3DC},
+ {WINED3DFMT_ATI2N, "YX11", EXT_TEXTURE_COMPRESSION_RGTC},
+ {WINED3DFMT_ATI2N, "YX11", ARB_TEXTURE_COMPRESSION_RGTC},
+
+ {WINED3DFMT_A8_UNORM, "000X", WINED3D_GL_EXT_NONE},
+ {WINED3DFMT_A8_UNORM, "XYZW", WINED3D_GL_LEGACY_CONTEXT},
+
+ {WINED3DFMT_L8A8_UNORM, "XXXY", WINED3D_GL_EXT_NONE},
+ {WINED3DFMT_L8A8_UNORM, "XYZW", WINED3D_GL_LEGACY_CONTEXT},
+
+ {WINED3DFMT_L4A4_UNORM, "XXXY", WINED3D_GL_EXT_NONE},
+ {WINED3DFMT_L4A4_UNORM, "XYZW", WINED3D_GL_LEGACY_CONTEXT},
+
+ {WINED3DFMT_L16_UNORM, "XXX1", WINED3D_GL_EXT_NONE},
+ {WINED3DFMT_L16_UNORM, "XYZW", WINED3D_GL_LEGACY_CONTEXT},
+
+ {WINED3DFMT_INTZ, "XXXX", WINED3D_GL_EXT_NONE},
+ {WINED3DFMT_INTZ, "XYZW", WINED3D_GL_LEGACY_CONTEXT},
+
+ {WINED3DFMT_L8_UNORM, "XXX1", ARB_TEXTURE_RG},
+ };
+
+ for (i = 0; i < ARRAY_SIZE(fixups); ++i)
{
- format = get_format_internal(adapter, WINED3DFMT_ATI2N);
- format->color_fixup = create_color_fixup_desc(
- 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_W, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE);
+ if (!gl_info->supported[fixups[i].extension])
+ continue;
+
+ format = get_format_internal(adapter, fixups[i].id);
+ format->color_fixup = create_color_fixup_desc_from_string(fixups[i].fixup);
}
if (!gl_info->supported[APPLE_YCBCR_422] && (gl_info->supported[ARB_FRAGMENT_PROGRAM]
@@ -3527,32 +3571,6 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_
format->glInternal = 0;
}
- if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
- {
- format = get_format_internal(adapter, WINED3DFMT_A8_UNORM);
- format->color_fixup = create_color_fixup_desc(
- 0, CHANNEL_SOURCE_ZERO, 0, CHANNEL_SOURCE_ZERO, 0, CHANNEL_SOURCE_ZERO, 0, CHANNEL_SOURCE_X);
- format = get_format_internal(adapter, WINED3DFMT_L8A8_UNORM);
- format->color_fixup = create_color_fixup_desc(
- 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y);
- format = get_format_internal(adapter, WINED3DFMT_L4A4_UNORM);
- format->color_fixup = create_color_fixup_desc(
- 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y);
- format = get_format_internal(adapter, WINED3DFMT_L16_UNORM);
- format->color_fixup = create_color_fixup_desc(
- 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_ONE);
- format = get_format_internal(adapter, WINED3DFMT_INTZ);
- format->color_fixup = create_color_fixup_desc(
- 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_X);
- }
-
- if (gl_info->supported[ARB_TEXTURE_RG])
- {
- format = get_format_internal(adapter, WINED3DFMT_L8_UNORM);
- format->color_fixup = create_color_fixup_desc(
- 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_ONE);
- }
-
if (gl_info->supported[ARB_FRAGMENT_PROGRAM] || gl_info->supported[ARB_FRAGMENT_SHADER])
{
format = get_format_internal(adapter, WINED3DFMT_P8_UINT);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7c8beb87535..2673de0c4eb 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -201,20 +201,6 @@ struct wined3d_d3d_info
static const struct color_fixup_desc COLOR_FIXUP_IDENTITY =
{0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_Z, 0, CHANNEL_SOURCE_W};
-static inline struct color_fixup_desc create_color_fixup_desc(
- int sign0, enum fixup_channel_source src0, int sign1, enum fixup_channel_source src1,
- int sign2, enum fixup_channel_source src2, int sign3, enum fixup_channel_source src3)
-{
- struct color_fixup_desc fixup =
- {
- sign0, src0,
- sign1, src1,
- sign2, src2,
- sign3, src3,
- };
- return fixup;
-}
-
static inline struct color_fixup_desc create_complex_fixup_desc(enum complex_fixup complex_fixup)
{
struct color_fixup_desc fixup =
--
2.11.0
Sept. 13, 2018
[PATCH 2/4] wined3d: Handle lack of ARB_half_float_vertex in format_vertex_info[].
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/utils.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 0c230da878d..3a74fc8f281 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -624,8 +624,11 @@ static const struct wined3d_format_vertex_info format_vertex_info[] =
{WINED3DFMT_R10G10B10X2_SNORM, WINED3D_FFP_EMIT_DEC3N, GL_SHORT},
{WINED3DFMT_R10G10B10A2_UNORM, WINED3D_FFP_EMIT_INVALID, GL_UNSIGNED_INT_2_10_10_10_REV,
ARB_VERTEX_TYPE_2_10_10_10_REV},
- {WINED3DFMT_R16G16_FLOAT, WINED3D_FFP_EMIT_FLOAT16_2, GL_HALF_FLOAT},
- {WINED3DFMT_R16G16B16A16_FLOAT, WINED3D_FFP_EMIT_FLOAT16_4, GL_HALF_FLOAT},
+ /* Without ARB_half_float_vertex we convert these on upload. */
+ {WINED3DFMT_R16G16_FLOAT, WINED3D_FFP_EMIT_FLOAT16_2, GL_FLOAT},
+ {WINED3DFMT_R16G16_FLOAT, WINED3D_FFP_EMIT_FLOAT16_2, GL_HALF_FLOAT, ARB_HALF_FLOAT_VERTEX},
+ {WINED3DFMT_R16G16B16A16_FLOAT, WINED3D_FFP_EMIT_FLOAT16_4, GL_FLOAT},
+ {WINED3DFMT_R16G16B16A16_FLOAT, WINED3D_FFP_EMIT_FLOAT16_4, GL_HALF_FLOAT, ARB_HALF_FLOAT_VERTEX},
{WINED3DFMT_R8G8B8A8_SNORM, WINED3D_FFP_EMIT_INVALID, GL_BYTE},
{WINED3DFMT_R8G8B8A8_SINT, WINED3D_FFP_EMIT_INVALID, GL_BYTE},
{WINED3DFMT_R16G16B16A16_UINT, WINED3D_FFP_EMIT_INVALID, GL_UNSIGNED_SHORT},
@@ -3556,17 +3559,6 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_
format->color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_P8);
}
- if (!gl_info->supported[ARB_HALF_FLOAT_VERTEX])
- {
- /* Do not change the size of the type, it is CPU side. We have to change the GPU-side information though.
- * It is the job of the vertex buffer code to make sure that the vbos have the right format */
- format = get_format_internal(adapter, WINED3DFMT_R16G16_FLOAT);
- format->gl_vtx_type = GL_FLOAT;
-
- format = get_format_internal(adapter, WINED3DFMT_R16G16B16A16_FLOAT);
- format->gl_vtx_type = GL_FLOAT;
- }
-
if (!gl_info->supported[ARB_HALF_FLOAT_PIXEL])
{
format = get_format_internal(adapter, WINED3DFMT_R16_FLOAT);
--
2.11.0
Sept. 13, 2018