Commit Graph

495 Commits

Author SHA1 Message Date
Philip Rebohle dc52212873
[dxbc] Disable Constant Buffer Range Check on AMD
The hardware already behaves as intended, no need to waste GPÜ cycles.
2019-04-30 16:07:24 +02:00
Philip Rebohle 3b1e753bb5
[dxvk] Re-implement early discard with quad granularity
May perform better on some hardware in situations where we cannot
discard a full subgroup. Closes #753.
2019-04-30 14:46:03 +02:00
Danylo Piliaiev 261d31cac6 [dxbc] Fix xfb passthrough for system values
vReg should be always allocated for system values which is
necessary for emitXfbOutputSetup and is already done for
hull shader passthrough.

Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
2019-04-30 12:19:21 +02:00
Philip Rebohle 06c144f075 [dxbc] Store sample positions as vec2 array
We can append the zeroes in shader code instead. May
improve generated code on drivers that use scratch
memory or temporary uniform buffers for large arrays.
2019-04-29 14:04:42 +02:00
Philip Rebohle b14ad7b30c [dxbc] Remove some old TODOs
This is already implemented properly.
2019-04-29 11:48:09 +02:00
Philip Rebohle 04152055b7 [dxbc] Correctly report a sample count of 0 for unbound images 2019-04-29 11:48:09 +02:00
Philip Rebohle a3e0157ab0 [dxbc] Correctly report a size of 0 for unbound images 2019-04-29 11:48:09 +02:00
Philip Rebohle 18cbaefdcb [dxbc] Correctly report a size of 0 for unbound buffers 2019-04-29 11:48:09 +02:00
Philip Rebohle ad5da34c57 [dxbc] Fix typo in sample positions 2019-04-29 11:48:09 +02:00
Philip Rebohle b44cad4d32
[dxbc] Replace computeResourceSlotId by light-weight alternatives
Slightly reduces overhead of D3D11 binding methods.
2019-04-18 10:06:15 +02:00
Philip Rebohle 35a2a02714
[dxbc] Do not emit GS system values if rasterization is disabled
Fixes issue in Star Citizen, which declares a max output vertex count
of 128 in a geometry shader which emits eight components per vertex,
which becomes 12 components in DXVK due to the gl_Position builtin.
This should keep us below the magic limit of 1024 output components.
2019-04-15 09:00:46 +02:00
Philip Rebohle 5819a69302
[d3d11] Add option to enable constant buffer range checks 2019-04-05 20:56:32 +02:00
Philip Rebohle 9b99c55a2e
[dxbc] Implement optional constant buffer range check 2019-04-05 20:56:29 +02:00
Philip Rebohle 0326258829 [dxbc] Use SDiv instead of ShiftRightLogical for index calc on Nvidia
Reportedly fixes Resident Evil 2 and Devil May Cry 5 on Nvidia.
2019-03-09 19:59:56 +01:00
Philip Rebohle 6d814b24da
[dxbc] Fix invalid SPIR-V for FirstBitHi / FirstBitShi on vectors
Refs #930.
2019-02-23 21:27:40 +01:00
Philip Rebohle d12a8e09a8
[dxbc] Decorate integer fragment shader builtins as flat
Fixes yellow tint in Unreal Engine 4 games on RADV and AMDGPU-PRO.
2019-02-23 14:33:59 +01:00
Philip Rebohle 38c6eeed26
[dxbc] Only emit depth clamp in fragment shader if necessary
We don't need this if the depth clip extension is supported
by the driver.
2019-02-19 14:27:21 +01:00
Philip Rebohle 2d81decb91
[dxbc] Fix SPIR-V caps for SRV and UAV resources 2019-02-19 11:31:12 +01:00
Philip Rebohle 915091b76b
[dxbc] OpSDiv by 4 -> OpShiftRightLogical by 2 2019-02-07 19:32:07 +01:00
Philip Rebohle 8b80db7839
[dxbc] Fix storage class for UBO loads
UniformConstant is used for other things, UBOs are Uniform.
2019-02-05 21:28:50 +01:00
Philip Rebohle c0b325b483
[dxbc] Add option to enable strict sm4-compliat division
SM4 is defined to return the first source operand if the divisor is zero.
Windows drivers don't do this by default, so we shouldn't do it either.
2019-02-05 21:08:13 +01:00
Philip Rebohle a4378996d9
[dxbc] Reduce length of temporary shader input array to a minimum
Fixes severe performance regression with the AMD proprietary driver.
2019-02-04 13:30:08 +01:00
Philip Rebohle e5a06d3f4a
[dxbc] Only load requested components from constant buffers
Results in better performance compared to loading the entire vector
on RADV. Suggested by Samuel Pitoiset.
2019-01-30 16:32:25 +01:00
Philip Rebohle 1cc24c223b
[dxbc] Reduce length of tessellation i/o arrays to minimum
This allows us to fix a violation of the Vulkan specification
where using the same location range for per-vertex and per-patch
i/o is illegal.

May also help certain drivers figure out what's actually needed.
2019-01-26 17:12:23 +01:00
Philip Rebohle b0b7960548
[dxbc] Add method to count required registers for signatures 2019-01-26 17:11:49 +01:00
Philip Rebohle 0b5cffb0bb
[dxbc] Parse patch constant signature 2019-01-26 14:52:29 +01:00
Philip Rebohle bee21e7539
[dxbc] Support parsing the ISG1 and OSG1 signature chunks
Required to get the Resident Evil 2 demo to work.
2019-01-12 15:17:51 +01:00
Philip Rebohle 4fe5929799
[dxbc] Add options to enable/disble early discard and raw ssbo use 2019-01-08 20:58:18 +01:00
Philip Rebohle 9890b87225
[dxbc] Fix incorrect error message 2019-01-08 00:46:24 +01:00
Philip Rebohle e5beab2872
[dxbc] Rename struct_c0 -> c0_t etc. 2018-12-14 23:45:38 +01:00
Philip Rebohle 01b8e74457
[dxbc] Use raw SSBOs for raw and structured buffers if appropriate 2018-12-14 23:45:37 +01:00
Philip Rebohle 48548eb894
[dxbc] Add useRawSsbo option
ENabled when we can replace texel buffers for raw and structured
buffers with raw SSBOs.
2018-12-14 23:45:37 +01:00
Philip Rebohle a0de90861c
[dxvk] Store access flags in resource slots
Makes distinguishing read-only resources from read-write
resources significantly easier.
2018-12-14 23:45:37 +01:00
Philip Rebohle f276bcd0e7
[dxbc] Check for RADV/Nvidia drivers explicitly using the new function
This way, only RADV gets locked out of using early discard whereas
AMDVLK and -PRO are able to use it.
2018-12-12 16:27:01 +01:00
Philip Rebohle 7096937c11
[dxbc] Use ballot to determine early-discard condition in fragment shaders 2018-11-27 11:50:01 +01:00
Philip Rebohle 2424cf0289
[dxbc] Disable early discard on AMD cards
Causes GPU hangs.
2018-11-24 10:09:33 +01:00
Philip Rebohle a75c596132
[d3d11] Add config option to enable TGSM initialization 2018-11-23 16:12:02 +01:00
Philip Rebohle ea5f11d091
[dxbc] Implement function to clear thread-group shared memory
Can be enabled in case a game reads undefined data from TGSM.
2018-11-23 15:57:54 +01:00
Philip Rebohle 79a6dd111e
[dxbc] Store workgroup size for compute shaders 2018-11-23 14:39:33 +01:00
Philip Rebohle 3e686098cc
[dxbc] Disable subgroup early discard on Nvidia GPUs
People report performance regressions up to 5% with it enabled.
2018-11-23 12:28:48 +01:00
Philip Rebohle 6dd82dfe03
[dxbc] Clamp written depth value to (0.0, 1.0)
Fixes shadow issue in Overwatch (#738).
2018-11-23 12:00:23 +01:00
Philip Rebohle 0418c02ac3
[dxbc] Use clustered subgroup operations on supported hardware 2018-11-21 11:17:09 +01:00
Philip Rebohle ab17c49c4e
[dxbc] Fix compiler warning about uninitialized values 2018-11-21 11:17:09 +01:00
Philip Rebohle 4f76b89941
[dxbc] Use subgroup operations for early discard
Can improve performance in some complex fragment shaders.
2018-11-21 11:17:09 +01:00
Philip Rebohle a574829bb6
[dxbc] Remove DeferKill flag
This behaviour is correct, and needs to be enabled by default.
2018-11-21 11:17:09 +01:00
Philip Rebohle f69c5e4c4e
[dxbc] Emit Index decoration for pixel shader outputs
Simplifies shader patching when dual-source blending is used.
2018-11-19 16:57:11 +01:00
Philip Rebohle a971370524
[dxbc] Implement Dmovc instruction
Fixes some mandelbrot demo mentioned in #216.
2018-11-10 23:27:56 +01:00
Philip Rebohle 05856e836b
[d3d11] Don't enable StorageImageReadWithoutFormat feature for FL11_0
We don't really need this, although it might be useful in the future.
2018-11-10 11:34:23 +01:00
Philip Rebohle bd03225c14
[dxbc] Refactor DxbcOptions
A bit mask isn't good enough going forward, and we also don't
need application-specific options for now.
2018-11-09 08:41:02 +01:00
Philip Rebohle 780780f8d1
[dxbc] Don't enable sample shading for interpolation functions
Actually doesn't resolve #456, and doesn't make any sense either because
interpolation at a given sample index is apparently supposed to work even
without using sample shading.
2018-11-05 18:30:32 +01:00
Philip Rebohle 2ee7ef7689
[dxbc] Enable sample shading when using interpolation functions
Fixes artifacts on RADV when enabling MSAA in World of Warcraft (#456).
2018-11-05 17:07:11 +01:00
Philip Rebohle 851d9fb726
[general] Remove unnecessary include directories from build files
These are no longer needed because dxvk includes consistently
use relative file paths now, instead of global includes.
2018-11-02 14:54:39 +01:00
Philip Rebohle a53e053391
[dxbc] Fix incorrect data type for explicit interpolation instructions 2018-10-25 22:25:13 +02:00
Philip Rebohle a27e440272
[dxvk] Detect Xfb and set rasterized stream index 2018-10-10 13:05:37 +02:00
Philip Rebohle d2c62a8645
[dxbc] Implement passthrough geometry shader
This is needed when vertex or domain shader code is
passed to CreateGeometryShaderWithStreamOutput.

- Fix compilation with new DxbcProgramInfo.
2018-10-10 10:28:15 +02:00
Philip Rebohle 017699df15
[dxbc] Implement Xfb output declarations and setup 2018-10-10 10:28:15 +02:00
Philip Rebohle 6a5fe2247a
[dxbc] Add support for multiple streams in geometry shaders 2018-10-10 10:28:15 +02:00
Philip Rebohle a42f03e32d
[dxbc] Add Xfb structures to DxbcModuleInfo 2018-10-10 10:28:15 +02:00
Andre Heider 8fcdf78b51 [dxbc] rename DxbcProgramVersion to DxbcProgramInfo
The version in not part of this class anymore.
2018-10-08 12:32:01 +02:00
Andre Heider 8492f0501e [dxbc] Drop unused major/minor from DxbcProgramVersion 2018-10-08 12:32:01 +02:00
Philip Rebohle 059073fcd0
[dxbc] Fix missing hull shader input declarations
Fixes tessellation in Tomb Raider 2013. Closes #368.
2018-09-13 18:25:32 +02:00
Philip Rebohle 797c568c74
[dxbc] Use temporary array for per-patch hull shader outputs
Drivers don't seem to like it when output arrays are addressed dynamically.
2018-09-13 15:17:39 +02:00
Philip Rebohle 16a3ae52fe
[dxbc] Remove emitCsSystemValueLoad
There are no compute shader system values.
2018-09-10 11:50:13 +02:00
Philip Rebohle f8dc5612f7
[d3d11] Added option to limit tessellation factors
d3d11.maxTessFactor accepts values ranging from 8 to 64, and limits
the maximum tessellation factor accordingly.
2018-09-09 23:14:00 +02:00
Philip Rebohle 108a6645e6
[dxbc] Make emitRawBufferLoad more readable 2018-09-06 21:44:53 +02:00
Philip Rebohle 9520c9b1b8
[dxbc] Apply Modulo 31 to bit counts and offsets (shr/shl/bfe/bfi)
Assassin's Creed Syndicate relies on correct behaviour.
2018-09-03 01:01:44 +02:00
Philip Rebohle 05e505a844
[dxbc] Implement pixel shader output component mapping 2018-09-01 18:15:27 +02:00
Philip Rebohle 01cc49555a [dxbc] End functions correctly even if last instruction is not 'ret'
Some DXBC shaders don't end in a return instruction, but rather implicitly
end when all branches end in a return instruction. Fixes an illegal shader
generated in Crysis 1.
2018-08-27 14:29:40 +02:00
Philip Rebohle b51361eaa9
Revert "[dxbc] Work around OpControlBarrier issue on radv 18.2-git"
This reverts commit 9293acfeb5.

This issue is caused by an LLVM bug, which now has a workaround in RADV:
https://cgit.freedesktop.org/mesa/mesa/commit/?id=71d5b2fbf83061a1319141d26942771e8c75ff2b
2018-08-17 11:50:36 +02:00
Philip Rebohle e113392bb9
[dxbc] Implement DtoI, DtoU, ItoD and UtoD 2018-08-15 20:11:40 +02:00
Philip Rebohle 86fbba06be
[dxbc] Implement DDiv, DFma and DRcp 2018-08-15 20:11:40 +02:00
Philip Rebohle fabcdbc3ae
[dxbc] Add definitions for extended double instructions 2018-08-15 20:11:34 +02:00
Philip Rebohle e1479f41c1
[dxbc] Fix case labels when case blocks are terminated with ret
Fixes incorrect shader in Monster Hunter World, which caused
RADV to crash.
2018-08-10 03:31:35 +02:00
Philip Rebohle 9293acfeb5
[dxbc] Work around OpControlBarrier issue on radv 18.2-git 2018-08-03 15:15:18 +02:00
Philip Rebohle 1da6617a73
[dxbc] Fix sample location order for 2xMSAA case
The sample locations were apparently incorrectly documented
in the Vulkan spec and have changed with the 1.1.82 update.
2018-08-01 11:38:59 +02:00
Philip Rebohle 0ba00b3f59
[dxvk] Add extended device feature structure
This allows the client API to query and enable extended
features in the future, should it become necessary, much
like the extende feature queries.
2018-07-31 16:58:25 +02:00
Philip Rebohle 91407098d5
[dxbc] Actually set "icb" as the debug name of the ICB 2018-07-30 22:08:01 +02:00
Philip Rebohle f8392b4f83
[dxbc] Fix incorrect pointer type when loading from baked ICBs 2018-07-30 21:08:52 +02:00
Philip Rebohle 2166769096
[dxbc] Map large ICBs to a constant buffer
Should fix an issue with compiling a specific compute shader in
the game Dragon Ball Xenoverse 2 (#523).
2018-07-30 20:52:42 +02:00
Philip Rebohle c31e646921
[dxvk] Introduce concept of shader constants
Large constant arrays should be moved to a uniform buffer instead
of being baked directly into the shader code.
2018-07-30 20:29:05 +02:00
Philip Rebohle a8eb7d343a
[dxvk] Reconfigure bindings
In order to map ICBs to uniform buffers, we need one spare constant
buffer slot per shader stage.
2018-07-30 20:29:05 +02:00
Philip Rebohle a196451400
[dxbc] Respect number of input/output components
Fixes issues with geometry shaders exceeding output component limits.
2018-07-01 17:45:50 +02:00
Philip Rebohle 2bce1491c6
WIP: Typed shader interfaces 2018-07-01 12:44:37 +02:00
Philip Rebohle c370eea948
[dxbc] Decorate untyped write-only UAVs as NonReadable 2018-06-28 03:42:11 +02:00
Philip Rebohle 6cc303c5ef
[dxbc] Implement SV_ViewportID as pixel shader input 2018-06-27 12:02:54 +02:00
Philip Rebohle 845c78fd20
[dxbc] Consider stream index in signature entry lookup 2018-06-23 20:13:00 +02:00
Philip Rebohle dd51437584
[dxbc] Implement EmitThenCut / EmitThenCutStream 2018-06-23 17:34:50 +02:00
Philip Rebohle 07ef25fec5
[dxbc] Parse OSG5 chunk for Shader Model 5 geometry shaders 2018-06-23 17:25:03 +02:00
Philip Rebohle 102591369e
[dxbc] Add DxbcModuleInfo struct
This will be required in the future to pass data from the
application to the shader compiler.
2018-06-23 17:14:35 +02:00
Philip Rebohle f7587014c7
[dxbc] Fix compiler warning 2018-06-18 15:33:35 +02:00
Philip Rebohle a607fe107f
[dxbc] Remove workarounds for the old Nvidia shader compiler 2018-06-12 22:13:53 +02:00
Philip Rebohle f5d55726b3
[dxbc] Fix index returned by ImmAtomicConsume instruction
Since the atomic operations always return the old value, we have to
subtract one for the consume instruction. The append instruction is
unaffected. Fixes an issue with vegetation in Final Fantasy XV.
2018-06-11 20:17:29 +02:00
Philip Rebohle e35cbf833c
[dxbc] Fixed issue with FtoD instruction picking an incorrect type 2018-06-07 16:02:59 +02:00
Philip Rebohle 10170a89ab
[dxbc] Implemented 64-bit compare instructions 2018-06-07 15:21:30 +02:00
Philip Rebohle a89eb15546
[dxbc] Implemented 64-bit Vector ALU instructions 2018-06-07 15:05:06 +02:00
Philip Rebohle 97af5ee6fe
[dxbc] Implement DtoF and FtoD instructions 2018-06-07 14:32:56 +02:00
Philip Rebohle 217399926d
Revert "[dxbc] Bound-check dynamically indexed constant buffer reads"
This reverts commit 621aed5fdb.

Breaks Dishonored 2. Apparently, out-of-bounds access to constant buffers
is allowed as long as it doesn't exceed the range of bound constants.
2018-06-02 18:09:59 +02:00
Philip Rebohle 9ff17b03f2
[dxbc] Support RenderTargetId and ViewportId in Vertex/Domain shaders
Fixes shader compilation errors in Pillars of Eternity II (#408)
and Lost Sphear (#406). Currently unsupported by RADV.
2018-06-01 13:57:26 +02:00
Philip Rebohle aa76bae32a
[dxbc] Fix incorrect OpSelectionMerge instruction
Fixes a regression introduced in v0.53 that would cause
Witcher 3 to crash when enabling Nvidia Hairworks on RADV.
2018-05-31 14:20:12 +02:00
Philip Rebohle 621aed5fdb
[dxbc] Bound-check dynamically indexed constant buffer reads
Emulates D3D11 behaviour more closely on Nvidia hardware.
Fixes an issue in Dark Souls Remastered caused by constant
buffer access with an undefined index value (#405).
2018-05-31 10:13:32 +02:00
Philip Rebohle 001794a094
[dxbc] Implement deferred kill operation
Fixes visual issues during LOD transitions in The Witcher 3,
Rise of the Tomb Raider and other games with a similar LOD
system. UAV stores and atomics are conditionalized as well.
2018-05-26 19:25:20 +02:00
Philip Rebohle 0619842dd9
[dxbc] Make UAV stores and atomics conditional
We should only perform stores when the corresponding
UAV is bound. This may be extended with range checks
at a later time.
2018-05-26 19:01:44 +02:00
Philip Rebohle 9278221416
[dxbc] Run analyzer before creating compiler object
We may need the analysis results when initializing the compiler object.
2018-05-26 17:46:49 +02:00
Philip Rebohle af62d423b2
[dxbc] Add per-device option for deferred kills 2018-05-26 17:08:39 +02:00
Philip Rebohle ec5572aa69
[dxbc] Scan for discard and derivative instructions 2018-05-26 17:08:08 +02:00
Philip Rebohle d79f39b963
[dxbc] Implement sampleinfo instruction for rasterizer 2018-05-26 14:54:05 +02:00
Philip Rebohle a43025294a
[dxbc] Remove DxbcImageInfo::layered property 2018-05-24 12:07:03 +02:00
Philip Rebohle 12d79257be
[dxbc] Remove TexCube -> TexCubeArray workaround 2018-05-24 12:00:31 +02:00
Philip Rebohle 58e9280891
[dxbc] Remove Tex2D -> Tex2DArray workaround 2018-05-24 11:49:12 +02:00
Philip Rebohle fb11acbc91
[dxbc] Implement geometry shader instancing
Required for Frostpunk (see #385).
2018-05-22 19:36:53 +02:00
Philip Rebohle 126c50a674
[dxbc] SampleMask does not depend on SampleRateShading
This was fixed in a later revision of the SPIR-V 1.0 specification.
2018-05-19 09:07:31 +02:00
Philip Rebohle a6ace7908f
[dxbc] Do not emit empty 'else' blocks 2018-05-18 22:37:23 +02:00
Philip Rebohle 581e505f54
[dxbc] Fix bit scan instructions
firstbithi counts from the MSB rather than the LSB. Fixes
rendering issues in Hitman.
2018-05-12 01:39:23 +02:00
Philip Rebohle 27d3a78d79 [dxbc] Omit empty source string in OpSource instruction
This parameter is optional and confuses RenderDoc if present.
2018-05-02 13:07:26 +02:00
Philip Rebohle 5eaacf7459 [dxbc] Add gs_vertex_in to the entry point interface
Fixes invalid SPIR-V generated in the Blacksmith demo (#267).
2018-04-23 18:07:31 +02:00
Philip Rebohle a5c43b5e59 [dxbc] Enable array texture hack for Dishonored 2
Partially fixes shadow rendering issues.
2018-04-23 11:09:48 +02:00
Philip Rebohle 01147492d5 [dxbc] Implemented Texture2D -> Texture2DArray mapping as a knob
Doing this for all applications is not necessary and degrades
performance in some cases.
2018-04-23 00:46:27 +02:00
Philip Rebohle e53cb72e39 [dxbc] Make DxbcOptions a set of flags
This allows for game-specific workarounds and driver-specific
workarounds to be applied in an easier fashion.
2018-04-22 23:49:41 +02:00
Philip Rebohle 2f20a61342 [dxbc] Map 2D MS shader resource views to 2D MS Array views
Works around a game bug in Dragon Age: Inquisition, which binds
an MS image to a non-MS resource slot. Closes
2018-04-22 18:27:01 +02:00
Philip Rebohle cd63ff6d76 [dxbc] Fix operand type of resinfo_rcp_float division
Fixes invalid SPIR-V generated for this instruction.
2018-04-22 16:43:16 +02:00
Philip Rebohle f30923718f [dxbc] Fix texture component count for OpImageQueryLod
Not a bug, but we don't need the extra component when dealing with
array images.
2018-04-22 14:08:01 +02:00
Philip Rebohle 0bf97993c6 [dxbc] Fix layer count in resinfo instruction
For non-layered types, this instruction is supposed to return 0, not 1.
2018-04-22 08:34:07 +02:00
Philip Rebohle dcb5b2a20c
[dxbc] Map 1D and 2D textures to their respective array type v2
We need to adjust the texture coordinate vectors as well, so that
some instructions continue to work properly.
2018-04-21 18:09:43 +02:00
Philip Rebohle 0318cc730a
Revert "[dxbc] Map 1D and 2D textures to their respective array type"
Broken. Requires some prep work in the shader compiler.
2018-04-21 15:38:39 +02:00
Philip Rebohle 906355b0da
[dxbc] Map 1D and 2D textures to their respective array type
As with cube textures, some games think it's a good idea to bind a
non-array view to a slot that expects an array view or vice versa.
Fixes clouds not appearing in TrackMania 2 Stadium (#191).
2018-04-21 14:15:10 +02:00
Philip Rebohle fd1c50d8d8
[dxbc] Fixed incorrect shader resource slot computation 2018-04-21 14:01:27 +02:00
Philip Rebohle 50f1cf007d
[dxbc] Implement precise flag
May fix depth precision in Skyrim SE (issue #189).
2018-04-20 23:32:51 +02:00
Philip Rebohle 8eb78591a0
[dxbc] Scan pixel shader output register type at declaration time
Fixes invalid shaders being generated in the Blacksmith demo on
some GPUs. Works around a possible issue in the output signature
reader.

Commit #1000, yay.
2018-04-18 21:14:34 +02:00
Vesim b82ae16f8a [dxbc] Moved all operators in dxbc_names to dxvk namespace (#296) 2018-04-17 17:33:07 +02:00
Philip Rebohle 75c928fc87
[dxbc] Remove is-bound check for constant buffer reads
We do not have to do this anymore since we'll bind a large
enough dummy buffer. Considerably reduces code size in shaders
which access a large number of shader constants.
2018-04-16 23:40:48 +02:00
Philip Rebohle 98b8d41016
[dxbc] Write shader name to the generated SPIR-V
Might help identifying shaders in debugging tools such as Renderdoc.
2018-04-15 21:00:08 +02:00
Philip Rebohle adb1789571
[dxbc] Fixed incorrect result vector dimension for OpImageQuerySize 2018-04-12 13:57:15 +02:00
Philip Rebohle 021ea64103
[dxbc] Remove Nvidia driver version check
Apparently this causes a regression in Overwatch for some.
2018-04-11 19:44:45 +02:00
Philip Rebohle 8ea17e7a25
[dxbc] Implemented Nop instruction
Required for Metal Gear Solid V.
2018-04-11 01:49:39 +02:00
Philip Rebohle f3544cc8e1
[dxbc] Fix __GL_NextGenCompiler check... 2018-04-11 01:17:07 +02:00
Philip Rebohle 3ff437ddbe
[dxbc] Re-enable Nvidia workarounds if __GL_NextGenCompiler is '0'
Fixes potential regressions when using the old SPIR-V compiler.
2018-04-11 00:26:42 +02:00
Philip Rebohle 1b6442b859
[dxbc] Disable Nvidia-specific workarounds for 396.18 and above 2018-04-11 00:20:24 +02:00
Philip Rebohle 1fb22a6022
[dxbc] Refactored opcode controls 2018-04-10 08:01:54 +02:00
Philip Rebohle 5cb65a6c19
[dxbc] Fix sampleinfo_uint instruction 2018-04-09 22:52:59 +02:00
Philip Rebohle 8a4e1d11b7
[dxbc] Add missing component count to gs_layer variable type
Fixes an incorrect geometry shader in Overwatch.
2018-04-09 00:20:27 +02:00
Philip Rebohle 797d7ec81d
[dxbc] Enable CapabilitySampleRateShading capability when needed
Fixes SPIR-V validation errors in the Final Fantasy XV benchmark.
2018-04-08 21:06:58 +02:00
Philip Rebohle e38cc4a0e0
[dxbc] Implement support for SV_PrimitiveID
Fixes some geometry/tessellation shaders in The Witcher 3.
2018-04-08 18:25:44 +02:00
Philip Rebohle bd17be472d
[dxbc] Reciprocate W component of SV_POSITION in pixel shaders
Fixes the fog effect in Nier:Automata, as well as some major
visual issues in Rise of the Tomb Raider, and potentially
other games.
2018-04-05 20:10:00 +02:00
Philip Rebohle 492c7384bc
[dxbc] Implemented ImmAtomicCmpExch and AtomicCmpStore 2018-04-04 13:59:43 +02:00
Philip Rebohle eb85f61084 [dxbc] Serialize hull shader fork/join phase invocations
We cannot run these in parallel in case the hull shader's output vertex
count, and thus the invocation count, is less than the fork/join phase
invocation count.
2018-04-02 16:22:19 +02:00
Philip Rebohle d2c6ec5c41 [dxbc] Implement ImmAtomic*Min/Max instructions 2018-04-02 10:58:26 +02:00
Philip Rebohle 99d9a5df0b [dxbc] Respect GloballyCoherent flag for UAVs 2018-03-31 16:41:19 +02:00
Philip Rebohle 770d94f796 [dxbc] Fix explicit memory barrier semantics
This imitates glslang behaviour for barrier instructions and
sets AcquireRelease semantics for all explicit memory barriers.
2018-03-30 17:59:57 +02:00
Philip Rebohle 47e78d0a95 [dxbc] Fixed type of atomic pointers into typed UAVs
Should fix a crash in the Nvidia driver.
2018-03-30 17:31:48 +02:00
Philip Rebohle b286b518c5
[dxbc] Fix ForkInstanceId type in EmitHsForkJoinPhase 2018-03-29 14:05:38 +02:00
Philip Rebohle 2ab4710054
[dxbc] Run HS fork/join phases in parallel
May reduce execution time of hull shaders on the GPU by running
the fork/join phases in parallel, as originally intended. Tested
on RADV 18.0.99 with LLVM 6.0.0.
2018-03-29 13:29:50 +02:00
Philip Rebohle 87f9bcfd75
[dxbc] Do not use locations >32 for tess control outputs
Fixes an assertion with latest mesa-git.
2018-03-28 11:55:29 +02:00
Philip Rebohle a700e928ef
[dxbc] Enable MultiViewport capability if needed
Fixes invalid SPIR-V generated since  60d6416e5f.
2018-03-27 01:41:06 +02:00
Philip Rebohle 60d6416e5f
[dxbc] Implemnted SV_ViewportArrayIndex for geometry shaders
Required by Final Fantasy XIV.
2018-03-26 23:32:30 +02:00
Philip Rebohle ac94c42380
Revert "[dxbc] Do not emit per-vertex input block"
This reverts commit 4ce64bd886.

Fixes a regression in Sniper: Ghost Warrior 2 and Dishonored 2.
2018-03-24 16:23:31 +01:00
Philip Rebohle 54382ae319
[dxbc] Add experimental support for mixed resource types
HLSL tbuffers are translated to resources with a "mixed" format.
There is no documentation about which format the buffers actually
use, so we'll default to UINT and see what happens.
2018-03-24 14:21:13 +01:00
Philip Rebohle 7f7eedac35
[dxbc] Implement SV_ClipDistance and SV_CullDistance 2018-03-24 11:29:07 +01:00
Philip Rebohle 4ce64bd886
[dxbc] Do not emit per-vertex input block
Instead, we can let the normal input registers do their thing.
2018-03-24 00:32:22 +01:00
Philip Rebohle 0ab27aa4e3
[dxbc] Check if the signature is nullptr before using it
Fixes a crash in The Witcher 3.
2018-03-23 21:38:21 +01:00
Philip Rebohle 31772af4a5
[dxbc] Count clipping and culling planes 2018-03-23 19:48:07 +01:00
Philip Rebohle abb90086d5
[dxvk] Use analyzer to determine UAV image type 2018-03-23 01:04:04 +01:00
Philip Rebohle 16caa10697
[dxbc] Add analyzer stub
Will be used to gather information for the compiler.
2018-03-22 20:01:57 +01:00
Philip Rebohle 9ef94e28ac
[dxbc] Support UNorm/SNorm typed resources 2018-03-21 15:08:53 +01:00
Philip Rebohle 584ee6b6f0
[dxbc] Lift ShaderStorageImageReadWithoutFormat requirement 2018-03-21 12:47:53 +01:00
Philip Rebohle fcff10aae7
[dxbc] Set image format for UAVs when atomic operations are used
Fixes a violation of the Vulkan specification where atomic operations
would be used on storage images with SpvImageFormatUnknown. Should fix
driver crashes on Nvidia.

TODO: Fix data types for atomic operation instructions.
2018-03-21 12:11:18 +01:00
Philip Rebohle 17e981f360
[dxvk] Increase UAV slot count to 64 for the graphics pipeline
D3D11 raised this limit from 8 UAVs in the fragment shader to
64 UAVs in all graphics stages combined.
2018-03-21 04:56:33 +01:00
Mikhail Paulyshka fd633ea784 [dxbc] fix MSVC 64-bit build 2018-03-17 01:59:13 +03:00
Philip Rebohle 3d0aad705d
[dxbc] Implemented samplepos instruction
Required by Fallout 4, among other games.
2018-03-12 12:25:10 +01:00
Mikhail Paulyshka 3dad074fc4 [dxbc] implemented retc instructions (#140) 2018-03-10 15:04:58 +01:00
Philip Rebohle 28880d0fa8
[dxbc] Implemented DclHsMaxTessFactor 2018-03-10 15:02:27 +01:00
Philip Rebohle 3efd437310
[dxbc] Fixed TGSM size with dcl_tgsm_raw
https://msdn.microsoft.com/en-us/library/windows/desktop/hh446929(v=vs.85).aspx
2018-03-09 22:01:19 +01:00
Philip Rebohle c3cf65c015
[dxbc] Use signed int for component index in OpImageGather
Workaround for a bug in Nvidia's shader compiler, which currently
expects the component index to be signed rather than unsigned.
2018-03-08 07:50:37 +01:00
Philip Rebohle 7ac0d413ad
[dxbc] Use correct arrays for vicp/vocp in hull shaders
Fixes Heaven on RADV.
2018-03-07 09:52:24 +01:00
Philip Rebohle 0fdde6a94e
[dxbc] Fix hull shader barrier issue 2018-03-07 00:22:40 +01:00
Philip Rebohle b7a9c2c751
[dxbc] Implemented vicp for hull shaders
Allows Unigine Heaven to start with tessellation enabled.
2018-03-06 19:19:10 +01:00
Mikhail Paulyshka 9deb73a2a7 Add support for MSVC, attempt 3 (#130)
* [dxvk] fixes for MSVC

* nullptr -> int is illegal conversion for MSVC. nullptr was replaced with VK_NULL_HANDLE
* MSVC does not support source code strings longer than 65535 chars. String was replaced with array of chars.

* [utils] fixes for MSVC

* __mingw_uuidof() does not exists in MSVC
* apply GCC pragma only for GCC
* added missing header

* [dxbc] fixes for MSVC

*added missing header

* [dxgi] fixes for MSVC

* user __declspec(uuid()) instead of _mingw_uuidof()
* do not use DLLEXPORT macro for MSVC

* [d3d11] fixes for MSVC

* replace WINBOOL with BOOL
* do not declare D3D11 structs for MSVC
* do not use DLLEXPORT macro for MSVC

* [meson] fix build scripts for MSVC

* change cpp version from c++1z to c++latest for MSVC
* set -DOMINMAX definition for MSVC
* disable test and wine_utils for MSVC
* use .def files instead of __declspec(dllexport) for MSVC (bypass 'C2375: redefinition; different linkage' error)
* fix .def files for MinGW
* add --enable-stdcall-fixup linker flag for MinGW
2018-03-06 18:34:34 +01:00
Philip Rebohle 88c4e363e5
[dxbc] Implemented workaround for hull shader output synchronization 2018-03-06 18:29:20 +01:00
Philip Rebohle 2271814d95
[dxbc] Implemented domain shader input variables 2018-03-06 16:47:35 +01:00
Philip Rebohle ff0ff0c23b
[dxbc] Implemented hull shader passthrough 2018-03-06 15:52:29 +01:00
Philip Rebohle d2ca721387
[dxbc] Reworked Hull Shader phase invocations
Instead of running individual phases sequentially, we can
run them in parallel if execution barriers are in place.
2018-03-06 15:05:58 +01:00
Philip Rebohle 87afb33228
[dxbc] Implemented Hull Shader output setup 2018-03-06 14:49:11 +01:00
Philip Rebohle 988aaa0161
[dxbc] Implemented Hull Shader output variables 2018-03-06 14:00:03 +01:00
Philip Rebohle b2f5b262f7
[dxbc] Added support for the control point phase in Hull Shaders 2018-03-05 17:23:00 +01:00
Philip Rebohle 4688b2cc5a
[dxbc] Formatting fixes + Hull shader barriers 2018-03-05 16:14:46 +01:00
Philip Rebohle 96ca9fa6ea
[dxbc] Fixed tessellation factor enums 2018-03-05 15:02:17 +01:00
Philip Rebohle 1cbe6829eb
Revert "Add MSVC support (#123)"
This reverts commit c63d4361a0.
2018-03-05 14:32:28 +01:00
Mikhail Paulyshka c63d4361a0 Add MSVC support (#123)
* [utils] fixes for MSVC

* __mingw_uuidof() does not exists in MSVC
* apply GCC pragma only for GCC
* added missing header

* [dxvk] fixes for MSVC

* nullptr -> int is illegal conversion for MSVC. nullptr was replaced with VK_NULL_HANDLE
* MSVC does not support source code strings longer than 65535 chars. String was replaced with array of chars.

* [dxbc] fixes for MSVC

*added missing header

* [dxgi] fixes for MSVC

* user __declspec(uuid()) instead of _mingw_uuidof()

* [d3d11] fixes for MSVC

* replace WINBOOL with BOOL
* do not declare D3D11 structs

* [meson] fix build scripts for MSVC

* change cpp version from 1z to 17 for MSVC
* set -DOMINMAX definition for MSVC
* disable test and wine_utils for MSVC
* use .def files instead of __declspec(dllexport) (bypass 'C2375: redefinition; different linkage' error)
2018-03-05 14:28:51 +01:00
Philip Rebohle 3501186d38
[dxbc] Added tess level interface variables 2018-03-05 14:07:15 +01:00
Philip Rebohle 3dea58dabc
[dxbc] Implemented more tessellation-related declarations 2018-03-01 14:36:17 +01:00
Philip Rebohle feba1f0e88
[dxbc] Implemented Hull Shader control point count declarations 2018-03-01 12:47:24 +01:00
Philip Rebohle 0916115086
[dxbc] Implemented Hull Shader fork/join phase invocations 2018-03-01 12:08:06 +01:00
Philip Rebohle 0e9b7d7ccd
[dxbc] Implemented new workaround for depth-compare ops on Nvidia 2018-03-01 10:11:15 +01:00
Philip Rebohle d185977918
[dxbc] Implemented Hull shader function declarations 2018-03-01 09:26:17 +01:00
Philip Rebohle d0db88ee62
[dxbc] Implemnted some HS/DS stubs 2018-03-01 07:00:54 +01:00
Philip Rebohle a5706254d5
[dxbc] Do not emit depth image types for integer images 2018-02-28 06:51:13 +01:00
Philip Rebohle 8bfd12067a
[dxbc] Remove packDrefValueIntoCoordinates hack
Causes more issues than it solves when the coordinate vector
gets too big.
2018-02-28 06:44:55 +01:00
Philip Rebohle fcb2b6d2d8
[dxbc] Use signed integers for bit insert/extract ops
Fixes a crash with the Nvidia driver.
2018-02-28 06:44:27 +01:00
Philip Rebohle ec59389527
[dxbc] Implement EvalAttribute* instructions 2018-02-26 16:46:34 +01:00
Philip Rebohle 00f6262ff3
[dxbc] Properly implement Input/Output coverage masks 2018-02-26 14:23:41 +01:00
Philip Rebohle 78e9b575c5
[dxbc] Implement AtomicIMin/Max instructions 2018-02-21 03:49:06 +01:00