Currently we are not properly handling register(cX) reservations for SM1, this is one of the things required for the SNK shaders (CW Bug Bug 18092).
register(cX) reservations also change the offset in the $Globals buffer in SM4, so support for this is also included.
---
Patch 1/4 is required to specify:
```
[require]
shader model < 4.0
```
so that the tests that follow do not get run with the vulkan backend on SM4. I think nobody disagreed with that patch.
--
v4: vkd3d-shader/hlsl: Turn register(cX) reservations into buffer offset for SM4.
vkd3d-shader/hlsl: Make register(cX) reservations work for SM1.
tests: Test register(cX) reservations.
tests: Rename register-reservations.shader_test to register-reservations-resources.shader_test.
tests/vkd3d-shader: Allow passing (sm<4) and (sm>=4) to "fail" and "todo" qualifiers.
tests/shader-runner: Discern between the minimum_shader_model and the selected_shader_model.
tests/shader-runner: Add missing requirement checks for backends.
ci: Execute the shader runner on the correct test data on Windows.
ci: Deduplicate the CI configuration for Windows.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/458
--
v13: vkd3d-shader/spirv: Avoid invalid bool-to-bool conversion in spirv_compiler_emit_movc().
vkd3d-shader/dxil: Implement the DXIL VSELECT instruction.
tests/shader-runner: Add tests for 64-bit casts.
vkd3d-shader/spirv: Return an error if an invalid handler is encountered.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/459
--
v3: dmsynth: Use FLUID_MOD_KEY for CONN_SRC_KEYNUMBER.
dmsynth: Fall back to the Standard drum set when there is no matching instrument or region.
dmsynth: Factor out instrument and region search.
dmsynth: Get rid of instrument reference counting.
dmsynth: Move instrument search to synth_preset_noteon().
https://gitlab.winehq.org/wine/wine/-/merge_requests/4375
Recent change to make unixlibs use hidden visibility made DECLSPEC_EXPORT being used in more cases. This means that it's used for PE modules as well, which is meant to be ignored since we use .spec files and winebuild-generated .edata anyway. This has some side effects:
- LLD correctly ignores dllexport when it detects .edata presence, but it also issues a warning:
`lld-link: warning: literal .edata sections override exports`
- AFAIR (I didn't verify), GNU LD would still generate its own .edata entries, but the one provided by winebuild will be actually used by PE header
- non-mingw builds will use default visibility for those symbols in PE modules
--
v2: include: Don't use dllexport attribute for Wine PE modules.
https://gitlab.winehq.org/wine/wine/-/merge_requests/4401
Recent change to make unixlibs use hidden visibility made DECLSPEC_EXPORT being used in more cases. This means that it's used for PE modules as well, which is meant to be ignored since we use .spec files and winebuild-generated .edata anyway. This has some side effects:
- LLD correctly ignores dllexport when it detects .edata presence, but it also issues a warning:
`lld-link: warning: literal .edata sections override exports`
- AFAIR (I didn't verify), GNU LD would still generate its own .edata entries, but the one provided by winebuild will be actually used by PE header
- non-mingw builds will use default visibility for those symbols in PE modules
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/4401
Goes atop !459. The last five commits belong to this MR.
--
v4: vkd3d-shader/dxil: Implement the DXIL LOAD instruction.
vkd3d-shader/dxil: Implement the DXIL GEP instruction.
vkd3d-shader/dxil: Support global variable initialisers.
vkd3d-shader/dxil: Introduce a value type for immediate constant buffers.
vkd3d-shader/dxil: Implement default address space global variables.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/471
So far this MR is just for experimentation, do not review it.
--
v11: ci: Execute the shader runner on the correct test data on Windows.
ci: Deduplicate the CI configuration for Windows.
Test.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/474
Recent versions of Native Instruments Kontakt 7 introduced some additional HiDPI features. To do this, Kontakt calls 2 functions in `user32.dll` that Wine hasn't implemented yet: `GetWindowDpiHostingBehavior` and `SetThreadDpiHostingBehavior`. This patch adds stubs for these 2 functions and apparently that's enough for Kontakt.
This is my first contribution to Wine, I'm not 100% sure if everything is like it should be.
--
v2: user32: Add stubs for GetWindowDpiHostingBehavior and SetThreadDpiHostingBehavior
https://gitlab.winehq.org/wine/wine/-/merge_requests/4373
On Wed Nov 15 06:54:38 2023 +0000, Henri Verbeet wrote:
> > This needs spirv changes to make any tests pass, but this series is
> already long enough. Not sure what to do about initialisers; we can't
> use `DCL_IMMEDIATE_CONSTANT_BUFFER` because it emits a variable,
> Is the issue purely that the shader may write to the variable, or are
> there other reasons that can't work? If what we want is essentially a
> writeable icb, we could perhaps consider adding a "data[]" field to the
> vkd3d_shader_indexable_temp structure, analogous to struct vkd3d_shader_immediate_constant_buffer.
What it really needed was a new value type to hold ICBs. Storing an ICB in the indexable temp declaration works well now. Constant arrays should be declared with `DCL_IMMEDIATE_CONSTANT_BUFFER`, but that must wait for the next MR. It's not broken, just ignores the constant attribute.
--
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/471#note_52336
--
v12: vkd3d-shader/spirv: Avoid invalid bool-to-bool conversion in spirv_compiler_emit_movc().
vkd3d-shader/dxil: Implement the DXIL VSELECT instruction.
tests/shader-runner: Add tests for 64-bit casts.
vkd3d-shader/spirv: Return an error if an invalid handler is encountered.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/459
This MR improves driver support for scaled HiDPI displays, by respecting the application/window DPI.
Since we don't support per-monitor DPI information and awareness modes yet, the user should set the Wine system DPI to match the DPI/scale of the display the app will be running on, for best results.
Here is how things look with a few scenarios:
1. Screen scaled at 2x, application at 96dpi (e.g., dpi unaware apps) => the compositor automatically scales the surface:

2. Screen scaled at 2x, application at 192dpi (dpi matches compositor scale) => no compositor scaling:

3. Screen scaled at 1x, application at 96dpi (dpi matches compositor scale) => no compositor scaling:

4. Screen scaled at 1x, application at 192dpi, not typically used, just wanted to show what happens with such a mismatch:

Thanks!
--
v4: winewayland.drv: Ignore spurious size hints.
winewayland.drv: Present cursors with the correct scale.
winewayland.drv: Refactor cursor code to prepare for scaling support.
winewayland.drv: Present surfaces with the correct scale.
winewayland.drv: Prepare to handle different coordinate spaces.
https://gitlab.winehq.org/wine/wine/-/merge_requests/4203
First part of a series that allows the shader-runner to test SM1 compilation on [shader] directives even if a backend to run these tests is not available and prepare they way for SM1-only tests.
Specifically:
- Compile [shader] directives separately from backend execution (on part 1).
- Allow specifying more detailed shader ranges for todo(), fail() and notimpl() qualifiers (on part 2).
- Always test shader compilation with SM1 profiles (on part 2).
The `minimum_shader_model` and `maximum_shader_model` parameters for run_shader_tests() are interpreted in the following way:
> Ask the pertaining backend to run the shader_test file so that each test is executed with the lowest profile it can support within the range of shader models specified, if any.
This allows us to control how many shader models we want to test for each backend, e.g.:
```
run_shader_tests(..., SHADER_MODEL_2_0, SHADER_MODEL_3_0)
run_shader_tests(..., SHADER_MODEL_4_0, SHADER_MODEL_5_1)
run_shader_tests(..., SHADER_MODEL_6_0, SHADER_MODEL_6_0)
```
versus
```
for (i = SHADER_MODEL_2_0, i <= SHADER_MODEL_6_0, ++i)
run_shader_tests(..., i, i);
```
Also, to allow to compile [shader] directives, which are not backend-specific, separately from the [test] directives, which are, the run_shader_tests() function is modified to skip backend specific directives if the shader_runner_ops is NULL.
Following patches are on my [master6i](https://gitlab.winehq.org/fcasas/vkd3d/-/commits/master6i) branch.
--
v3: tests/shader-runner: Compile [shader] directives separately from backend execution.
tests/shader-runner: Execute runner for many shader model ranges if it supports it.
tests/shader-runner: Discern between the minimum_shader_model and the selected_shader_model.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/418
Basically, @giomasce proposal of specifying shader models for tests individually.
Supersedes !418.
---
To make the shader_runner expressive enough to handle SM1 and SM6 shader
models on tests, we need to intercept the shader model ranges for which
we want to run the tests with the ranges that each backend is capable of
running, this is complicated.
So, to make it more clear, the test's shader models are specified
individually, and runner->minimum_shader_model and
runner->maximum_shader_model are replaced with just
runner->current_shader_model.
The supported ranges are removed from the backends (except for d3d12, which handles them internally)
and their check_requirements functions is always assumed to exist and
return either true or false for just a single shader model.
Something that must be kept in mind with these changes is that if two
tests with different shader models rely on the same resources, these
resources must be either specified twice, or after a [require] directive
that includes all the pertaining models. This was necessary for
gather.shader_test and gather-offset.shader_test.
---
The following patches would change:
```
run_compilation_tests(SHADER_MODEL_4_0, SHADER_MODEL_5_1, NULL);
```
to
```
run_compilation_tests(SHADER_MODEL_2_0, SHADER_MODEL_5_1, NULL);
```
for Unix and non-cross builds, so we can test SM1 compilation even if we don't have a backend available that can actually run the tests. Some improvements to the qualifiers are required before that, to mark sm1 todos properly.
Once we have a proper SM1 runner, maybe we could get rid of run_compilation_tests().
--
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/434
--
v11: vkd3d-shader/spirv: Avoid invalid bool-to-bool conversion in spirv_compiler_emit_movc().
vkd3d-shader/dxil: Implement the DXIL VSELECT instruction.
tests/shader-runner: Add tests for 64-bit casts.
vkd3d-shader/spirv: Return an error if an invalid handler is encountered.
tests/shader-runner: Add a test for float comparisons.
tests/shader-runner: Run d3d11 tests with a mimimum shader model of 4.0.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/459
> I'm currently out and haven't had a chance to properly look at this, but, how does this interact with resource arrays?
Resource arrays should work as long as they're not dynamically indexed. (And the ps_5_1 test exercises that path.) Dynamic indexing of resource arrays can't work with combined samplers; there's essentially no way to create the required combined samplers in either the OpenGL or Vulkan APIs, and it's not clear what that would even look like.
There's perhaps an unresolved question of how to handle that if we do run into it in the scanner. The current behaviour is to return the base index for such accesses; an argument could be made for either not recording them at all, or e.g. setting some flag in the vkd3d_shader_combined_resource_sampler_info structure to indicate dynamic indexing is involved. Ultimately such shaders just aren't going to be usable with combined samplers though.
--
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/466#note_52254
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
--
v9: vkd3d-shader/tpf: Initial support for writing fx_4_0/fx_4_1 binaries.
vkd3d-shader: Add separate binary target type for effects.
vkd3d-shader/hlsl: Handle effect group statement.
vkd3d-shader/hlsl: Add variables for techniques.
vkd3d-shader/hlsl: Rename rule for top-level techniques.
vkd3d-shader/hlsl: Add 'fxgroup' token.
tests: Add some tests for effects groups syntax.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/443
Currently we are not properly handling register(cX) reservations for SM1, this is one of the things required for the SNK shaders (CW Bug Bug 18092).
register(cX) reservations also change the offset in the $Globals buffer in SM4, so support for this is also included.
---
Patch 1/4 is required to specify:
```
[require]
shader model < 4.0
```
so that the tests that follow do not get run with the vulkan backend on SM4. I think nobody disagreed with that patch.
--
v3: vkd3d-shader/hlsl: Turn register(cX) reservations into buffer offset for SM4.
tvkd3d-shader/hlsl: Make register(cX) reservations work for SM1.
tests: Test register(cX) reservations.
tests: Rename register-reservations.shader_test to register-reservations-resources.shader_test.
tests/vkd3d-shader: Allow passing (sm<4) and (sm>=4) to "fail" and "todo" qualifiers.
tests/shader-runner: Discern between the minimum_shader_model and the selected_shader_model.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/458
On Tue Nov 14 11:01:46 2023 +0000, Rémi Bernon wrote:
> Hmm, right but does FluidSynth support such things? I had the impression
> (but haven't confirmed it in any way) that they have dedicated
> generators for some often used connections and that these were not
> supposed to be set through fluid_mod. So, under that assumption a custom
> connection to link SRC_KEYNUMBER -> DST_EG1_DECAYTIME would not be
> possible to map?
Looking a bit more into FS, it seems possible that it actually supports this, with fluid_voice_modulate updating generators "mod" value (used in fluid_voice_gen_value return) and calling fluid_voice_update_param, which calls calculate_hold_decay_buffers.
In this case would it be simpler for our mapping to use mods for everything instead of setting it through these special generators?
Anyway, for the fixups I think we could have a list of `fluid_mod` to apply like this, using `fluid_mod_test_identity` to replace identical mod entries:
```c
struct mod_entry
{
struct list entry;
fluid_mod_t *mod;
};
```
And if we can use mods for most generators, I can even imagine having an additional `int mode` field to keep at most one `FLUID_VOICE_OVERWRITE` and one `FLUID_VOICE_ADD` mod of each, translating and de-duplicating / fixing up all articulations at once, then adding the resulting mod list to the voice in a separate step.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/4375#note_52231
On Tue Nov 14 10:43:53 2023 +0000, Anton Baskanov wrote:
> DLS2 spec has a table of fixed routing connections that must be
> supported, but also mentions that implementations are free to support
> other connections as well.
> Imagine a DLS file that has a SRC_KEYNUMBER->DST_EG1_DECAYTIME
> connection with a controller. It would require a dynamic offset
> adjustment based on the controller value. And there could be multiple
> such connections, each with a different controller.
Hmm, right but does FluidSynth support such things? I had the impression (but haven't confirmed it in any way) that they have dedicated generators for some often used connections and that these were not supposed to be set through fluid_mod. So, under that assumption a custom connection to link SRC_KEYNUMBER -> DST_EG1_DECAYTIME would not be possible to map?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/4375#note_52212
On Tue Nov 14 10:00:34 2023 +0000, Rémi Bernon wrote:
> What do you mean by arbitrary connections?
DLS2 spec has a table of fixed routing connections that must be supported, but also mentions that implementations are free to support other connections as well.
Imagine a DLS file that has a SRC_KEYNUMBER->DST_EG1_DECAYTIME connection with a controller. It would require a dynamic offset adjustment based on the controller value. And there could be multiple such connections, each with a different controller.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/4375#note_52209
On Tue Nov 14 09:21:35 2023 +0000, Anton Baskanov wrote:
> > Although they look fine, 20ab5954 (and ec219ce1 even more) cut some
> notes early in FF VIII intro.
> Looks like note-off queuing for DMUS_PMSGT_NOTE needs to be handled
> differently. I'll drop these for now.
> > Haven't really looked into the details but 0ff26da7 feels a bit
> complicated, I'm wondering if there's a better way to do this.
> It depends on whether we need to support arbitrary connections.
> > Regarding 2e226c26, is this what native does?
> Yes, there is no fallback for melodic instruments for some reason, only
> for drums. Though now I see that I handle missing regions incorrectly
> (these should also fall back to Standard). I'll update the request.
> I was also thinking about adding some tests, though I'm not sure how to
> compare the output. The generated waveforms are quite different (e.g.
> native produces a linear attack slope with some discrete steps, while
> FluidSynth produces a smooth exponential one).
> 
The attack time looks different but were it the same I think the shape difference can be ignored by having some leeway in the test. I added a couple of similar tests for MF audio transform output where we check that the total sample diff does not exceed a small percentage of the total, maybe reusing it here can work.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/4375#note_52207
On Tue Nov 14 09:21:35 2023 +0000, Anton Baskanov wrote:
> If we don't need to support arbitrary connections, then yes, your
> proposed solution looks like the way to go.
> I don't currently plan to add more fixups.
What do you mean by arbitrary connections?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/4375#note_52206
> Although they look fine, 20ab5954 (and ec219ce1 even more) cut some notes early in FF VIII intro.
Looks like note-off queuing for DMUS_PMSGT_NOTE needs to be handled differently. I'll drop these for now.
> Haven't really looked into the details but 0ff26da7 feels a bit complicated, I'm wondering if there's a better way to do this.
It depends on whether we need to support arbitrary connections.
> Regarding 2e226c26, is this what native does?
Yes, there is no fallback for melodic instruments for some reason, only for drums. Though now I see that I handle missing regions incorrectly (these should also fall back to Standard). I'll update the request.
I was also thinking about adding some tests, though I'm not sure how to compare the output. The generated waveforms are quite different (e.g. native produces a linear attack slope with some discrete steps, while FluidSynth produces a smooth exponential one).

--
https://gitlab.winehq.org/wine/wine/-/merge_requests/4375#note_52200
On Mon Nov 13 13:16:56 2023 +0000, Rémi Bernon wrote:
> Instead of a dynamic list, could we have just a simple structure like:
> ```c
> struct gen_increments
> {
> float env_hold;
> float env_decay;
> float vol_hold;
> float vol_decay;
> };
> ```
> Which we would pass around down to `add_mod_from_connection` which would
> set the needed adjustments (it's actually only needed there,
> `set_gen_from_connection` won't have to add increments), and then after
> the loops we would call `fluid_voice_gen_incr` for each of these?
> Or do we need the generic version for more fixups that are not in this MR?
If we don't need to support arbitrary connections, then yes, your proposed solution looks like the way to go.
I don't currently plan to add more fixups.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/4375#note_52199
`sysconf(_SC_PHYS_PAGES)` returns an error for i386 Mac binaries on any machine with more than 4 GB of RAM. From [the source code](https://github.com/apple-oss-distributions/Libc/blob/c5a3293354e22262… it's clear why--it calls `sysctlbyname()` to put the `hw.memsize` sysctl into a long, which is only 32-bits on i386. This returns an error on any Mac with more than 4GB: the value is too large for a 32-bit long.
The `sysctl` man page documents that an int64 should be used for `hw.memsize`, do that and divide by the page size ourselves.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/4384
On Mon Nov 13 21:02:03 2023 +0000, Alexandre Julliard wrote:
> > Well, I target the parts where the folders are created, where else
> could I handle it? I currently don't see a better way to do this. Mind
> pointing me into the direction of a better design?
> I don't mean the code, I mean the UI design.
> As you point out, this can be configured from winecfg. So why do we need
> a separate mechanism, with an ad-hoc environment variable? Why is it
> only usable at prefix creation? Is there a way to unify the features, or
> make them easier to use? How is it different from `winetricks sandbox`?
> etc. etc.
Not sure this is the right place to discuss this, but the problem with winecfg is that the config is stored inside the WINEPREFIX. Every new WINEPREFIX would need to be configured again, since you (currently) can't have a global config. Similar issue with `winetricks sandbox`, you need to remember to do it in every new WINEPREFIX. I'm testing a lot of applications, and they often tend to put files into Documents and similar folders, and I want to prevent that. But since I regularly delete my WINEPREFIX, that config currently can't be permanent.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/3259#note_52188
--
v10: vkd3d-shader/spirv: Avoid invalid bool-to-bool conversion in spirv_compiler_emit_movc().
vkd3d-shader/dxil: Implement the DXIL VSELECT instruction.
tests/shader-runner: Add tests for 64-bit casts.
vkd3d-shader/spirv: Return an error if an invalid handler is encountered.
tests/shader-runner: Add a test for float comparisons.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/459