- This assumes FETCH4 is already supported by wine And checks for ARB_texture_gather support before exposing DF24
Signed-off-by: Daniel Ansorregui mailszeros@gmail.com --- dlls/wined3d/directx.c | 6 ++++++ dlls/wined3d/utils.c | 30 ++++++++++++++++++++++++++++++ include/wine/wined3d.h | 2 ++ 3 files changed, 38 insertions(+)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 75622be80c..be0c514a78 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1723,6 +1723,12 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad return WINED3DOK_NOMIPGEN; }
+ if ((check_format_id == WINED3DFMT_DF24) && !adapter->gl_info.supported[ARB_TEXTURE_GATHER]) + { + TRACE("No Support for Fetch4 disabling DF24 support.\n"); + return WINED3DERR_NOTAVAILABLE; + } + return WINED3D_OK; }
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 24e08df377..02667870cb 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -65,6 +65,8 @@ format_index_remap[] = {WINED3DFMT_R16, WINED3D_FORMAT_FOURCC_BASE + 20}, {WINED3DFMT_AL16, WINED3D_FORMAT_FOURCC_BASE + 21}, {WINED3DFMT_NV12, WINED3D_FORMAT_FOURCC_BASE + 22}, + {WINED3DFMT_DF16, WINED3D_FORMAT_FOURCC_BASE + 23}, + {WINED3DFMT_DF24, WINED3D_FORMAT_FOURCC_BASE + 24}, };
#define WINED3D_FORMAT_COUNT (WINED3D_FORMAT_FOURCC_BASE + ARRAY_SIZE(format_index_remap)) @@ -141,6 +143,8 @@ static const struct wined3d_format_channels formats[] = {WINED3DFMT_NVHU, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, {WINED3DFMT_NVHS, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, {WINED3DFMT_NULL, 8, 8, 8, 8, 0, 8, 16, 24, 4, 0, 0}, + {WINED3DFMT_DF16, 0, 0, 0, 0, 0, 0, 0, 0, 2, 16, 0}, + {WINED3DFMT_DF24, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 0}, /* Unsure about them, could not find a Windows driver that supports them */ {WINED3DFMT_R16, 16, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, {WINED3DFMT_AL16, 0, 0, 0, 16, 0, 0, 0, 16, 4, 0, 0}, @@ -345,6 +349,8 @@ static const struct wined3d_format_base_flags format_base_flags[] = {WINED3DFMT_R16_FLOAT, WINED3DFMT_FLAG_ALLOW_FETCH4}, {WINED3DFMT_R16, WINED3DFMT_FLAG_ALLOW_FETCH4}, {WINED3DFMT_R32_FLOAT, WINED3DFMT_FLAG_ALLOW_FETCH4}, + {WINED3DFMT_DF16, WINED3DFMT_FLAG_ALLOW_FETCH4}, + {WINED3DFMT_DF24, WINED3DFMT_FLAG_ALLOW_FETCH4}, };
static void rgb888_from_rgb565(WORD rgb565, BYTE *r, BYTE *g, BYTE *b) @@ -1893,6 +1899,25 @@ static const struct wined3d_format_texture_info format_texture_info[] = WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL, ARB_FRAMEBUFFER_OBJECT, NULL}, + {WINED3DFMT_DF16, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, 0, + GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0, + WINED3DFMT_FLAG_DEPTH, + WINED3D_GL_EXT_NONE, NULL}, + {WINED3DFMT_DF16, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT16, 0, + GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_DEPTH, + ARB_DEPTH_TEXTURE, NULL}, + {WINED3DFMT_DF24, GL_DEPTH24_STENCIL8_EXT, GL_DEPTH24_STENCIL8_EXT, 0, + GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, 0, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_DEPTH, + EXT_PACKED_DEPTH_STENCIL, NULL}, + {WINED3DFMT_DF24, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, 0, + GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 0, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_DEPTH, + ARB_FRAMEBUFFER_OBJECT, NULL}, {WINED3DFMT_NULL, 0, 0, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 0, WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_FBO_ATTACHABLE, @@ -3534,6 +3559,9 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_ {WINED3DFMT_INTZ, "XXXX", FALSE, WINED3D_GL_EXT_NONE}, {WINED3DFMT_INTZ, "XYZW", FALSE, WINED3D_GL_LEGACY_CONTEXT},
+ {WINED3DFMT_DF16, "X011", FALSE, WINED3D_GL_EXT_NONE}, + {WINED3DFMT_DF24, "X111", FALSE, WINED3D_GL_EXT_NONE}, + {WINED3DFMT_L8_UNORM, "XXX1", FALSE, ARB_TEXTURE_RG}, };
@@ -4388,6 +4416,8 @@ const char *debug_d3dformat(enum wined3d_format_id format_id) FMT_TO_STR(WINED3DFMT_R16); FMT_TO_STR(WINED3DFMT_AL16); FMT_TO_STR(WINED3DFMT_NV12); + FMT_TO_STR(WINED3DFMT_DF16); + FMT_TO_STR(WINED3DFMT_DF24); #undef FMT_TO_STR default: { diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index b0b1abc508..abf103f395 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -271,6 +271,8 @@ enum wined3d_format_id WINED3DFMT_R16 = WINEMAKEFOURCC(' ','R','1','6'), WINED3DFMT_AL16 = WINEMAKEFOURCC('A','L','1','6'), WINED3DFMT_NV12 = WINEMAKEFOURCC('N','V','1','2'), + WINED3DFMT_DF16 = WINEMAKEFOURCC('D','F','1','6'), + WINED3DFMT_DF24 = WINEMAKEFOURCC('D','F','2','4'),
WINED3DFMT_FORCE_DWORD = 0xffffffff };