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
Implement vertex discard in shader translator #501
Comments
discard as the GLSL keyword EDIT: it was a long time ago I didn't use geometry shader. Not using |
In this case, the vertex shader is discarding the vertex, not the fragment shader (the only place 'discard' works) or something that can happen prior to that (like in the geometry shader). It's a dynamic operation computed per vertex, so unless the entire vertex shader is run for every vertex inside of the geometry shader (or all vertex processing is moved to the geometry shader) that won't work :( The best 'solution' I've found is to offset the position far out of the clip volume and let the clipping system take care of it. |
If your solution works fine thanks to the clipping system, there is no reason to do otherwise :). EDIT: seriously I'm out. Geometry shader is applied after Vertex shader and for some reason I thought it was the inverse. |
Moving the vertex shader to the geometry shader isn't a terrible idea (I On Wed, Dec 30, 2015 at 9:41 AM hlide notifications@github.com wrote:
|
Never mind I made a mistake and correct the previous post :). |
Implemented in the Direct3D 12 backend. Using NaN SV_Position to discard if any discarded (seems to be well-defined on the current PC hardware), and SV_CullDistance to discard if all discarded. Banjo-Kazooie: Nuts & Bolts uses this functionality to remove grass that would otherwise be hovering in the air. However, we need to check how discarding should work with quads and point sprites, also depending on some registers (I remember seeing something about "quads as triangles" somewhere). Currently I'm treating them as whole primitives, culled entirely, but this may be wrong. |
z in a vertex shader is a discard, though that's not easily possible in GLSL. May need to set the vertex position way out of bounds, or set point size to 0 (does that work?).
The text was updated successfully, but these errors were encountered: