Commit Graph

4583 Commits

Author SHA1 Message Date
Giovanni Mascellani
5cb17cfd1c vkd3d-shader/ir: Validate IFC instructions. 2023-11-20 22:07:36 +01:00
Giovanni Mascellani
849a8f3add vkd3d-shader/ir: Expect two sources for LOOP in SM1-3. 2023-11-20 22:07:35 +01:00
Henri Verbeet
73c563ffb7 vkd3d-shader/d3dbc: Adjust the token count for DEF and DEFI instructions in shader_sm1_skip_opcode().
This was broken by commit e390bc35e2c9b0a2110370f916033eea2366317e; that
commit fixed the source count for these instructions, but didn't adjust
shader_sm1_skip_opcode(). Note that this only affects shader model 1;
later versions have a token count embedded in the initial opcode token.
2023-11-20 22:07:29 +01:00
Nikolay Sivov
e55b6a7fa1 vkd3d-shader/hlsl: Add constants to the block for log()/log10() builtins. 2023-11-20 22:07:24 +01:00
Akihiro Sagawa
aed2d142cf vkd3d-shader/hlsl: Add degrees() function. 2023-11-20 22:07:19 +01:00
Akihiro Sagawa
e493627130 vkd3d-shader/hlsl: Add radians() function. 2023-11-20 22:07:17 +01:00
Nikolay Sivov
88caf87789 vkd3d-shader/hlsl: Add a helper to check for a numeric type. 2023-11-15 21:48:49 +01:00
Conor McCarthy
76eb0adf03 vkd3d: Support depth bounds test. 2023-11-15 21:48:45 +01:00
Conor McCarthy
63b8972b0e tests: Test CreatePipelineState().
Based on vkd3d-proton patches by Hans-Kristian Arntzen and Philip
Rebohle.
2023-11-15 21:48:44 +01:00
Conor McCarthy
d8ba0d2a11 vkd3d: Implement ID3D12Device2::CreatePipelineState(). 2023-11-15 21:48:44 +01:00
Conor McCarthy
6196199a89 vkd3d: Use struct d3d12_pipeline_state_desc for compute pipelines. 2023-11-15 21:48:44 +01:00
Conor McCarthy
39afbb8e32 vkd3d: Introduce struct d3d12_pipeline_state_desc for graphics pipelines.
A generic container for both compute and graphics pipeline descriptions
to facilitate reading the description from a stream.
2023-11-15 21:48:42 +01:00
Conor McCarthy
529c0f46b0 include: Add a D3D12_RT_FORMAT_ARRAY typedef.
For consistency with how other D3D12_* structs are declared.
2023-11-15 21:48:41 +01:00
Conor McCarthy
fb588b8d1a vkd3d-shader/spirv: Avoid invalid bool-to-bool conversion in spirv_compiler_emit_movc().
Shaders parsed from DXIL contain a bool condition register, so calling
spirv_compiler_emit_int_to_bool() results in an invalid bool/uint
comparison.
2023-11-15 21:48:36 +01:00
Conor McCarthy
3c4631a4d4 vkd3d-shader/dxil: Implement the DXIL VSELECT instruction. 2023-11-15 21:48:35 +01:00
Conor McCarthy
130e7bdf0f tests/shader-runner: Add tests for 64-bit casts. 2023-11-15 21:48:33 +01:00
Conor McCarthy
08b8730866 vkd3d-shader/spirv: Return an error if an invalid handler is encountered.
Prevents return of an invalid SPIR-V module.
2023-11-15 21:48:31 +01:00
Conor McCarthy
38e85079aa tests/shader-runner: Add a test for float comparisons. 2023-11-15 21:48:30 +01:00
Conor McCarthy
d957247c67 tests/shader-runner: Run d3d11 tests with a mimimum shader model of 4.0.
Passing less than 4.0 breaks the use of [require] with
'shader model < 4.0'.
2023-11-15 21:48:28 +01:00
Henri Verbeet
b7480911a8 build: Make doxygen output slightly less verbose.
There is perhaps a bit of a trade-off involved here, but with the
current state of things it's fairly hard to notice unexpected issues in
the output.
2023-11-14 23:06:49 +01:00
Conor McCarthy
408f67c69c vkd3d-shader/dxil: Handle missing flags as zero for CMP2.
The flag operand is omitted if IEEE strictness is specified.
2023-11-14 23:06:43 +01:00
Conor McCarthy
f1e9f40061 vkd3d-shader/dxil: Handle missing flags as zero for BINOP.
The flag operand is omitted if IEEE strictness is specified.
2023-11-14 23:06:41 +01:00
Henri Verbeet
9de793f180 vkd3d-shader: Implement scanning combined resource/sampler information. 2023-11-13 23:19:23 +01:00
Nikolay Sivov
d190fdf8c5 vkd3d-shader/dxil: Fully initialize instruction data in sm6_parser_emit_extractval().
Noticed after test runner started crashing when tracing is enabled.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-13 23:19:18 +01:00
Nikolay Sivov
e7422fdefb vkd3d: Fix some spelling mistakes. 2023-11-13 23:19:15 +01:00
Nikolay Sivov
3203485a7c vkd3d-shader: Fix some spelling mistakes. 2023-11-13 23:19:15 +01:00
Nikolay Sivov
41a72a4eae tests: Fix some spelling mistakes. 2023-11-13 23:19:14 +01:00
Henri Verbeet
215a2c4ede vkd3d-shader/ir: Introduce vsir_register_is_descriptor(). 2023-11-13 23:19:10 +01:00
Conor McCarthy
22960753e9 vkd3d-shader/spirv: Introduce orderedness to comparison instructions. 2023-11-10 20:23:51 +01:00
Conor McCarthy
d3b90cc877 vkd3d-shader/dxil: Implement the DXIL CMP2 instruction. 2023-11-10 20:23:50 +01:00
Conor McCarthy
1dd141535c vkd3d-shader/spirv: Support bool dst register in spirv_compiler_emit_comparison_instruction(). 2023-11-10 20:23:48 +01:00
Nikolay Sivov
418c177a1b vkd3d-shader/hlsl: Implement texCUBEproj().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-10 20:23:44 +01:00
Nikolay Sivov
81ff57e07c vkd3d-shader/hlsl: Implement tex3Dproj().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-10 20:23:43 +01:00
Nikolay Sivov
dd6a9135f4 vkd3d-shader/hlsl: Implement tex2Dproj().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-10 20:23:41 +01:00
Giovanni Mascellani
0c5c18bdce vkd3d-shader/ir: Validate index count for IMMCONST64 registers. 2023-11-09 21:15:51 +01:00
Giovanni Mascellani
b74470b9d2 vkd3d-shader/ir: Validate index count for IMMCONST registers. 2023-11-09 21:15:49 +01:00
Giovanni Mascellani
c867682982 vkd3d-shader/ir: Validate index count for NULL registers. 2023-11-09 21:15:47 +01:00
Giovanni Mascellani
12fcb8dcc6 vkd3d-shader/ir: Validate register indices. 2023-11-09 21:15:44 +01:00
Giovanni Mascellani
b7aeb5dd70 vkd3d-shader/ir: Use vsir_register_init() to initialize a register. 2023-11-09 21:15:42 +01:00
Giovanni Mascellani
a869069a48 vkd3d-shader/ir: Validate the TEMP register indices in each HS phase. 2023-11-09 21:15:40 +01:00
Giovanni Mascellani
0f4bda9c9d vkd3d-shader/ir: Keep track of hull shader phases. 2023-11-09 21:15:38 +01:00
Conor McCarthy
5768c019c1 vkd3d-shader/ir: Check the handler before changing it to NOP in remove_dead_code(). 2023-11-09 21:15:29 +01:00
Zebediah Figura
ade8899456 vkd3d-shader/hlsl: Use hlsl_types_are_equal() in func_decl_matches().
Besides reusing code, this now handles UAV types correctly.
2023-11-09 21:15:21 +01:00
Zebediah Figura
8f041fbe6f vkd3d-shader/hlsl: Return bool from compare_function_decl(). 2023-11-09 21:15:19 +01:00
Zebediah Figura
fef118555c vkd3d-shader/hlsl: Do not prioritize an exact match when looking up functions.
Native does not always do this. For example, functions whose parameters are
float and float1 always result in an "ambiguous function call" error.

This does not fix any tests, because the relevant tests previously (incorrectly)
succeeded, and now fail with:

E5017: Aborting due to not yet implemented feature: Prioritize between multiple compatible function overloads.

when they should simply fail.
2023-11-09 21:15:17 +01:00
Zebediah Figura
514d179b70 vkd3d-shader/hlsl: Do not consider scalars and 1-dimensional vectors to be equivalent in function parameters. 2023-11-09 21:15:14 +01:00
Zebediah Figura
b1c2852cd7 vkd3d-shader/hlsl: Store function overloads in a list.
The choice to store them in an rbtree was made early on. It does not seem likely
that HLSL programs would define many overloads for any of their functions, but I
suspect the idea was rather that intrinsics would be defined as plain
hlsl_ir_function_decl structures [cf. 447463e590]
and that some intrinsics that could operate on any type would therefore need
many overrides.

This is not how we deal with intrinsics, however. When the first intrinsics were
implemented I made the choice disregard this intended design, and instead match
and convert their types manually, in C. Nothing that has happened in the time
since has led me to question that choice, and in fact, the flexibility with
which we must accommodate functions has led me to believe that matching in this
way was definitely the right choice. The main other designs I see would have
been:

* define each intrinsic variant separately using existing HLSL types. Besides
  efficiency concerns (i.e. this would take more space in memory, and would take
  longer to generate each variant), the normal type-matching rules don't really
  apply to intrinsics.

  [For example: elementwise intrinsics like abs() return the same type as the
  input, including preserving the distinction between float and float1. It is
  legal to define separate HLSL overloads taking float and float1, but trying to
  invoke these functions yields an "ambiguous function call" error.]

* introduce new (semi-)generic types. This is far more code and ends up acting
  like our current scheme (with helpers) in a slightly more complex form.

So I think we can go ahead and rip out this vestige of the original design for
intrinsics.

As for why to change it: rbtrees are simply more complex to deal with, and it
seems unlikely to me that the difference is going to matter. I do not expect any
program to define large quantities of intrinsics; linked list search should be
good enough.
2023-11-09 21:15:11 +01:00
Zebediah Figura
2b59a759d5 vkd3d-shader/hlsl: Rename hlsl_get_func_decl() to hlsl_get_first_func_decl(). 2023-11-09 21:15:09 +01:00
Zebediah Figura
3e35570221 tests: Add some more tests for function overloads. 2023-11-09 21:15:08 +01:00
Zebediah Figura
011e31f624 vkd3d-shader/spirv: Remove no longer used private_output_variable_array_idx array. 2023-11-09 21:15:01 +01:00