Coder Social home page Coder Social logo

Comments (8)

johnkslang avatar johnkslang commented on August 22, 2024

GLSL was defined with copy-in/copy-out semantics, to unambiguously avoid all such problems, but then some objects got treated like references or handles to other things.

I think we need to be more clear when something is acting on a copy and when it is acting on the original.

from glsl.

johnkslang avatar johnkslang commented on August 22, 2024

I also think it is safer to revert the recent change until we have this fully sorted out.

Edit: The change was very syntactic, equating two syntaxes, so the underlying issue is the same either way.

The change just made these two the same:

// 1
layout(set = 0, binding = 0, std430) readonly restrict buffer A {
    float b;
} a;

// 2
layout(set = 0, binding = 0, std430) restrict buffer A {
    readonly float b;
} a;

Based on this language from the spec:

memory qualifiers may also be used in the declaration of shader storage blocks. When a
block declaration is qualified with a memory qualifier, it is as if all of its members were declared with the same memory qualifier.

from glsl.

alegal-arm avatar alegal-arm commented on August 22, 2024

Is there anything holding back the revert? I'm afraid that we wouldn't be able to get any recent glslang changes into the CTS until this issue is resolved.

from glsl.

johnkslang avatar johnkslang commented on August 22, 2024

The revert does not change the fundamental problem the issue is about.

Do you want glslang to relax the read-only thing in general, not just for a failed inheritance?

from glsl.

alegal-arm avatar alegal-arm commented on August 22, 2024

I understand that the revert doesn't solve the fundamental problem but I'm trying to solve practical problem of not being able to update glslang in the CTS. New restrictions break shader compilation.

Personally, I would prefer to relax the read-only thing in general but I assume it would require some change in the specification.

from glsl.

johnkslang avatar johnkslang commented on August 22, 2024

When the thing passed is effectively a pointer or handle to something else, the readonly is really a modifier on what is pointed to. Passing a readonly handle to a non-readonly in parameter that then goes and updates what was pointed to needs to be disallowed.

My mental model for this is something like "Reading a readonly buffer member returns an rvalue. values passed to an in parameter must be rvalues. Therefore it is valid to pass a readonly buffer member to an in parameter."

I think that works only because members don't happen to (currently) be pointers to other things, while the real distinguishing characteristic should be that it is either:

A. Essentially a pass-by-reference (or pointer, or handle, whatever the term of the moment is). Includes atomic counters, anything atomic operations act on, buffers as a whole, and textures/samplers/images (and futuristically interpolants that interpolate*() functions might be applied to) .

or

B. Everything else; normal stuff, where the entire object in question is [semantically] copied in and copied out, such that the function is operating only on the copy.

For B, readonly should be ignored when passing to in and inout and writeonly should be ignored when passed to out, as Jeff said, I'm just slicing it as A vs. B rather than block member vs. not block member.

I think glslang should move now in that direction as it is much closer (if not exactly) to spec. intent, and while it would technically be a spec. bug, the previous state of glslang for this was also a spec. bug, and adhering to the spec. is clearly wrong and breaks real things.

from glsl.

johnkslang avatar johnkslang commented on August 22, 2024

I pushed KhronosGroup/glslang@92f5afd as the least of evils until we have agreement on correct approach.

from glsl.

pdaniell-nv avatar pdaniell-nv commented on August 22, 2024

We discussed this in the OpenGL/ES meeting today. @johnkslang agreed to propose a spec change incorporating his proposal in #83 (comment).

from glsl.

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.