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
September 2018
- 70 participants
- 627 discussions
[PATCH] wininet/tests: Skip tests when querying INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT fails (newer win10)
by André Hentschel 22 Sep '18
by André Hentschel 22 Sep '18
22 Sep '18
Signed-off-by: André Hentschel <nerv(a)dawncrow.de>
---
dlls/wininet/tests/http.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index ace8512399..9ec4902cdc 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -5569,6 +5569,12 @@ static void test_cert_struct(HINTERNET req, const cert_struct_test_t *test)
size = sizeof(info);
res = InternetQueryOptionA(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT, &info, &size);
+ if (!res)
+ {
+ win_skip("Querying INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT failed, skipping tests\n");
+ return;
+ }
+
ok(res, "InternetQueryOption failed: %u\n", GetLastError());
ok(size == sizeof(info), "size = %u\n", size);
--
2.17.1
2
2
From: Sebastian Lackner <sebastian(a)fds-team.de>
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=15670
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
loader/wine.inf.in | 2 ++
1 file changed, 2 insertions(+)
diff --git a/loader/wine.inf.in b/loader/wine.inf.in
index 5767b29887..5c4da2f756 100644
--- a/loader/wine.inf.in
+++ b/loader/wine.inf.in
@@ -527,6 +527,8 @@ HKLM,%CurrentVersionNT%\Perflib,,16
HKLM,%CurrentVersionNT%\Ports,,16
HKLM,%CurrentVersionNT%\Print,,16
HKLM,%CurrentVersionNT%\ProfileList,,16
+; Update/Replace if local_user_sid in server/token.c changes
+HKLM,%CurrentVersionNT%\ProfileList\S-1-5-21-0-0-0-1000,,16
[CurrentVersionWow64]
HKLM,%CurrentVersion%,"ProgramFilesDir (x86)",,"%16426%"
--
2.19.0
2
3
[PATCH 2/5] d3d9/tests: Properly check whether creating a device succeeded in test_flip().
by Henri Verbeet 21 Sep '18
by Henri Verbeet 21 Sep '18
21 Sep '18
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/d3d9/tests/visual.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 9c3e83d3005..4f26b0d23f9 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -20984,9 +20984,8 @@ static void test_flip(void)
present_parameters.Windowed = TRUE;
present_parameters.BackBufferCount = 3;
present_parameters.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
- hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
- window, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device);
- if (!device)
+ if (FAILED(hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ window, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
--
2.11.0
2
1
[PATCH 5/5] wined3d: Move the OpenGL texture format to struct wined3d_format_gl.
by Henri Verbeet 21 Sep '18
by Henri Verbeet 21 Sep '18
21 Sep '18
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/context.c | 4 +-
dlls/wined3d/surface.c | 48 ++--
dlls/wined3d/texture.c | 93 ++++----
dlls/wined3d/utils.c | 485 +++++++++++++++++++++--------------------
dlls/wined3d/view.c | 30 +--
dlls/wined3d/wined3d_private.h | 11 +-
6 files changed, 349 insertions(+), 322 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 167241a6f0f..8199afa1d0e 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -3868,6 +3868,7 @@ static void context_bind_unordered_access_views(struct wined3d_context *context,
{
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_unordered_access_view *view;
+ const struct wined3d_format_gl *format_gl;
GLuint texture_name;
unsigned int i;
GLint level;
@@ -3903,8 +3904,9 @@ static void context_bind_unordered_access_views(struct wined3d_context *context,
continue;
}
+ format_gl = wined3d_format_gl(view->format);
GL_EXTCALL(glBindImageTexture(i, texture_name, level, GL_TRUE, 0, GL_READ_WRITE,
- view->format->glInternal));
+ format_gl->internal));
if (view->counter_bo)
GL_EXTCALL(glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, i, view->counter_bo));
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index d1847bea34e..8b69720693e 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -348,22 +348,24 @@ static BOOL fbo_blitter_supported(enum wined3d_blit_op blit_op, const struct win
static void texture2d_download_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
const struct wined3d_context *context, DWORD dst_location)
{
- const struct wined3d_format *format = texture->resource.format;
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_texture_sub_resource *sub_resource;
unsigned int dst_row_pitch, dst_slice_pitch;
unsigned int src_row_pitch, src_slice_pitch;
+ const struct wined3d_format_gl *format_gl;
struct wined3d_bo_address data;
BYTE *temporary_mem = NULL;
unsigned int level;
GLenum target;
void *mem;
+ format_gl = wined3d_format_gl(texture->resource.format);
+
/* Only support read back of converted P8 textures. */
- if (texture->flags & WINED3D_TEXTURE_CONVERTED && format->id != WINED3DFMT_P8_UINT && !format->download)
+ if (texture->flags & WINED3D_TEXTURE_CONVERTED && format_gl->f.id != WINED3DFMT_P8_UINT && !format_gl->f.download)
{
ERR("Trying to read back converted texture %p, %u with format %s.\n",
- texture, sub_resource_idx, debug_d3dformat(format->id));
+ texture, sub_resource_idx, debug_d3dformat(format_gl->f.id));
return;
}
@@ -373,7 +375,7 @@ static void texture2d_download_data(struct wined3d_texture *texture, unsigned in
if (target == GL_TEXTURE_2D_ARRAY)
{
- if (format->download)
+ if (format_gl->f.download)
{
FIXME("Reading back converted array texture %p is not supported.\n", texture);
return;
@@ -396,14 +398,14 @@ static void texture2d_download_data(struct wined3d_texture *texture, unsigned in
if (texture->flags & WINED3D_TEXTURE_COND_NP2_EMULATED)
{
- if (format->download)
+ if (format_gl->f.download)
{
FIXME("Reading back converted texture %p with NP2 emulation is not supported.\n", texture);
return;
}
wined3d_texture_get_pitch(texture, level, &dst_row_pitch, &dst_slice_pitch);
- wined3d_format_calculate_pitch(format, texture->resource.device->surface_alignment,
+ wined3d_format_calculate_pitch(&format_gl->f, texture->resource.device->surface_alignment,
wined3d_texture_get_level_pow2_width(texture, level),
wined3d_texture_get_level_pow2_height(texture, level),
&src_row_pitch, &src_slice_pitch);
@@ -419,7 +421,7 @@ static void texture2d_download_data(struct wined3d_texture *texture, unsigned in
ERR("Unexpected compressed format for NP2 emulated texture.\n");
}
- if (format->download)
+ if (format_gl->f.download)
{
struct wined3d_format f;
@@ -427,10 +429,10 @@ static void texture2d_download_data(struct wined3d_texture *texture, unsigned in
ERR("Converted texture %p uses PBO unexpectedly.\n", texture);
WARN_(d3d_perf)("Downloading converted texture %p, %u with format %s.\n",
- texture, sub_resource_idx, debug_d3dformat(format->id));
+ texture, sub_resource_idx, debug_d3dformat(format_gl->f.id));
- f = *format;
- f.byte_count = format->conv_byte_count;
+ f = format_gl->f;
+ f.byte_count = format_gl->f.conv_byte_count;
wined3d_texture_get_pitch(texture, level, &dst_row_pitch, &dst_slice_pitch);
wined3d_format_calculate_pitch(&f, texture->resource.device->surface_alignment,
wined3d_texture_get_level_width(texture, level),
@@ -462,7 +464,7 @@ static void texture2d_download_data(struct wined3d_texture *texture, unsigned in
if (texture->resource.format_flags & WINED3DFMT_FLAG_COMPRESSED)
{
TRACE("Downloading compressed texture %p, %u, level %u, format %#x, type %#x, data %p.\n",
- texture, sub_resource_idx, level, format->glFormat, format->glType, mem);
+ texture, sub_resource_idx, level, format_gl->format, format_gl->type, mem);
GL_EXTCALL(glGetCompressedTexImage(target, level, mem));
checkGLcall("glGetCompressedTexImage");
@@ -470,15 +472,15 @@ static void texture2d_download_data(struct wined3d_texture *texture, unsigned in
else
{
TRACE("Downloading texture %p, %u, level %u, format %#x, type %#x, data %p.\n",
- texture, sub_resource_idx, level, format->glFormat, format->glType, mem);
+ texture, sub_resource_idx, level, format_gl->format, format_gl->type, mem);
- gl_info->gl_ops.gl.p_glGetTexImage(target, level, format->glFormat, format->glType, mem);
+ gl_info->gl_ops.gl.p_glGetTexImage(target, level, format_gl->format, format_gl->type, mem);
checkGLcall("glGetTexImage");
}
- if (format->download)
+ if (format_gl->f.download)
{
- format->download(mem, data.addr, src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch,
+ format_gl->f.download(mem, data.addr, src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch,
wined3d_texture_get_level_width(texture, level),
wined3d_texture_get_level_height(texture, level), 1);
}
@@ -931,7 +933,9 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
static void texture2d_read_from_framebuffer(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_context *context, DWORD src_location, DWORD dst_location)
{
- struct wined3d_device *device = texture->resource.device;
+ struct wined3d_resource *resource = &texture->resource;
+ struct wined3d_device *device = resource->device;
+ const struct wined3d_format_gl *format_gl;
struct wined3d_texture *restore_texture;
const struct wined3d_gl_info *gl_info;
unsigned int row_pitch, slice_pitch;
@@ -953,10 +957,10 @@ static void texture2d_read_from_framebuffer(struct wined3d_texture *texture, uns
restore_texture = NULL;
gl_info = context->gl_info;
- if (src_location != texture->resource.draw_binding)
+ if (src_location != resource->draw_binding)
{
context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER,
- &texture->resource, sub_resource_idx, NULL, 0, src_location);
+ resource, sub_resource_idx, NULL, 0, src_location);
context_check_fbo_status(context, GL_READ_FRAMEBUFFER);
context_invalidate_state(context, STATE_FRAMEBUFFER);
}
@@ -969,7 +973,7 @@ static void texture2d_read_from_framebuffer(struct wined3d_texture *texture, uns
* There is no need to keep track of the current read buffer or reset it,
* every part of the code that reads sets the read buffer as desired.
*/
- if (src_location != WINED3D_LOCATION_DRAWABLE || wined3d_resource_is_offscreen(&texture->resource))
+ if (src_location != WINED3D_LOCATION_DRAWABLE || wined3d_resource_is_offscreen(resource))
{
/* Mapping the primary render target which is not on a swapchain.
* Read from the back buffer. */
@@ -995,16 +999,16 @@ static void texture2d_read_from_framebuffer(struct wined3d_texture *texture, uns
level = sub_resource_idx % texture->level_count;
wined3d_texture_get_pitch(texture, level, &row_pitch, &slice_pitch);
+ format_gl = wined3d_format_gl(resource->format);
/* Setup pixel store pack state -- to glReadPixels into the correct place */
- gl_info->gl_ops.gl.p_glPixelStorei(GL_PACK_ROW_LENGTH, row_pitch / texture->resource.format->byte_count);
+ gl_info->gl_ops.gl.p_glPixelStorei(GL_PACK_ROW_LENGTH, row_pitch / format_gl->f.byte_count);
checkGLcall("glPixelStorei");
width = wined3d_texture_get_level_width(texture, level);
height = wined3d_texture_get_level_height(texture, level);
gl_info->gl_ops.gl.p_glReadPixels(0, 0, width, height,
- texture->resource.format->glFormat,
- texture->resource.format->glType, data.addr);
+ format_gl->format, format_gl->type, data.addr);
checkGLcall("glReadPixels");
/* Reset previous pixel store pack state */
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index b878e38961e..fdf26512b91 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -561,7 +561,7 @@ static unsigned int wined3d_texture_get_gl_sample_count(const struct wined3d_tex
/* Context activation is done by the caller. */
/* The caller is responsible for binding the correct texture. */
static void wined3d_texture_allocate_gl_mutable_storage(struct wined3d_texture *texture,
- GLenum gl_internal_format, const struct wined3d_format *format,
+ GLenum gl_internal_format, const struct wined3d_format_gl *format,
const struct wined3d_gl_info *gl_info)
{
unsigned int level, level_count, layer, layer_count;
@@ -584,8 +584,8 @@ static void wined3d_texture_allocate_gl_mutable_storage(struct wined3d_texture *
height = wined3d_texture_get_level_pow2_height(texture, level);
if (texture->resource.format_flags & WINED3DFMT_FLAG_HEIGHT_SCALE)
{
- height *= format->height_scale.numerator;
- height /= format->height_scale.denominator;
+ height *= format->f.height_scale.numerator;
+ height /= format->f.height_scale.denominator;
}
TRACE("texture %p, layer %u, level %u, target %#x, width %u, height %u.\n",
@@ -596,19 +596,19 @@ static void wined3d_texture_allocate_gl_mutable_storage(struct wined3d_texture *
depth = wined3d_texture_get_level_depth(texture, level);
GL_EXTCALL(glTexImage3D(target, level, gl_internal_format, width, height,
target == GL_TEXTURE_2D_ARRAY ? texture->layer_count : depth, 0,
- format->glFormat, format->glType, NULL));
+ format->format, format->type, NULL));
checkGLcall("glTexImage3D");
}
else if (target == GL_TEXTURE_1D)
{
gl_info->gl_ops.gl.p_glTexImage1D(target, level, gl_internal_format,
- width, 0, format->glFormat, format->glType, NULL);
+ width, 0, format->format, format->type, NULL);
}
else
{
gl_info->gl_ops.gl.p_glTexImage2D(target, level, gl_internal_format, width,
target == GL_TEXTURE_1D_ARRAY ? texture->layer_count : height, 0,
- format->glFormat, format->glType, NULL);
+ format->format, format->type, NULL);
checkGLcall("glTexImage2D");
}
}
@@ -1513,10 +1513,12 @@ void wined3d_texture_set_compatible_renderbuffer(struct wined3d_texture *texture
if (!renderbuffer)
{
+ const struct wined3d_format_gl *format_gl;
+
+ format_gl = wined3d_format_gl(texture->resource.format);
gl_info->fbo_ops.glGenRenderbuffers(1, &renderbuffer);
gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer);
- gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER,
- texture->resource.format->glInternal, width, height);
+ gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, format_gl->internal, width, height);
entry = heap_alloc(sizeof(*entry));
entry->width = width;
@@ -1712,11 +1714,13 @@ static void wined3d_texture_force_reload(struct wined3d_texture *texture)
void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
{
DWORD alloc_flag = srgb ? WINED3D_TEXTURE_SRGB_ALLOCATED : WINED3D_TEXTURE_RGB_ALLOCATED;
- const struct wined3d_device *device = texture->resource.device;
- const struct wined3d_format *format = texture->resource.format;
const struct wined3d_d3d_info *d3d_info = context->d3d_info;
const struct wined3d_gl_info *gl_info = context->gl_info;
+ struct wined3d_resource *resource = &texture->resource;
+ const struct wined3d_device *device = resource->device;
+ const struct wined3d_format *format = resource->format;
const struct wined3d_color_key_conversion *conversion;
+ const struct wined3d_format_gl *format_gl;
GLenum internal;
TRACE("texture %p, context %p, format %s.\n", texture, context, debug_d3dformat(format->id));
@@ -1734,11 +1738,11 @@ void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct win
if (texture->flags & alloc_flag)
return;
- if (texture->resource.format_flags & WINED3DFMT_FLAG_DECOMPRESS)
+ if (resource->format_flags & WINED3DFMT_FLAG_DECOMPRESS)
{
TRACE("WINED3DFMT_FLAG_DECOMPRESS set.\n");
texture->flags |= WINED3D_TEXTURE_CONVERTED;
- format = wined3d_resource_get_decompress_format(&texture->resource);
+ format = wined3d_resource_get_decompress_format(resource);
}
else if (format->conv_byte_count)
{
@@ -1747,37 +1751,38 @@ void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct win
else if ((conversion = wined3d_format_get_color_key_conversion(texture, TRUE)))
{
texture->flags |= WINED3D_TEXTURE_CONVERTED;
- format = wined3d_get_format(device->adapter, conversion->dst_format, texture->resource.usage);
+ format = wined3d_get_format(device->adapter, conversion->dst_format, resource->usage);
TRACE("Using format %s for color key conversion.\n", debug_d3dformat(format->id));
}
+ format_gl = wined3d_format_gl(format);
wined3d_texture_bind_and_dirtify(texture, context, srgb);
if (srgb)
- internal = format->glGammaInternal;
- else if (texture->resource.usage & WINED3DUSAGE_RENDERTARGET
- && wined3d_resource_is_offscreen(&texture->resource))
- internal = format->rtInternal;
+ internal = format_gl->srgb_internal;
+ else if (resource->usage & WINED3DUSAGE_RENDERTARGET && wined3d_resource_is_offscreen(resource))
+ internal = format_gl->rt_internal;
else
- internal = format->glInternal;
+ internal = format_gl->internal;
if (!internal)
FIXME("No GL internal format for format %s.\n", debug_d3dformat(format->id));
- TRACE("internal %#x, format %#x, type %#x.\n", internal, format->glFormat, format->glType);
+ TRACE("internal %#x, format %#x, type %#x.\n", internal, format_gl->format, format_gl->type);
if (wined3d_texture_use_immutable_storage(texture, gl_info))
wined3d_texture_allocate_gl_immutable_storage(texture, internal, gl_info);
else
- wined3d_texture_allocate_gl_mutable_storage(texture, internal, format, gl_info);
+ wined3d_texture_allocate_gl_mutable_storage(texture, internal, format_gl, gl_info);
texture->flags |= alloc_flag;
}
static void wined3d_texture_prepare_rb(struct wined3d_texture *texture,
const struct wined3d_gl_info *gl_info, BOOL multisample)
{
- const struct wined3d_format *format = texture->resource.format;
+ const struct wined3d_format_gl *format_gl;
+ format_gl = wined3d_format_gl(texture->resource.format);
if (multisample)
{
DWORD samples;
@@ -1790,7 +1795,7 @@ static void wined3d_texture_prepare_rb(struct wined3d_texture *texture,
gl_info->fbo_ops.glGenRenderbuffers(1, &texture->rb_multisample);
gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, texture->rb_multisample);
gl_info->fbo_ops.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples,
- format->glInternal, texture->resource.width, texture->resource.height);
+ format_gl->internal, texture->resource.width, texture->resource.height);
checkGLcall("glRenderbufferStorageMultisample()");
TRACE("Created multisample rb %u.\n", texture->rb_multisample);
}
@@ -1801,7 +1806,7 @@ static void wined3d_texture_prepare_rb(struct wined3d_texture *texture,
gl_info->fbo_ops.glGenRenderbuffers(1, &texture->rb_resolved);
gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, texture->rb_resolved);
- gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, format->glInternal,
+ gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, format_gl->internal,
texture->resource.width, texture->resource.height);
checkGLcall("glRenderbufferStorage()");
TRACE("Created resolved rb %u.\n", texture->rb_resolved);
@@ -1906,9 +1911,10 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
unsigned int update_w = src_box->right - src_box->left;
unsigned int update_h = src_box->bottom - src_box->top;
unsigned int update_d = src_box->back - src_box->front;
+ const struct wined3d_format_gl *format_gl;
struct wined3d_bo_address bo;
void *converted_mem = NULL;
- struct wined3d_format f;
+ struct wined3d_format_gl f;
unsigned int level;
BOOL decompress;
GLenum target;
@@ -1978,9 +1984,9 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
if (texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)
ERR("Converting a block-based format.\n");
- f = *format;
- f.byte_count = format->conv_byte_count;
- format = &f;
+ f = *wined3d_format_gl(format);
+ f.f.byte_count = format->conv_byte_count;
+ format = &f.f;
}
wined3d_format_calculate_pitch(format, 1, update_w, update_h, &dst_row_pitch, &dst_slice_pitch);
@@ -2015,6 +2021,7 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
checkGLcall("glBindBuffer");
}
+ format_gl = wined3d_format_gl(format);
if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED)
{
unsigned int dst_row_pitch, dst_slice_pitch;
@@ -2022,12 +2029,12 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
GLenum internal;
if (srgb)
- internal = format->glGammaInternal;
+ internal = format_gl->srgb_internal;
else if (texture->resource.usage & WINED3DUSAGE_RENDERTARGET
&& wined3d_resource_is_offscreen(&texture->resource))
- internal = format->rtInternal;
+ internal = format_gl->rt_internal;
else
- internal = format->glInternal;
+ internal = format_gl->internal;
wined3d_format_calculate_pitch(format, 1, update_w, update_h, &dst_row_pitch, &dst_slice_pitch);
@@ -2088,23 +2095,23 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
TRACE("Uploading data, target %#x, level %u, x %u, y %u, z %u, "
"w %u, h %u, d %u, format %#x, type %#x, addr %p.\n",
target, level, dst_x, dst_y, dst_z, update_w, update_h,
- update_d, format->glFormat, format->glType, bo.addr);
+ update_d, format_gl->format, format_gl->type, bo.addr);
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, src_row_pitch / format->byte_count);
if (target == GL_TEXTURE_2D_ARRAY || target == GL_TEXTURE_3D)
{
GL_EXTCALL(glTexSubImage3D(target, level, dst_x, dst_y, dst_z,
- update_w, update_h, update_d, format->glFormat, format->glType, bo.addr));
+ update_w, update_h, update_d, format_gl->format, format_gl->type, bo.addr));
}
else if (target == GL_TEXTURE_1D)
{
gl_info->gl_ops.gl.p_glTexSubImage1D(target, level, dst_x,
- update_w, format->glFormat, format->glType, bo.addr);
+ update_w, format_gl->format, format_gl->type, bo.addr);
}
else
{
gl_info->gl_ops.gl.p_glTexSubImage2D(target, level, dst_x, dst_y,
- update_w, update_h, format->glFormat, format->glType, bo.addr);
+ update_w, update_h, format_gl->format, format_gl->type, bo.addr);
}
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
checkGLcall("Upload texture data");
@@ -2437,13 +2444,14 @@ static const struct wined3d_resource_ops texture_resource_ops =
static void texture1d_download_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
const struct wined3d_context *context, const struct wined3d_bo_address *data)
{
- const struct wined3d_format *format = texture->resource.format;
const struct wined3d_gl_info *gl_info = context->gl_info;
+ const struct wined3d_format_gl *format_gl;
- if (format->conv_byte_count)
+ format_gl = wined3d_format_gl(texture->resource.format);
+ if (format_gl->f.conv_byte_count)
{
FIXME("Attempting to download a converted texture, format %s.\n",
- debug_d3dformat(format->id));
+ debug_d3dformat(format_gl->f.id));
return;
}
@@ -2454,7 +2462,7 @@ static void texture1d_download_data(struct wined3d_texture *texture, unsigned in
}
gl_info->gl_ops.gl.p_glGetTexImage(texture->target, sub_resource_idx,
- format->glFormat, format->glType, data->addr);
+ format_gl->format, format_gl->type, data->addr);
checkGLcall("glGetTexImage");
if (data->buffer_object)
@@ -2909,13 +2917,14 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
static void texture3d_download_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
const struct wined3d_context *context, const struct wined3d_bo_address *data)
{
- const struct wined3d_format *format = texture->resource.format;
const struct wined3d_gl_info *gl_info = context->gl_info;
+ const struct wined3d_format_gl *format_gl;
- if (format->conv_byte_count)
+ format_gl = wined3d_format_gl(texture->resource.format);
+ if (format_gl->f.conv_byte_count)
{
FIXME("Attempting to download a converted volume, format %s.\n",
- debug_d3dformat(format->id));
+ debug_d3dformat(format_gl->f.id));
return;
}
@@ -2926,7 +2935,7 @@ static void texture3d_download_data(struct wined3d_texture *texture, unsigned in
}
gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_3D, sub_resource_idx,
- format->glFormat, format->glType, data->addr);
+ format_gl->format, format_gl->type, data->addr);
checkGLcall("glGetTexImage");
if (data->buffer_object)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 36694856081..055d546ccba 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -1935,6 +1935,11 @@ static struct wined3d_format *get_format_by_idx(const struct wined3d_adapter *ad
return (struct wined3d_format *)((BYTE *)adapter->formats + fmt_idx * adapter->format_size);
}
+static struct wined3d_format_gl *get_format_gl_by_idx(const struct wined3d_adapter *adapter, int fmt_idx)
+{
+ return wined3d_format_gl_mutable(get_format_by_idx(adapter, fmt_idx));
+}
+
static struct wined3d_format *get_format_internal(const struct wined3d_adapter *adapter,
enum wined3d_format_id format_id)
{
@@ -2431,7 +2436,7 @@ static void draw_test_quad(struct wined3d_caps_gl_ctx *ctx, const struct wined3d
}
/* Context activation is done by the caller. */
-static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_format *format)
+static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_format_gl *format)
{
/* Check if the default internal format is supported as a frame buffer
* target, otherwise fall back to the render target internal.
@@ -2440,24 +2445,24 @@ static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_for
static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 1.0f};
static const struct wined3d_color half_transparent_red = {1.0f, 0.0f, 0.0f, 0.5f};
const struct wined3d_gl_info *gl_info = ctx->gl_info;
- GLenum status, rt_internal = format->rtInternal;
+ GLenum status, rt_internal = format->rt_internal;
GLuint object, color_rb;
enum wined3d_gl_resource_type type;
BOOL fallback_fmt_used = FALSE, regular_fmt_used = FALSE;
gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
- for (type = 0; type < ARRAY_SIZE(format->flags); ++type)
+ for (type = 0; type < ARRAY_SIZE(format->f.flags); ++type)
{
const char *type_string = "color";
if (type == WINED3D_GL_RES_TYPE_BUFFER)
continue;
- create_and_bind_fbo_attachment(gl_info, format->flags[type], type, &object, format->glInternal,
- format->glFormat, format->glType);
+ create_and_bind_fbo_attachment(gl_info, format->f.flags[type], type,
+ &object, format->internal, format->format, format->type);
- if (format->flags[type] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
+ if (format->f.flags[type] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
{
gl_info->fbo_ops.glGenRenderbuffers(1, &color_rb);
gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, color_rb);
@@ -2478,39 +2483,39 @@ static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_for
if (status == GL_FRAMEBUFFER_COMPLETE)
{
TRACE("Format %s is supported as FBO %s attachment, type %u.\n",
- debug_d3dformat(format->id), type_string, type);
- format->flags[type] |= WINED3DFMT_FLAG_FBO_ATTACHABLE;
- format->rtInternal = format->glInternal;
+ debug_d3dformat(format->f.id), type_string, type);
+ format->f.flags[type] |= WINED3DFMT_FLAG_FBO_ATTACHABLE;
+ format->rt_internal = format->internal;
regular_fmt_used = TRUE;
}
else
{
if (!rt_internal)
{
- if (format->flags[type] & WINED3DFMT_FLAG_RENDERTARGET)
+ if (format->f.flags[type] & WINED3DFMT_FLAG_RENDERTARGET)
{
WARN("Format %s with rendertarget flag is not supported as FBO color attachment (type %u),"
- " and no fallback specified.\n", debug_d3dformat(format->id), type);
- format->flags[type] &= ~WINED3DFMT_FLAG_RENDERTARGET;
+ " and no fallback specified.\n", debug_d3dformat(format->f.id), type);
+ format->f.flags[type] &= ~WINED3DFMT_FLAG_RENDERTARGET;
}
else
{
TRACE("Format %s is not supported as FBO %s attachment, type %u.\n",
- debug_d3dformat(format->id), type_string, type);
+ debug_d3dformat(format->f.id), type_string, type);
}
- format->rtInternal = format->glInternal;
+ format->rt_internal = format->internal;
}
else
{
TRACE("Format %s is not supported as FBO %s attachment (type %u),"
" trying rtInternal format as fallback.\n",
- debug_d3dformat(format->id), type_string, type);
+ debug_d3dformat(format->f.id), type_string, type);
while (gl_info->gl_ops.gl.p_glGetError());
delete_fbo_attachment(gl_info, type, object);
- create_and_bind_fbo_attachment(gl_info, format->flags[type], type, &object, format->rtInternal,
- format->glFormat, format->glType);
+ create_and_bind_fbo_attachment(gl_info, format->f.flags[type], type,
+ &object, format->rt_internal, format->format, format->type);
status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER);
checkGLcall("Framebuffer format check");
@@ -2518,25 +2523,25 @@ static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_for
if (status == GL_FRAMEBUFFER_COMPLETE)
{
TRACE("Format %s rtInternal format is supported as FBO %s attachment, type %u.\n",
- debug_d3dformat(format->id), type_string, type);
+ debug_d3dformat(format->f.id), type_string, type);
fallback_fmt_used = TRUE;
}
else
{
WARN("Format %s rtInternal format is not supported as FBO %s attachment, type %u.\n",
- debug_d3dformat(format->id), type_string, type);
- format->flags[type] &= ~WINED3DFMT_FLAG_RENDERTARGET;
+ debug_d3dformat(format->f.id), type_string, type);
+ format->f.flags[type] &= ~WINED3DFMT_FLAG_RENDERTARGET;
}
}
}
if (status == GL_FRAMEBUFFER_COMPLETE
- && ((format->flags[type] & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)
+ && ((format->f.flags[type] & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)
|| !(gl_info->quirks & WINED3D_QUIRK_LIMITED_TEX_FILTERING))
- && !(format->flags[type] & WINED3DFMT_FLAG_INTEGER)
- && format->id != WINED3DFMT_NULL && format->id != WINED3DFMT_P8_UINT
- && format->glFormat != GL_LUMINANCE && format->glFormat != GL_LUMINANCE_ALPHA
- && (format->red_size || format->alpha_size))
+ && !(format->f.flags[type] & WINED3DFMT_FLAG_INTEGER)
+ && format->f.id != WINED3DFMT_NULL && format->f.id != WINED3DFMT_P8_UINT
+ && format->format != GL_LUMINANCE && format->format != GL_LUMINANCE_ALPHA
+ && (format->f.red_size || format->f.alpha_size))
{
DWORD readback[16 * 16 * 16], color, r_range, a_range;
BYTE r, a;
@@ -2564,8 +2569,8 @@ static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_for
{
while (gl_info->gl_ops.gl.p_glGetError());
TRACE("Format %s doesn't support post-pixelshader blending, type %u.\n",
- debug_d3dformat(format->id), type);
- format->flags[type] &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
+ debug_d3dformat(format->f.id), type);
+ format->f.flags[type] &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
}
else
{
@@ -2628,25 +2633,25 @@ static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_for
a = color >> 24;
r = (color & 0x00ff0000u) >> 16;
- r_range = format->red_size < 8 ? 1u << (8 - format->red_size) : 1;
- a_range = format->alpha_size < 8 ? 1u << (8 - format->alpha_size) : 1;
- if (format->red_size && (r < 0x7f - r_range || r > 0x7f + r_range))
+ r_range = format->f.red_size < 8 ? 1u << (8 - format->f.red_size) : 1;
+ a_range = format->f.alpha_size < 8 ? 1u << (8 - format->f.alpha_size) : 1;
+ if (format->f.red_size && (r < 0x7f - r_range || r > 0x7f + r_range))
match = FALSE;
- else if (format->alpha_size > 1 && (a < 0xbf - a_range || a > 0xbf + a_range))
+ else if (format->f.alpha_size > 1 && (a < 0xbf - a_range || a > 0xbf + a_range))
match = FALSE;
if (!match)
{
TRACE("Format %s doesn't support post-pixelshader blending, type %u.\n",
- debug_d3dformat(format->id), type);
+ debug_d3dformat(format->f.id), type);
TRACE("Color output: %#x\n", color);
- format->flags[type] &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
+ format->f.flags[type] &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
}
else
{
TRACE("Format %s supports post-pixelshader blending, type %u.\n",
- debug_d3dformat(format->id), type);
+ debug_d3dformat(format->f.id), type);
TRACE("Color output: %#x\n", color);
- format->flags[type] |= WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
+ format->f.flags[type] |= WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
}
}
@@ -2660,11 +2665,11 @@ static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_for
}
}
- if (format->glInternal != format->glGammaInternal)
+ if (format->internal != format->srgb_internal)
{
delete_fbo_attachment(gl_info, type, object);
- create_and_bind_fbo_attachment(gl_info, format->flags[type], type, &object, format->glGammaInternal,
- format->glFormat, format->glType);
+ create_and_bind_fbo_attachment(gl_info, format->f.flags[type], type, &object, format->srgb_internal,
+ format->format, format->type);
status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER);
checkGLcall("Framebuffer format check");
@@ -2672,22 +2677,22 @@ static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_for
if (status == GL_FRAMEBUFFER_COMPLETE)
{
TRACE("Format %s's sRGB format is FBO attachable, type %u.\n",
- debug_d3dformat(format->id), type);
- format->flags[type] |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB;
+ debug_d3dformat(format->f.id), type);
+ format->f.flags[type] |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB;
if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
- format->glInternal = format->glGammaInternal;
+ format->internal = format->srgb_internal;
}
else
{
WARN("Format %s's sRGB format is not FBO attachable, type %u.\n",
- debug_d3dformat(format->id), type);
- format_clear_flag(format, WINED3DFMT_FLAG_SRGB_WRITE);
+ debug_d3dformat(format->f.id), type);
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_SRGB_WRITE);
}
}
else if (status == GL_FRAMEBUFFER_COMPLETE)
- format->flags[type] |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB;
+ format->f.flags[type] |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB;
- if (format->flags[type] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
+ if (format->f.flags[type] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
{
gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0);
gl_info->fbo_ops.glDeleteRenderbuffers(1, &color_rb);
@@ -2700,30 +2705,30 @@ static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_for
if (fallback_fmt_used && regular_fmt_used)
{
FIXME("Format %s needs different render target formats for different resource types.\n",
- debug_d3dformat(format->id));
- format_clear_flag(format, WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_FBO_ATTACHABLE
+ debug_d3dformat(format->f.id));
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_FBO_ATTACHABLE
| WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING);
}
}
-static void query_format_flag(struct wined3d_gl_info *gl_info, struct wined3d_format *format,
+static void query_format_flag(struct wined3d_gl_info *gl_info, struct wined3d_format_gl *format,
GLint internal, GLenum pname, DWORD flag, const char *string)
{
GLint value;
enum wined3d_gl_resource_type type;
- for (type = 0; type < ARRAY_SIZE(format->flags); ++type)
+ for (type = 0; type < ARRAY_SIZE(format->f.flags); ++type)
{
gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type), internal, pname, 1, &value);
if (value == GL_FULL_SUPPORT)
{
- TRACE("Format %s supports %s, resource type %u.\n", debug_d3dformat(format->id), string, type);
- format->flags[type] |= flag;
+ TRACE("Format %s supports %s, resource type %u.\n", debug_d3dformat(format->f.id), string, type);
+ format->f.flags[type] |= flag;
}
else
{
- TRACE("Format %s doesn't support %s, resource type %u.\n", debug_d3dformat(format->id), string, type);
- format->flags[type] &= ~flag;
+ TRACE("Format %s doesn't support %s, resource type %u.\n", debug_d3dformat(format->f.id), string, type);
+ format->f.flags[type] &= ~flag;
}
}
}
@@ -2740,56 +2745,56 @@ static void init_format_fbo_compat_info(const struct wined3d_adapter *adapter,
{
for (i = 0; i < WINED3D_FORMAT_COUNT; ++i)
{
- struct wined3d_format *format = get_format_by_idx(adapter, i);
+ struct wined3d_format_gl *format = get_format_gl_by_idx(adapter, i);
BOOL fallback_fmt_used = FALSE, regular_fmt_used = FALSE;
- GLenum rt_internal = format->rtInternal;
+ GLenum rt_internal = format->rt_internal;
GLint value;
- if (!format->glInternal)
+ if (!format->internal)
continue;
- for (type = 0; type < ARRAY_SIZE(format->flags); ++type)
+ for (type = 0; type < ARRAY_SIZE(format->f.flags); ++type)
{
gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type),
- format->glInternal, GL_FRAMEBUFFER_RENDERABLE, 1, &value);
+ format->internal, GL_FRAMEBUFFER_RENDERABLE, 1, &value);
if (value == GL_FULL_SUPPORT)
{
TRACE("Format %s is supported as FBO color attachment, resource type %u.\n",
- debug_d3dformat(format->id), type);
- format->flags[type] |= WINED3DFMT_FLAG_FBO_ATTACHABLE;
- format->rtInternal = format->glInternal;
+ debug_d3dformat(format->f.id), type);
+ format->f.flags[type] |= WINED3DFMT_FLAG_FBO_ATTACHABLE;
+ format->rt_internal = format->internal;
regular_fmt_used = TRUE;
gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type),
- format->glInternal, GL_FRAMEBUFFER_BLEND, 1, &value);
+ format->internal, GL_FRAMEBUFFER_BLEND, 1, &value);
if (value == GL_FULL_SUPPORT)
{
TRACE("Format %s supports post-pixelshader blending, resource type %u.\n",
- debug_d3dformat(format->id), type);
- format->flags[type] |= WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
+ debug_d3dformat(format->f.id), type);
+ format->f.flags[type] |= WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
}
else
{
TRACE("Format %s doesn't support post-pixelshader blending, resource typed %u.\n",
- debug_d3dformat(format->id), type);
- format->flags[type] &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
+ debug_d3dformat(format->f.id), type);
+ format->f.flags[type] &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
}
}
else
{
if (!rt_internal)
{
- if (format->flags[type] & WINED3DFMT_FLAG_RENDERTARGET)
+ if (format->f.flags[type] & WINED3DFMT_FLAG_RENDERTARGET)
{
WARN("Format %s with rendertarget flag is not supported as FBO color attachment"
" and no fallback specified, resource type %u.\n",
- debug_d3dformat(format->id), type);
- format->flags[type] &= ~WINED3DFMT_FLAG_RENDERTARGET;
+ debug_d3dformat(format->f.id), type);
+ format->f.flags[type] &= ~WINED3DFMT_FLAG_RENDERTARGET;
}
else
TRACE("Format %s is not supported as FBO color attachment,"
- " resource type %u.\n", debug_d3dformat(format->id), type);
- format->rtInternal = format->glInternal;
+ " resource type %u.\n", debug_d3dformat(format->f.id), type);
+ format->rt_internal = format->internal;
}
else
{
@@ -2798,46 +2803,46 @@ static void init_format_fbo_compat_info(const struct wined3d_adapter *adapter,
if (value == GL_FULL_SUPPORT)
{
TRACE("Format %s rtInternal format is supported as FBO color attachment,"
- " resource type %u.\n", debug_d3dformat(format->id), type);
+ " resource type %u.\n", debug_d3dformat(format->f.id), type);
fallback_fmt_used = TRUE;
}
else
{
WARN("Format %s rtInternal format is not supported as FBO color attachment,"
- " resource type %u.\n", debug_d3dformat(format->id), type);
- format->flags[type] &= ~WINED3DFMT_FLAG_RENDERTARGET;
+ " resource type %u.\n", debug_d3dformat(format->f.id), type);
+ format->f.flags[type] &= ~WINED3DFMT_FLAG_RENDERTARGET;
}
}
}
- if (format->glInternal != format->glGammaInternal)
+ if (format->internal != format->srgb_internal)
{
gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type),
- format->glGammaInternal, GL_FRAMEBUFFER_RENDERABLE, 1, &value);
+ format->srgb_internal, GL_FRAMEBUFFER_RENDERABLE, 1, &value);
if (value == GL_FULL_SUPPORT)
{
TRACE("Format %s's sRGB format is FBO attachable, resource type %u.\n",
- debug_d3dformat(format->id), type);
- format->flags[type] |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB;
+ debug_d3dformat(format->f.id), type);
+ format->f.flags[type] |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB;
if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
- format->glInternal = format->glGammaInternal;
+ format->internal = format->srgb_internal;
}
else
{
WARN("Format %s's sRGB format is not FBO attachable, resource type %u.\n",
- debug_d3dformat(format->id), type);
- format_clear_flag(format, WINED3DFMT_FLAG_SRGB_WRITE);
+ debug_d3dformat(format->f.id), type);
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_SRGB_WRITE);
}
}
- else if (format->flags[type] & WINED3DFMT_FLAG_FBO_ATTACHABLE)
- format->flags[type] |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB;
+ else if (format->f.flags[type] & WINED3DFMT_FLAG_FBO_ATTACHABLE)
+ format->f.flags[type] |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB;
}
if (fallback_fmt_used && regular_fmt_used)
{
FIXME("Format %s needs different render target formats for different resource types.\n",
- debug_d3dformat(format->id));
- format_clear_flag(format, WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_FBO_ATTACHABLE
+ debug_d3dformat(format->f.id));
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_FBO_ATTACHABLE
| WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING);
}
}
@@ -2854,25 +2859,26 @@ static void init_format_fbo_compat_info(const struct wined3d_adapter *adapter,
for (i = 0; i < WINED3D_FORMAT_COUNT; ++i)
{
- struct wined3d_format *format = get_format_by_idx(adapter, i);
+ struct wined3d_format_gl *format = get_format_gl_by_idx(adapter, i);
- if (!format->glInternal) continue;
+ if (!format->internal)
+ continue;
- if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED)
+ if (format->f.flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED)
{
TRACE("Skipping format %s because it's a compressed format.\n",
- debug_d3dformat(format->id));
+ debug_d3dformat(format->f.id));
continue;
}
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
{
- TRACE("Checking if format %s is supported as FBO color attachment...\n", debug_d3dformat(format->id));
+ TRACE("Checking if format %s is supported as FBO color attachment...\n", debug_d3dformat(format->f.id));
check_fbo_compat(ctx, format);
}
else
{
- format->rtInternal = format->glInternal;
+ format->rt_internal = format->internal;
}
}
@@ -2995,9 +3001,9 @@ static void query_view_class(struct wined3d_format_gl *format)
{
GLenum internal_view_class, gamma_view_class, rt_view_class;
- internal_view_class = lookup_gl_view_class(format->f.glInternal);
- gamma_view_class = lookup_gl_view_class(format->f.glGammaInternal);
- rt_view_class = lookup_gl_view_class(format->f.rtInternal);
+ internal_view_class = lookup_gl_view_class(format->internal);
+ gamma_view_class = lookup_gl_view_class(format->srgb_internal);
+ rt_view_class = lookup_gl_view_class(format->rt_internal);
if (internal_view_class == gamma_view_class || gamma_view_class == rt_view_class)
{
@@ -3012,7 +3018,7 @@ static void query_view_class(struct wined3d_format_gl *format)
}
static void query_internal_format(struct wined3d_adapter *adapter,
- struct wined3d_format *format, const struct wined3d_format_texture_info *texture_info,
+ struct wined3d_format_gl *format, const struct wined3d_format_texture_info *texture_info,
struct wined3d_gl_info *gl_info, BOOL srgb_write_supported, BOOL srgb_format)
{
GLint count, multisample_types[8];
@@ -3021,105 +3027,106 @@ static void query_internal_format(struct wined3d_adapter *adapter,
if (gl_info->supported[ARB_INTERNALFORMAT_QUERY2])
{
- query_format_flag(gl_info, format, format->glInternal, GL_VERTEX_TEXTURE,
+ query_format_flag(gl_info, format, format->internal, GL_VERTEX_TEXTURE,
WINED3DFMT_FLAG_VTF, "vertex texture usage");
- query_format_flag(gl_info, format, format->glInternal, GL_FILTER,
+ query_format_flag(gl_info, format, format->internal, GL_FILTER,
WINED3DFMT_FLAG_FILTERING, "filtering");
- if (srgb_format || format->glGammaInternal != format->glInternal)
+ if (srgb_format || format->srgb_internal != format->internal)
{
- query_format_flag(gl_info, format, format->glGammaInternal, GL_SRGB_READ,
+ query_format_flag(gl_info, format, format->srgb_internal, GL_SRGB_READ,
WINED3DFMT_FLAG_SRGB_READ, "sRGB read");
if (srgb_write_supported)
- query_format_flag(gl_info, format, format->glGammaInternal, GL_SRGB_WRITE,
+ query_format_flag(gl_info, format, format->srgb_internal, GL_SRGB_WRITE,
WINED3DFMT_FLAG_SRGB_WRITE, "sRGB write");
else
- format_clear_flag(format, WINED3DFMT_FLAG_SRGB_WRITE);
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_SRGB_WRITE);
- if (!(format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & (WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE)))
- format->glGammaInternal = format->glInternal;
+ if (!(format->f.flags[WINED3D_GL_RES_TYPE_TEX_2D]
+ & (WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE)))
+ format->srgb_internal = format->internal;
else if (wined3d_settings.offscreen_rendering_mode != ORM_FBO
&& gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
- format->glInternal = format->glGammaInternal;
+ format->internal = format->srgb_internal;
}
}
else
{
if (!gl_info->limits.samplers[WINED3D_SHADER_TYPE_VERTEX])
- format_clear_flag(format, WINED3DFMT_FLAG_VTF);
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_VTF);
if (!(gl_info->quirks & WINED3D_QUIRK_LIMITED_TEX_FILTERING))
- format_set_flag(format, WINED3DFMT_FLAG_FILTERING);
- else if (format->id != WINED3DFMT_R32G32B32A32_FLOAT && format->id != WINED3DFMT_R32_FLOAT)
- format_clear_flag(format, WINED3DFMT_FLAG_VTF);
+ format_set_flag(&format->f, WINED3DFMT_FLAG_FILTERING);
+ else if (format->f.id != WINED3DFMT_R32G32B32A32_FLOAT && format->f.id != WINED3DFMT_R32_FLOAT)
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_VTF);
- if (srgb_format || format->glGammaInternal != format->glInternal)
+ if (srgb_format || format->srgb_internal != format->internal)
{
/* Filter sRGB capabilities if EXT_texture_sRGB is not supported. */
if (!gl_info->supported[EXT_TEXTURE_SRGB])
{
- format->glGammaInternal = format->glInternal;
- format_clear_flag(format, WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE);
+ format->srgb_internal = format->internal;
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE);
}
else if (wined3d_settings.offscreen_rendering_mode != ORM_FBO
&& gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
{
- format->glInternal = format->glGammaInternal;
+ format->internal = format->srgb_internal;
}
}
- if ((format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_SRGB_WRITE) && !srgb_write_supported)
- format_clear_flag(format, WINED3DFMT_FLAG_SRGB_WRITE);
+ if ((format->f.flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_SRGB_WRITE) && !srgb_write_supported)
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_SRGB_WRITE);
if (!gl_info->supported[ARB_DEPTH_TEXTURE]
&& texture_info->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
{
- format->flags[WINED3D_GL_RES_TYPE_TEX_1D] &= ~WINED3DFMT_FLAG_TEXTURE;
- format->flags[WINED3D_GL_RES_TYPE_TEX_2D] &= ~WINED3DFMT_FLAG_TEXTURE;
- format->flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
- format->flags[WINED3D_GL_RES_TYPE_TEX_CUBE] &= ~WINED3DFMT_FLAG_TEXTURE;
- format->flags[WINED3D_GL_RES_TYPE_TEX_RECT] &= ~WINED3DFMT_FLAG_TEXTURE;
+ format->f.flags[WINED3D_GL_RES_TYPE_TEX_1D] &= ~WINED3DFMT_FLAG_TEXTURE;
+ format->f.flags[WINED3D_GL_RES_TYPE_TEX_2D] &= ~WINED3DFMT_FLAG_TEXTURE;
+ format->f.flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
+ format->f.flags[WINED3D_GL_RES_TYPE_TEX_CUBE] &= ~WINED3DFMT_FLAG_TEXTURE;
+ format->f.flags[WINED3D_GL_RES_TYPE_TEX_RECT] &= ~WINED3DFMT_FLAG_TEXTURE;
}
}
- query_view_class(wined3d_format_gl_mutable(format));
+ query_view_class(format);
- if (format->glInternal && format->flags[WINED3D_GL_RES_TYPE_RB]
+ if (format->internal && format->f.flags[WINED3D_GL_RES_TYPE_RB]
& (WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
{
if (gl_info->supported[ARB_INTERNALFORMAT_QUERY])
{
target = gl_info->supported[ARB_TEXTURE_MULTISAMPLE] ? GL_TEXTURE_2D_MULTISAMPLE : GL_RENDERBUFFER;
count = 0;
- GL_EXTCALL(glGetInternalformativ(target, format->glInternal,
+ GL_EXTCALL(glGetInternalformativ(target, format->internal,
GL_NUM_SAMPLE_COUNTS, 1, &count));
if (count > ARRAY_SIZE(multisample_types))
FIXME("Unexpectedly high number of multisample types %d.\n", count);
count = min(count, ARRAY_SIZE(multisample_types));
- GL_EXTCALL(glGetInternalformativ(target, format->glInternal,
+ GL_EXTCALL(glGetInternalformativ(target, format->internal,
GL_SAMPLES, count, multisample_types));
checkGLcall("query sample counts");
for (i = 0; i < count; ++i)
{
- if (multisample_types[i] > sizeof(format->multisample_types) * CHAR_BIT)
+ if (multisample_types[i] > sizeof(format->f.multisample_types) * CHAR_BIT)
continue;
- format->multisample_types |= 1u << (multisample_types[i] - 1);
+ format->f.multisample_types |= 1u << (multisample_types[i] - 1);
}
}
else
{
max_log2 = wined3d_log2i(min(gl_info->limits.samples,
- sizeof(format->multisample_types) * CHAR_BIT));
+ sizeof(format->f.multisample_types) * CHAR_BIT));
for (i = 1; i <= max_log2; ++i)
- format->multisample_types |= 1u << ((1u << i) - 1);
+ format->f.multisample_types |= 1u << ((1u << i) - 1);
}
}
}
static BOOL init_format_texture_info(struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
{
- struct wined3d_format *format, *srgb_format;
+ struct wined3d_format_gl *format, *srgb_format;
struct fragment_caps fragment_caps;
struct shader_caps shader_caps;
unsigned int i, j;
@@ -3132,7 +3139,7 @@ static BOOL init_format_texture_info(struct wined3d_adapter *adapter, struct win
for (i = 0; i < ARRAY_SIZE(format_texture_info); ++i)
{
- if (!(format = get_format_internal(adapter, format_texture_info[i].id)))
+ if (!(format = get_format_gl_internal(adapter, format_texture_info[i].id)))
return FALSE;
if (!gl_info->supported[format_texture_info[i].extension])
@@ -3141,62 +3148,62 @@ static BOOL init_format_texture_info(struct wined3d_adapter *adapter, struct win
/* ARB_texture_rg defines floating point formats, but only if
* ARB_texture_float is also supported. */
if (!gl_info->supported[ARB_TEXTURE_FLOAT]
- && (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_FLOAT))
+ && (format->f.flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_FLOAT))
continue;
/* ARB_texture_rg defines integer formats if EXT_texture_integer is also supported. */
if (!gl_info->supported[EXT_TEXTURE_INTEGER]
- && (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_INTEGER))
+ && (format->f.flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_INTEGER))
continue;
- format->glInternal = format_texture_info[i].gl_internal;
- format->glGammaInternal = format_texture_info[i].gl_srgb_internal;
- format->rtInternal = format_texture_info[i].gl_rt_internal;
- format->glFormat = format_texture_info[i].gl_format;
- format->glType = format_texture_info[i].gl_type;
- format->color_fixup = COLOR_FIXUP_IDENTITY;
- format->height_scale.numerator = 1;
- format->height_scale.denominator = 1;
+ format->internal = format_texture_info[i].gl_internal;
+ format->srgb_internal = format_texture_info[i].gl_srgb_internal;
+ format->rt_internal = format_texture_info[i].gl_rt_internal;
+ format->format = format_texture_info[i].gl_format;
+ format->type = format_texture_info[i].gl_type;
+ format->f.color_fixup = COLOR_FIXUP_IDENTITY;
+ format->f.height_scale.numerator = 1;
+ format->f.height_scale.denominator = 1;
- format->flags[WINED3D_GL_RES_TYPE_TEX_1D] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
- format->flags[WINED3D_GL_RES_TYPE_TEX_2D] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
- format->flags[WINED3D_GL_RES_TYPE_BUFFER] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
+ format->f.flags[WINED3D_GL_RES_TYPE_TEX_1D] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
+ format->f.flags[WINED3D_GL_RES_TYPE_TEX_2D] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
+ format->f.flags[WINED3D_GL_RES_TYPE_BUFFER] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
/* GL_ARB_depth_texture does not support 3D textures. It also says "cube textures are
* problematic", but doesn't explicitly mandate that an error is generated. */
if (gl_info->supported[EXT_TEXTURE3D]
&& !(format_texture_info[i].flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)))
- format->flags[WINED3D_GL_RES_TYPE_TEX_3D] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
+ format->f.flags[WINED3D_GL_RES_TYPE_TEX_3D] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
- format->flags[WINED3D_GL_RES_TYPE_TEX_CUBE] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
+ format->f.flags[WINED3D_GL_RES_TYPE_TEX_CUBE] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
- format->flags[WINED3D_GL_RES_TYPE_TEX_RECT] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
+ format->f.flags[WINED3D_GL_RES_TYPE_TEX_RECT] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
- format->flags[WINED3D_GL_RES_TYPE_RB] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
- format->flags[WINED3D_GL_RES_TYPE_RB] &= ~WINED3DFMT_FLAG_TEXTURE;
+ format->f.flags[WINED3D_GL_RES_TYPE_RB] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
+ format->f.flags[WINED3D_GL_RES_TYPE_RB] &= ~WINED3DFMT_FLAG_TEXTURE;
- if (format->glGammaInternal != format->glInternal
+ if (format->srgb_internal != format->internal
&& !(adapter->d3d_info.wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL))
{
- format->glGammaInternal = format->glInternal;
- format_clear_flag(format, WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE);
+ format->srgb_internal = format->internal;
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE);
}
query_internal_format(adapter, format, &format_texture_info[i], gl_info, srgb_write, FALSE);
/* Texture conversion stuff */
- format->conv_byte_count = format_texture_info[i].conv_byte_count;
- format->upload = format_texture_info[i].upload;
- format->download = format_texture_info[i].download;
+ format->f.conv_byte_count = format_texture_info[i].conv_byte_count;
+ format->f.upload = format_texture_info[i].upload;
+ format->f.download = format_texture_info[i].download;
srgb_format = NULL;
for (j = 0; j < ARRAY_SIZE(format_srgb_info); ++j)
{
- if (format_srgb_info[j].base_format_id == format->id)
+ if (format_srgb_info[j].base_format_id == format->f.id)
{
- if (!(srgb_format = get_format_internal(adapter, format_srgb_info[j].srgb_format_id)))
+ if (!(srgb_format = get_format_gl_internal(adapter, format_srgb_info[j].srgb_format_id)))
return FALSE;
break;
}
@@ -3204,14 +3211,14 @@ static BOOL init_format_texture_info(struct wined3d_adapter *adapter, struct win
if (!srgb_format)
continue;
- copy_format(adapter, srgb_format, format);
+ copy_format(adapter, &srgb_format->f, &format->f);
if (gl_info->supported[EXT_TEXTURE_SRGB]
&& !(adapter->d3d_info.wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL))
{
- srgb_format->glInternal = format_texture_info[i].gl_srgb_internal;
- srgb_format->glGammaInternal = format_texture_info[i].gl_srgb_internal;
- format_set_flag(srgb_format, WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE);
+ srgb_format->internal = format_texture_info[i].gl_srgb_internal;
+ srgb_format->srgb_internal = format_texture_info[i].gl_srgb_internal;
+ format_set_flag(&srgb_format->f, WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE);
query_internal_format(adapter, srgb_format, &format_texture_info[i], gl_info, srgb_write, TRUE);
}
}
@@ -3335,7 +3342,7 @@ static void init_format_filter_info(struct wined3d_adapter *adapter,
struct wined3d_gl_info *gl_info)
{
enum wined3d_pci_vendor vendor = adapter->driver_info.vendor;
- struct wined3d_format *format;
+ struct wined3d_format_gl *format;
unsigned int i;
static const enum wined3d_format_id fmts16[] =
{
@@ -3373,8 +3380,8 @@ static void init_format_filter_info(struct wined3d_adapter *adapter,
{
for (i = 0; i < ARRAY_SIZE(fmts16); ++i)
{
- format = get_format_internal(adapter, fmts16[i]);
- format_set_flag(format, WINED3DFMT_FLAG_FILTERING);
+ format = get_format_gl_internal(adapter, fmts16[i]);
+ format_set_flag(&format->f, WINED3DFMT_FLAG_FILTERING);
}
}
return;
@@ -3382,19 +3389,19 @@ static void init_format_filter_info(struct wined3d_adapter *adapter,
for (i = 0; i < ARRAY_SIZE(fmts16); ++i)
{
- format = get_format_internal(adapter, fmts16[i]);
- if (!format->glInternal)
+ format = get_format_gl_internal(adapter, fmts16[i]);
+ if (!format->internal)
continue; /* Not supported by GL */
- filtered = check_filter(gl_info, format->glInternal);
+ filtered = check_filter(gl_info, format->internal);
if (filtered)
{
- TRACE("Format %s supports filtering.\n", debug_d3dformat(format->id));
- format_set_flag(format, WINED3DFMT_FLAG_FILTERING);
+ TRACE("Format %s supports filtering.\n", debug_d3dformat(format->f.id));
+ format_set_flag(&format->f, WINED3DFMT_FLAG_FILTERING);
}
else
{
- TRACE("Format %s does not support filtering.\n", debug_d3dformat(format->id));
+ TRACE("Format %s does not support filtering.\n", debug_d3dformat(format->f.id));
}
}
}
@@ -3455,7 +3462,7 @@ static struct color_fixup_desc create_color_fixup_desc_from_string(const char *s
static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
{
const struct wined3d_d3d_info *d3d_info = &adapter->d3d_info;
- struct wined3d_format *format;
+ struct wined3d_format_gl *format;
BOOL use_legacy_fixups;
unsigned int i;
@@ -3527,79 +3534,79 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_
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);
+ format = get_format_gl_internal(adapter, fixups[i].id);
+ format->f.color_fixup = create_color_fixup_desc_from_string(fixups[i].fixup);
}
if (!gl_info->supported[APPLE_YCBCR_422] && (gl_info->supported[ARB_FRAGMENT_PROGRAM]
|| (gl_info->supported[ARB_FRAGMENT_SHADER] && gl_info->supported[ARB_VERTEX_SHADER])))
{
- format = get_format_internal(adapter, WINED3DFMT_YUY2);
- format->color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_YUY2);
+ format = get_format_gl_internal(adapter, WINED3DFMT_YUY2);
+ format->f.color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_YUY2);
- format = get_format_internal(adapter, WINED3DFMT_UYVY);
- format->color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_UYVY);
+ format = get_format_gl_internal(adapter, WINED3DFMT_UYVY);
+ format->f.color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_UYVY);
}
else if (!gl_info->supported[APPLE_YCBCR_422] && (!gl_info->supported[ARB_FRAGMENT_PROGRAM]
&& (!gl_info->supported[ARB_FRAGMENT_SHADER] || !gl_info->supported[ARB_VERTEX_SHADER])))
{
- format = get_format_internal(adapter, WINED3DFMT_YUY2);
- format_clear_flag(format, WINED3DFMT_FLAG_BLIT);
- format->glInternal = 0;
+ format = get_format_gl_internal(adapter, WINED3DFMT_YUY2);
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_BLIT);
+ format->internal = 0;
- format = get_format_internal(adapter, WINED3DFMT_UYVY);
- format_clear_flag(format, WINED3DFMT_FLAG_BLIT);
- format->glInternal = 0;
+ format = get_format_gl_internal(adapter, WINED3DFMT_UYVY);
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_BLIT);
+ format->internal = 0;
}
if (gl_info->supported[ARB_FRAGMENT_PROGRAM]
|| (gl_info->supported[ARB_FRAGMENT_SHADER] && gl_info->supported[ARB_VERTEX_SHADER]))
{
- format = get_format_internal(adapter, WINED3DFMT_YV12);
- format_set_flag(format, WINED3DFMT_FLAG_HEIGHT_SCALE);
- format->height_scale.numerator = 3;
- format->height_scale.denominator = 2;
- format->color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_YV12);
+ format = get_format_gl_internal(adapter, WINED3DFMT_YV12);
+ format_set_flag(&format->f, WINED3DFMT_FLAG_HEIGHT_SCALE);
+ format->f.height_scale.numerator = 3;
+ format->f.height_scale.denominator = 2;
+ format->f.color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_YV12);
- format = get_format_internal(adapter, WINED3DFMT_NV12);
- format_set_flag(format, WINED3DFMT_FLAG_HEIGHT_SCALE);
- format->height_scale.numerator = 3;
- format->height_scale.denominator = 2;
- format->color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_NV12);
+ format = get_format_gl_internal(adapter, WINED3DFMT_NV12);
+ format_set_flag(&format->f, WINED3DFMT_FLAG_HEIGHT_SCALE);
+ format->f.height_scale.numerator = 3;
+ format->f.height_scale.denominator = 2;
+ format->f.color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_NV12);
}
else
{
- format = get_format_internal(adapter, WINED3DFMT_YV12);
- format_clear_flag(format, WINED3DFMT_FLAG_BLIT);
- format->glInternal = 0;
+ format = get_format_gl_internal(adapter, WINED3DFMT_YV12);
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_BLIT);
+ format->internal = 0;
- format = get_format_internal(adapter, WINED3DFMT_NV12);
- format_clear_flag(format, WINED3DFMT_FLAG_BLIT);
- format->glInternal = 0;
+ format = get_format_gl_internal(adapter, WINED3DFMT_NV12);
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_BLIT);
+ format->internal = 0;
}
if (gl_info->supported[ARB_FRAGMENT_PROGRAM] || gl_info->supported[ARB_FRAGMENT_SHADER])
{
- format = get_format_internal(adapter, WINED3DFMT_P8_UINT);
- format->color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_P8);
+ format = get_format_gl_internal(adapter, WINED3DFMT_P8_UINT);
+ format->f.color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_P8);
}
if (!gl_info->supported[ARB_HALF_FLOAT_PIXEL])
{
- format = get_format_internal(adapter, WINED3DFMT_R16_FLOAT);
- format_clear_flag(format, WINED3DFMT_FLAG_TEXTURE);
+ format = get_format_gl_internal(adapter, WINED3DFMT_R16_FLOAT);
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_TEXTURE);
- format = get_format_internal(adapter, WINED3DFMT_R16G16_FLOAT);
- format_clear_flag(format, WINED3DFMT_FLAG_TEXTURE);
+ format = get_format_gl_internal(adapter, WINED3DFMT_R16G16_FLOAT);
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_TEXTURE);
- format = get_format_internal(adapter, WINED3DFMT_R16G16B16A16_FLOAT);
- format_clear_flag(format, WINED3DFMT_FLAG_TEXTURE);
+ format = get_format_gl_internal(adapter, WINED3DFMT_R16G16B16A16_FLOAT);
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_TEXTURE);
}
if (gl_info->quirks & WINED3D_QUIRK_BROKEN_RGBA16)
{
- format = get_format_internal(adapter, WINED3DFMT_R16G16B16A16_UNORM);
- format_clear_flag(format, WINED3DFMT_FLAG_TEXTURE);
+ format = get_format_gl_internal(adapter, WINED3DFMT_R16G16B16A16_UNORM);
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_TEXTURE);
}
/* ATI instancing hack: Although ATI cards do not support Shader Model
@@ -3617,8 +3624,8 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_
/* FIXME: This should just check the shader backend caps. */
if (gl_info->supported[ARB_VERTEX_PROGRAM] || gl_info->supported[ARB_VERTEX_SHADER])
{
- format = get_format_internal(adapter, WINED3DFMT_INST);
- format_set_flag(format, WINED3DFMT_FLAG_TEXTURE);
+ format = get_format_gl_internal(adapter, WINED3DFMT_INST);
+ format_set_flag(&format->f, WINED3DFMT_FLAG_TEXTURE);
}
/* Depth bound test. To query if the card supports it CheckDeviceFormat()
@@ -3629,8 +3636,8 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_
* value. */
if (gl_info->supported[EXT_DEPTH_BOUNDS_TEST])
{
- format = get_format_internal(adapter, WINED3DFMT_NVDB);
- format_set_flag(format, WINED3DFMT_FLAG_TEXTURE);
+ format = get_format_gl_internal(adapter, WINED3DFMT_NVDB);
+ format_set_flag(&format->f, WINED3DFMT_FLAG_TEXTURE);
}
/* RESZ aka AMD DX9-level hack for multisampled depth buffer resolve. You query for RESZ
@@ -3638,27 +3645,27 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_
* RENDERTARGET usage. */
if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT])
{
- format = get_format_internal(adapter, WINED3DFMT_RESZ);
- format_set_flag(format, WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_RENDERTARGET);
+ format = get_format_gl_internal(adapter, WINED3DFMT_RESZ);
+ format_set_flag(&format->f, WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_RENDERTARGET);
}
for (i = 0; i < WINED3D_FORMAT_COUNT; ++i)
{
- struct wined3d_format *format = get_format_by_idx(adapter, i);
+ format = get_format_gl_by_idx(adapter, i);
- if (!(format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_TEXTURE))
+ if (!(format->f.flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_TEXTURE))
continue;
- if (is_identity_fixup(format->color_fixup))
+ if (is_identity_fixup(format->f.color_fixup))
continue;
TRACE("Checking support for fixup:\n");
- dump_color_fixup_desc(format->color_fixup);
- if (!adapter->shader_backend->shader_color_fixup_supported(format->color_fixup)
- || !adapter->fragment_pipe->color_fixup_supported(format->color_fixup))
+ dump_color_fixup_desc(format->f.color_fixup);
+ if (!adapter->shader_backend->shader_color_fixup_supported(format->f.color_fixup)
+ || !adapter->fragment_pipe->color_fixup_supported(format->f.color_fixup))
{
TRACE("[FAILED]\n");
- format_clear_flag(format, WINED3DFMT_FLAG_TEXTURE);
+ format_clear_flag(&format->f, WINED3DFMT_FLAG_TEXTURE);
}
else
{
@@ -3668,18 +3675,18 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_
/* These formats are not supported for 3D textures. See also
* WINED3DFMT_FLAG_DECOMPRESS. */
- format = get_format_internal(adapter, WINED3DFMT_ATI1N);
- format->flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
- format = get_format_internal(adapter, WINED3DFMT_ATI2N);
- format->flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
- format = get_format_internal(adapter, WINED3DFMT_BC4_UNORM);
- format->flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
- format = get_format_internal(adapter, WINED3DFMT_BC4_SNORM);
- format->flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
- format = get_format_internal(adapter, WINED3DFMT_BC5_UNORM);
- format->flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
- format = get_format_internal(adapter, WINED3DFMT_BC5_SNORM);
- format->flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
+ format = get_format_gl_internal(adapter, WINED3DFMT_ATI1N);
+ format->f.flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
+ format = get_format_gl_internal(adapter, WINED3DFMT_ATI2N);
+ format->f.flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
+ format = get_format_gl_internal(adapter, WINED3DFMT_BC4_UNORM);
+ format->f.flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
+ format = get_format_gl_internal(adapter, WINED3DFMT_BC4_SNORM);
+ format->f.flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
+ format = get_format_gl_internal(adapter, WINED3DFMT_BC5_UNORM);
+ format->f.flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
+ format = get_format_gl_internal(adapter, WINED3DFMT_BC5_SNORM);
+ format->f.flags[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3DFMT_FLAG_TEXTURE;
}
static BOOL init_format_vertex_info(const struct wined3d_adapter *adapter,
@@ -3936,22 +3943,22 @@ static void init_format_depth_bias_scale(struct wined3d_adapter *adapter,
for (i = 0; i < WINED3D_FORMAT_COUNT; ++i)
{
- struct wined3d_format *format = get_format_by_idx(adapter, i);
+ struct wined3d_format_gl *format = get_format_gl_by_idx(adapter, i);
- if (format->flags[WINED3D_GL_RES_TYPE_RB] & WINED3DFMT_FLAG_DEPTH)
+ if (format->f.flags[WINED3D_GL_RES_TYPE_RB] & WINED3DFMT_FLAG_DEPTH)
{
- TRACE("Testing depth bias scale for format %s.\n", debug_d3dformat(format->id));
- format->depth_bias_scale = wined3d_adapter_find_polyoffset_scale(ctx, format->glInternal);
+ TRACE("Testing depth bias scale for format %s.\n", debug_d3dformat(format->f.id));
+ format->f.depth_bias_scale = wined3d_adapter_find_polyoffset_scale(ctx, format->internal);
if (!(d3d_info->wined3d_creation_flags & WINED3D_NORMALIZED_DEPTH_BIAS))
{
/* The single-precision binary floating-point format has
* a significand precision of 24 bits.
*/
- if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_FLOAT)
- format->depth_bias_scale /= 1u << 24;
+ if (format->f.flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_FLOAT)
+ format->f.depth_bias_scale /= 1u << 24;
else
- format->depth_bias_scale /= 1u << format->depth_size;
+ format->f.depth_bias_scale /= 1u << format->f.depth_size;
}
}
}
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index dedb9fc8047..ff284684089 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -169,11 +169,13 @@ static void create_texture_view(struct wined3d_gl_view *view, GLenum view_target
const struct wined3d_view_desc *desc, struct wined3d_texture *texture,
const struct wined3d_format *view_format)
{
+ const struct wined3d_format_gl *view_format_gl;
unsigned int level_idx, layer_idx, layer_count;
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
GLuint texture_name;
+ view_format_gl = wined3d_format_gl(view_format);
view->target = view_target;
context = context_acquire(texture->resource.device, NULL, 0);
@@ -201,11 +203,11 @@ static void create_texture_view(struct wined3d_gl_view *view, GLenum view_target
}
gl_info->gl_ops.gl.p_glGenTextures(1, &view->name);
- GL_EXTCALL(glTextureView(view->name, view->target, texture_name, view_format->glInternal,
+ GL_EXTCALL(glTextureView(view->name, view->target, texture_name, view_format_gl->internal,
level_idx, desc->u.texture.level_count, layer_idx, layer_count));
checkGLcall("create texture view");
- if (is_stencil_view_format(view_format))
+ if (is_stencil_view_format(&view_format_gl->f))
{
static const GLint swizzle[] = {GL_ZERO, GL_RED, GL_ZERO, GL_ZERO};
@@ -233,6 +235,7 @@ static void create_buffer_texture(struct wined3d_gl_view *view, struct wined3d_c
unsigned int offset, unsigned int size)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
+ const struct wined3d_format_gl *view_format_gl;
if (!gl_info->supported[ARB_TEXTURE_BUFFER_OBJECT])
{
@@ -247,6 +250,7 @@ static void create_buffer_texture(struct wined3d_gl_view *view, struct wined3d_c
return;
}
+ view_format_gl = wined3d_format_gl(view_format);
wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER);
view->target = GL_TEXTURE_BUFFER;
@@ -255,14 +259,14 @@ static void create_buffer_texture(struct wined3d_gl_view *view, struct wined3d_c
context_bind_texture(context, GL_TEXTURE_BUFFER, view->name);
if (gl_info->supported[ARB_TEXTURE_BUFFER_RANGE])
{
- GL_EXTCALL(glTexBufferRange(GL_TEXTURE_BUFFER, view_format->glInternal,
+ GL_EXTCALL(glTexBufferRange(GL_TEXTURE_BUFFER, view_format_gl->internal,
buffer->buffer_object, offset, size));
}
else
{
if (offset || size != buffer->resource.size)
FIXME("OpenGL implementation does not support ARB_texture_buffer_range.\n");
- GL_EXTCALL(glTexBuffer(GL_TEXTURE_BUFFER, view_format->glInternal, buffer->buffer_object));
+ GL_EXTCALL(glTexBuffer(GL_TEXTURE_BUFFER, view_format_gl->internal, buffer->buffer_object));
}
checkGLcall("Create buffer texture");
@@ -1006,7 +1010,7 @@ void wined3d_unordered_access_view_clear_uint(struct wined3d_unordered_access_vi
const struct wined3d_uvec4 *clear_value, struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
- const struct wined3d_format *format;
+ const struct wined3d_format_gl *format;
struct wined3d_resource *resource;
struct wined3d_buffer *buffer;
unsigned int offset, size;
@@ -1024,12 +1028,12 @@ void wined3d_unordered_access_view_clear_uint(struct wined3d_unordered_access_vi
return;
}
- format = view->format;
- if (format->id != WINED3DFMT_R32_UINT && format->id != WINED3DFMT_R32_SINT
- && format->id != WINED3DFMT_R32G32B32A32_UINT
- && format->id != WINED3DFMT_R32G32B32A32_SINT)
+ format = wined3d_format_gl(view->format);
+ if (format->f.id != WINED3DFMT_R32_UINT && format->f.id != WINED3DFMT_R32_SINT
+ && format->f.id != WINED3DFMT_R32G32B32A32_UINT
+ && format->f.id != WINED3DFMT_R32G32B32A32_SINT)
{
- FIXME("Not implemented for format %s.\n", debug_d3dformat(format->id));
+ FIXME("Not implemented for format %s.\n", debug_d3dformat(format->f.id));
return;
}
@@ -1037,10 +1041,10 @@ void wined3d_unordered_access_view_clear_uint(struct wined3d_unordered_access_vi
wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER);
wined3d_unordered_access_view_invalidate_location(view, ~WINED3D_LOCATION_BUFFER);
- get_buffer_view_range(buffer, &view->desc, format, &offset, &size);
+ get_buffer_view_range(buffer, &view->desc, &format->f, &offset, &size);
context_bind_bo(context, buffer->buffer_type_hint, buffer->buffer_object);
- GL_EXTCALL(glClearBufferSubData(buffer->buffer_type_hint, format->glInternal,
- offset, size, format->glFormat, format->glType, clear_value));
+ GL_EXTCALL(glClearBufferSubData(buffer->buffer_type_hint, format->internal,
+ offset, size, format->format, format->type, clear_value));
checkGLcall("clear unordered access view");
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index cec2cfff330..4c5d73f677e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -4339,11 +4339,6 @@ struct wined3d_format
enum wined3d_ffp_emit_idx emit_idx;
- GLint glInternal;
- GLint glGammaInternal;
- GLint rtInternal;
- GLint glFormat;
- GLint glType;
UINT conv_byte_count;
DWORD multisample_types;
unsigned int flags[WINED3D_GL_RES_TYPE_COUNT];
@@ -4387,6 +4382,12 @@ struct wined3d_format_gl
GLenum vtx_type;
GLint vtx_format;
+ GLint internal;
+ GLint srgb_internal;
+ GLint rt_internal;
+ GLint format;
+ GLint type;
+
GLenum view_class;
};
--
2.11.0
1
0
To indicate whether a particular format can be used for "off-screen plain"
surfaces.
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/directx.c | 40 +++-------------------------
dlls/wined3d/utils.c | 59 +++++++++++++++++++++++++++++++++++++-----
dlls/wined3d/wined3d_private.h | 2 ++
3 files changed, 58 insertions(+), 43 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 89684477e68..02ca3f6f04b 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -1474,41 +1474,9 @@ static BOOL CheckRenderTargetCapability(const struct wined3d_adapter *adapter,
return FALSE;
}
-static BOOL wined3d_check_surface_capability(const struct wined3d_format *format, BOOL no3d)
+static BOOL wined3d_check_surface_capability(const struct wined3d_format *format)
{
- if (no3d)
- {
- switch (format->id)
- {
- case WINED3DFMT_B8G8R8_UNORM:
- TRACE("[FAILED] - Not enumerated on Windows.\n");
- return FALSE;
- case WINED3DFMT_B8G8R8A8_UNORM:
- case WINED3DFMT_B8G8R8X8_UNORM:
- case WINED3DFMT_B5G6R5_UNORM:
- case WINED3DFMT_B5G5R5X1_UNORM:
- case WINED3DFMT_B5G5R5A1_UNORM:
- case WINED3DFMT_B4G4R4A4_UNORM:
- case WINED3DFMT_B2G3R3_UNORM:
- case WINED3DFMT_A8_UNORM:
- case WINED3DFMT_B2G3R3A8_UNORM:
- case WINED3DFMT_B4G4R4X4_UNORM:
- case WINED3DFMT_R10G10B10A2_UNORM:
- case WINED3DFMT_R8G8B8A8_UNORM:
- case WINED3DFMT_R8G8B8X8_UNORM:
- case WINED3DFMT_R16G16_UNORM:
- case WINED3DFMT_B10G10R10A2_UNORM:
- case WINED3DFMT_R16G16B16A16_UNORM:
- case WINED3DFMT_P8_UINT:
- TRACE("[OK]\n");
- return TRUE;
- default:
- TRACE("[FAILED] - Not available on GDI surfaces.\n");
- return FALSE;
- }
- }
-
- if (format->glInternal)
+ if ((format->flags[WINED3D_GL_RES_TYPE_TEX_2D] | format->flags[WINED3D_GL_RES_TYPE_RB]) & WINED3DFMT_FLAG_BLIT)
{
TRACE("[OK]\n");
return TRUE;
@@ -1589,7 +1557,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
allowed_usage |= WINED3DUSAGE_QUERY_SRGBWRITE;
if (!(usage & WINED3DUSAGE_TEXTURE))
{
- if (!wined3d_check_surface_capability(format, wined3d->flags & WINED3D_NO3D))
+ if (!wined3d_check_surface_capability(format))
{
TRACE("[FAILED] - Not supported for plain surfaces.\n");
return WINED3DERR_NOTAVAILABLE;
@@ -2490,7 +2458,7 @@ static BOOL wined3d_adapter_no3d_init(struct wined3d_adapter *adapter)
adapter->vram_bytes_used = 0;
TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter->vram_bytes));
- if (!wined3d_adapter_init_format_info(adapter, sizeof(struct wined3d_format)))
+ if (!wined3d_adapter_no3d_init_format_info(adapter))
return FALSE;
adapter->vertex_pipe = &none_vertex_pipe;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 8e9b6dfafd6..36694856081 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -3158,23 +3158,23 @@ static BOOL init_format_texture_info(struct wined3d_adapter *adapter, struct win
format->height_scale.numerator = 1;
format->height_scale.denominator = 1;
- format->flags[WINED3D_GL_RES_TYPE_TEX_1D] |= format_texture_info[i].flags;
- format->flags[WINED3D_GL_RES_TYPE_TEX_2D] |= format_texture_info[i].flags;
- format->flags[WINED3D_GL_RES_TYPE_BUFFER] |= format_texture_info[i].flags;
+ format->flags[WINED3D_GL_RES_TYPE_TEX_1D] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
+ format->flags[WINED3D_GL_RES_TYPE_TEX_2D] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
+ format->flags[WINED3D_GL_RES_TYPE_BUFFER] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
/* GL_ARB_depth_texture does not support 3D textures. It also says "cube textures are
* problematic", but doesn't explicitly mandate that an error is generated. */
if (gl_info->supported[EXT_TEXTURE3D]
&& !(format_texture_info[i].flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)))
- format->flags[WINED3D_GL_RES_TYPE_TEX_3D] |= format_texture_info[i].flags;
+ format->flags[WINED3D_GL_RES_TYPE_TEX_3D] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
- format->flags[WINED3D_GL_RES_TYPE_TEX_CUBE] |= format_texture_info[i].flags;
+ format->flags[WINED3D_GL_RES_TYPE_TEX_CUBE] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
- format->flags[WINED3D_GL_RES_TYPE_TEX_RECT] |= format_texture_info[i].flags;
+ format->flags[WINED3D_GL_RES_TYPE_TEX_RECT] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
- format->flags[WINED3D_GL_RES_TYPE_RB] |= format_texture_info[i].flags;
+ format->flags[WINED3D_GL_RES_TYPE_RB] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
format->flags[WINED3D_GL_RES_TYPE_RB] &= ~WINED3DFMT_FLAG_TEXTURE;
if (format->glGammaInternal != format->glInternal
@@ -3544,9 +3544,11 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_
&& (!gl_info->supported[ARB_FRAGMENT_SHADER] || !gl_info->supported[ARB_VERTEX_SHADER])))
{
format = get_format_internal(adapter, WINED3DFMT_YUY2);
+ format_clear_flag(format, WINED3DFMT_FLAG_BLIT);
format->glInternal = 0;
format = get_format_internal(adapter, WINED3DFMT_UYVY);
+ format_clear_flag(format, WINED3DFMT_FLAG_BLIT);
format->glInternal = 0;
}
@@ -3568,9 +3570,11 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_
else
{
format = get_format_internal(adapter, WINED3DFMT_YV12);
+ format_clear_flag(format, WINED3DFMT_FLAG_BLIT);
format->glInternal = 0;
format = get_format_internal(adapter, WINED3DFMT_NV12);
+ format_clear_flag(format, WINED3DFMT_FLAG_BLIT);
format->glInternal = 0;
}
@@ -3979,6 +3983,47 @@ fail:
return FALSE;
}
+BOOL wined3d_adapter_no3d_init_format_info(struct wined3d_adapter *adapter)
+{
+ struct wined3d_format *format;
+ unsigned int i;
+
+ static const enum wined3d_format_id blit_formats[] =
+ {
+ WINED3DFMT_B8G8R8A8_UNORM,
+ WINED3DFMT_B8G8R8X8_UNORM,
+ WINED3DFMT_B5G6R5_UNORM,
+ WINED3DFMT_B5G5R5X1_UNORM,
+ WINED3DFMT_B5G5R5A1_UNORM,
+ WINED3DFMT_B4G4R4A4_UNORM,
+ WINED3DFMT_B2G3R3_UNORM,
+ WINED3DFMT_A8_UNORM,
+ WINED3DFMT_B2G3R3A8_UNORM,
+ WINED3DFMT_B4G4R4X4_UNORM,
+ WINED3DFMT_R10G10B10A2_UNORM,
+ WINED3DFMT_R8G8B8A8_UNORM,
+ WINED3DFMT_R8G8B8X8_UNORM,
+ WINED3DFMT_R16G16_UNORM,
+ WINED3DFMT_B10G10R10A2_UNORM,
+ WINED3DFMT_R16G16B16A16_UNORM,
+ WINED3DFMT_P8_UINT,
+ };
+
+ if (!wined3d_adapter_init_format_info(adapter, sizeof(struct wined3d_format)))
+ return FALSE;
+
+ for (i = 0; i < ARRAY_SIZE(blit_formats); ++i)
+ {
+ if (!(format = get_format_internal(adapter, blit_formats[i])))
+ return FALSE;
+
+ format->flags[WINED3D_GL_RES_TYPE_TEX_2D] |= WINED3DFMT_FLAG_BLIT;
+ format->flags[WINED3D_GL_RES_TYPE_RB] |= WINED3DFMT_FLAG_BLIT;
+ }
+
+ return TRUE;
+}
+
/* Context activation is done by the caller. */
BOOL wined3d_adapter_gl_init_format_info(struct wined3d_adapter *adapter, struct wined3d_caps_gl_ctx *ctx)
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index cb2f44212c4..cec2cfff330 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2695,6 +2695,7 @@ struct wined3d_caps_gl_ctx
BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter, size_t format_size) DECLSPEC_HIDDEN;
BOOL wined3d_adapter_gl_init_format_info(struct wined3d_adapter *adapter,
struct wined3d_caps_gl_ctx *ctx) DECLSPEC_HIDDEN;
+BOOL wined3d_adapter_no3d_init_format_info(struct wined3d_adapter *adapter) DECLSPEC_HIDDEN;
UINT64 adapter_adjust_memory(struct wined3d_adapter *adapter, INT64 amount) DECLSPEC_HIDDEN;
BOOL wined3d_caps_gl_ctx_test_viewport_subpixel_bits(struct wined3d_caps_gl_ctx *ctx) DECLSPEC_HIDDEN;
@@ -4299,6 +4300,7 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
#define WINED3DFMT_FLAG_GEN_MIPMAP 0x00400000
#define WINED3DFMT_FLAG_NORMALISED 0x00800000
#define WINED3DFMT_FLAG_VERTEX_ATTRIBUTE 0x01000000
+#define WINED3DFMT_FLAG_BLIT 0x02000000
struct wined3d_rational
{
--
2.11.0
1
0
[PATCH 3/5] wined3d: Accept "renderer" in addition to "DirectDrawRenderer".
by Henri Verbeet 21 Sep '18
by Henri Verbeet 21 Sep '18
21 Sep '18
Even though the "gdi" renderer is mainly used for ddraw, wined3d itself has no
knowledge of ddraw.
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/wined3d_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index f8a84a17adb..3537a4884fe 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -307,7 +307,8 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
TRACE("Limiting PS shader model to %u.\n", wined3d_settings.max_sm_ps);
if (!get_config_key_dword(hkey, appkey, "MaxShaderModelCS", &wined3d_settings.max_sm_cs))
TRACE("Limiting CS shader model to %u.\n", wined3d_settings.max_sm_cs);
- if (!get_config_key(hkey, appkey, "DirectDrawRenderer", buffer, size)
+ if ((!get_config_key(hkey, appkey, "renderer", buffer, size)
+ || !get_config_key(hkey, appkey, "DirectDrawRenderer", buffer, size))
&& !strcmp(buffer, "gdi"))
{
TRACE("Disabling 3D support.\n");
--
2.11.0
1
0
[PATCH 1/5] d3d8/tests: Properly check whether creating a device succeeded in test_flip().
by Henri Verbeet 21 Sep '18
by Henri Verbeet 21 Sep '18
21 Sep '18
Perhaps CreateDevice() should clear the pointer on failure, but that's not
documented behaviour, and Wine currently doesn't.
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/d3d8/tests/visual.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index 24481bd0533..e8e6bf870e2 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -8154,9 +8154,8 @@ static void test_flip(void)
present_parameters.Windowed = TRUE;
present_parameters.BackBufferCount = 3;
present_parameters.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
- hr = IDirect3D8_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
- window, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device);
- if (!device)
+ if (FAILED(hr = IDirect3D8_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ window, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D8_Release(d3d);
--
2.11.0
1
0
21 Sep '18
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/dbghelp/dwarf.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index 31c008a..26e2f42 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -568,7 +568,7 @@ static void dwarf2_fill_attr(const dwarf2_parse_context_t* ctx,
case DW_FORM_string:
attr->u.string = (const char *)data;
- TRACE("string<%s>\n", attr->u.string);
+ TRACE("string<%s>\n", debugstr_a(attr->u.string));
break;
case DW_FORM_strp:
@@ -576,7 +576,7 @@ static void dwarf2_fill_attr(const dwarf2_parse_context_t* ctx,
unsigned long offset = dwarf2_get_u4(data);
attr->u.string = (const char*)ctx->sections[section_string].address + offset;
}
- TRACE("strp<%s>\n", attr->u.string);
+ TRACE("strp<%s>\n", debugstr_a(attr->u.string));
break;
case DW_FORM_block:
@@ -1613,7 +1613,7 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm,
struct attribute ext;
TRACE("found parameter %s (kind=%d, offset=%ld, reg=%d) at %s\n",
- name.u.string, loc.kind, loc.offset, loc.reg,
+ debugstr_a(name.u.string), loc.kind, loc.offset, loc.reg,
dwarf2_debug_ctx(subpgm->ctx));
switch (loc.kind)
@@ -1648,8 +1648,8 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm,
else if (dwarf2_find_attribute(subpgm->ctx, di, DW_AT_const_value, &value))
{
VARIANT v;
- if (subpgm->func) WARN("Unsupported constant %s in function\n", name.u.string);
- if (is_pmt) FIXME("Unsupported constant (parameter) %s in function\n", name.u.string);
+ if (subpgm->func) WARN("Unsupported constant %s in function\n", debugstr_a(name.u.string));
+ if (is_pmt) FIXME("Unsupported constant (parameter) %s in function\n", debugstr_a(name.u.string));
switch (value.form)
{
case DW_FORM_data1:
@@ -1699,7 +1699,7 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm,
default:
FIXME("Unsupported form for const value %s (%lx)\n",
- name.u.string, value.form);
+ debugstr_a(name.u.string), value.form);
v.n1.n2.vt = VT_EMPTY;
}
di->symt = &symt_new_constant(subpgm->ctx->module, subpgm->ctx->compiland,
@@ -1718,7 +1718,7 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm,
}
else
{
- WARN("dropping global variable %s which has been optimized away\n", name.u.string);
+ WARN("dropping global variable %s which has been optimized away\n", debugstr_a(name.u.string));
}
}
if (is_pmt && subpgm->func && subpgm->func->type)
@@ -1933,7 +1933,7 @@ static struct symt* dwarf2_parse_subprogram(dwarf2_parse_context_t* ctx,
}
if (!dwarf2_read_range(ctx, di, &low_pc, &high_pc))
{
- WARN("cannot get range for %s\n", name.u.string);
+ WARN("cannot get range for %s\n", debugstr_a(name.u.string));
return NULL;
}
/* As functions (defined as inline assembly) get debug info with dwarf
@@ -2173,7 +2173,7 @@ static void dwarf2_set_line_number(struct module* module, unsigned long address,
if (!file || !(psrc = vector_at(v, file - 1))) return;
TRACE("%s %lx %s %u\n",
- debugstr_w(module->module.ModuleName), address, source_get(module, *psrc), line);
+ debugstr_w(module->module.ModuleName), address, debugstr_a(source_get(module, *psrc)), line);
if (!(symt = symt_find_nearest(module, address)) ||
symt->symt.tag != SymTagFunction) return;
func = (struct symt_function*)symt;
@@ -2234,7 +2234,7 @@ static BOOL dwarf2_parse_line_numbers(const dwarf2_section_t* sections,
{
const char* rel = (const char*)traverse.data;
unsigned rellen = strlen(rel);
- TRACE("Got include %s\n", rel);
+ TRACE("Got include %s\n", debugstr_a(rel));
traverse.data += rellen + 1;
p = vector_add(&dirs, &ctx->pool);
@@ -2268,7 +2268,7 @@ static BOOL dwarf2_parse_line_numbers(const dwarf2_section_t* sections,
mod_time = dwarf2_leb128_as_unsigned(&traverse);
length = dwarf2_leb128_as_unsigned(&traverse);
dir = *(const char**)vector_at(&dirs, dir_index);
- TRACE("Got file %s/%s (%u,%lu)\n", dir, name, mod_time, length);
+ TRACE("Got file %s/%s (%u,%lu)\n", debugstr_a(dir), debugstr_a(name), mod_time, length);
psrc = vector_add(&files, &ctx->pool);
*psrc = source_new(ctx->module, dir, name);
}
@@ -2339,7 +2339,7 @@ static BOOL dwarf2_parse_line_numbers(const dwarf2_section_t* sections,
address = ctx->load_offset + dwarf2_parse_addr(&traverse);
break;
case DW_LNE_define_file:
- FIXME("not handled define file %s\n", traverse.data);
+ FIXME("not handled define file %s\n", debugstr_a((char *)traverse.data));
traverse.data += strlen((const char *)traverse.data) + 1;
dwarf2_leb128_as_unsigned(&traverse);
dwarf2_leb128_as_unsigned(&traverse);
@@ -2522,7 +2522,7 @@ static enum location_error loc_compute_frame(struct process* pcs,
*frame = *pframe;
break;
case loc_dwarf2_location_list:
- WARN("Searching loclist for %s\n", func->hash_elt.name);
+ WARN("Searching loclist for %s\n", debugstr_a(func->hash_elt.name));
if (!dwarf2_lookup_loclist(modfmt,
modfmt->u.dwarf2_info->debug_loc.address + pframe->offset,
ip, &lctx))
@@ -2668,7 +2668,7 @@ static BOOL parse_cie_details(dwarf2_traverse_context_t* ctx, struct frame_info*
info->state.cfa_rule = RULE_CFA_OFFSET;
end = NULL;
- TRACE("\tparsing augmentation %s\n", augmentation);
+ TRACE("\tparsing augmentation %s\n", debugstr_a(augmentation));
if (*augmentation) do
{
switch (*augmentation)
@@ -3325,7 +3325,7 @@ static void dwarf2_location_compute(struct process* pcs,
if (!func->container || func->container->tag != SymTagCompiland)
{
- WARN("We'd expect function %s's container to exist and be a compiland\n", func->hash_elt.name);
+ WARN("We'd expect function %s's container to exist and be a compiland\n", debugstr_a(func->hash_elt.name));
err = loc_err_internal;
}
else
@@ -3400,7 +3400,7 @@ static inline BOOL dwarf2_init_zsection(dwarf2_section_t* section,
if (sz <= 12 || memcmp(sect, "ZLIB", 4))
{
- ERR("invalid compressed section %s\n", zsectname);
+ ERR("invalid compressed section %s\n", debugstr_a(zsectname));
goto out;
}
@@ -3425,7 +3425,7 @@ static inline BOOL dwarf2_init_zsection(dwarf2_section_t* section,
res = inflateInit(&z);
if (res != Z_OK)
{
- FIXME("inflateInit failed with %i / %s\n", res, z.msg);
+ FIXME("inflateInit failed with %i / %s\n", res, debugstr_a(z.msg));
goto out_free;
}
@@ -3437,7 +3437,7 @@ static inline BOOL dwarf2_init_zsection(dwarf2_section_t* section,
if (res != Z_STREAM_END)
{
- FIXME("Decompression failed with %i / %s\n", res, z.msg);
+ FIXME("Decompression failed with %i / %s\n", res, debugstr_a(z.msg));
goto out_end;
}
--
2.7.4
1
0
[PATCH 1/4] quartz/filtergraph: Try other output pins if one shouldn't be rendered.
by Zebediah Figura 21 Sep '18
by Zebediah Figura 21 Sep '18
21 Sep '18
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/quartz/filtergraph.c | 3 +--
dlls/quartz/tests/filtergraph.c | 2 --
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c
index 03d4091..8516dbf 100644
--- a/dlls/quartz/filtergraph.c
+++ b/dlls/quartz/filtergraph.c
@@ -1093,8 +1093,7 @@ static HRESULT connect_output_pin(IFilterGraphImpl *graph, IBaseFilter *filter,
{
TRACE("Skipping non-rendered pin %s.\n", debugstr_w(info.achName));
IPin_Release(pin);
- IEnumPins_Release(enumpins);
- return E_FAIL;
+ continue;
}
if (SUCCEEDED(IFilterGraph2_Connect(&graph->IFilterGraph2_iface, pin, sink)))
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index 9ef229f..30bf0cc 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -1783,11 +1783,9 @@ todo_wine
parser1.pin_count = 3;
hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-todo_wine {
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(source_pin.peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
ok(sink_pin.peer == &parser1_pins[2].IPin_iface, "Got peer %p.\n", sink_pin.peer);
-}
IFilterGraph2_Disconnect(graph, source_pin.peer);
IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
IFilterGraph2_Disconnect(graph, sink_pin.peer);
--
2.7.4
2
4
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/msvcp90/misc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/msvcp90/misc.c b/dlls/msvcp90/misc.c
index 0d1a74e250..ef0212958f 100644
--- a/dlls/msvcp90/misc.c
+++ b/dlls/msvcp90/misc.c
@@ -618,7 +618,7 @@ unsigned int __cdecl _Random_device(void)
#endif
#if _MSVCP_VER >= 110
-#if defined(__i386__) && !defined(__arm__)
+#if defined(__i386__)
extern void *call_thiscall_func;
__ASM_GLOBAL_FUNC(call_thiscall_func,
--
2.18.0
3
2