Skip to content

Instantly share code, notes, and snippets.

@mosra
Created October 18, 2016 20:27
Show Gist options
  • Save mosra/1c8fbeaa7938fcb957797414d6107e00 to your computer and use it in GitHub Desktop.
Save mosra/1c8fbeaa7938fcb957797414d6107e00 to your computer and use it in GitHub Desktop.
Quick'n'dirty NV conservative raster support
diff --git a/src/MagnumExternal/OpenGL/GL/extensions.txt b/src/MagnumExternal/OpenGL/GL/extensions.txt
index 82b268d..18e158d 100644
--- a/src/MagnumExternal/OpenGL/GL/extensions.txt
+++ b/src/MagnumExternal/OpenGL/GL/extensions.txt
@@ -34,3 +34,5 @@ extension KHR_texture_compression_astc_hdr optional
extension KHR_blend_equation_advanced optional
extension KHR_blend_equation_advanced_coherent optional
extension KHR_no_error optional
+
+extension NV_conservative_raster optional
diff --git a/src/MagnumExternal/OpenGL/GL/flextGL.cpp b/src/MagnumExternal/OpenGL/GL/flextGL.cpp
index 80f2cfc..6c55b82 100644
--- a/src/MagnumExternal/OpenGL/GL/flextGL.cpp
+++ b/src/MagnumExternal/OpenGL/GL/flextGL.cpp
@@ -319,6 +319,9 @@ FLEXTGL_EXPORT void(APIENTRY *flextglStringMarkerGREMEDY)(GLsizei, const void *)
/* GL_KHR_blend_equation_advanced */
FLEXTGL_EXPORT void(APIENTRY *flextglBlendBarrierKHR)(void) = nullptr;
+/* GL_NV_conservative_raster */
+FLEXTGL_EXPORT void(APIENTRY *flextglSubpixelPrecisionBiasNV)(GLuint, GLuint) = nullptr;
+
/* GL_VERSION_1_2 */
FLEXTGL_EXPORT void(APIENTRY *flextglCopyTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) = nullptr;
FLEXTGL_EXPORT void(APIENTRY *flextglDrawRangeElements)(GLenum, GLuint, GLuint, GLsizei, GLenum, const void *) = nullptr;
diff --git a/src/MagnumExternal/OpenGL/GL/flextGL.h b/src/MagnumExternal/OpenGL/GL/flextGL.h
index 92148bc..4915958 100644
--- a/src/MagnumExternal/OpenGL/GL/flextGL.h
+++ b/src/MagnumExternal/OpenGL/GL/flextGL.h
@@ -1753,6 +1753,13 @@ typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum
#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008
+/* GL_NV_conservative_raster */
+
+#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346
+#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347
+#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348
+#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349
+
/* Function prototypes */
/* GL_ARB_bindless_texture */
@@ -2374,6 +2381,11 @@ GLAPI FLEXTGL_EXPORT void(APIENTRY *flextglStringMarkerGREMEDY)(GLsizei, const v
GLAPI FLEXTGL_EXPORT void(APIENTRY *flextglBlendBarrierKHR)(void);
#define glBlendBarrierKHR flextglBlendBarrierKHR
+/* GL_NV_conservative_raster */
+
+GLAPI FLEXTGL_EXPORT void(APIENTRY *flextglSubpixelPrecisionBiasNV)(GLuint, GLuint);
+#define glSubpixelPrecisionBiasNV flextglSubpixelPrecisionBiasNV
+
/* GL_VERSION_1_0 */
GLAPI FLEXTGL_EXPORT void APIENTRY glBlendFunc(GLenum, GLenum);
diff --git a/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp b/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp
index 9396c4a..1cea6fa 100644
--- a/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp
+++ b/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp
@@ -323,6 +323,9 @@ void flextGLInit() {
/* GL_KHR_blend_equation_advanced */
flextglBlendBarrierKHR = reinterpret_cast<void(APIENTRY*)(void)>(loader.load("glBlendBarrierKHR"));
+ /* GL_NV_conservative_raster */
+ flextglSubpixelPrecisionBiasNV = reinterpret_cast<void(APIENTRY*)(GLuint, GLuint)>(loader.load("glSubpixelPrecisionBiasNV"));
+
/* GL_VERSION_1_2 */
flextglCopyTexSubImage3D = reinterpret_cast<void(APIENTRY*)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei)>(loader.load("glCopyTexSubImage3D"));
flextglDrawRangeElements = reinterpret_cast<void(APIENTRY*)(GLenum, GLuint, GLuint, GLsizei, GLenum, const void *)>(loader.load("glDrawRangeElements"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment