-
-
Notifications
You must be signed in to change notification settings - Fork 644
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- AMD_shader_explicit_vertex_parameter - NV_clip_space_w_scaling - NV_conservative_raster_pre_snap_triangles - NV_robustness_video_memory_purge - NV_shader_atomic_float64 - NV_stereo_view_rendering
- Loading branch information
Showing
6 changed files
with
306 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
...les/templates/src/main/kotlin/org/lwjgl/egl/templates/NV_robustness_video_memory_purge.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright LWJGL. All rights reserved. | ||
* License terms: http://lwjgl.org/license.php | ||
*/ | ||
package org.lwjgl.egl.templates | ||
|
||
import org.lwjgl.egl.* | ||
import org.lwjgl.generator.* | ||
|
||
val NV_robustness_video_memory_purge = "NVRobustnessVideoMemoryPurge".nativeClassEGL("NV_robustness_video_memory_purge", postfix = NV) { | ||
documentation = | ||
"Native bindings to the {@code EGL_NV_robustness_video_memory_purge} extension." | ||
|
||
IntConstant( | ||
"Accepted as an attribute name in the {@code *attrib_list} argument of eglCreateContext.", | ||
|
||
"GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV"..0x334C | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
modules/templates/src/main/kotlin/org/lwjgl/opengl/templates/NV_clip_space_w_scaling.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright LWJGL. All rights reserved. | ||
* License terms: http://lwjgl.org/license.php | ||
*/ | ||
package org.lwjgl.opengl.templates | ||
|
||
import org.lwjgl.generator.* | ||
import org.lwjgl.opengl.* | ||
|
||
val NV_clip_space_w_scaling = "NVClipSpaceWScaling".nativeClassGL("NV_clip_space_w_scaling", postfix = NV) { | ||
documentation = | ||
""" | ||
Virtual Reality (VR) applications often involve a post-processing step to apply a "barrel" distortion to the rendered image to correct the "pincushion" | ||
distortion introduced by the optics in a VR device. The barrel distorted image has lower resolution along the edges compared to the center. Since the | ||
original image is rendered at high resolution, which is uniform across the complete image, a lot of pixels towards the edges do not make it to the | ||
final post-processed image. | ||
This extension also provides a mechanism to render VR scenes at a non-uniform resolution, in particular a resolution that falls linearly from the | ||
center towards the edges. This is achieved by scaling the "w" coordinate of the vertices in the clip space before perspective divide. The clip space | ||
"w" coordinate of the vertices may be offset as of a function of "x" and "y" coordinates as follows: | ||
${codeBlock(""" | ||
w' = w + Ax + By""")} | ||
In the intended use case for viewport position scaling, an application should use a set of 4 viewports, one for each of the 4 quadrants of a Cartesian | ||
coordinate system. Each viewport is set to the dimension of the image, but is scissored to the quadrant it represents. The application should specify A | ||
and B coefficients of the w-scaling equation above, that have the same value, but different signs, for each of the viewports. The signs of A and B | ||
should match the signs of X and Y for the quadrant that they represent such that the value of "w'" will always be greater than or equal to the original | ||
"w" value for the entire image. Since the offset to "w", (Ax + By), is always positive and increases with the absolute values of "x" and "y", the | ||
effective resolution will fall off linearly from the center of the image to its edges. | ||
""" | ||
|
||
IntConstant( | ||
"Accepted by the {@code cap} parameter of Enable, Disable, IsEnabled.", | ||
|
||
"VIEWPORT_POSITION_W_SCALE_NV"..0x937C | ||
) | ||
|
||
IntConstant( | ||
"Accepted by the {@code pname} parameter of GetBooleani_v, GetDoublei_v, GetIntegeri_v, GetFloati_v, and GetInteger64i_v.", | ||
|
||
"VIEWPORT_POSITION_W_SCALE_X_COEFF"..0x937D, | ||
"VIEWPORT_POSITION_W_SCALE_Y_COEFF"..0x937E | ||
) | ||
|
||
void( | ||
"ViewportPositionWScaleNV", | ||
""" | ||
If #VIEWPORT_POSITION_W_SCALE_NV is enabled, the w coordinates for each primitive sent to a given viewport will be scaled as a function of its x and y | ||
coordinates using the following equation: | ||
${codeBlock(""" | ||
w' = xcoeff * x + ycoeff * y + w;""")} | ||
The coefficients for "x" and "y" used in the above equation depend on the viewport index, and are controlled by this command. | ||
The viewport specified by {@code index} has its coefficients for "x" and "y" set to the {@code xcoeff} and {@code ycoeff} values. Specifying these | ||
coefficients enables rendering images at a non-uniform resolution, in particular a resolution that falls off linearly from the center towards the | ||
edges, which is useful for VR applications. VR applications often involve a post-processing step to apply a "barrel" distortion to the rendered image | ||
to correct the "pincushion" distortion introduced by the optics in a VR device. The barrel distorted image, has lower resolution along the edges | ||
compared to the center. Since the original image is rendered at high resolution, which is uniform across the complete image, a lot of pixels towards | ||
the edges do not make it to the final post-processed image. VR applications may use the w-scaling to minimize the processing of unused fragments. To | ||
achieve the intended effect, applications should use a set of 4 viewports one for each of the 4 quadrants of a Cartesian coordinate system. Each | ||
viewport is set to the dimension of the image, but is scissored to the quadrant it represents. The application should specify the x and y coefficients | ||
of the w-scaling equation above, that have the same value, but different signs, for each of the viewports. The signs of {@code xcoeff} and | ||
{@code ycoeff} should match the signs of X and Y for the quadrant that they represent such that the value of "w'" will always be greater than or equal | ||
to the original "w" value for the entire image. Since the offset to "w", (Ax + By), is always positive and increases with the absolute values of "x" | ||
and "y", the effective resolution will fall off linearly from the center of the image to its edges. | ||
""", | ||
|
||
GLuint.IN("index", "the viewport index"), | ||
GLfloat.IN("xcoeff", "the x coefficient"), | ||
GLfloat.IN("ycoeff", "the y coefficient") | ||
) | ||
} |
55 changes: 55 additions & 0 deletions
55
...s/src/main/kotlin/org/lwjgl/opengl/templates/NV_conservative_raster_pre_snap_triangles.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright LWJGL. All rights reserved. | ||
* License terms: http://lwjgl.org/license.php | ||
*/ | ||
package org.lwjgl.opengl.templates | ||
|
||
import org.lwjgl.generator.* | ||
import org.lwjgl.opengl.* | ||
|
||
val NV_conservative_raster_pre_snap_triangles = "NVConservativeRasterPreSnapTriangles".nativeClassGL("NV_conservative_raster_pre_snap_triangles", postfix = NV) { | ||
documentation = | ||
""" | ||
When #CONSERVATIVE_RASTERIZATION_NV is enabled, the fragments generated for a primitive are conservative with respect to the primitive after snapping | ||
to sub-pixel grid. This extension provides a new mode of rasterization for triangles where the fragments generated are conservative with respect to the | ||
primitive at infinite precision before vertex snapping. | ||
When the conservative raster mode is set to #CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV, triangles are rasterized more conservatively, and may | ||
generate fragments not generated when the mode is #CONSERVATIVE_RASTER_MODE_POST_SNAP_NV (default). In particular it may generate fragments for pixels | ||
covered by triangles with zero area, or for pixels that are adjacent to but not covered by any triangle. This modified behavior may be useful in | ||
compensating for rounding errors caused by snapping vertex positions to a sub-pixel grid during rasterization. It's possible that a non-degenerate | ||
triangle becomes degenerate due to snapping. It's additionally possible that rounding errors in computing the position of a vertex or from snapping may | ||
cause a primitive that would cover a pixel at infinite precision to fail to cover the pixel post-snap. Rasterizing such primitives more conservatively | ||
may be useful for "binning" algorithms described in ${NV_conservative_raster.link}. | ||
""" | ||
|
||
IntConstant( | ||
"Accepted by the {@code pname} parameter of ConservativeRasterParameteriNV.", | ||
|
||
"CONSERVATIVE_RASTER_MODE_NV"..0x954D | ||
) | ||
|
||
val Modes = IntConstant( | ||
"Accepted by the {@code param} parameter of ConservativeRasterParameteriNV.", | ||
|
||
"CONSERVATIVE_RASTER_MODE_POST_SNAP_NV"..0x954E, | ||
"CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV"..0x954F | ||
).javaDocLinks | ||
|
||
void( | ||
"ConservativeRasterParameteriNV", | ||
""" | ||
When #CONSERVATIVE_RASTERIZATION_NV is enabled, the rasterization behavior may be controlled by calling the this command. | ||
If the mode is set to #CONSERVATIVE_RASTER_MODE_POST_SNAP_NV, the generated fragments are conservative w.r.t the primitive after it is snapped to | ||
sub-pixel grid. If the mode is set to #CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV the fragments generated for triangles will be conservative w.r.t | ||
the triangle at infinite precision. Since non-degenerate triangles may become degenerate due to vertex snapping, this mode will generate fragments for | ||
zero area triangles that are otherwise culled when the mode is #CONSERVATIVE_RASTER_MODE_POST_SNAP_NV. This mode may also generate fragments for pixels | ||
that are within half a sub-pixel distance away from a triangle's infinite precision boundary. The default mode is set to | ||
#CONSERVATIVE_RASTER_MODE_POST_SNAP_NV. | ||
""", | ||
|
||
GLenum.IN("pname", "the parameter to set", "#CONSERVATIVE_RASTER_MODE_NV"), | ||
GLint.IN("param", "specifies the conservative raster mode to be used", Modes) | ||
) | ||
} |
50 changes: 50 additions & 0 deletions
50
.../templates/src/main/kotlin/org/lwjgl/opengl/templates/NV_robustness_video_memory_purge.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright LWJGL. All rights reserved. | ||
* License terms: http://lwjgl.org/license.php | ||
*/ | ||
package org.lwjgl.opengl.templates | ||
|
||
import org.lwjgl.generator.* | ||
import org.lwjgl.opengl.* | ||
|
||
val NV_robustness_video_memory_purge = "NVRobustnessVideoMemoryPurge".nativeClassGL("NV_robustness_video_memory_purge", postfix = NV) { | ||
documentation = | ||
""" | ||
Native bindings to the $registryLink extension. | ||
This extension allows applications to be notified when video memory has been purged. | ||
The NVIDIA OpenGL driver architecture on Linux has a limitation: resources located in video memory are not persistent across certain events. VT | ||
switches, suspend/resume events, and mode switching events may erase the contents of video memory. Any resource that is located exclusively in video | ||
memory, such as framebuffer objects (FBOs), will be lost. As the OpenGL specification makes no mention of events where the video memory is allowed to | ||
be cleared, the driver attempts to hide this fact from the application, but cannot do it for all resources. | ||
This extension provides a way for applications to discover when video memory content has been lost, so that the application can re-populate the video | ||
memory content as necessary. | ||
This extension will have a limited lifespan, as planned architectural evolutions in the NVIDIA Linux driver stack will allow video memory to be | ||
persistent. Any driver that exposes this extension is a driver that considers video memory to be volatile. Once the driver stack has been improved, the | ||
extension will no longer be exposed. | ||
""" | ||
|
||
IntConstant( | ||
"Returned by GetGraphicsResetStatusARB, in addition to other tokens defined in ARB_robustness.", | ||
|
||
"PURGED_CONTEXT_RESET_NV"..0x92BB | ||
) | ||
} | ||
|
||
val GLX_NV_robustness_video_memory_purge = "GLXNVRobustnessVideoMemoryPurge".nativeClassGLX("GLX_NV_robustness_video_memory_purge", postfix = NV) { | ||
documentation = | ||
""" | ||
Native bindings to the ${registryLinkTo("NV", "robustness_video_memory_purge", "GLX_NV_robustness_video_memory_purge")} extension. | ||
GLX functionality for ${NV_robustness_video_memory_purge.link}. | ||
""" | ||
|
||
IntConstant( | ||
"Accepted as an attribute name in the {@code *attrib_list} argument of glXCreateContextAttribsARB.", | ||
|
||
"GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV"..0x20F7 | ||
) | ||
} |
58 changes: 58 additions & 0 deletions
58
...src/main/kotlin/org/lwjgl/opengles/templates/NV_conservative_raster_pre_snap_triangles.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright LWJGL. All rights reserved. | ||
* License terms: http://lwjgl.org/license.php | ||
*/ | ||
package org.lwjgl.opengles.templates | ||
|
||
import org.lwjgl.generator.* | ||
import org.lwjgl.opengles.* | ||
|
||
val NV_conservative_raster_pre_snap_triangles = "NVConservativeRasterPreSnapTriangles".nativeClassGLES( | ||
"NV_conservative_raster_pre_snap_triangles", | ||
postfix = NV | ||
) { | ||
documentation = | ||
""" | ||
When #CONSERVATIVE_RASTERIZATION_NV is enabled, the fragments generated for a primitive are conservative with respect to the primitive after snapping | ||
to sub-pixel grid. This extension provides a new mode of rasterization for triangles where the fragments generated are conservative with respect to the | ||
primitive at infinite precision before vertex snapping. | ||
When the conservative raster mode is set to #CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV, triangles are rasterized more conservatively, and may | ||
generate fragments not generated when the mode is #CONSERVATIVE_RASTER_MODE_POST_SNAP_NV (default). In particular it may generate fragments for pixels | ||
covered by triangles with zero area, or for pixels that are adjacent to but not covered by any triangle. This modified behavior may be useful in | ||
compensating for rounding errors caused by snapping vertex positions to a sub-pixel grid during rasterization. It's possible that a non-degenerate | ||
triangle becomes degenerate due to snapping. It's additionally possible that rounding errors in computing the position of a vertex or from snapping may | ||
cause a primitive that would cover a pixel at infinite precision to fail to cover the pixel post-snap. Rasterizing such primitives more conservatively | ||
may be useful for "binning" algorithms described in ${NV_conservative_raster.link}. | ||
""" | ||
|
||
IntConstant( | ||
"Accepted by the {@code pname} parameter of ConservativeRasterParameteriNV.", | ||
|
||
"CONSERVATIVE_RASTER_MODE_NV"..0x954D | ||
) | ||
|
||
val Modes = IntConstant( | ||
"Accepted by the {@code param} parameter of ConservativeRasterParameteriNV.", | ||
|
||
"CONSERVATIVE_RASTER_MODE_POST_SNAP_NV"..0x954E, | ||
"CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV"..0x954F | ||
).javaDocLinks | ||
|
||
void( | ||
"ConservativeRasterParameteriNV", | ||
""" | ||
When #CONSERVATIVE_RASTERIZATION_NV is enabled, the rasterization behavior may be controlled by calling the this command. | ||
If the mode is set to #CONSERVATIVE_RASTER_MODE_POST_SNAP_NV, the generated fragments are conservative w.r.t the primitive after it is snapped to | ||
sub-pixel grid. If the mode is set to #CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV the fragments generated for triangles will be conservative w.r.t | ||
the triangle at infinite precision. Since non-degenerate triangles may become degenerate due to vertex snapping, this mode will generate fragments for | ||
zero area triangles that are otherwise culled when the mode is #CONSERVATIVE_RASTER_MODE_POST_SNAP_NV. This mode may also generate fragments for pixels | ||
that are within half a sub-pixel distance away from a triangle's infinite precision boundary. The default mode is set to | ||
#CONSERVATIVE_RASTER_MODE_POST_SNAP_NV. | ||
""", | ||
|
||
GLenum.IN("pname", "the parameter to set", "#CONSERVATIVE_RASTER_MODE_NV"), | ||
GLint.IN("param", "specifies the conservative raster mode to be used", Modes) | ||
) | ||
} |