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
91e88fac2e
vkd3d-shader/hlsl: Add parser support for BlendState type.
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
Victor Chiletto
8c3a5e5458
vkd3d-shader/hlsl: Implement f16tof32 intrinsic.
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
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
090df488ba
vkd3d-shader/hlsl: Parse string constants.
2024-08-07 15:48:59 +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
Giovanni Mascellani
eff30577af
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in hlsl_codegen.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
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
Shaun Ren
b4845b9dca
vkd3d-shader/hlsl: Implement sin/cos for SM1.
...
Also introduce HLSL_OP3_MAD.
2024-07-16 18:55:22 +02:00
Elizabeth Figura
98def3214b
vkd3d-shader: Introduce struct vkd3d_shader_parameter_info and struct vkd3d_shader_parameter1.
...
As the newly added documentation describes, this reroll serves two purposes:
* to allow shader parameters to be used for any target type (which allows using
parameters for things like Direct3D 8-9 alpha test),
* to allow the union in struct vkd3d_shader_parameter to contain types larger
than 32 bits (by specifying them indirectly through a pointer).
2024-07-11 16:48:09 +02:00
Victor Chiletto
2034a8bab9
vkd3d-shader/hlsl: Implement loop unrolling.
...
Based on a patch by Nikolay Sivov.
Co-authored-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-11 00:32:53 +02:00
Victor Chiletto
50e28f70ed
vkd3d-shader/hlsl: Defer bounds checks to after copy propagation.
...
We potentially generate OOB accesses during loop unrolling that are later deleted.
2024-07-11 00:32:53 +02:00
Victor Chiletto
317bd46efd
vkd3d-shader/hlsl: Use a switch in validate_static_object_references().
2024-07-11 00:32:49 +02:00
Francisco Casas
daa13934a4
vkd3d-shader/d3dbc: Use vsir_program I/O signatures to write dcls.
...
Instead of relying on ctx->extern vars, semantics are now stored in the
vsir_program signatures, and then read to write the declarations.
2024-07-09 20:31:14 +02:00
Francisco Casas
704ce03561
vkd3d-shader/d3dbc: Don't require a hlsl_semantic to get register and usage.
2024-07-09 20:12:47 +02:00
Francisco Casas
003f4c7600
vkd3d-shader/d3dbc: Use program->shader_version instead of ctx->profile.
2024-07-09 20:06:23 +02:00
Francisco Casas
dd8aa2ec91
vkd3d-shader/hlsl: Generate CTAB outside d3dbc_compile().
...
There is no way to store this information from the vsir_program alone,
so we make d3dbc_compile() expect the CTAB blob.
2024-07-09 18:59:54 +02:00
Francisco Casas
130b3335cb
vkd3d-shader/d3dbc: Split hlsl_sm1_write().
...
The idea is to start splitting the
HLSL IR -> d3dbc
translation into
HLSL IR -> vsir -> d3dbc
So hlsl_sm1_write is split into two functions, sm1_generate_vsir()
which should handle the first part and d3dbc_compile() which should
handle the second part.
This translation should be completed once the hlsl_ctx and entry_func
are no longer used in d3dbc_compile().
2024-07-09 18:38:00 +02:00
Zebediah Figura
6db2bc3eff
vkd3d-shader/d3dbc: Use enum vkd3d_shader_register_type in struct sm1_instruction.
2024-07-09 16:59:02 +02:00
Nikolay Sivov
4ff288bd32
vkd3d-shader: Implement tex*() functions variants with gradient arguments.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:23:38 +02:00
Nikolay Sivov
f03cb7e911
vkd3d-shader/hlsl: Add RasterizerState type.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Nikolay Sivov
12947aa50d
vkd3d-shader/fx: Add support for writing DepthStencilState objects.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Francisco Casas
597e55691a
vkd3d-shader/hlsl: Only error out on bind_count register reservation overlaps for SM1.
...
While on SM1 a register reservation reserves the whole size in
registers of the variable's data type, overlapping conflicts are only
checked up to the bind_count (used size) for each variable.
2024-07-08 18:12:03 +02:00
Nikolay Sivov
48ff7de8ef
vkd3d-shader/hlsl: Add support for ConstantBuffer<> type.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Victor Chiletto
abbcf0461f
vkd3d-shader/hlsl: Reserve register slots for unused buffers.
2024-07-03 17:09:16 -03:00
Victor Chiletto
da36a447b8
vkd3d-shader/hlsl: Validate cbuffer register allocations.
2024-07-03 17:09:16 -03:00
Elizabeth Figura
acc9d79fbb
vkd3d-shader/hlsl: Only allocate the aligned size for uniforms.
2024-06-18 13:19:44 -05:00
Nikolay Sivov
402dc94259
vkd3d-shader/fx: Set EXPLICIT_BIND_POINT flag for packoffset() reservations as well.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-06-12 19:02:20 +02:00
Nikolay Sivov
1124ea46ee
vkd3d-shader/hlsl: Store original semantic name.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-06-11 15:53:19 +02:00
Elizabeth Figura
4355e6ca69
vkd3d-shader/hlsl: Allocate register spaces for objects.
2024-06-11 15:49:30 +02:00
Elizabeth Figura
7b61b0219e
vkd3d-shader/hlsl: Allocate register spaces for constant buffers.
2024-06-11 15:49:30 +02:00
Elizabeth Figura
28a5e23814
vkd3d-shader: Write SM5.1 register indices.
...
Separate ID and index. Allocate IDs for all external resources (but ignore them
for shader models other than 5).
2024-06-11 15:49:30 +02:00
Francisco Casas
e8dbc36bd2
vkd3d-shader/hlsl: Record default values for uniforms and constant buffers.
2024-06-11 15:46:40 +02:00
Nikolay Sivov
f090d1e80d
vkd3d-shader: Remove explicit newlines from hlsl_fixme() messages.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-23 23:12:10 +02:00
Francisco Casas
061dc39036
vkd3d-shader/hlsl: Also lower matrix swizzles and index loads in const passes.
2024-05-15 21:17:51 +02:00
Francisco Casas
4f60c7167e
vkd3d-shader/hlsl: Run constant passes in a separate function.
2024-05-15 21:17:49 +02:00
Francisco Casas
28d267b7c0
vkd3d-shader/hlsl: Allocate SM1 numeric uniforms in decreasing bind count.
2024-05-13 22:26:21 +02:00
Francisco Casas
f548644222
vkd3d-shader/hlsl: Only allocate numeric bind count for SM1 numeric uniforms.
...
Unless they have register reservations, in which case the whole
variable is still reserved.
2024-05-13 22:26:08 +02:00
Francisco Casas
573d511344
vkd3d-shader/hlsl: Track bind count according to usage for uniforms.
...
Where bind count means the number of registers required to include all
dereferences to the variable within the shader as in
hlsl_ir_var.bind_count[].
2024-05-13 22:26:07 +02:00
Francisco Casas
e0a801e796
vkd3d-shader/hlsl: Improve tracking of used components running DCE before.
...
track_object_components_usage() had to be improved to also
register derefs on resource stores.
It was not doing it because it assumed that for every resource store
there was a resource load already, which was true, before calling DCE.
2024-05-13 22:26:05 +02:00
Francisco Casas
657e460d11
vkd3d-shader/hlsl: Allocate unused variables with register reservations on SM1.
2024-05-13 22:26:03 +02:00
Zebediah Figura
c2eb563e50
vkd3d-shader/fx: Skip uniform copy logic for global variables.
2024-05-08 21:07:58 +02:00
Zebediah Figura
2480eec98b
vkd3d-shader/hlsl: Move the "base_type" member to the class-specific union.
2024-05-06 22:12:41 +02:00
Zebediah Figura
d9f7a88329
vkd3d-shader/hlsl: Make HLSL_TYPE_PIXELSHADER into a separate class.
2024-05-06 22:12:37 +02:00