Commit Graph

391 Commits

Author SHA1 Message Date
Joshua Ashton 4291bc9dfb [d3d9] Reupload fixed func ps data if stage constant changes
Closes #1420
2020-02-08 16:33:47 +00:00
Joshua Ashton b9474cf787 [d3d9] Return D3D_OK in CreateTexture even if AUTOGENMIPMAP flag is stripped
D3DOK_NOAUTOGEN is only returned when querying format support, the flag is stripped away silently in CreateTexture if it has to be.

Fixes #1409
2020-02-06 23:48:01 +00:00
Philip Rebohle 88147e19d2 [d3d9] Simplify dirty check for shader constants 2020-02-06 17:58:15 +01:00
Philip Rebohle aa70369671 [d3d9] Store copy of shader metadata in constant set
Reduces pointer chasing when updating shader constants.
2020-02-06 17:58:15 +01:00
Philip Rebohle 06809587e8 [d3d9] Don't arbitrarily set fog scale to 0
The Witcher 1 sets FOGSTART == FOGEND together with LINEAR fog mode, in
which case we previously set fog_scale to 0 and therefore incorrectly
override the pixel color with the fog color.

Fixes #1401.
2020-02-06 17:50:04 +01:00
Joshua Ashton 87dd8f0122 [d3d9] Validate blit regions are in range
Closes #1392
2020-02-04 23:45:32 +00:00
Joshua Ashton 92ee9c7ef1 [d3d9] Error on StretchRect when not D3DPOOL_DEFAULT 2020-02-04 22:37:44 +00:00
Joshua Ashton 3196fbc759 [d3d9] Unbind fragment shader for ProcessVertices
Fixes validation errors and potential UB on some drivers
2020-01-29 21:43:12 +00:00
Joshua Ashton b1edf227f8 [d3d9] Enable depth bounds feature, if supported
Only expose it in format checks if the adapter supports the feature also
2020-01-28 01:51:04 +00:00
Joshua Ashton 720cdf383e [d3d9] Use spec constants for bool constants 2020-01-27 14:21:21 +01:00
Joshua Ashton a43223256e [d3d9] Fix GetTextureStageState using unmapped types
Closes #1378
2020-01-27 01:07:11 +00:00
Joshua Ashton 9b486515fa [d3d9] Allow StretchRect BC -> BC format without stretch 2020-01-25 00:31:45 +00:00
Philip Rebohle 5d2215e898 [d3d9] Don't try to blit to compressed images
Fixes Vulkan validation errors and potential driver crashes in
Dragon Age Origins.
2020-01-24 22:59:26 +00:00
Joshua Ashton 13792df4c5 [d3d9] Don't mark D3DUSAGE_AUTOGENMIPMAP as renderable
We can't access those mips via locking in D3D9 so it's a-okay! :)
2020-01-24 15:54:15 +00:00
Joshua Ashton f804c6364d [d3d9] Implement d3d9.allowDoNotWait 2020-01-24 15:54:15 +00:00
Joshua Ashton 764cb5634f [d3d9] Unmark resources as dirty if they get discarded 2020-01-24 15:54:15 +00:00
Joshua Ashton 6fa28bf937 [d3d9] Don't block on GetRenderTargetData
Fixes perf in #1363
2020-01-24 15:54:15 +00:00
Joshua Ashton 7d0ddc4b3b [d3d9] Remap texture stage state types onto our own enum
Fits us nicely into a dword for captures while not exclusing D3DTSS_CONSTANT
2020-01-23 02:05:09 +00:00
Philip Rebohle 296aacb23e [d3d9] Return specific image view from GetSampleView
Lets us have pick the sRGB-ness of the view in one place. Needed
for the next patch.
2020-01-17 17:47:08 +01:00
Philip Rebohle 905d69e77b [d3d9] Don't pass format mapping to D3D9CommonTexture
Instead, infer it from the format. This is basically being done
already, however the mapping we pass in is not correct if the
image format is Unknown.
2020-01-17 17:47:08 +01:00
Joshua Ashton e5df573292 [d3d9] Add AreFormatsSimilar helper 2020-01-17 05:55:47 +00:00
Joshua Ashton 9e5e4c1cfc [d3d9] Don't mark for hazards if we aren't rendering to mip 0 2020-01-16 03:04:58 +00:00
Joshua Ashton 7c53a997ef [d3d9] Keep subresource views in subresources, defer creation until needed
Avoid creating a bunch of views that we probably don't need whenever a texture is created
2020-01-16 03:00:31 +00:00
Joshua Ashton 9647e449d2 [d3d9] Remove redundant logging from SetDialogBoxMode
This path doesn't error anyway...
2020-01-10 04:30:02 +00:00
Philip Rebohle 79fcaa9fba [d3d9] Remove unused variable from D3D9DeviceEx::Clear
Fixes a compiler warning.
2020-01-09 18:06:58 +00:00
Joshua Ashton 47555f1dda [d3d9] Add GetSurfaceExtent helper 2020-01-09 03:29:58 +00:00
Joshua Ashton cd58b147a1 [d3d9] Respect mip != 0 for Clear fastpath 2020-01-09 03:24:50 +00:00
Joshua Ashton ebcab68822 [d3d9] Respect specific mip size for implicit viewport in SetRenderTarget
Closes #1295
2020-01-09 03:19:37 +00:00
Joshua Ashton b738c4220b [d3d9] Scale depth bias value based on current format's `r` value 2020-01-08 19:38:18 +00:00
Joshua Ashton 2d7f4b1a2c [d3d9] Set depth bias values separately, optimize redundant rasterizer state changes 2020-01-08 19:38:18 +00:00
Joshua Ashton c024b89171 [dxso] Implement d3d9.forceSamplerTypeSpecConstants
This option makes us always use a spec constant to determine sampler type (instead of just in PS 1.x)
which works around a game bug in Halo CE where it gives cube textures to 2d/volume samplers
2020-01-01 20:56:05 +00:00
Joshua Ashton b4f2094c02 [d3d9] Enable bounds testing for D3DPOOL_SYSTEMMEM buffers
Improves performance in Halo CE.
2019-12-22 19:05:22 +00:00
Joshua Ashton 5cc0fd5c25 [d3d9] Simplify SetViewport
pViewport == nullptr is illegal
2019-12-18 23:18:01 +00:00
Joshua Ashton bab56433cb [d3d9] Avoid rebinding scissor rects if the same one is re-set 2019-12-18 23:18:01 +00:00
Joshua Ashton 288a9dd547 [d3d9] Avoid rebinding viewports if the same one is re-set 2019-12-18 23:18:01 +00:00
Joshua Ashton 9ec0541b93 [d3d9] Still rebind viewport/scissor when setting the same RT
Closes #1290
2019-12-18 23:18:01 +00:00
Joshua Ashton 784abe5cf4 [d3d9] Move auto depth stencil creation to after swapchain creation
If the app specifies w == 0 and/or h == 0 then this will be filled in by then in the presentation params.

Impacts #1278
2019-12-18 00:09:55 +00:00
Joshua Ashton 009e772fe8 [d3d9] Remove initial device reset outside of constructor
Allows us to funnel hresults from that to the response of CreateDevice
2019-12-17 23:59:37 +00:00
Joshua Ashton 3b119c0be6 [d3d9] Log unavailable backbuffer format if encountered when resetting swapchain 2019-12-17 22:36:27 +00:00
Joshua Ashton 3abd30bb96 [d3d9] Fix return value for invalid backbuffer formats
This got changed when I saw that the auto depth stencil when set to an unavailable returns D3DERR_NOTAVAILABLE.
Turns out if the backbuffer is unavailable it returns D3DERR_INVALIDCALL...

Consistent...

Closes #1278
2019-12-17 22:36:27 +00:00
Joshua Ashton 54ed8f0bb0 [d3d9] Implement Direct3D9 Frontend (#1275)
Co-authored-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Co-authored-by: Robin Kertels <robin.kertels@gmail.com>
Co-authored-by: pchome <pchome@users.noreply.github.com>
Co-authored-by: Christopher Egert <cme3000@gmail.com>
Co-authored-by: Derek Lesho <dereklesho52@Gmail.com>
Co-authored-by: Luis Cáceres <lacaceres97@gmail.com>
Co-authored-by: Nelson Chen <crazysim@gmail.com>
Co-authored-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Co-authored-by: Riesi <riesi@opentrash.com>
Co-authored-by: gbMichelle <gbmichelle.dev@gmail.com>
2019-12-16 04:28:01 +01:00