Commit Graph

70 Commits

Author SHA1 Message Date
Philip Rebohle 6c8042033e
[d3d11] Select memory type based on CPU access flags 2019-03-26 21:17:52 +01:00
Philip Rebohle 97d77fa508
[d3d11] Implement depth-stencil mapping on the immediate context 2019-03-26 18:04:56 +01:00
Philip Rebohle 8194bec1bf
[d3d11] Fix image format mapping when creating mapped buffer 2019-03-26 17:54:43 +01:00
Joshua Ashton 5ea8648cd9 [d3d11, d3d10, dxgi] Handle null ppvObject in QueryInterface. (#909)
When a null ppvObject is passed into a QueryInterface on any IUnknown, a E_POINTER should be returned as the result (and it should not crash.)

This matches native d3d11/d3d10/dxgi behaviour and the documentation found here https://docs.microsoft.com/en-us/windows/desktop/api/unknwn/nf-unknwn-iunknown-queryinterface(q_) for IUnknown.
2019-02-10 08:01:01 +01:00
Philip Rebohle a79409ad02
Revert "[dxvk] Don't put rendering stage/access masks into image info"
This reverts commit ce3642edd0.

We're actually going to need these when optimizing render pass barriers.
2019-01-22 14:52:35 +01:00
Philip Rebohle c804d99db7
[d3d11] Fix log spam in SetEvictionPriority stubs 2019-01-12 15:22:34 +01:00
Philip Rebohle 214891ffc6
[d3d11] Improve error logging when texture creation fails 2019-01-08 10:34:48 +01:00
Chip Davis 6feeb4bbba Only set 2D_ARRAY_COMPATIBLE on 3D textures that will be rendered to.
It is impossible to create a 2D or 2D array SRV or UAV from a 3D
texture. Nor is it possible to create a DSV from a 3D texture.
Therefore, the only time we ever need to create a 2D array view from a
3D texture is when we're going to render to it.
2019-01-02 19:15:23 +01:00
Philip Rebohle ce3642edd0
[dxvk] Don't put rendering stage/access masks into image info
Not needed since these stages and access flags are handled by render
pass transitions.
2018-11-24 00:40:59 +01:00
Philip Rebohle f483bc9633
[d3d11] Add usage flag for meta-pack operations if necessary
- Fix depth-stencil format list
2018-11-08 18:51:43 +01:00
Philip Rebohle 6d18efdfc7
[d3d10] Lock device on context operations
May fix thread safety issues in some games. Apparently, the
D3D10Device is supposed to be thread safe by default.
2018-10-12 18:31:55 +02:00
Philip Rebohle da8274daaf
[d3d11] Don't set meta-resolve usage flags for depth buffers
Depth buffers cannot be resolved in D3D11.
May improve performance on some hardware when MSAA is used.
2018-09-29 14:59:36 +02:00
Philip Rebohle c5f7f9f3b0
[d3d11] Enable usage flags for meta copy formats
This is required in order to make meta copies work between images
that do not have the necessary D3D11 bind flags set, and it may
speed things up because it allows rendering to the destination
image directly rather than requiring a temporary image.
2018-09-27 11:44:09 +02:00
Philip Rebohle 837a3f5787
[d3d11] Don't allow creation of 0x0-sized textures 2018-09-18 21:33:27 +02:00
Philip Rebohle b97f9a702a
[d3d10] Implement D3D10 texture interfaces 2018-08-13 17:22:36 +02:00
Philip Rebohle 9373bab3e3
[d3d11] Validate image view format compatibility correctly
Prevents the application from creating illegal image views.
2018-08-09 23:34:03 +02:00
Philip Rebohle b06eb4fe2a
[d3d11] Validate image view bind flags
Since the bind flags of the texture may not always match the
image usage flags of the underlying Vulkan image, we should
use the latter to check whether a view can be created.
2018-08-09 21:58:58 +02:00
Philip Rebohle 73c91138db
[d3d11] Allow creation of SRGB textures with D3D11_BIND_UNORDERED_ACCESS
Should fix a crash in Call of Duty: Advanced Warfare.
2018-08-09 17:13:35 +02:00
Philip Rebohle 63af141383
[d3d11] Set proper view format list for typed UAVs
Typed UAVs are mutable, but we only need them to be compatible to
their typed format and the bit-compatible integer format used for
clears.
2018-07-03 13:31:22 +02:00
Philip Rebohle cbf4772973
[d3d11] Pass image format family to the backend 2018-07-03 12:44:56 +02:00
Philip Rebohle 4520b1ca8f
[d3d11] Fix usage and access flags for multisampled images
Meta-resolve operations will use the image in a fragment shader.
2018-06-28 16:47:54 +02:00
Philip Rebohle 060cd1d87c
[d3d11] Do not use MUTABLE_FORMAT_BIT for strictly typed formats
This used to cause issues in the past, but apparently we can safely
enable this optimization now. Improves performance slightly on RADV.
2018-06-24 17:01:05 +02:00
Philip Rebohle fb3dbd8bcd
[d3d11] Relaxed view format compatibility check
Fixes regressions in multiple games. MSDN docs regarding
format compatibility are wrong in every way.
2018-05-05 20:16:01 +02:00
Philip Rebohle 8177898151
[d3d11] Validate image view format compatibility
Fixes Vulkan validation errors in Far Cry 5.
2018-05-05 15:13:35 +02:00
Philip Rebohle fb288d8713
[d3d11] Disable VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT for typed formats
Yields over 10% performance improvement on RADV in GPU-bound scenarios.
2018-05-05 00:49:43 +02:00
Philip Rebohle 41fca78d27 [dxgi] Add GetDevice method to IDXGIVkInteropSurface
Convenient way of getting the IDXGIVkInteropDevice from the surface
without having to go through several D3D interface queries.
2018-05-01 23:30:39 +02:00
Philip Rebohle d5041337f5 [d3d11] Use linar tiling for textures if optimal tiling is not supported
Fixes texture creation issues in various Batman games.
2018-04-29 14:43:24 +02:00
Philip Rebohle 1ed1c43431
[d3d11] Wire up D3D11VkInteropSurface to D3D11Texture*D classes 2018-04-20 11:12:54 +02:00
Philip Rebohle 81a0fa4805
[d3d11] Implemented IDXGIVkInteropSurface for common textures 2018-04-20 10:38:39 +02:00
Philip Rebohle 4a0c9dbaba
[d3d11] Validate texture sample count
Fixes incorrect return values in case a game tries to create
a texture with an unsupported number of samples.
2018-04-13 13:46:45 +02:00
Philip Rebohle 8508994a63
[d3d11] Cap mip level count for textures and views
Some games do not compute the number of mip levels of
a texture or texture view correctly, so we should work
around this by capping it to the highest possible value.
2018-04-12 23:42:11 +02:00
Philip Rebohle db541d188f
[dxgi] Added static format mapping table 2018-04-12 17:49:14 +02:00
Philip Rebohle 2973c18055 [dxgi/d3d11] Remove COM_QUERY_INTERFACE macro, reset pointers
May fix some crashes in applications that rely on the returned
pointer being set to nullptr before returning.
2018-04-02 12:52:02 +02:00
Philip Rebohle a8eecfbfe5
[d3d11] Enable direct image mapping by default 2018-03-18 00:36:53 +01:00
Philip Rebohle eb8ae5cc82
[d3d11] Allow 2D array view creation for 3D textures
Fixes a regression that was introduced with the texture
class refactor. Fixes validation issues in Hellblade.
2018-03-14 20:40:11 +01:00
Philip Rebohle 0e0ee61d9b
[d3d11] Always use VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT
We need to investigate why not doing this breaks shadows in Heaven.
2018-03-14 17:40:26 +01:00
Philip Rebohle 3b20c71894
[d3d11] Re-implement direct image mapping (disabled by default)
We cannot enable this by default yet because it may break some games.
2018-03-14 16:40:28 +01:00
Philip Rebohle 155bd32e22
[d3d11] Check if a textue can be created before making the attempt
This may prevent driver crashes and give more useful debugging info
in case a given combination of image parameters is not supported by
a device. May also improve compatibility with direct image mapping.
2018-03-14 16:03:48 +01:00
Philip Rebohle 7a6d61d943
[d3d11] Create mapped image buffer only when needed
Also adds some documentation to D3D11CommonTexture.
2018-03-14 14:49:45 +01:00
Philip Rebohle 0ba3337289
[d3d11] Refactored Map/Unmap methods 2018-03-14 14:40:09 +01:00
Philip Rebohle 91b82c05b2
[d3d11] Refactoring texture classes: Move static methods into D3D11CommonTexture 2018-03-14 01:16:31 +01:00
Philip Rebohle 56df0bcccb
[d3d11] Refactoring texture classes: Remove D3D11TextureInfo 2018-03-14 00:45:07 +01:00
Philip Rebohle 16d66c8a1d
[d3d11] Refactoring texture classes: Introduce D3D11CommonTexture 2018-03-13 23:51:30 +01:00
Philip Rebohle e6814332e7
Revert "[d3d11] Re-enable image mapping"
Still breaks games for unknown reasons.
2018-03-13 17:40:12 +01:00
Philip Rebohle 72f954088b
[d3d11] Use only one mip level for multisampled textures 2018-03-13 11:29:25 +01:00
Philip Rebohle 3e60c8f316
[d3d11] Re-enable image mapping
After more extensive testing, it looks like commit 4eacff21
actually fixed the issue in most (all?) cases.
2018-03-12 12:54:05 +01:00
Mikhail Paulyshka b17568deba [dxgi,d3d11] log unknown interfaces GUID (#154)
* [d3d11] log unknown interfaces GUID in QueryInterface()

* [dxgi] log unknown interfaces GUID in QueryInterface()
2018-03-12 12:05:43 +01:00
Philip Rebohle bbbc552868
[d3d11] Disabled image mapping
Effectively reverts d3e89b20dd as it
breaks games for some reason.
2018-03-11 19:02:02 +01:00
Philip Rebohle 5b9e4c1faa
[d3d11] Fix image tiling
Fixes bug introduced in d3e89b20dd, which
applies linear tiling to the wrong kind of images.
2018-03-11 00:06:44 +01:00
Philip Rebohle d3e89b20dd
[d3d11] Allocate host-readable images on host-visible memory
Not having to wait for an image->buffer copy to finish on the
GPU allows for more efficient synchronization. Significantly
improves performance in The Witcher 3.
2018-03-10 23:32:15 +01:00