Giter Club home page Giter Club logo

Comments (6)

alan-baker avatar alan-baker commented on June 29, 2024

The problem here is placing s_var2 at offset 1032. Vulkan has the following rule:

If one of the conditions below applies

  • The storage class is Uniform, StorageBuffer, PhysicalStorageBuffer, ShaderRecordBufferKHR, or PushConstant, and the scalarBlockLayout feature is not enabled on the device.
  • The storage class is Workgroup, and either the struct member is not part of a Block or the workgroupMemoryExplicitLayoutScalarBlockLayout feature is not enabled on the device.
  • The storage class is any other storage class.

the memory layout must also obey the following rules:

  • Vectors must not improperly straddle, as defined above.
  • The Offset decoration of a member must not place it between the end of a structure, an array or a matrix and the next multiple of the alignment of that structure, array or matrix.

The last bullet is being tripped. If you were to use -scalar-block-layout (or even -uniform-buffer-standard-layout I believe) it should validate successfully.

from spirv-tools.

Vovan675 avatar Vovan675 commented on June 29, 2024

But when I am creating shader module using vkCreateShaderModule I have the same error. I can't enable -scalar-block-layout or -uniform-buffer-standard-layout because it called internally in validation layer. And what if I dont want to enable additional features? I dont think that I need them, because everything works correctly now I think

from spirv-tools.

alan-baker avatar alan-baker commented on June 29, 2024

But when I am compiling shader using vkCreateShaderModule I have the same error. I can't enable -scalar-block-layout or -uniform-buffer-standard-layout because it called internally in validation layer. And what if I dont want to enable additional features? I dont think that I need them, because everything works correctly now I think

The validation layers would pick the vulkan features and enable those setting appropriately. So if you requested either at device creation the layers should use them. Your app might work because the device supports the higher feature level. If you tried this on an old implementation it might not.

from spirv-tools.

Vovan675 avatar Vovan675 commented on June 29, 2024

But do I really need to enable one of these features to truly support offsets like this on all devices?

from spirv-tools.

alan-baker avatar alan-baker commented on June 29, 2024

Unfortunately, yes, I think so. Alternatively you reorder your structure definition.

from spirv-tools.

Vovan675 avatar Vovan675 commented on June 29, 2024

Yep, I added uniform-buffer-standard-layout extension and now it validates and work fine. Thank you!

from spirv-tools.

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.