Commit Graph

3699 Commits

Author SHA1 Message Date
Henri Verbeet
f866fb95ad Release 1.11. 2024-03-05 20:39:45 +01:00
Zebediah Figura
9177df883e vkd3d-shader/hlsl: Write the SFI0 section and "REQUIRES_ROVS" flag when ROVs are used. 2024-03-04 22:34:46 +01:00
Henri Verbeet
0914561f85 vkd3d: Store a D3D12_RESOURCE_DESC structure in struct vkd3d_image_resource_create_info.
Like we did before commit 6d4782ed7f. That
commit somehow managed to change the "desc" field from
D3D12_RESOURCE_DESC to D3D12_RESOURCE_DESC1, but that breaks the ABI.
2024-02-26 23:04:05 +01:00
Victor Chiletto
7e27ae73af vkd3d-shader/hlsl: Fix hlsl_ir_resource_store::resource cleanup. 2024-02-26 23:03:51 +01:00
Conor McCarthy
c083b1d0fc vkd3d-shader/dxil: Implement DX intrinsic GetDimensions. 2024-02-26 23:03:48 +01:00
Conor McCarthy
292bbdefbf vkd3d-shader/dxil: Move the resource kind helper functions up. 2024-02-26 23:03:46 +01:00
Henri Verbeet
d65f331efc configure: Build with -Wwrite-strings.
libs/vkd3d-shader/hlsl.c: In function ‘declare_predefined_types’:
libs/vkd3d-shader/hlsl.c:3408:10: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
         {"technique",    9},
          ^~~~~~~~~~~
...
programs/vkd3d-compiler/main.c: In function ‘parse_formatting’:
programs/vkd3d-compiler/main.c:303:10: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
         {"colour",  VKD3D_SHADER_COMPILE_OPTION_FORMATTING_COLOUR},
          ^~~~~~~~
...

macOS tigetstr() takes a non-const char *, so account for that as well.
2024-02-22 22:46:29 +01:00
Henri Verbeet
7029d821be configure: Build with -Wtype-limits.
libs/vkd3d-shader/tpf.c: In function ‘write_sm4_unary_op_with_two_destinations’:
libs/vkd3d-shader/tpf.c:4489:24: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     assert(1 - dst_idx >= 0);
                        ^~
libs/vkd3d-shader/tpf.c: In function ‘write_sm4_binary_op_with_two_destinations’:
libs/vkd3d-shader/tpf.c:4549:24: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     assert(1 - dst_idx >= 0);
                        ^~
2024-02-22 22:46:22 +01:00
Henri Verbeet
773f02d82f vkd3d: Disable "robustBufferAccess2" as well when we disable "robustBufferAccess".
From the validation layers: "If robustBufferAccess2 is enabled then
robustBufferAccess must also be enabled
(https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VUID-VkPhysicalDeviceRobustness2FeaturesEXT-robustBufferAccess2-04000)"
2024-02-22 22:45:46 +01:00
Conor McCarthy
ba4bd651e5 vkd3d-shader/dxil: Implement DX intrinsics SampleCmp and SampleCmpLevelZero. 2024-02-22 22:45:36 +01:00
Conor McCarthy
2330ffdeda vkd3d-shader/dxil: Implement DX intrinsics SampleBias and SampleLevel. 2024-02-22 22:45:34 +01:00
Zebediah Figura
87b1de94da vkd3d-shader/hlsl: Check the resource format for UAVs also in hlsl_types_are_equal().
Spotted by Henri Verbeet.
2024-02-22 22:45:31 +01:00
Nikolay Sivov
5474d91804 vkd3d-shader/fx: Write DepthStencilView types. 2024-02-22 22:45:27 +01:00
Nikolay Sivov
371be3b60a vkd3d-shader/hlsl: Add DepthStencilView object type. 2024-02-22 22:45:26 +01:00
Nikolay Sivov
9632adaaec vkd3d-shader/fx: Handle fx_4+ UAV types. 2024-02-22 22:45:24 +01:00
Nikolay Sivov
e5f4f60214 vkd3d-shader/fx: Handle fx_4+ texture types. 2024-02-22 22:45:23 +01:00
Nikolay Sivov
a6057a1365 vkd3d-shader/fx: Add initial support for writing object variables.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-02-22 22:45:22 +01:00
Nikolay Sivov
c2b1714c5c vkd3d-shader/hlsl: Add RenderTargetView object type.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-02-22 22:45:21 +01:00
Giovanni Mascellani
9c678532a7 vkd3d-shader/ir: Dump the domination relationship. 2024-02-22 22:45:16 +01:00
Giovanni Mascellani
04c2852c1a vkd3d-shader/ir: Compute the domination relationship. 2024-02-22 22:45:15 +01:00
Giovanni Mascellani
2573d86ccf vkd3d-shader/ir: Dump the control flow graph in the GraphViz format. 2024-02-22 22:45:14 +01:00
Giovanni Mascellani
da037b61ba vkd3d-shader/ir: Build a representation of the control flow graph. 2024-02-22 22:45:13 +01:00
Conor McCarthy
1dffc281c9 vkd3d-shader/dxil: Implement DX intrinsic RawBufferStore. 2024-02-22 22:45:08 +01:00
Conor McCarthy
cab8b781ab vkd3d-shader/dxil: Handle raw and structured buffers in sm6_parser_emit_dx_buffer_store(). 2024-02-22 22:45:07 +01:00
Conor McCarthy
ce1875c435 vkd3d-shader/dxil: Implement DX intrinsic BufferStore. 2024-02-22 22:45:06 +01:00
Petrichor Park
02a3667822 vkd3d-shader/hlsl: Implement atan and atan2.
Also narrows some more todos on the tests.
2024-02-21 23:23:13 +01:00
Petrichor Park
69294c290b vkd3d-shader/hlsl: Implement acos and asin trig intrinsics.
Tests have already been implemented in 92044d5e; this commit also reduces
the scope of some of the todos (because now they're implemented!).

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55154
2024-02-21 23:23:11 +01:00
Henri Verbeet
d4223a03c8 vkd3d-shader/hlsl: Replace HLSL_MODIFIER_RASTERIZER_ORDERED with a hlsl_type.e.resource flag. 2024-02-21 23:23:08 +01:00
Henri Verbeet
49d14613a5 vkd3d-shader/hlsl: Introduce hlsl_type.e.resource. 2024-02-21 23:23:06 +01:00
Conor McCarthy
d9c68ee481 vkd3d-shader/dxil: Handle resource descriptor additional tag/value pairs.
These are tag/value pairs, and the current code only works if an element
type or element stride pair is present at index zero.
2024-02-20 22:50:19 +01:00
Conor McCarthy
96a0685ba6 vkd3d-shader/dxil: Implement DX intrinsic AtomicCompareExchange. 2024-02-20 22:50:16 +01:00
Conor McCarthy
560c9413c3 vkd3d-shader/dxil: Implement DX intrinsic AtomicBinOp. 2024-02-20 22:50:15 +01:00
Evan Tang
7b41abaa1b vkd3d-shader/hlsl: Support SV_PrimitiveID in pixel shaders. 2024-02-19 21:12:23 +01:00
Francisco Casas
8df34fce62 vkd3d-shader/hlsl: Emit fixme on non-direct resource stores.
Co-authored-by: Giovanni Mascellani <gmascellani@codeweavers.com>

These may happen when storing to structured buffers, and we are not
handling them properly yet. The included test reaches unreacheable code
before this patch.

Storing to buffers is complicated since we need to split the index
chain in two paths:
- The path within the variable where the resource is.
- The subpath to the part of the resource element that is being stored
  to.

For now, we will emit a fixme when the index chain in the lhs is not a
direct resource access.
2024-02-19 21:12:14 +01:00
Nikolay Sivov
315b7c5a42 vkd3d-shader/fx: Do not align structured data section.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-02-19 21:12:09 +01:00
Nikolay Sivov
c107ec03b8 vkd3d-shader/fx: Add initial support for writing buffers descriptions.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-02-19 21:12:08 +01:00
Nikolay Sivov
656c068b32 vkd3d-shader/fx: Do not align strings for fx_4/fx_5 profiles.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-02-19 21:12:07 +01:00
Nikolay Sivov
d5f562d994 vkd3d-shader/fx: Use variable pointer in write_group().
The helper will need to access group annotations later, and these are
available for variables.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-02-19 21:12:05 +01:00
Francisco Casas
c249461e97 vkd3d-shader/hlsl: Parse Buffer types. 2024-02-19 21:11:55 +01:00
Francisco Casas
e1c759e1c9 vkd3d-shader/hlsl: Record valid methods in object_methods[].
Also, call hlsl_sampler_dim_count() and hlsl_offset_dim_count() after
type checking, to avoid reaching unreacheable cases.
2024-02-19 21:11:46 +01:00
Evan Tang
ee867bd470 vkd3d-shader/hlsl: Parse rasteriser-ordered view types. 2024-02-15 23:29:46 +01:00
Francisco Casas
e3ed5ac77e vkd3d-shader/hlsl: Lower casts to int for SM1. 2024-02-15 23:29:39 +01:00
Francisco Casas
4b5c7e3721 vkd3d-shader/d3dbc: Implement casts from ints to floats as a MOV.
For temporary registers, SM1-SM3 integer types are internally
represented as floating point, so, in order to perform a cast
from ints to floats we need a mere MOV.

For constant integer registers "iN" there is no operation for casting
from a floating point register to them. For address registers "aN", and
the loop counting register "aL", vertex shaders have the "mova" operation
but we haven't used these registers in any way yet.

We probably would want to introduce these as synthetic variables
allocated in a special register set. In that case we have to remember to
use MOVA instead of MOV in the store operations, but they shouldn't be src
or dst of CAST operations.

Regarding constant integer registers, in some shaders, constants are
expected to be received formatted as an integer, such as:

    int m;
    float4 main() : sv_target
    {
        float4 res = {0, 0, 0, 0};

        for (int k = 0; k < m; ++k)
            res += k;
        return res;
    }

which compiles as:

    // Registers:
    //
    //   Name         Reg   Size
    //   ------------ ----- ----
    //   m            i0       1
    //

    ps_3_0
    def c0, 0, 1, 0, 0
    mov r0, c0.x
    mov r1.x, c0.x
    rep i0
      add r0, r0, r1.x
      add r1.x, r1.x, c0.y
    endrep
    mov oC0, r0

but this only happens if the integer constant is used directly in an
instruction that needs it, and as I said there is no instruction that
allows converting them to a float representation.

Notice how a more complex shader, that performs operations with this
integer variable "m":

    int m;
    float4 main() : sv_target
    {
        float4 res = {0, 0, 0, 0};

        for (int k = 0; k < m * m; ++k)
            res += k;
        return res;
    }

gives the following output:

    // Registers:
    //
    //   Name         Reg   Size
    //   ------------ ----- ----
    //   m            c0       1
    //

    ps_3_0
    def c1, 0, 0, 1, 0
    defi i0, 255, 0, 0, 0
    mul r0.x, c0.x, c0.x
    mov r1, c1.y
    mov r0.y, c1.y
    rep i0
      mov r0.z, r0.x
      break_ge r0.y, r0.z
      add r1, r0.y, r1
      add r0.y, r0.y, c1.z
    endrep
    mov oC0, r1

Meaning that the uniform "m" is just stored as a floating point in
"c0", the constant integer register "i0" is just set to 255 (hoping
it is a high enough value) using "defi", and the "break_ge"
involving c0 is used to break from the loop.

We could potentially use this approach to implement loops from SM3
without expecting the variables being received as constant integer
registers.

According to the D3D documentation, for SM1-SM3 constant integer
registers are only used by the 'loop' and 'rep' instructions.
2024-02-15 23:29:37 +01:00
Conor McCarthy
6d4782ed7f vkd3d: Implement ID3D12Resource2. 2024-02-15 23:29:33 +01:00
Conor McCarthy
4668271872 vkd3d: Return DXGI_ERROR_NOT_FOUND from GetProtectedResourceSession(). 2024-02-15 23:29:32 +01:00
Conor McCarthy
6e634ad690 vkd3d-shader: Raise the instruction parameter allocation size if necessary.
Monolithic switch instructions have no definite case count limit.
2024-02-14 21:48:38 +01:00
Conor McCarthy
55c28e94f8 vkd3d-shader/dxil: Check for src param allocation failure in sm6_parser_emit_vselect(). 2024-02-14 21:48:32 +01:00
Conor McCarthy
c89627ec73 vkd3d-shader/dxil: Check for src param allocation failure in sm6_parser_emit_store(). 2024-02-14 21:48:31 +01:00
Conor McCarthy
4c7d956bdb vkd3d-shader/dxil: Check for src param allocation failure in sm6_parser_emit_load(). 2024-02-14 21:48:30 +01:00
Conor McCarthy
04a9340164 vkd3d-shader/dxil: Check for src param allocation failure in sm6_parser_emit_extractval(). 2024-02-14 21:48:28 +01:00