[Mesa-dev] [PATCH 2/8] mesa: Add new functions and enums required by GL_ARB_sample_shading
Anuj Phogat
anuj.phogat at gmail.com
Mon Oct 14 19:12:50 CEST 2013
New functions added by GL_ARB_sample_shading:
glMinSampleShadingARB()
New enums:
GL_SAMPLE_SHADING_ARB
GL_MIN_SAMPLE_SHADING_VALUE_ARB
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
src/mapi/glapi/gen/ARB_sample_shading.xml | 19 +++++++++++++++++++
src/mapi/glapi/gen/GL3x.xml | 5 +++++
src/mapi/glapi/gen/gl_API.xml | 2 +-
src/mesa/main/enable.c | 16 ++++++++++++++++
src/mesa/main/get.c | 4 ++++
src/mesa/main/get_hash_params.py | 3 +++
src/mesa/main/mtypes.h | 2 ++
src/mesa/main/multisample.c | 13 +++++++++++++
src/mesa/main/multisample.h | 2 ++
src/mesa/main/tests/dispatch_sanity.cpp | 4 ++--
10 files changed, 67 insertions(+), 3 deletions(-)
create mode 100644 src/mapi/glapi/gen/ARB_sample_shading.xml
diff --git a/src/mapi/glapi/gen/ARB_sample_shading.xml b/src/mapi/glapi/gen/ARB_sample_shading.xml
new file mode 100644
index 0000000..a87a517
--- /dev/null
+++ b/src/mapi/glapi/gen/ARB_sample_shading.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<!-- Note: no GLX protocol info yet. -->
+
+<OpenGLAPI>
+
+<category name="GL_ARB_sample_shading" number="70">
+
+ <enum name="SAMPLE_SHADING_ARB" value="0x8C36"/>
+ <enum name="MIN_SAMPLE_SHADING_VALUE_ARB" value="0x8C37"/>
+
+ <function name="MinSampleShadingARB" alias="MinSampleShading">
+ <param name="value" type="GLclampf"/>
+ </function>
+
+</category>
+
+</OpenGLAPI>
diff --git a/src/mapi/glapi/gen/GL3x.xml b/src/mapi/glapi/gen/GL3x.xml
index 5078f7b..4ec4749 100644
--- a/src/mapi/glapi/gen/GL3x.xml
+++ b/src/mapi/glapi/gen/GL3x.xml
@@ -630,6 +630,11 @@
<param name="divisor" type="GLuint"/>
</function>
+ <function name="MinSampleShading" offset="assign">
+ <param name="value" type="GLclampf"/>
+ </function>
+
+
</category>
</OpenGLAPI>
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index 48fce36..8919852 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -8187,7 +8187,7 @@
<xi:include href="ARB_draw_buffers_blend.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="AMD_draw_buffers_blend.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
-<!-- 70. GL_ARB_sample_shading -->
+<xi:include href="ARB_sample_shading.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="ARB_texture_cube_map_array.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="ARB_texture_gather.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<!-- 73. GL_ARB_texture_query_lod -->
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 5e2fd80..83c59ee 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -802,6 +802,15 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->Multisample.SampleCoverageInvert = state;
break;
+ /*GL_ARB_sample_shading*/
+ case GL_SAMPLE_SHADING_ARB:
+ CHECK_EXTENSION(ARB_sample_shading, cap);
+ if (ctx->Multisample.SampleShading == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ ctx->Multisample.SampleShading = state;
+ break;
+
/* GL_IBM_rasterpos_clip */
case GL_RASTER_POSITION_UNCLIPPED_IBM:
if (ctx->API != API_OPENGL_COMPAT)
@@ -1594,6 +1603,13 @@ _mesa_IsEnabled( GLenum cap )
CHECK_EXTENSION(ARB_texture_multisample);
return ctx->Multisample.SampleMask;
+ /* ARB_sample_shading */
+ case GL_SAMPLE_SHADING_ARB:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum_error;
+ CHECK_EXTENSION(ARB_sample_shading);
+ return ctx->Multisample.SampleShading;
+
default:
goto invalid_enum_error;
}
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 89b3bf0..c52133e 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -894,6 +894,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
_mesa_problem(ctx, "driver doesn't implement GetTimestamp");
}
break;
+ /* GL_ARB_sample_shading */
+ case GL_MIN_SAMPLE_SHADING_VALUE_ARB:
+ v->value_float = ctx->Multisample.MinSampleShadingValue;
+ break;
}
}
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 9c54af0..0d7effb 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -83,6 +83,9 @@ descriptor=[
[ "SAMPLE_BUFFERS_ARB", "BUFFER_INT(Visual.sampleBuffers), extra_new_buffers" ],
[ "SAMPLES_ARB", "BUFFER_INT(Visual.samples), extra_new_buffers" ],
+# GL_ARB_sample_shading
+ [ "MIN_SAMPLE_SHADING_VALUE_ARB", "CONTEXT_FLOAT(Multisample.MinSampleShadingValue), NO_EXTRA" ],
+
# GL_SGIS_generate_mipmap
[ "GENERATE_MIPMAP_HINT_SGIS", "CONTEXT_ENUM(Hint.GenerateMipmap), NO_EXTRA" ],
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 053514d..5520e86 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -872,6 +872,8 @@ struct gl_multisample_attrib
GLboolean SampleCoverage;
GLfloat SampleCoverageValue;
GLboolean SampleCoverageInvert;
+ GLboolean SampleShading;
+ GLfloat MinSampleShadingValue;
/* ARB_texture_multisample / GL3.2 additions */
GLboolean SampleMask;
diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c
index bd97c50..892525e 100644
--- a/src/mesa/main/multisample.c
+++ b/src/mesa/main/multisample.c
@@ -119,6 +119,19 @@ _mesa_SampleMaski(GLuint index, GLbitfield mask)
ctx->Multisample.SampleMaskValue = mask;
}
+/**
+ * Called via glMinSampleShadingARB
+ */
+void GLAPIENTRY
+_mesa_MinSampleShading(GLclampf value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ FLUSH_VERTICES(ctx, 0);
+
+ ctx->Multisample.MinSampleShadingValue = (GLfloat) CLAMP(value, 0.0, 1.0);
+ ctx->NewState |= _NEW_MULTISAMPLE;
+}
/**
* Helper for checking a requested sample count against the limit
diff --git a/src/mesa/main/multisample.h b/src/mesa/main/multisample.h
index 66848d2..7441d3e 100644
--- a/src/mesa/main/multisample.h
+++ b/src/mesa/main/multisample.h
@@ -44,6 +44,8 @@ _mesa_GetMultisamplefv(GLenum pname, GLuint index, GLfloat* val);
extern void GLAPIENTRY
_mesa_SampleMaski(GLuint index, GLbitfield mask);
+extern void GLAPIENTRY
+_mesa_MinSampleShading(GLclampf value);
extern GLenum
_mesa_check_sample_count(struct gl_context *ctx, GLenum target,
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 244173a..19a77db 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -542,7 +542,7 @@ const struct function gl_core_functions_possible[] = {
{ "glVertexAttribDivisor", 33, -1 },
/* GL 4.0 */
-// { "glMinSampleShading", 40, -1 }, // XXX: Add to xml
+ { "glMinSampleShadingARB", 40, -1 },
// { "glBlendEquationi", 40, -1 }, // XXX: Add to xml
// { "glBlendEquationSeparatei", 40, -1 }, // XXX: Add to xml
// { "glBlendFunci", 40, -1 }, // XXX: Add to xml
@@ -603,7 +603,7 @@ const struct function gl_core_functions_possible[] = {
{ "glBlendEquationSeparateiARB", 43, -1 },
{ "glBlendFunciARB", 43, -1 },
{ "glBlendFuncSeparateiARB", 43, -1 },
-// { "glMinSampleShadingARB", 43, -1 }, // XXX: Add to xml
+ { "glMinSampleShadingARB", 43, -1 },
// { "glNamedStringARB", 43, -1 }, // XXX: Add to xml
// { "glDeleteNamedStringARB", 43, -1 }, // XXX: Add to xml
// { "glCompileShaderIncludeARB", 43, -1 }, // XXX: Add to xml
--
1.8.1.4
More information about the mesa-dev
mailing list