Hot answers tagged

3

GLSL has no mechanism to change the "size" of shared memory. Indeed, GLSL is structurally incapable of such a thing. You can't get a pointer to shared memory. Indeed, "shared memory" doesn't really exist in GLSL; there are only shared variables. And variables have a compile-time fixed size. So GLSL wouldn't even have a good way of ...


3

The GS is responsible for assigning a particular primitive to a particular layer. The GS is also responsible for writing values for gl_ClipDistance for a particular primitive. So the GS is perfectly capable of doing both of those things: assigning a primitive to a layer and doing the clip-plane computations for that layer. And if you need to "deactivate&...


2

I think you may be focusing on the wrong thing here. Moving the data from an SSBO to a uniform buffer might give some speedup, sure, but that is a micro-optimization. I would search for algorithmic optimizations first. As noted in the comments, processing all 200 records for every vertex is both a lot of data to read, and a lot of computation to do if there'...


1

Everything in this code functions as intended, until I try to translate the entire grid (grid lines) to the center of the screen by adding v_Resolution.x / 2 to uv.x. Not sure what your intention is here since the Shadertoy example you referenced generates an infinite grid. So maybe you can clarify that. However, I think I can help you with this problem: .....


1

The volume inside of the frustum is defined by a set of inequalities, and since we are trying to find the boundaries of the frustum, we set the inequalities to equalities. That's really all it is. To take a 1D example, if we have a "frustum" defined by 0 < x < 5, then of course the bounding points of it are defined by x = 0 and x = 5. ...


1

Yes, With a certain OpenGL extension, that is possible (thanks to NicolBolas for pointing that out). It is pretty much the same as in C++. Let's assume you have a file util.glsl, vertex.glsl and fragment.glsl, all in the same folder. $^1$ //in util.glsl float add(float a, float b) { return a + b; } Then you can call that function, as if it were in your ...


1

No. When you use image load/store, you don't get to play "texture" games like playing with the border color, doing filtering on values, etc. You are fetching a texel from a particular location. If you want this, you will have to detect the out-of-bounds access and choose to substitute an alternate value. You can query the image's size, so it should ...


Only top voted, non community-wiki answers of a minimum length are eligible