Nikolay Sivov
873b182021
vkd3d-shader/fx: Support NULL constants for object fields.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-15 17:53:46 +02:00
Nikolay Sivov
c3075d6fb4
vkd3d-shader/hlsl: Adjust NULL type properties to make it usable in transformations.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-15 17:53:46 +02:00
Nikolay Sivov
aa0ea548e4
vkd3d-shader/fx: Handle SetPixelShader() and SetVertexShader().
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-15 17:53:46 +02:00
Nikolay Sivov
2c533e494a
vkd3d-shader/fx: Handle SetBlendState().
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-15 17:53:46 +02:00
Anna (navi) Figueiredo Gomes
16e9872718
vkd3d: Use D3D12_SHADER_VISIBILITY_ALL for 32-bit root constants when using vk_heaps.
...
The existing code sets "stageFlags" to VK_SHADER_STAGE_ALL when
"use_vk_heaps" is true, but doesn't adjust the visibility. This
potentially violates the "Any two elements of pPushConstantRanges must
not include the same stage in stageFlags" constraint, and causes the
validation layers to complain accordingly.
2024-08-15 17:53:46 +02:00
Nikolay Sivov
60ce81112b
vkd3d-shader/fx: Support string annotations for fx_4+.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-14 22:00:35 +02:00
Nikolay Sivov
d4ae844bb6
vkd3d-shader/fx: Enable writing string objects for fx_4+.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-14 22:00:35 +02:00
Nikolay Sivov
89be723ad7
vkd3d-shader/hlsl: Treat "string" type name as case-insensitive.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-14 22:00:35 +02:00
Nikolay Sivov
1ce68cee2c
vkd3d-shader/hlsl: Tokenize 'String' the same as 'string'.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-14 22:00:35 +02:00
Francisco Casas
412f91a14c
vkd3d-shader/hlsl: Always work with the extern resource's component type.
...
We need to distinguish between the data type of a resource and the data
type of its components. These are usually the same except for 4.0
profiles where an array (or multi-dimensional array) of resources is
still considered a single resource, so it is possible for it to hold
more than one component.
In the latter case, we often need to access the type of a single
component (all components have the same type) instead of the type of the
whole array which often doesn't contain the required information, such
as sampler dimension.
This patch replaces the extern_resource.data_type field with the
extern_resource.component_type field, which points to the type of a
single component in the resource. Using it relieves many other code
paths from considering the possibility of the resource being an array.
This fixes runtime errors reported by UBSan, such as this:
vkd3d/libs/vkd3d-shader/tpf.c:6075:87: runtime error: load of value 7, which is not a valid value for type '_Bool'
when trying to compile shaders that contain UAV arrays on 4.0 profiles.
Before this commit, tpf.c accesses the
hlsl_type->e.resource.rasteriser_ordered
field, but on 4.0 and 4.1 profiles these code paths can also be reached
by UAV arrays which are HLSL_CLASS_ARRAY and this field is not supposed
to be accessed.
By coincidence, the value of hlsl_type->e.array.elements_count was being
read because these fields have the same offset in the hlsl_type.e union.
2024-08-14 21:57:21 +02:00
Henri Verbeet
9cf479d4bb
vkd3d: Do not include assert.h.
2024-08-13 21:20:28 +02:00
Henri Verbeet
114578fc8a
vkd3d-shader/fx: Replace assert() with VKD3D_ASSERT().
2024-08-13 21:20:28 +02:00
Henri Verbeet
cd9879f237
vkd3d-common: Replace assert() with VKD3D_ASSERT().
2024-08-13 21:20:28 +02:00
Francisco Casas
355d4c4a86
vkd3d-shader/hlsl: Skip writing string default values.
...
This causes a crash in the native compiler, but can only happen in
ps_5_0 were it is possible to declare structs that are both used in the
shader and contain strings.
struct
{
float a;
string b;
} apple = {1, "foobar"};
float4 main() : sv_target
{
return apple.a;
}
In our case, hlsl_type_get_component_offset() triggered an assertion
failure because it does not expect the string type. So this is replaced
by an hlsl_error().
2024-08-13 21:19:04 +02:00
Francisco Casas
094e298c1c
vkd3d-shader/hlsl: Parse string default values.
2024-08-13 21:19:01 +02:00
Nikolay Sivov
b4d957f848
vkd3d-shader/hlsl: Handle NULL constants.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-13 21:10:45 +02:00
Nikolay Sivov
d945d5e78c
vkd3d-shader/hlsl: Check MS texture declaration without sample count only for used variables.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-13 21:10:29 +02:00
Anna (navi) Figueiredo Gomes
80b2a2eb55
vkd3d-shader/ir: Periodically flush buffers when tracing blocks.
...
Avoids overflowing the output buffer for the trace in cases where the
output is too long, which raises an exception.
2024-08-12 14:19:13 +02:00
Nikolay Sivov
b0ca3627bf
vkd3d-shader/fx: Turn assignments to arrays to element assignments for certain states.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
25e1c3e374
vkd3d-shader/fx: Explicitly handle bool values in state entries.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
c81223d086
vkd3d-shader/fx: Handle states of a BlendState object.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
2affc8f5c5
vkd3d-shader/fx: Run full set of constants passes on state block entries values.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
f1e65ecc83
vkd3d-shader/fx: Enable writing BlendState variables.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
91e88fac2e
vkd3d-shader/hlsl: Add parser support for BlendState type.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
1be0d99b76
vkd3d-shader/fx: Check destination array index when checking for duplicate state entries.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
b23874dad6
vkd3d-shader/hlsl: Add parser support for GeometryShader type.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-08 23:42:37 +02:00
Nikolay Sivov
de48960b33
vkd3d-shader/fx: Add support for the OMSetRenderTargets() state.
2024-08-08 23:42:37 +02:00
Nikolay Sivov
c565a60b9e
vkd3d-shader/fx: Add an array size field to the states description table.
2024-08-08 23:42:37 +02:00
Nikolay Sivov
d55a709992
vkd3d-shader/fx: Use more descriptive names for FX-specific types.
2024-08-08 23:42:37 +02:00
Nikolay Sivov
9fb23b9090
vkd3d-shader/fx: Handle "Texture" field of the sampler state objects.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-08 23:42:37 +02:00
Giovanni Mascellani
8b6ab9627d
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in vkd3d_shader_private.h.
2024-08-08 23:39:23 +02:00
Giovanni Mascellani
27bceec965
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in vkd3d_shader_main.c.
2024-08-08 23:39:23 +02:00
Giovanni Mascellani
0294aa62f3
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in tpf.c.
2024-08-08 23:38:02 +02:00
Giovanni Mascellani
d5126b4d98
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in spirv.c.
2024-08-08 23:36:23 +02:00
Victor Chiletto
8c3a5e5458
vkd3d-shader/hlsl: Implement f16tof32 intrinsic.
2024-08-08 23:35:02 +02:00
Victor Chiletto
693e89c74e
vkd3d-shader/hlsl: Push a new scope when compiling internal functions.
...
This allows for typedef usage without interfering with user code.
Thanks Zeb for the suggestion.
2024-08-08 23:35:02 +02:00
Francisco Casas
016be7e591
vkd3d-shader/hlsl: Lower non-constant row_major matrix loads for SM1.
2024-08-08 23:33:33 +02:00
Francisco Casas
87f01f5205
vkd3d-shader/hlsl: Remove SM1 fixme for matrix writemasks.
...
hlsl_ir_store instructions don't use writemasks for whole matrices.
2024-08-08 23:32:03 +02:00
Francisco Casas
9f515a9daa
vkd3d-shader/hlsl: Lower non-constant array loads for SM1.
...
This is achieved by means of creating a variable storing zero,
loading every array element, comparing if the non-constant index
matches the index of that element at runtime, and in that case
store the corresponding element in the variable.
This seems to be the same strategy that the native compiler uses.
2024-08-08 23:30:39 +02:00
Francisco Casas
eb2d320596
vkd3d-shader/hlsl: Avoid dereferencing rel_offset if it is NULL.
...
We are currently using &offset_node->loc when offset_node is NULL.
A NULL dereference of rel_offset can also happen if
hlsl_offset_from_deref() fails because the dereference is out of
bounds.
2024-08-08 23:28:31 +02:00
Francisco Casas
e8354ac499
vkd3d-shader/hlsl: Parse string type.
2024-08-07 15:53:07 +02:00
Francisco Casas
652db433e1
vkd3d-shader/hlsl: Parse string escape sequences.
2024-08-07 15:51:43 +02:00
Francisco Casas
090df488ba
vkd3d-shader/hlsl: Parse string constants.
2024-08-07 15:48:59 +02:00
Nikolay Sivov
c44a18b3d1
vkd3d-shader/fx: Add support for SetDomainShader(), SetComputeShader(), and SetHullShader() states.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-06 16:54:19 +02:00
Nikolay Sivov
1559237780
vkd3d-shader/fx: Fix state block entry array shifting when decomposing.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-06 16:54:19 +02:00
Nikolay Sivov
7c3677b114
vkd3d-shader/hlsl: Add parser support for ComputeShader, DomainShader, and HullShader types.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-06 16:54:19 +02:00
Nikolay Sivov
2cbad81b55
vkd3d-shader/fx: Handle SetRasterizerState().
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-06 16:54:19 +02:00
Giovanni Mascellani
784e69a366
vkd3d: Check the entire root signature for register conflicts.
...
Not just each descriptor table individually.
2024-08-06 16:53:06 +02:00
Nikolay Sivov
a3f4785720
vkd3d-shader/fx: Decompose function-style state assignments to individual states.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-05 16:01:33 +02:00
Stefan Dösinger
d4c2a7f22b
vkd3d: Pass a proper struct shader_cache_key * to rb_put() in vkd3d_shader_cache_add_entry().
2024-08-05 15:59:53 +02:00
Giovanni Mascellani
46aec9fba8
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in preproc.y.
2024-08-05 15:57:56 +02:00
Giovanni Mascellani
625327653b
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in preproc.l.
2024-08-05 15:57:56 +02:00
Giovanni Mascellani
351220f182
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in preproc.h.
2024-08-05 15:57:56 +02:00
Giovanni Mascellani
4a04324ecc
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in ir.c.
2024-08-05 15:57:56 +02:00
Giovanni Mascellani
5e1ae5aaa3
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in hlsl.y.
2024-08-05 15:57:56 +02:00
Giovanni Mascellani
97a7ec8914
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in hlsl.h.
2024-08-05 15:57:56 +02:00
Conor McCarthy
969cae8b67
vkd3d: Add support for the ID3D12CommandList6 interface.
2024-08-05 15:56:09 +02:00
Giovanni Mascellani
9ff5b2ce7a
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in hlsl.c.
2024-08-01 15:18:15 +02:00
Giovanni Mascellani
4e7d0faaf0
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in hlsl_constant_ops.c.
2024-08-01 15:18:15 +02:00
Giovanni Mascellani
eff30577af
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in hlsl_codegen.c.
2024-08-01 15:18:15 +02:00
Giovanni Mascellani
02ef731b9a
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in fx.c.
2024-08-01 15:18:15 +02:00
Giovanni Mascellani
7d3e8f49e4
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in dxil.c.
2024-08-01 15:18:15 +02:00
Francisco Casas
e6e82ad3f6
vkd3d-shader/hlsl: Add missing src1 and src2 constants to sincos on SM2.
...
The sincos instruction expects two specific constants on 2.0 and 2.1 profiles.
Consider the following shader:
uniform float u;
float4 main() : sv_target
{
return sin(u);
}
On native, with ps_2_0, this compiles as:
ps_2_0
def c3, 0.159154937, 0.5, 6.28318548, -3.14159274
def c1, -1.55009923e-006, -2.17013894e-005, 0.00260416674, 0.00026041668
def c2, -0.020833334, -0.125, 1, 0.5
mov r0.xy, c3
mad r0.x, c0.x, r0.x, r0.y
frc r0.x, r0.x
mad r0.x, r0.x, c3.z, c3.w
sincos r1.y, r0.x, c1, c2
mov r0, r1.y
mov oC0, r0
We are not emitting the src1 and src2 constant arguments before this
patch.
2024-07-31 22:22:38 +02:00
Giovanni Mascellani
4094e5dbeb
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in dxbc.c.
2024-07-30 16:32:59 +02:00
Giovanni Mascellani
bcffcb4a29
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in d3dbc.c
2024-07-30 16:32:59 +02:00
Giovanni Mascellani
8e08fa6bf2
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in d3d_asm.c.
2024-07-30 16:32:59 +02:00
Giovanni Mascellani
5af138b247
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in checksum.c.
2024-07-30 16:32:59 +02:00
Giovanni Mascellani
ba381497cc
vkd3d-common: Remove an assertion in vkd3d_dbg_printf().
...
We want to get rid of assertions and only use the new VKD3D_ASSERT(),
but this cannot be done here, because a failing VKD3D_ASSERT() would
call back again to vkd3d_dbg_printf().
At the same time the asserted condition should be simple enough to
debug even without the assertion, since logging with a bad level
will likely result in either a crash or writing garbage to the log.
2024-07-30 16:32:59 +02:00
Atharva Nimbalkar
2170fdc633
vkd3d-shader/glsl: Implement support for VKD3DSPR_TEMP registers.
2024-07-30 16:31:59 +02:00
Atharva Nimbalkar
337a030908
vkd3d-shader/glsl: Implement VKD3DSIH_MOV.
2024-07-30 16:31:59 +02:00
Henri Verbeet
c7589d8f19
vkd3d-shader/ir: Remove VKD3DSIH_DCL_SAMPLER instructions.
2024-07-30 16:31:44 +02:00
Henri Verbeet
fffe521b80
vkd3d-shader/ir: Remove VKD3DSIH_DCL instructions.
2024-07-30 16:31:44 +02:00
Giovanni Mascellani
240d31c793
vkd3d: Replace assert() with VKD3D_ASSERT() in vkd3d_private.h.
2024-07-29 19:12:13 +02:00
Giovanni Mascellani
529647142c
vkd3d: Replace assert() with VKD3D_ASSERT() in utils.c.
2024-07-29 19:12:13 +02:00
Giovanni Mascellani
bd75396b38
vkd3d: Replace assert() with VKD3D_ASSERT() in state.c.
2024-07-29 19:12:13 +02:00
Giovanni Mascellani
02b898bec0
vkd3d: Replace assert() with VKD3D_ASSERT() in resource.c.
2024-07-29 19:12:13 +02:00
Giovanni Mascellani
150bf69da9
vkd3d: Replace assert() with VKD3D_ASSERT() in command.c.
2024-07-29 19:12:13 +02:00
Giovanni Mascellani
51b65688e1
ci: Abort on assertions on the CI.
2024-07-29 13:17:19 +02:00
Giovanni Mascellani
d7fc2693c4
vkd3d: Introduce a softer form of assertion.
...
Triggering an ERR() instead of aborting the program.
2024-07-29 13:17:19 +02:00
Giovanni Mascellani
a484063cd2
vkd3d: Introduce debug severity MESSAGE.
...
That's intended for messages that it's pretty important that the
user receives, but that are not proper error messages.
2024-07-29 13:17:19 +02:00
Elizabeth Figura
ae5cd6573f
vkd3d-shader: Allow controlling d3d color shade mode through vkd3d-shader parameters.
2024-07-24 16:08:10 +02:00
Elizabeth Figura
d20d0fc69f
vkd3d-shader: Use the program parameters in spirv_compiler_alloc_spec_constant_id().
2024-07-24 16:07:13 +02:00
Victor Chiletto
a0de05f0b4
vkd3d-shader/hlsl: Implement the asint() intrinsic.
2024-07-24 16:06:03 +02:00
Nikolay Sivov
91dce79227
vkd3d-shader/fx: Correct one of the object counters in the fx_2_0 header.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-24 16:04:21 +02:00
Elizabeth Figura
97cd941710
vkd3d-shader: Do not make the alpha test ref parameter VSIR_DIMENSION_VEC4.
2024-07-23 21:12:28 +02:00
Elizabeth Figura
1db7c03185
vkd3d-shader/spirv: Pass a vkd3d_data_type to spirv_compiler_emit_shader_parameter().
2024-07-23 21:11:15 +02:00
Elizabeth Figura
f6dd6d52b3
vkd3d-shader: Factor out a vsir_program_get_parameter() helper.
2024-07-23 21:10:00 +02:00
Elizabeth Figura
6b58b6f261
vkd3d-shader/spirv: Allocate output_info after normalization.
...
Normalization may change the signatures.
2024-07-23 21:09:00 +02:00
Shaun Ren
49caeee1fd
vkd3d-shader/hlsl: Support default values for function parameters.
2024-07-23 15:36:32 +02:00
Nikolay Sivov
29699d3d22
vkd3d-shader/fx: Set total pass count for fx_2_0.
...
Binaries with that field set incorrectly fail to load on Windows.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-23 15:23:54 +02:00
Nikolay Sivov
dcf4ce753b
vkd3d-shader/fx: Correct empty pass check.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-23 15:23:54 +02:00
Nikolay Sivov
958117df2f
vkd3d-shader/hlsl: Allow annotations on global variables.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-23 15:23:54 +02:00
Giovanni Mascellani
ba0fec4c51
vkd3d: Propagate errors out of d3d12_root_signature_append_vk_binding().
2024-07-22 16:01:37 +02:00
Giovanni Mascellani
4b7fe26b33
vkd3d: Remove the temporary pointers in vkd3d_physical_device_info_init().
...
They were rather pointless now.
2024-07-22 16:00:28 +02:00
Giovanni Mascellani
75c64e55cd
vkd3d: Rebuild the vkd3d_physical_device_info chain before creating the device.
...
vkd3d might decide to disable some extensions after the chain is created,
so the chain must be recreated with only the structures corresponding to
enabled extensions.
2024-07-22 16:00:28 +02:00
Giovanni Mascellani
a876e0b192
vkd3d: Allocate temporary arrays on the stack in d3d12_command_list_update_push_descriptors().
2024-07-17 15:52:37 +02:00
Conor McCarthy
ae0faf4500
vkd3d: Limit the workgroup X count for buffer UAV clears to the supported max.
2024-07-17 15:51:39 +02:00
Conor McCarthy
15f8657d74
vkd3d: Create a descriptor pool for static samplers when Vulkan-backed heaps are used.
...
Static samplers may be allocated from these pools.
2024-07-17 15:50:24 +02:00
Shaun Ren
0202393d41
vkd3d-shader/d3dbc: Implement HLSL_OP1_{COS,SIN}_REDUCED for SM1.
...
Also enable SM1 trigonometry function tests.
2024-07-16 19:03:52 +02:00
Shaun Ren
ea2ffc0b6c
vkd3d-shader/hlsl: Allocate registers for HLSL_OP1_{COS,SIN}_REDUCED with the required writemasks.
2024-07-16 19:02:01 +02:00