[Mesa-dev] [PATCH V2 02/12] mesa: Add new functions and enums required by GL_ARB_sample_shading
Paul Berry
stereotype441 at gmail.com
Mon Oct 28 22:07:36 CET 2013
On 25 October 2013 16:44, Anuj Phogat <anuj.phogat at gmail.com> wrote:
> New functions added by GL_ARB_sample_shading:
> glMinSampleShadingARB()
>
> New enums:
> GL_SAMPLE_SHADING_ARB
> GL_MIN_SAMPLE_SHADING_VALUE_ARB
>
> V2: Update comments.
> Create new GL4x.xml.
> Remove redundant code in get.c.
> Update the API_XML list in Makefile.am.
> Add extra_gl40_ARB_sample_shading predicate to get.c.
>
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> Reviewed-by: Ken Graunke <kenneth at whitecape.org>
>
This patch breaks "make check". src/mesa/main/tests/test-suite.log says:
===========================================================
Mesa 10.0.0-devel: src/mesa/main/tests/test-suite.log
===========================================================
# TOTAL: 1
# PASS: 0
# SKIP: 0
# XFAIL: 0
# FAIL: 1
# XPASS: 0
# ERROR: 0
.. contents:: :depth: 2
FAIL: main-test
===============
Running main() from gtest_main.cc
[==========] Running 7 tests from 3 test cases.
[----------] Global test environment set-up.
[----------] 2 tests from EnumStrings
[ RUN ] EnumStrings.LookUpByNumber
[ OK ] EnumStrings.LookUpByNumber (0 ms)
[ RUN ] EnumStrings.LookUpUnknownNumber
[ OK ] EnumStrings.LookUpUnknownNumber (0 ms)
[----------] 2 tests from EnumStrings (0 ms total)
[----------] 4 tests from DispatchSanity_test
[ RUN ] DispatchSanity_test.GL31_CORE
dispatch_sanity.cpp:166: Failure
Value of: table[i]
Actual: 0x45702c
Expected: (_glapi_proc) _mesa_generic_nop
Which is: 0x40cb2c
i = 620 (MinSampleShading)
[ FAILED ] DispatchSanity_test.GL31_CORE (1 ms)
[ RUN ] DispatchSanity_test.GLES11
[ OK ] DispatchSanity_test.GLES11 (1 ms)
[ RUN ] DispatchSanity_test.GLES2
[ OK ] DispatchSanity_test.GLES2 (0 ms)
[ RUN ] DispatchSanity_test.GLES3
[ OK ] DispatchSanity_test.GLES3 (0 ms)
[----------] 4 tests from DispatchSanity_test (2 ms total)
[----------] 1 test from program_state_string
[ RUN ] program_state_string.depth_range
[ OK ] program_state_string.depth_range (0 ms)
[----------] 1 test from program_state_string (0 ms total)
[----------] Global test environment tear-down
[==========] 7 tests from 3 test cases ran. (2 ms total)
[ PASSED ] 6 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] DispatchSanity_test.GL31_CORE
1 FAILED TEST
> ---
> src/mapi/glapi/gen/ARB_sample_shading.xml | 19 +++++++++++++++++++
> src/mapi/glapi/gen/GL4x.xml | 21 +++++++++++++++++++++
> src/mapi/glapi/gen/Makefile.am | 4 +++-
> src/mapi/glapi/gen/gl_API.xml | 3 ++-
> src/mesa/main/enable.c | 16 ++++++++++++++++
> src/mesa/main/get.c | 8 ++++++++
> src/mesa/main/get_hash_params.py | 3 +++
> src/mesa/main/mtypes.h | 2 ++
> src/mesa/main/multisample.c | 18 ++++++++++++++++++
> src/mesa/main/multisample.h | 2 ++
> src/mesa/main/tests/dispatch_sanity.cpp | 2 +-
> 11 files changed, 95 insertions(+), 3 deletions(-)
> create mode 100644 src/mapi/glapi/gen/ARB_sample_shading.xml
> create mode 100644 src/mapi/glapi/gen/GL4x.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/GL4x.xml b/src/mapi/glapi/gen/GL4x.xml
> new file mode 100644
> index 0000000..367741f
> --- /dev/null
> +++ b/src/mapi/glapi/gen/GL4x.xml
> @@ -0,0 +1,21 @@
> +<?xml version="1.0"?>
> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
> +
> +<!-- Note: no GLX protocol info yet. -->
> +
> +<OpenGLAPI>
> +
> +<category name="4.0">
> + <enum name="SAMPLE_SHADING" value="0x8C36"/>
> + <enum name="MIN_SAMPLE_SHADING_VALUE" value="0x8C37"/>
> +
> + <function name="MinSampleShading" offset="assign">
> + <param name="value" type="GLclampf"/>
> + </function>
> +</category>
> +
> +<category name="4.3">
> +
> +</category>
> +
> +</OpenGLAPI>
> diff --git a/src/mapi/glapi/gen/Makefile.am
> b/src/mapi/glapi/gen/Makefile.am
> index d71d5d2..b8d280c 100644
> --- a/src/mapi/glapi/gen/Makefile.am
> +++ b/src/mapi/glapi/gen/Makefile.am
> @@ -108,6 +108,7 @@ API_XML = \
> ARB_invalidate_subdata.xml \
> ARB_map_buffer_range.xml \
> ARB_robustness.xml \
> + ARB_sample_shading.xml \
> ARB_sampler_objects.xml \
> ARB_seamless_cube_map.xml \
> ARB_sync.xml \
> @@ -142,7 +143,8 @@ API_XML = \
> NV_primitive_restart.xml \
> NV_texture_barrier.xml \
> OES_EGL_image.xml \
> - GL3x.xml
> + GL3x.xml \
> + GL4x.xml
>
>
> COMMON = $(API_XML) \
> diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
> index 48fce36..f0eea9b 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 -->
> @@ -13150,4 +13150,5 @@
>
> <xi:include href="EXT_transform_feedback.xml" xmlns:xi="
> http://www.w3.org/2001/XInclude"/>
>
> +<xi:include href="GL4x.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
> </OpenGLAPI>
> diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
> index 5e2fd80..c9ccfd2 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:
> + 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:
> + 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..9ad87c4 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -131,6 +131,7 @@ enum value_extra {
> EXTRA_VERSION_30,
> EXTRA_VERSION_31,
> EXTRA_VERSION_32,
> + EXTRA_VERSION_40,
> EXTRA_API_GL,
> EXTRA_API_GL_CORE,
> EXTRA_API_ES2,
> @@ -384,6 +385,7 @@ extra_NV_primitive_restart[] = {
> static const int extra_version_30[] = { EXTRA_VERSION_30, EXTRA_END };
> static const int extra_version_31[] = { EXTRA_VERSION_31, EXTRA_END };
> static const int extra_version_32[] = { EXTRA_VERSION_32, EXTRA_END };
> +static const int extra_version_40[] = { EXTRA_VERSION_40, EXTRA_END };
>
> static const int extra_gl30_es3[] = {
> EXTRA_VERSION_30,
> @@ -403,6 +405,12 @@ static const int extra_gl32_ARB_geometry_shader4[] = {
> EXTRA_END
> };
>
> +static const int extra_gl40_ARB_sample_shading[] = {
> + EXTRA_VERSION_40,
> + EXT(ARB_sample_shading),
> + EXTRA_END
> +};
> +
> static const int
> extra_ARB_vertex_program_api_es2[] = {
> EXT(ARB_vertex_program),
> diff --git a/src/mesa/main/get_hash_params.py
> b/src/mesa/main/get_hash_params.py
> index 9c54af0..2fe0615 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),
> extra_gl40_ARB_sample_shading" ],
> +
> # 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 67f1bf6..8306969 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..9824c0e 100644
> --- a/src/mesa/main/multisample.c
> +++ b/src/mesa/main/multisample.c
> @@ -119,6 +119,24 @@ _mesa_SampleMaski(GLuint index, GLbitfield mask)
> ctx->Multisample.SampleMaskValue = mask;
> }
>
> +/**
> + * Called via glMinSampleShadingARB
> + */
> +void GLAPIENTRY
> +_mesa_MinSampleShading(GLclampf value)
> +{
> + GET_CURRENT_CONTEXT(ctx);
> +
> + if (!ctx->Extensions.ARB_sample_shading) {
> + _mesa_error(ctx, GL_INVALID_OPERATION, "glMinSampleShading");
> + return;
> + }
> +
> + FLUSH_VERTICES(ctx, 0);
> +
> + ctx->Multisample.MinSampleShadingValue = 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..771efd9 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 }, // XXX: Add to xml
> // { "glBlendEquationi", 40, -1 }, // XXX: Add to xml
> // { "glBlendEquationSeparatei", 40, -1 }, // XXX: Add to xml
> // { "glBlendFunci", 40, -1 }, // XXX: Add to xml
> --
> 1.8.1.4
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131028/1777cc56/attachment-0001.html>
More information about the mesa-dev
mailing list