Code Monkey home page Code Monkey logo

Comments (5)

devshgraphicsprogramming avatar devshgraphicsprogramming commented on June 26, 2024

AFAIK vk::combinedImageSampler is deprecated but the syntax for declaring them "properly" with Proposal 0011 (inline SPIR-V) segfaults.

Anyway in order for your shader to compile you need to declare the combined sampler twice, and probably use vk::binding() instead of relying on automagic HLSL register to SPIR-V location translation

from directxshadercompiler.

TheArheus avatar TheArheus commented on June 26, 2024

Hmm, got it. Because I wanted to do something like this:

Texture2D<float4> GBuffer[5] : register(t4, space0);
SamplerState _GBuffer_sampler[5] : register(s4, space0);

But, I saw, that I should use Texture2DArray and one sampler and vk::combinedImageSampler. So, then, if it is deprecated, then, the example in the wiki should not be correct anymore? I am confused about the right way to do it with the modern versions

from directxshadercompiler.

devshgraphicsprogramming avatar devshgraphicsprogramming commented on June 26, 2024

I think there's a bug about arrays of combined image samplers #5092

This made us support separate samplers in our engine.

from directxshadercompiler.

s-perron avatar s-perron commented on June 26, 2024

I want to deprecate vk::combinedImageSampler, but we don't have the replacement done yet. We will fix small bugs for the feature, but will not implement bigger changes. For example, we will not add the ability to do arrays of combined texture samplers. We'll take a look at this, and see where the problem it. It is getting the access violation in the optimizer, probably because something it returning a nullptr. This is worth looking into.

from directxshadercompiler.

s-perron avatar s-perron commented on June 26, 2024

The problem is not related to the texture samplers. The problem is that the HLSL is invalid, and the SPIR-V backend is not catching the problem.

You error is still there even if I remove the combinedtexturesampler attributes. If I compile the shader for DXIL, it gives the proper error:

t.hlsl:10:60: error: cannot compile this unexpected cast lvalue yet
    GBuffer.GetDimensions(0, TextureDims.x, TextureDims.y, 0, 0);
                                                           ^
t.hlsl:10:63: error: cannot compile this unexpected cast lvalue yet
    GBuffer.GetDimensions(0, TextureDims.x, TextureDims.y, 0, 0);

The last two parameters to this function call are out parameter. See the docs. This is essentially telling the compiler that they should write to the memory lcationo of the contant 0, which makes no sense. However the spir-v tries, and generates:

               OpStore %float_0 %47

This is invalid spir-v, and cause the optimizer to fail.

This fix for this will be to try to add a more meaningful error message, but the test given above will never work. You code will have to be changed.

from directxshadercompiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.