I tried replacing Wine’s built-in DLLs with the d3d12.dll compiled from vkd3d-proton and the dxgi.dll compiled from dxvk.
However, I noticed that Wine’s built-in D3DCompile2 still calls vkd3d_shader_compiler( https://gitlab.winehq.org/wine/wine/-/blob/master/dlls/d3dcompiler_43/compil...), which belongs to vkd3d, not vkd3d-proton.
Does this mean that even in Proton, vkd3d and vkd3d-proton coexist, and it’s not possible to completely replace vkd3d?
So if there’s a bug in it, I would still need to fix the issue in vkd3d rather than being able to replace it with functions from vkd3d-proton. Is that correct?
Hi,
Il 26/11/24 14:18, zhengxianwei ha scritto:
I tried replacing Wine’s built-in DLLs with the d3d12.dll compiled from vkd3d-proton and the dxgi.dll compiled from dxvk.
However, I noticed that Wine’s built-in D3DCompile2 still calls vkd3d_shader_compiler(https://gitlab.winehq.org/wine/wine/-/blob/master/ dlls/d3dcompiler_43/compiler.c?ref_type=heads#L573 <https:// gitlab.winehq.org/wine/wine/-/blob/master/dlls/d3dcompiler_43/ compiler.c?ref_type=heads#L573>), which belongs to vkd3d, not vkd3d-proton.
That's right, vkd3d-proton doesn't ship an HLSL shader compiler, so there's no way it can be used to implement D3DCompile2().
Does this mean that even in Proton, vkd3d and vkd3d-proton coexist, and it’s not possible to completely replace vkd3d?
Yes, Proton ships both vkd3d and vkd3d-proton; by default it uses vkd3d for the HLSL shader compiler and vkd3d-proton as the D3D12 implementation. By setting environment variable PROTON_USE_WINED3D=1 you can use vkd3d for D3D12, but you can't use vkd3d-proton for the HLSL shader compiler because, as I said, it's not a feature implemented in vkd3d-proton. At any rate, if you're using Proton the Proton script itself will care about copying DLLs and setting whatever has to be set so that you're using vkd3d or vkd3d-proton depending on the environment variables.
So if there’s a bug in it, I would still need to fix the issue in vkd3d rather than being able to replace it with functions from vkd3d-proton. Is that correct?
Yes, any bug in vkd3d must be fixed in vkd3d and any bug in vkd3d-proton must be fixed in vkd3d-proton.
However, the fact that vkd3d is the only possible implementation for the HLSL shader compiler shouldn't prevent you from using vkd3d-proton as a D3D12 implementation, if that's what you want to do. You just have to install it properly. I cannot help you with that because I never tried, you should look for the vkd3d-proton documentation.
And to answer your question in another email: on the wiki[1] there is some documentation on how to build vkd3d from sources and use it in Wine, without relying on Wine's convenience copy.
[1] https://gitlab.winehq.org/wine/vkd3d/-/wikis/Building-a-MinGW-WoW64-Wine-wit...
HTH, Gio.
Thank you very much for your reply. However, I have many questions about the wiki help page:
And to answer your question in another email: on the wiki[1] there is some documentation on how to build vkd3d from sources and use it in Wine, without relying on Wine's convenience copy.
[1]
https://gitlab.winehq.org/wine/vkd3d/-/wikis/Building-a-MinGW-WoW64-Wine-wit...
1. It actually mentions two ways to test vkd3d. The first one is available at: https://gitlab.winehq.org/wine/vkd3d/-/wikis/home ``` Building Wine with Direct3D 12 support Wine uses pkg-config to find vkd3d libraries. If vkd3d libraries are installed system-wide, the Wine configure script should find the vkd3d libraries automatically. You can also use PKG_CONFIG_PATH, VKD3D_CFLAGS or VKD3D_LIBS to override pkg-config search path, C compiler flags for libvkd3d, or linker flags for libvkd3d, e.g.
$ ../wine-git/configure PKG_CONFIG_PATH=$HOME/src/vulkan/install/lib/pkgconfig ```
However, following the steps didn’t work. It seems that VKD3D_FLAGS and VKD3D_LIBS have been deprecated?
2. The second method is the one you provided on this page:
When I tried following the instructions on this page, I encountered many issues. It seems to treat vkd3d as a .dll file instead of an .a file. Additionally, during ./configure, it seems to treat the host environment as Windows, requiring dependencies to be reinstalled even if they are already installed. It doesn’t feel like a testing environment meant for Ubuntu x64. Is that correct?
On Tue, Nov 26, 2024 at 10:01 PM Giovanni Mascellani < gmascellani@codeweavers.com> wrote:
Hi,
Il 26/11/24 14:18, zhengxianwei ha scritto:
I tried replacing Wine’s built-in DLLs with the d3d12.dll compiled from vkd3d-proton and the dxgi.dll compiled from dxvk.
However, I noticed that Wine’s built-in D3DCompile2 still calls vkd3d_shader_compiler(https://gitlab.winehq.org/wine/wine/-/blob/master/ dlls/d3dcompiler_43/compiler.c?ref_type=heads#L573 https:// gitlab.winehq.org/wine/wine/-/blob/master/dlls/d3dcompiler_43/ compiler.c?ref_type=heads#L573), which belongs to vkd3d, not
vkd3d-proton.
That's right, vkd3d-proton doesn't ship an HLSL shader compiler, so there's no way it can be used to implement D3DCompile2().
Does this mean that even in Proton, vkd3d and vkd3d-proton coexist, and it’s not possible to completely replace vkd3d?
Yes, Proton ships both vkd3d and vkd3d-proton; by default it uses vkd3d for the HLSL shader compiler and vkd3d-proton as the D3D12 implementation. By setting environment variable PROTON_USE_WINED3D=1 you can use vkd3d for D3D12, but you can't use vkd3d-proton for the HLSL shader compiler because, as I said, it's not a feature implemented in vkd3d-proton. At any rate, if you're using Proton the Proton script itself will care about copying DLLs and setting whatever has to be set so that you're using vkd3d or vkd3d-proton depending on the environment variables.
So if there’s a bug in it, I would still need to fix the issue in vkd3d rather than being able to replace it with functions from vkd3d-proton. Is that correct?
Yes, any bug in vkd3d must be fixed in vkd3d and any bug in vkd3d-proton must be fixed in vkd3d-proton.
However, the fact that vkd3d is the only possible implementation for the HLSL shader compiler shouldn't prevent you from using vkd3d-proton as a D3D12 implementation, if that's what you want to do. You just have to install it properly. I cannot help you with that because I never tried, you should look for the vkd3d-proton documentation.
And to answer your question in another email: on the wiki[1] there is some documentation on how to build vkd3d from sources and use it in Wine, without relying on Wine's convenience copy.
[1]
https://gitlab.winehq.org/wine/vkd3d/-/wikis/Building-a-MinGW-WoW64-Wine-wit...
HTH, Gio.
Hi,
Il 27/11/24 01:36, zhengxianwei ha scritto:
- It actually mentions two ways to test vkd3d. The first one is
available at: https://gitlab.winehq.org/wine/vkd3d/-/wikis/home https://gitlab.winehq.org/wine/vkd3d/-/wikis/home
Building Wine with Direct3D 12 support Wine uses pkg-config to find vkd3d libraries. If vkd3d libraries are installed system-wide, the Wine configure script should find the vkd3d libraries automatically. You can also use PKG_CONFIG_PATH, VKD3D_CFLAGS or VKD3D_LIBS to override pkg-config search path, C compiler flags for libvkd3d, or linker flags for libvkd3d, e.g. $ ../wine-git/configure PKG_CONFIG_PATH=$HOME/src/vulkan/install/lib/ pkgconfig
However, following the steps didn’t work. It seems that VKD3D_FLAGS and VKD3D_LIBS have been deprecated?
"Didn't work" is not a very complete or usable description of the problems you found, so it's hard to help you with that. However, if you want a build of vkd3d that is usable with Wine I think you're off course here. Page https://gitlab.winehq.org/wine/vkd3d/-/wikis/home is mostly about building vkd3d on a Linux/macOS system on its own, which is different to crosscompiling it to a .dll library (which is what you need to use it in Wine).
- The second method is the one you provided on this page:
When I tried following the instructions on this page, I encountered many issues. It seems to treat vkd3d as a .dll file instead of an .a file. Additionally, during ./configure, it seems to treat the host environment as Windows, requiring dependencies to be reinstalled even if they are already installed. It doesn’t feel like a testing environment meant for Ubuntu x64. Is that correct?
As before, saying that you "encountered many issues" doesn't help me a lot with understand what these issues are. You should describe explicitly what you're trying to do and which problems you find if you want to hope that somebody will be able to help you.
It's correct that you need to build vkd3d as a .dll library (what we call a PE build) if you want to use it within Wine, and it's true that a standard Ubuntu environment requires some work before it's able to host such a compilation process. All of that is described in the page I already linked to you. It's a bit lengthy, unfortunately, and it requires some non-trivial knowledge about how compilation works, or at least the availability to study a little bit to acquire said knowledge, but that's what it is.
I can't help, though, wondering a little bit about what's your ultimate goal. Are you trying to play some particular game? Are you trying to add vkd3d support for some particular game? Are you trying to do some vkd3d development without having a particular application in mind? Depending on what's your real goal, compiling a PE build of vkd3d might not necessarily be the easiest way to get there, especially if you're not much used to PE cross compilation.
Gio.
Il 27/11/24 01:36, zhengxianwei ha scritto:
- It actually mentions two ways to test vkd3d. The first one is
available at: https://gitlab.winehq.org/wine/vkd3d/-/wikis/home https://gitlab.winehq.org/wine/vkd3d/-/wikis/home
Building Wine with Direct3D 12 support Wine uses pkg-config to find vkd3d libraries. If vkd3d libraries are installed system-wide, the Wine configure script should find the vkd3d libraries automatically. You can also use PKG_CONFIG_PATH, VKD3D_CFLAGS or VKD3D_LIBS to override pkg-config search path, C compiler flags for libvkd3d, or linker flags for libvkd3d, e.g. $ ../wine-git/configure PKG_CONFIG_PATH=$HOME/src/vulkan/install/lib/ pkgconfig
However, following the steps didn’t work. It seems that VKD3D_FLAGS and VKD3D_LIBS have been deprecated?
"Didn't work" is not a very complete or usable description of the problems you found, so it's hard to help you with that. However, if you want a build of vkd3d that is usable with Wine I think you're off course here. Page https://gitlab.winehq.org/wine/vkd3d/-/wikis/home is mostly about building vkd3d on a Linux/macOS system on its own, which is different to crosscompiling it to a .dll library (which is what you need to use it in Wine).
Thank you very much for pointing out my mistake. I will do my best to
describe my question clearly next time.
My issue with building vkd3d has been resolved. I referred to the code logic in Proton for building vkd3d:
Proton Build Logic https://github.com/ValveSoftware/Proton/blob/3c3d468971353a5302f401a1e017730970ab8921/Makefile.in#L419C39-L419C81 .
The main issue was with the code provided on the webpage (Building a MinGW WoW64 Wine with a Custom VKD3D Build https://gitlab.winehq.org/wine/vkd3d/-/wikis/Building-a-MinGW-WoW64-Wine-with-a-custom-vkd3d-build), which needs to be modified as follows:
``` $ ../wine-git/configure --enable-win64 \ CC='ccache gcc' x86_64_CC='ccache x86_64-w64-mingw32-gcc' \ --with-system-dllpath="$HOME/wine-dirs/vkd3d64-prefix/bin:<mingw 64-bit gcc dynamic dependencies>" \ VKD3D_PE_CFLAGS="-I$HOME/wine-dirs/vulkan-sdk/x86_64/include -I$HOME/wine-dirs/vkd3d64-prefix/include/vkd3d" \ VKD3D_PE_LIBS="-L$HOME/wine-dirs/vkd3d64-prefix/lib -lvkd3d -lvkd3d-shader" VKD3D_PE_LIBS="-L$HOME/wine-dirs/vkd3d64-prefix/lib -l:libvkd3d-1.dll -l:libvkd3d-shader-1.dl" ```
I can't help, though, wondering a little bit about what's your ultimate
goal. Are you trying to play some particular game? Are you trying to add vkd3d support for some particular game? Are you trying to do some vkd3d development without having a particular application in mind? Depending on what's your real goal, compiling a PE build of vkd3d might not necessarily be the easiest way to get there, especially if you're not much used to PE cross compilation.
I am attempting to run Photoshop 2023 (WineHQ AppDB link https://appdb.winehq.org/objectManager.php?sClass=version&iId=41345).
Photoshop 2023 requires D3D12 support, which is provided by VKD3D. However, after testing, I found that VKD3D lacks support for the tiled resource feature. As a result, I switched to VKD3D-Proton.
Unfortunately, when using VKD3D-Proton to run the program, new issues arise. Specifically, its HLSL implementation (part of the VKD3D module) seems to lack support for function overloads (source code reference https://gitlab.winehq.org/wine/vkd3d/-/blob/master/libs/vkd3d-shader/hlsl.y?ref_type=heads#L3014 ).
For example, the following code fails to compile:
``` float mod(float x, float y) {
}
float mod(float2 x, float2 y) {
}
float mod(float3 x, float3 y) {
}
void func1() { ... float t0 = mod(t, 2.0f); }
```
I chose to use the native version of d3dcompiler_47.dll to override the built-in version, which bypassed this issue. I am still considering whether to attempt fixing the problem in VKD3D.
Since this is a private project, I might not contribute the fix back to the community. My apologies for that.
On Wed, Nov 27, 2024 at 5:47 PM Giovanni Mascellani < gmascellani@codeweavers.com> wrote:
Hi,
Il 27/11/24 01:36, zhengxianwei ha scritto:
- It actually mentions two ways to test vkd3d. The first one is
available at: https://gitlab.winehq.org/wine/vkd3d/-/wikis/home https://gitlab.winehq.org/wine/vkd3d/-/wikis/home
Building Wine with Direct3D 12 support Wine uses pkg-config to find vkd3d libraries. If vkd3d libraries are installed system-wide, the Wine configure script should find the vkd3d libraries automatically. You can also use PKG_CONFIG_PATH, VKD3D_CFLAGS or VKD3D_LIBS to override pkg-config search path, C compiler flags for libvkd3d, or linker flags for libvkd3d, e.g. $ ../wine-git/configure PKG_CONFIG_PATH=$HOME/src/vulkan/install/lib/ pkgconfig
However, following the steps didn’t work. It seems that VKD3D_FLAGS and VKD3D_LIBS have been deprecated?
"Didn't work" is not a very complete or usable description of the problems you found, so it's hard to help you with that. However, if you want a build of vkd3d that is usable with Wine I think you're off course here. Page https://gitlab.winehq.org/wine/vkd3d/-/wikis/home is mostly about building vkd3d on a Linux/macOS system on its own, which is different to crosscompiling it to a .dll library (which is what you need to use it in Wine).
- The second method is the one you provided on this page:
When I tried following the instructions on this page, I encountered many issues. It seems to treat vkd3d as a .dll file instead of an .a file. Additionally, during ./configure, it seems to treat the host environment as Windows, requiring dependencies to be reinstalled even if they are already installed. It doesn’t feel like a testing environment meant for Ubuntu x64. Is that correct?
As before, saying that you "encountered many issues" doesn't help me a lot with understand what these issues are. You should describe explicitly what you're trying to do and which problems you find if you want to hope that somebody will be able to help you.
It's correct that you need to build vkd3d as a .dll library (what we call a PE build) if you want to use it within Wine, and it's true that a standard Ubuntu environment requires some work before it's able to host such a compilation process. All of that is described in the page I already linked to you. It's a bit lengthy, unfortunately, and it requires some non-trivial knowledge about how compilation works, or at least the availability to study a little bit to acquire said knowledge, but that's what it is.
I can't help, though, wondering a little bit about what's your ultimate goal. Are you trying to play some particular game? Are you trying to add vkd3d support for some particular game? Are you trying to do some vkd3d development without having a particular application in mind? Depending on what's your real goal, compiling a PE build of vkd3d might not necessarily be the easiest way to get there, especially if you're not much used to PE cross compilation.
Gio.
Hi,
Thanks for pointing out the errors in the page, I have to update it, albeit seems that in this case you don't need to do crosscompilation and you are on the right track compiling proton.
On 11/27/24 9:34 AM, zhengxianwei wrote:
Unfortunately, when using VKD3D-Proton to run the program, new issues arise. Specifically, its HLSL implementation (part of the VKD3D module) seems to lack support for function overloads (source code reference https://gitlab.winehq.org/wine/vkd3d/-/blob/master/libs/vkd3d-shader/ hlsl.y?ref_type=heads#L3014).
The issue here is that function overload is not implemented yet.
Initially we had the policy of always prioritizing an exact type match overload if there is any, which made a lot of shaders compile, but we removed this in:
fef118555cd6341eb648f482a4517d61c347a0d3
because there are some odd cases where this isn't true: e.g. functions with "float" and "float1" arguments. And we want to avoid misscompilations on vkd3d upstream.
The version of vkd3d in stable releases of Proton (not to be confused with vkd3d-proton) keep this hack to avoid regressions.
You can apply the following patch to your vkd3d in proton before compiling proton to add the hack again.
https://gitlab.winehq.org/fcasas/vkd3d/-/commit/4d2637bfc66edd449745b7410043...
We are working on a proper implementation of overload resolution but it might take time.
Best regards, Francisco.
On Thu, Nov 28, 2024 at 12:16 AM Francisco Casas fcasas@codeweavers.com wrote:
Hi,
Thanks for pointing out the errors in the page, I have to update it, albeit seems that in this case you don't need to do crosscompilation and you are on the right track compiling proton.
Are you saying that I don’t need cross-compilation? Are you referring to the process mentioned on this page: Building Wine with Direct3D 12 support https://gitlab.winehq.org/wine/vkd3d/-/wikis/home?
```
Wine uses pkg-config to find vkd3d libraries. If vkd3d libraries are
installed system-wide, the Wine configure script should find the vkd3d
libraries automatically. You can also use PKG_CONFIG_PATH,
VKD3D_CFLAGS or VKD3D_LIBS to override pkg-config search
path, C compiler flags for libvkd3d, or linker flags for
libvkd3d, e.g.
```
But in reality, this doesn’t seem to work because the wine configure script has long removed VKD3D_CFLAGS and VKD3D_LIBS. At least, I couldn’t find the configurations mentioned in this document. So, it seems this page is outdated.
On 11/27/24 9:34 AM, zhengxianwei wrote:
Unfortunately, when using VKD3D-Proton to run the program, new issues arise. Specifically, its HLSL implementation (part of the VKD3D module) seems to lack support for function overloads (source code reference https://gitlab.winehq.org/wine/vkd3d/-/blob/master/libs/vkd3d-shader/ hlsl.y?ref_type=heads#L3014).
The issue here is that function overload is not implemented yet.
Initially we had the policy of always prioritizing an exact type match overload if there is any, which made a lot of shaders compile, but we removed this in:
fef118555cd6341eb648f482a4517d61c347a0d3
because there are some odd cases where this isn't true: e.g. functions with "float" and "float1" arguments. And we want to avoid misscompilations on vkd3d upstream.
The version of vkd3d in stable releases of Proton (not to be confused with vkd3d-proton) keep this hack to avoid regressions.
You can apply the following patch to your vkd3d in proton before compiling proton to add the hack again.
https://gitlab.winehq.org/fcasas/vkd3d/-/commit/4d2637bfc66edd449745b7410043...
We are working on a proper implementation of overload resolution but it might take time.
This is truly excellent advice. In the future, when I encounter errors, I should look into the Git log history.
The changes in this commit don’t seem to be a final solution, but it’s a good starting point.
Best regards, Francisco.
Hi,
Il 27/11/24 17:16, Francisco Casas ha scritto:
The version of vkd3d in stable releases of Proton (not to be confused with vkd3d-proton) keep this hack to avoid regressions.
You can apply the following patch to your vkd3d in proton before compiling proton to add the hack again.
https://gitlab.winehq.org/fcasas/vkd3d/-/ commit/4d2637bfc66edd449745b7410043b81b68189af7
To add to what Francisco said, notice that a merge request is open to update the vkd3d version shipped with Wine (https://gitlab.winehq.org/wine/wine/-/merge_requests/6899). This was just accepted by Matteo, so it's likely to be merged soon (and you can merge it in your Wine copy anyway).
It won't add support for overload resolution, though, so you'd still probably want to use Francisco's patch. However, it shouldn't be too hard to apply it directly to Wine's embedded copy of vkd3d. That way you can spare yourself from the complexity of crosscompiling vkd3d to PE.
Gio.
Apologies, I’m not very familiar with using the quote feature in emails, which caused some formatting issues in the content above. However, I believe it shouldn’t affect readability, so I won’t resend it.
On Wed, Nov 27, 2024 at 5:47 PM Giovanni Mascellani < gmascellani@codeweavers.com> wrote:
Hi,
Il 27/11/24 01:36, zhengxianwei ha scritto:
- It actually mentions two ways to test vkd3d. The first one is
available at: https://gitlab.winehq.org/wine/vkd3d/-/wikis/home https://gitlab.winehq.org/wine/vkd3d/-/wikis/home
Building Wine with Direct3D 12 support Wine uses pkg-config to find vkd3d libraries. If vkd3d libraries are installed system-wide, the Wine configure script should find the vkd3d libraries automatically. You can also use PKG_CONFIG_PATH, VKD3D_CFLAGS or VKD3D_LIBS to override pkg-config search path, C compiler flags for libvkd3d, or linker flags for libvkd3d, e.g. $ ../wine-git/configure PKG_CONFIG_PATH=$HOME/src/vulkan/install/lib/ pkgconfig
However, following the steps didn’t work. It seems that VKD3D_FLAGS and VKD3D_LIBS have been deprecated?
"Didn't work" is not a very complete or usable description of the problems you found, so it's hard to help you with that. However, if you want a build of vkd3d that is usable with Wine I think you're off course here. Page https://gitlab.winehq.org/wine/vkd3d/-/wikis/home is mostly about building vkd3d on a Linux/macOS system on its own, which is different to crosscompiling it to a .dll library (which is what you need to use it in Wine).
- The second method is the one you provided on this page:
When I tried following the instructions on this page, I encountered many issues. It seems to treat vkd3d as a .dll file instead of an .a file. Additionally, during ./configure, it seems to treat the host environment as Windows, requiring dependencies to be reinstalled even if they are already installed. It doesn’t feel like a testing environment meant for Ubuntu x64. Is that correct?
As before, saying that you "encountered many issues" doesn't help me a lot with understand what these issues are. You should describe explicitly what you're trying to do and which problems you find if you want to hope that somebody will be able to help you.
It's correct that you need to build vkd3d as a .dll library (what we call a PE build) if you want to use it within Wine, and it's true that a standard Ubuntu environment requires some work before it's able to host such a compilation process. All of that is described in the page I already linked to you. It's a bit lengthy, unfortunately, and it requires some non-trivial knowledge about how compilation works, or at least the availability to study a little bit to acquire said knowledge, but that's what it is.
I can't help, though, wondering a little bit about what's your ultimate goal. Are you trying to play some particular game? Are you trying to add vkd3d support for some particular game? Are you trying to do some vkd3d development without having a particular application in mind? Depending on what's your real goal, compiling a PE build of vkd3d might not necessarily be the easiest way to get there, especially if you're not much used to PE cross compilation.
Gio.