Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/utils.c | 6 ++++++ dlls/wined3d/wined3d_private.h | 1 + 2 files changed, 7 insertions(+)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 01a838db897..88175d4bf26 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -2989,6 +2989,8 @@ static void query_internal_format(struct wined3d_adapter *adapter, WINED3DFMT_FLAG_VTF, "vertex texture usage"); query_format_flag(gl_info, format, format->internal, GL_FILTER, WINED3DFMT_FLAG_FILTERING, "filtering"); + query_format_flag(gl_info, format, format->internal, GL_SHADER_IMAGE_STORE, + WINED3DFMT_FLAG_UNORDERED_ACCESS, "unordered access");
if (srgb_format || format->srgb_internal != format->internal) { @@ -4183,6 +4185,10 @@ static void init_vulkan_format_info(struct wined3d_format_vk *format, { flags |= WINED3DFMT_FLAG_FILTERING; } + if (texture_flags & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) + { + flags |= WINED3DFMT_FLAG_UNORDERED_ACCESS; + }
format->f.flags[WINED3D_GL_RES_TYPE_TEX_1D] |= flags; format->f.flags[WINED3D_GL_RES_TYPE_TEX_2D] |= flags; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index abc6e0e57bb..1c783d28bc2 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -5560,6 +5560,7 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN /* WineD3D pixel format flags */ #define WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING 0x00000001 #define WINED3DFMT_FLAG_FILTERING 0x00000002 +#define WINED3DFMT_FLAG_UNORDERED_ACCESS 0x00000004 #define WINED3DFMT_FLAG_DEPTH_STENCIL 0x00000008 #define WINED3DFMT_FLAG_RENDERTARGET 0x00000010 #define WINED3DFMT_FLAG_EXTENSION 0x00000020
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/directx.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index f51aae95507..e7b4bebc703 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1614,7 +1614,8 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, case WINED3D_RTYPE_NONE: allowed_usage = 0; allowed_bind_flags = WINED3D_BIND_RENDER_TARGET - | WINED3D_BIND_DEPTH_STENCIL; + | WINED3D_BIND_DEPTH_STENCIL + | WINED3D_BIND_UNORDERED_ACCESS; gl_type = WINED3D_GL_RES_TYPE_TEX_2D; gl_type_end = WINED3D_GL_RES_TYPE_TEX_3D; break; @@ -1629,7 +1630,8 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, | WINED3DUSAGE_QUERY_SRGBWRITE | WINED3DUSAGE_QUERY_VERTEXTEXTURE | WINED3DUSAGE_QUERY_WRAPANDMIP; - allowed_bind_flags = WINED3D_BIND_SHADER_RESOURCE; + allowed_bind_flags = WINED3D_BIND_SHADER_RESOURCE + | WINED3D_BIND_UNORDERED_ACCESS; gl_type = gl_type_end = WINED3D_GL_RES_TYPE_TEX_1D; break;
@@ -1638,7 +1640,8 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, if (bind_flags & WINED3D_BIND_RENDER_TARGET) allowed_usage |= WINED3DUSAGE_QUERY_SRGBWRITE; allowed_bind_flags = WINED3D_BIND_RENDER_TARGET - | WINED3D_BIND_DEPTH_STENCIL; + | WINED3D_BIND_DEPTH_STENCIL + | WINED3D_BIND_UNORDERED_ACCESS; if (!(bind_flags & WINED3D_BIND_SHADER_RESOURCE)) { if (!wined3d_check_surface_format(format)) @@ -1679,7 +1682,8 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, | WINED3DUSAGE_QUERY_SRGBWRITE | WINED3DUSAGE_QUERY_VERTEXTEXTURE | WINED3DUSAGE_QUERY_WRAPANDMIP; - allowed_bind_flags = WINED3D_BIND_SHADER_RESOURCE; + allowed_bind_flags = WINED3D_BIND_SHADER_RESOURCE + | WINED3D_BIND_UNORDERED_ACCESS; gl_type = gl_type_end = WINED3D_GL_RES_TYPE_TEX_3D; break;
@@ -1709,6 +1713,8 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, format_flags |= WINED3DFMT_FLAG_RENDERTARGET; if (bind_flags & WINED3D_BIND_DEPTH_STENCIL) format_flags |= WINED3DFMT_FLAG_DEPTH_STENCIL; + if (bind_flags & WINED3D_BIND_UNORDERED_ACCESS) + format_flags |= WINED3DFMT_FLAG_UNORDERED_ACCESS; if (usage & WINED3DUSAGE_QUERY_FILTER) format_flags |= WINED3DFMT_FLAG_FILTERING; if (usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) @@ -1750,6 +1756,13 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, return WINED3DERR_NOTAVAILABLE; }
+ if ((bind_flags & WINED3D_BIND_UNORDERED_ACCESS) && wined3d_format_is_typeless(format)) + { + TRACE("Requested WINED3D_BIND_UNORDERED_ACCESS, but format %s is typeless.\n", + debug_d3dformat(check_format_id)); + return WINED3DERR_NOTAVAILABLE; + } + if ((format->flags[gl_type] & format_flags) != format_flags) { TRACE("Requested format flags %#x, but format %s only has %#x.\n",
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- This fixes a rendering error in the game "Space Trucker":
https://globalgamejam.org/2020/games/space-trucker-0
dlls/d3d11/device.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index dd0a67ebc80..2a08d2b1e65 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -3318,6 +3318,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 * {WINED3D_RTYPE_TEXTURE_2D, WINED3D_BIND_SHADER_RESOURCE, WINED3DUSAGE_LEGACY_CUBEMAP, D3D11_FORMAT_SUPPORT_TEXTURECUBE}, {WINED3D_RTYPE_NONE, WINED3D_BIND_RENDER_TARGET, 0, D3D11_FORMAT_SUPPORT_RENDER_TARGET}, {WINED3D_RTYPE_NONE, WINED3D_BIND_DEPTH_STENCIL, 0, D3D11_FORMAT_SUPPORT_DEPTH_STENCIL}, + {WINED3D_RTYPE_NONE, WINED3D_BIND_UNORDERED_ACCESS, 0, D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW}, {WINED3D_RTYPE_TEXTURE_2D, WINED3D_BIND_SHADER_RESOURCE, WINED3DUSAGE_QUERY_WRAPANDMIP, D3D11_FORMAT_SUPPORT_MIP}, {WINED3D_RTYPE_TEXTURE_2D, WINED3D_BIND_SHADER_RESOURCE, WINED3DUSAGE_QUERY_GENMIPMAP, D3D11_FORMAT_SUPPORT_MIP_AUTOGEN}, {WINED3D_RTYPE_NONE, WINED3D_BIND_RENDER_TARGET, WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING, D3D11_FORMAT_SUPPORT_BLENDABLE},
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com