I just realized one more thing. I think we are not properly following the specification for both sample_l and sample_b.
In the **Restrictions** section of the documentation for sample_b it is mentioned that the last src register must use a single component selector if it is not a scalar immediate. This "select_component" is also ilustrated in the sample_l format:
```
sample_l[_aoffimmi(u,v,w)] dest[.mask], srcAddress[.swizzle], srcResource[.swizzle], srcSampler, srcLOD.select_component
```
Currently, we are not respecting that since sm4_src_from_node() sets
```
src->swizzle_type = VKD3D_SM4_SWIZZLE_VEC4;
```
by default.
It should be VKD3D_SM4_SWIZZLE_SCALAR in this case.
If I am not mistaken, a simple:
```
instr.srcs[3].swizzle_type = VKD3D_SM4_SWIZZLE_SCALAR;
```
after calling sm4_src_from_node() should do. The disassembly should show a single component in the swizzle of the last src register.
--
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/188#note_31568
On Fri Apr 28 21:50:24 2023 +0000, Francisco Casas wrote:
> Currently, there doesn't exist a `[test todo]` Section for the
> shader_runner.
> This only seems to work (in this incomplete stage) because the
> shader_runner is handling the section the same as the previous one,
> `[pixel shader todo]`.
> The proper way to write this part is:
> ```
> [test]
> todo draw quad
> todo probe all rgba (0.25, 0, 0.25, 0)
> ```
> and remove the `todo`s in the next commit.
Done!
--
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/188#note_31566
From what I can tell, the recent work on SampleBias/SampleLevel did all of the work for us, we just need to take the same framework and include the case for the `sample_l` instruction.
Tested with some shaders from the native Linux version of Little Racers STREET.
--
v3: vkd3d-shader/tpf: Add support for emitting sample_l instructions
tests: Add a test for SampleLevel() function.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/188
From what I can tell, the recent work on SampleBias/SampleLevel did all of the work for us, we just need to take the same framework and include the case for the `sample_l` instruction.
Tested with some shaders from the native Linux version of Little Racers STREET.
--
v2: vkd3d-shader/tpf: Add support for emitting sample_l instructions
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/188
From what I can tell, the recent work on SampleBias/SampleLevel did all of the work for us, we just need to take the same framework and include the case for the `sample_l` instruction.
Tested with some shaders from the native Linux version of Little Racers STREET.
--
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/188
~~This one's marked as a draft, as there seems to be a blocker with the method parameters.~~
~~The first commit totally works, _if_ the ddx/ddy parameters are literals - they do _not_ work when passing a variable of any kind. The test comes from tests/d3d12.c, so I'm mostly just trying to migrate that to the HLSL test suite, but it currently hits an assert before we get to the resource load (which does eventually work) and I'm not sure what's causing it:~~
```
vkd3d-compiler: libs/vkd3d-shader/tpf.c:3190: sm4_register_from_node: Assertion `instr->reg.allocated' failed.
```
~~Seems like it's surprised when we try to load from the constant buffer maybe?~~ Fixed!
--
v6: tests: Add a basic compilation test for SampleGrad() method.
vkd3d-shader/hlsl: Add support for SampleGrad() method
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/184
On Fri Apr 28 14:26:01 2023 +0000, Ethan Lee wrote:
> Understood, test has been pushed!
40 isn't that bad, no. Our trigonometry tests do far worse.
I'm not particularly surprised that derivatives aren't very accurate anyway.
--
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/179#note_31550