[Mesa-dev] [PATCH 13/16] main: Added entry point for glCreateSamplers
Martin Peres
martin.peres at linux.intel.com
Fri Mar 20 06:43:05 PDT 2015
On 19/03/15 23:50, Fredrik Höglund wrote:
> On Monday 16 February 2015, Martin Peres wrote:
>> Signed-off-by: Martin Peres <martin.peres at linux.intel.com>
>> ---
>> src/mapi/glapi/gen/ARB_direct_state_access.xml | 7 +++++++
>> src/mesa/main/samplerobj.c | 26 ++++++++++++++++++++------
>> src/mesa/main/samplerobj.h | 2 ++
>> src/mesa/main/tests/dispatch_sanity.cpp | 1 +
>> 4 files changed, 30 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
>> index 2102e82..db85ea3 100644
>> --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
>> +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
>> @@ -308,6 +308,13 @@
>> <param name="params" type="GLint *" />
>> </function>
>>
>> + <!-- Sampler object functions -->
>> +
>> + <function name="CreateSamplers" offset="assign">
>> + <param name="n" type="GLsizei" />
>> + <param name="samplers" type="GLuint *" />
>> + </function>
>> +
>> <!-- Program Pipeline object functions -->
>>
>> <function name="CreateProgramPipelines" offset="assign">
>> diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
>> index cadc9cc..5e44ece 100644
>> --- a/src/mesa/main/samplerobj.c
>> +++ b/src/mesa/main/samplerobj.c
>> @@ -181,19 +181,19 @@ _mesa_delete_sampler_object(struct gl_context *ctx,
>> free(sampObj);
>> }
>>
>> -
>> -void GLAPIENTRY
>> -_mesa_GenSamplers(GLsizei count, GLuint *samplers)
>> +static void
>> +create_samplers(struct gl_context *ctx, GLsizei count, GLuint *samplers,
>> + bool dsa)
>> {
>> - GET_CURRENT_CONTEXT(ctx);
>> + const char *func = dsa ? "glCreateSamplers" : "glGenSamplers";
>> GLuint first;
>> GLint i;
>>
>> if (MESA_VERBOSE & VERBOSE_API)
>> - _mesa_debug(ctx, "glGenSamplers(%d)\n", count);
>> + _mesa_debug(ctx, "%s(%d)\n", func, count);
>>
>> if (count < 0) {
>> - _mesa_error(ctx, GL_INVALID_VALUE, "glGenSamplers");
>> + _mesa_error(ctx, GL_INVALID_VALUE, "%s(n<0)", func);
>> return;
>> }
> It's not a big deal, but you could make func a parameter to
> create_samplers() instead, since the function doesn't need to know
> if it was called from a DSA entry point or not.
>
> I would also mention in the commit message that there are no
> functional differences between GenSamplers and CreateSamplers.
Done both, thanks for the comment!
>
>> @@ -211,6 +211,20 @@ _mesa_GenSamplers(GLsizei count, GLuint *samplers)
>> }
>> }
>>
>> +void GLAPIENTRY
>> +_mesa_GenSamplers(GLsizei count, GLuint *samplers)
>> +{
>> + GET_CURRENT_CONTEXT(ctx);
>> + create_samplers(ctx, count, samplers, false);
>> +}
>> +
>> +void GLAPIENTRY
>> +_mesa_CreateSamplers(GLsizei count, GLuint *samplers)
>> +{
>> + GET_CURRENT_CONTEXT(ctx);
>> + create_samplers(ctx, count, samplers, true);
>> +}
>> +
>>
>> void GLAPIENTRY
>> _mesa_DeleteSamplers(GLsizei count, const GLuint *samplers)
>> diff --git a/src/mesa/main/samplerobj.h b/src/mesa/main/samplerobj.h
>> index 1bb3193..988b874 100644
>> --- a/src/mesa/main/samplerobj.h
>> +++ b/src/mesa/main/samplerobj.h
>> @@ -80,6 +80,8 @@ _mesa_init_sampler_object_functions(struct dd_function_table *driver);
>> void GLAPIENTRY
>> _mesa_GenSamplers(GLsizei count, GLuint *samplers);
>> void GLAPIENTRY
>> +_mesa_CreateSamplers(GLsizei count, GLuint *samplers);
>> +void GLAPIENTRY
>> _mesa_DeleteSamplers(GLsizei count, const GLuint *samplers);
>> GLboolean GLAPIENTRY
>> _mesa_IsSampler(GLuint sampler);
>> diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
>> index cc2b267..cfbd1a2 100644
>> --- a/src/mesa/main/tests/dispatch_sanity.cpp
>> +++ b/src/mesa/main/tests/dispatch_sanity.cpp
>> @@ -993,6 +993,7 @@ const struct function gl_core_functions_possible[] = {
>> { "glTextureStorage2DMultisample", 45, -1 },
>> { "glTextureStorage3DMultisample", 45, -1 },
>> { "glTextureBuffer", 45, -1 },
>> + { "glCreateSamplers", 45, -1 },
>> { "glCreateProgramPipelines", 45, -1 },
>> { "glCreateQueries", 45, -1 },
>> { "glGetQueryBufferObjectiv", 45, -1 },
>>
More information about the mesa-dev
mailing list