<div dir="ltr">On 25 October 2013 16:44, Anuj Phogat <span dir="ltr"><<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">New functions added by GL_ARB_sample_shading:<br>
glMinSampleShadingARB()<br>
<br>
New enums:<br>
GL_SAMPLE_SHADING_ARB<br>
GL_MIN_SAMPLE_SHADING_VALUE_ARB<br>
<br>
V2: Update comments.<br>
Create new GL4x.xml.<br>
Remove redundant code in get.c.<br>
Update the API_XML list in Makefile.am.<br>
Add extra_gl40_ARB_sample_shading predicate to get.c.<br>
<br>
Signed-off-by: Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>><br>
Reviewed-by: Ken Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br></blockquote><div><br></div><div>This patch breaks "make check". src/mesa/main/tests/test-suite.log says:<br>
<br>===========================================================<br> Mesa 10.0.0-devel: src/mesa/main/tests/test-suite.log<br>===========================================================<br><br># TOTAL: 1<br># PASS: 0<br>
# SKIP: 0<br># XFAIL: 0<br># FAIL: 1<br># XPASS: 0<br># ERROR: 0<br><br>.. contents:: :depth: 2<br><br>FAIL: main-test<br>===============<br><br>Running main() from gtest_main.cc<br>[==========] Running 7 tests from 3 test cases.<br>
[----------] Global test environment set-up.<br>[----------] 2 tests from EnumStrings<br>[ RUN ] EnumStrings.LookUpByNumber<br>[ OK ] EnumStrings.LookUpByNumber (0 ms)<br>[ RUN ] EnumStrings.LookUpUnknownNumber<br>
[ OK ] EnumStrings.LookUpUnknownNumber (0 ms)<br>[----------] 2 tests from EnumStrings (0 ms total)<br><br>[----------] 4 tests from DispatchSanity_test<br>[ RUN ] DispatchSanity_test.GL31_CORE<br>dispatch_sanity.cpp:166: Failure<br>
Value of: table[i]<br> Actual: 0x45702c<br>Expected: (_glapi_proc) _mesa_generic_nop<br>Which is: 0x40cb2c<br>i = 620 (MinSampleShading)<br>[ FAILED ] DispatchSanity_test.GL31_CORE (1 ms)<br>[ RUN ] DispatchSanity_test.GLES11<br>
[ OK ] DispatchSanity_test.GLES11 (1 ms)<br>[ RUN ] DispatchSanity_test.GLES2<br>[ OK ] DispatchSanity_test.GLES2 (0 ms)<br>[ RUN ] DispatchSanity_test.GLES3<br>[ OK ] DispatchSanity_test.GLES3 (0 ms)<br>
[----------] 4 tests from DispatchSanity_test (2 ms total)<br><br>[----------] 1 test from program_state_string<br>[ RUN ] program_state_string.depth_range<br>[ OK ] program_state_string.depth_range (0 ms)<br>[----------] 1 test from program_state_string (0 ms total)<br>
<br>[----------] Global test environment tear-down<br>[==========] 7 tests from 3 test cases ran. (2 ms total)<br>[ PASSED ] 6 tests.<br>[ FAILED ] 1 test, listed below:<br>[ FAILED ] DispatchSanity_test.GL31_CORE<br>
<br> 1 FAILED TEST<br><br><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
src/mapi/glapi/gen/ARB_sample_shading.xml | 19 +++++++++++++++++++<br>
src/mapi/glapi/gen/GL4x.xml | 21 +++++++++++++++++++++<br>
src/mapi/glapi/gen/Makefile.am | 4 +++-<br>
src/mapi/glapi/gen/gl_API.xml | 3 ++-<br>
src/mesa/main/enable.c | 16 ++++++++++++++++<br>
src/mesa/main/get.c | 8 ++++++++<br>
src/mesa/main/get_hash_params.py | 3 +++<br>
src/mesa/main/mtypes.h | 2 ++<br>
src/mesa/main/multisample.c | 18 ++++++++++++++++++<br>
src/mesa/main/multisample.h | 2 ++<br>
src/mesa/main/tests/dispatch_sanity.cpp | 2 +-<br>
11 files changed, 95 insertions(+), 3 deletions(-)<br>
create mode 100644 src/mapi/glapi/gen/ARB_sample_shading.xml<br>
create mode 100644 src/mapi/glapi/gen/GL4x.xml<br>
<br>
diff --git a/src/mapi/glapi/gen/ARB_sample_shading.xml b/src/mapi/glapi/gen/ARB_sample_shading.xml<br>
new file mode 100644<br>
index 0000000..a87a517<br>
--- /dev/null<br>
+++ b/src/mapi/glapi/gen/ARB_sample_shading.xml<br>
@@ -0,0 +1,19 @@<br>
+<?xml version="1.0"?><br>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"><br>
+<br>
+<!-- Note: no GLX protocol info yet. --><br>
+<br>
+<OpenGLAPI><br>
+<br>
+<category name="GL_ARB_sample_shading" number="70"><br>
+<br>
+ <enum name="SAMPLE_SHADING_ARB" value="0x8C36"/><br>
+ <enum name="MIN_SAMPLE_SHADING_VALUE_ARB" value="0x8C37"/><br>
+<br>
+ <function name="MinSampleShadingARB" alias="MinSampleShading"><br>
+ <param name="value" type="GLclampf"/><br>
+ </function><br>
+<br>
+</category><br>
+<br>
+</OpenGLAPI><br>
diff --git a/src/mapi/glapi/gen/GL4x.xml b/src/mapi/glapi/gen/GL4x.xml<br>
new file mode 100644<br>
index 0000000..367741f<br>
--- /dev/null<br>
+++ b/src/mapi/glapi/gen/GL4x.xml<br>
@@ -0,0 +1,21 @@<br>
+<?xml version="1.0"?><br>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"><br>
+<br>
+<!-- Note: no GLX protocol info yet. --><br>
+<br>
+<OpenGLAPI><br>
+<br>
+<category name="4.0"><br>
+ <enum name="SAMPLE_SHADING" value="0x8C36"/><br>
+ <enum name="MIN_SAMPLE_SHADING_VALUE" value="0x8C37"/><br>
+<br>
+ <function name="MinSampleShading" offset="assign"><br>
+ <param name="value" type="GLclampf"/><br>
+ </function><br>
+</category><br>
+<br>
+<category name="4.3"><br>
+<br>
+</category><br>
+<br>
+</OpenGLAPI><br>
diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am<br>
index d71d5d2..b8d280c 100644<br>
--- a/src/mapi/glapi/gen/Makefile.am<br>
+++ b/src/mapi/glapi/gen/Makefile.am<br>
@@ -108,6 +108,7 @@ API_XML = \<br>
ARB_invalidate_subdata.xml \<br>
ARB_map_buffer_range.xml \<br>
ARB_robustness.xml \<br>
+ ARB_sample_shading.xml \<br>
ARB_sampler_objects.xml \<br>
ARB_seamless_cube_map.xml \<br>
ARB_sync.xml \<br>
@@ -142,7 +143,8 @@ API_XML = \<br>
NV_primitive_restart.xml \<br>
NV_texture_barrier.xml \<br>
OES_EGL_image.xml \<br>
- GL3x.xml<br>
+ GL3x.xml \<br>
+ GL4x.xml<br>
<br>
<br>
COMMON = $(API_XML) \<br>
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml<br>
index 48fce36..f0eea9b 100644<br>
--- a/src/mapi/glapi/gen/gl_API.xml<br>
+++ b/src/mapi/glapi/gen/gl_API.xml<br>
@@ -8187,7 +8187,7 @@<br>
<xi:include href="ARB_draw_buffers_blend.xml" xmlns:xi="<a href="http://www.w3.org/2001/XInclude" target="_blank">http://www.w3.org/2001/XInclude</a>"/><br>
<xi:include href="AMD_draw_buffers_blend.xml" xmlns:xi="<a href="http://www.w3.org/2001/XInclude" target="_blank">http://www.w3.org/2001/XInclude</a>"/><br>
<br>
-<!-- 70. GL_ARB_sample_shading --><br>
+<xi:include href="ARB_sample_shading.xml" xmlns:xi="<a href="http://www.w3.org/2001/XInclude" target="_blank">http://www.w3.org/2001/XInclude</a>"/><br>
<xi:include href="ARB_texture_cube_map_array.xml" xmlns:xi="<a href="http://www.w3.org/2001/XInclude" target="_blank">http://www.w3.org/2001/XInclude</a>"/><br>
<xi:include href="ARB_texture_gather.xml" xmlns:xi="<a href="http://www.w3.org/2001/XInclude" target="_blank">http://www.w3.org/2001/XInclude</a>"/><br>
<!-- 73. GL_ARB_texture_query_lod --><br>
@@ -13150,4 +13150,5 @@<br>
<br>
<xi:include href="EXT_transform_feedback.xml" xmlns:xi="<a href="http://www.w3.org/2001/XInclude" target="_blank">http://www.w3.org/2001/XInclude</a>"/><br>
<br>
+<xi:include href="GL4x.xml" xmlns:xi="<a href="http://www.w3.org/2001/XInclude" target="_blank">http://www.w3.org/2001/XInclude</a>"/><br>
</OpenGLAPI><br>
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c<br>
index 5e2fd80..c9ccfd2 100644<br>
--- a/src/mesa/main/enable.c<br>
+++ b/src/mesa/main/enable.c<br>
@@ -802,6 +802,15 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)<br>
ctx->Multisample.SampleCoverageInvert = state;<br>
break;<br>
<br>
+ /* GL_ARB_sample_shading */<br>
+ case GL_SAMPLE_SHADING:<br>
+ CHECK_EXTENSION(ARB_sample_shading, cap);<br>
+ if (ctx->Multisample.SampleShading == state)<br>
+ return;<br>
+ FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);<br>
+ ctx->Multisample.SampleShading = state;<br>
+ break;<br>
+<br>
/* GL_IBM_rasterpos_clip */<br>
case GL_RASTER_POSITION_UNCLIPPED_IBM:<br>
if (ctx->API != API_OPENGL_COMPAT)<br>
@@ -1594,6 +1603,13 @@ _mesa_IsEnabled( GLenum cap )<br>
CHECK_EXTENSION(ARB_texture_multisample);<br>
return ctx->Multisample.SampleMask;<br>
<br>
+ /* ARB_sample_shading */<br>
+ case GL_SAMPLE_SHADING:<br>
+ if (!_mesa_is_desktop_gl(ctx))<br>
+ goto invalid_enum_error;<br>
+ CHECK_EXTENSION(ARB_sample_shading);<br>
+ return ctx->Multisample.SampleShading;<br>
+<br>
default:<br>
goto invalid_enum_error;<br>
}<br>
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c<br>
index 89b3bf0..9ad87c4 100644<br>
--- a/src/mesa/main/get.c<br>
+++ b/src/mesa/main/get.c<br>
@@ -131,6 +131,7 @@ enum value_extra {<br>
EXTRA_VERSION_30,<br>
EXTRA_VERSION_31,<br>
EXTRA_VERSION_32,<br>
+ EXTRA_VERSION_40,<br>
EXTRA_API_GL,<br>
EXTRA_API_GL_CORE,<br>
EXTRA_API_ES2,<br>
@@ -384,6 +385,7 @@ extra_NV_primitive_restart[] = {<br>
static const int extra_version_30[] = { EXTRA_VERSION_30, EXTRA_END };<br>
static const int extra_version_31[] = { EXTRA_VERSION_31, EXTRA_END };<br>
static const int extra_version_32[] = { EXTRA_VERSION_32, EXTRA_END };<br>
+static const int extra_version_40[] = { EXTRA_VERSION_40, EXTRA_END };<br>
<br>
static const int extra_gl30_es3[] = {<br>
EXTRA_VERSION_30,<br>
@@ -403,6 +405,12 @@ static const int extra_gl32_ARB_geometry_shader4[] = {<br>
EXTRA_END<br>
};<br>
<br>
+static const int extra_gl40_ARB_sample_shading[] = {<br>
+ EXTRA_VERSION_40,<br>
+ EXT(ARB_sample_shading),<br>
+ EXTRA_END<br>
+};<br>
+<br>
static const int<br>
extra_ARB_vertex_program_api_es2[] = {<br>
EXT(ARB_vertex_program),<br>
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py<br>
index 9c54af0..2fe0615 100644<br>
--- a/src/mesa/main/get_hash_params.py<br>
+++ b/src/mesa/main/get_hash_params.py<br>
@@ -83,6 +83,9 @@ descriptor=[<br>
[ "SAMPLE_BUFFERS_ARB", "BUFFER_INT(Visual.sampleBuffers), extra_new_buffers" ],<br>
[ "SAMPLES_ARB", "BUFFER_INT(Visual.samples), extra_new_buffers" ],<br>
<br>
+# GL_ARB_sample_shading<br>
+ [ "MIN_SAMPLE_SHADING_VALUE_ARB", "CONTEXT_FLOAT(Multisample.MinSampleShadingValue), extra_gl40_ARB_sample_shading" ],<br>
+<br>
# GL_SGIS_generate_mipmap<br>
[ "GENERATE_MIPMAP_HINT_SGIS", "CONTEXT_ENUM(Hint.GenerateMipmap), NO_EXTRA" ],<br>
<br>
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h<br>
index 67f1bf6..8306969 100644<br>
--- a/src/mesa/main/mtypes.h<br>
+++ b/src/mesa/main/mtypes.h<br>
@@ -872,6 +872,8 @@ struct gl_multisample_attrib<br>
GLboolean SampleCoverage;<br>
GLfloat SampleCoverageValue;<br>
GLboolean SampleCoverageInvert;<br>
+ GLboolean SampleShading;<br>
+ GLfloat MinSampleShadingValue;<br>
<br>
/* ARB_texture_multisample / GL3.2 additions */<br>
GLboolean SampleMask;<br>
diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c<br>
index bd97c50..9824c0e 100644<br>
--- a/src/mesa/main/multisample.c<br>
+++ b/src/mesa/main/multisample.c<br>
@@ -119,6 +119,24 @@ _mesa_SampleMaski(GLuint index, GLbitfield mask)<br>
ctx->Multisample.SampleMaskValue = mask;<br>
}<br>
<br>
+/**<br>
+ * Called via glMinSampleShadingARB<br>
+ */<br>
+void GLAPIENTRY<br>
+_mesa_MinSampleShading(GLclampf value)<br>
+{<br>
+ GET_CURRENT_CONTEXT(ctx);<br>
+<br>
+ if (!ctx->Extensions.ARB_sample_shading) {<br>
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glMinSampleShading");<br>
+ return;<br>
+ }<br>
+<br>
+ FLUSH_VERTICES(ctx, 0);<br>
+<br>
+ ctx->Multisample.MinSampleShadingValue = CLAMP(value, 0.0, 1.0);<br>
+ ctx->NewState |= _NEW_MULTISAMPLE;<br>
+}<br>
<br>
/**<br>
* Helper for checking a requested sample count against the limit<br>
diff --git a/src/mesa/main/multisample.h b/src/mesa/main/multisample.h<br>
index 66848d2..7441d3e 100644<br>
--- a/src/mesa/main/multisample.h<br>
+++ b/src/mesa/main/multisample.h<br>
@@ -44,6 +44,8 @@ _mesa_GetMultisamplefv(GLenum pname, GLuint index, GLfloat* val);<br>
extern void GLAPIENTRY<br>
_mesa_SampleMaski(GLuint index, GLbitfield mask);<br>
<br>
+extern void GLAPIENTRY<br>
+_mesa_MinSampleShading(GLclampf value);<br>
<br>
extern GLenum<br>
_mesa_check_sample_count(struct gl_context *ctx, GLenum target,<br>
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp<br>
index 244173a..771efd9 100644<br>
--- a/src/mesa/main/tests/dispatch_sanity.cpp<br>
+++ b/src/mesa/main/tests/dispatch_sanity.cpp<br>
@@ -542,7 +542,7 @@ const struct function gl_core_functions_possible[] = {<br>
{ "glVertexAttribDivisor", 33, -1 },<br>
<br>
/* GL 4.0 */<br>
-// { "glMinSampleShading", 40, -1 }, // XXX: Add to xml<br>
+// { "glMinSampleShadingARB", 40, -1 }, // XXX: Add to xml<br>
// { "glBlendEquationi", 40, -1 }, // XXX: Add to xml<br>
// { "glBlendEquationSeparatei", 40, -1 }, // XXX: Add to xml<br>
// { "glBlendFunci", 40, -1 }, // XXX: Add to xml<br>
<span class=""><font color="#888888">--<br>
1.8.1.4<br>
<br>
</font></span></blockquote></div><br></div></div>