Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues compiling HLSL on Linux #109

Open
NitroPlum opened this issue Feb 25, 2025 · 3 comments
Open

Issues compiling HLSL on Linux #109

NitroPlum opened this issue Feb 25, 2025 · 3 comments

Comments

@NitroPlum
Copy link

On linux when I call SDL_ShaderCross_CompileGraphicsShaderFromHLSL I get:

Failed loading D3DCompile: /lib/x86_64-linux-gnu/libvkd3d-utils.so.1: undefined symbol: _D3DCompile

I was previously having a problem finding vkd3d so I installed: libvkd3d-utils1 and libvkd3d1

@sutbult
Copy link

sutbult commented Mar 1, 2025

I have a similar problem. I built SDL_shadercross locally using this command:

cmake -B build -DSDLSHADERCROSS_DXC=OFF -DSDLSHADERCROSS_INSTALL=ON -DSDLSHADERCROSS_SHARED=ON

As you can see, I disabled DXC as I in this early stage of development of the project I am working on, I am only interested in compiling my program on Linux and running SDL_GPU with the Vulkan backend.

I have this function:

SDL_GPUShader* compileShader(SDL_GPUDevice* device) {
    SDL_ShaderCross_HLSL_Info info = {0};
    SDL_ShaderCross_GraphicsShaderMetadata metadata = {0};

    SDL_GPUShader *vertexShader = SDL_ShaderCross_CompileGraphicsShaderFromHLSL(
        device,
        &info,
        &metadata);

    if(vertexShader == NULL) {
        fprintf(
            stderr,
            "SDL_ShaderCross_CompileGraphicsShaderFromHLSL failed: %s\n",
            SDL_GetError());
        return NULL;
    }

    return vertexShader;
}

When the function is called, I get this output:

SDL_ShaderCross_CompileGraphicsShaderFromHLSL failed: Shadercross was not built with DXC support, cannot compile using DXC!

I would expect something like "Your source is null" instead.

@sutbult
Copy link

sutbult commented Mar 1, 2025

I have a similar problem. I built SDL_shadercross locally using this command:

cmake -B build -DSDLSHADERCROSS_DXC=OFF -DSDLSHADERCROSS_INSTALL=ON -DSDLSHADERCROSS_SHARED=ON

As you can see, I disabled DXC as I in this early stage of development of the project I am working on, I am only interested in compiling my program on Linux and running SDL_GPU with the Vulkan backend.

I have this function:

SDL_GPUShader* compileShader(SDL_GPUDevice* device) {
    SDL_ShaderCross_HLSL_Info info = {0};
    SDL_ShaderCross_GraphicsShaderMetadata metadata = {0};

    SDL_GPUShader *vertexShader = SDL_ShaderCross_CompileGraphicsShaderFromHLSL(
        device,
        &info,
        &metadata);

    if(vertexShader == NULL) {
        fprintf(
            stderr,
            "SDL_ShaderCross_CompileGraphicsShaderFromHLSL failed: %s\n",
            SDL_GetError());
        return NULL;
    }

    return vertexShader;
}

When the function is called, I get this output:

SDL_ShaderCross_CompileGraphicsShaderFromHLSL failed: Shadercross was not built with DXC support, cannot compile using DXC!

I would expect something like "Your source is null" instead.

I also tried this:

shadercross triangle.vert.hlsl -o triangle.vert.spv

Then I got this result:

ERROR: Failed to compile SPIR-V From HLSL: Shadercross was not built with DXC support, cannot compile using DXC!

So it seems like the command line tool has the same problem.

@sutbult
Copy link

sutbult commented Mar 1, 2025

I have a similar problem. I built SDL_shadercross locally using this command:

cmake -B build -DSDLSHADERCROSS_DXC=OFF -DSDLSHADERCROSS_INSTALL=ON -DSDLSHADERCROSS_SHARED=ON

As you can see, I disabled DXC as I in this early stage of development of the project I am working on, I am only interested in compiling my program on Linux and running SDL_GPU with the Vulkan backend.
I have this function:

SDL_GPUShader* compileShader(SDL_GPUDevice* device) {
    SDL_ShaderCross_HLSL_Info info = {0};
    SDL_ShaderCross_GraphicsShaderMetadata metadata = {0};

    SDL_GPUShader *vertexShader = SDL_ShaderCross_CompileGraphicsShaderFromHLSL(
        device,
        &info,
        &metadata);

    if(vertexShader == NULL) {
        fprintf(
            stderr,
            "SDL_ShaderCross_CompileGraphicsShaderFromHLSL failed: %s\n",
            SDL_GetError());
        return NULL;
    }

    return vertexShader;
}

When the function is called, I get this output:

SDL_ShaderCross_CompileGraphicsShaderFromHLSL failed: Shadercross was not built with DXC support, cannot compile using DXC!

I would expect something like "Your source is null" instead.

I also tried this:

shadercross triangle.vert.hlsl -o triangle.vert.spv

Then I got this result:

ERROR: Failed to compile SPIR-V From HLSL: Shadercross was not built with DXC support, cannot compile using DXC!

So it seems like the command line tool has the same problem.

I realize my issue is probably caused by something else than @NitroPlum's issue, so I created a separate one: #111.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants