[Mesa-dev] [PATCH 18/41] main: Added entry point for glTextureParameterf.

Brian Paul brianp at vmware.com
Fri Jan 2 07:50:10 PST 2015


On 12/30/2014 06:45 PM, Anuj Phogat wrote:
> On Tue, Dec 16, 2014 at 6:52 AM, Laura Ekstrand <laura at jlekstrand.net> wrote:
>> ---
>>   src/mapi/glapi/gen/ARB_direct_state_access.xml |  6 +++
>>   src/mesa/main/texparam.c                       | 52 +++++++++++++++++++++-----
>>   src/mesa/main/texparam.h                       | 20 ++++++++++
>>   3 files changed, 68 insertions(+), 10 deletions(-)
>>
>> diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
>> index f54c3f8..0757b98 100644
>> --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
>> +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
>> @@ -75,6 +75,12 @@
>>         <param name="pixels" type="const GLvoid *" />
>>      </function>
>>
>> +   <function name="TextureParameterf" offset="assign">
>> +      <param name="texture" type="GLuint" />
>> +      <param name="pname" type="GLenum" />
>> +      <param name="param" type="GLfloat" />
>> +   </function>
>> +
>>      <function name="BindTextureUnit" offset="assign">
>>         <param name="unit" type="GLuint" />
>>         <param name="texture" type="GLuint" />
>> diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
>> index 6121346..cd1a094 100644
>> --- a/src/mesa/main/texparam.c
>> +++ b/src/mesa/main/texparam.c
>> @@ -758,16 +758,12 @@ invalid_enum:
>>   }
>>
>>
>> -void GLAPIENTRY
>> -_mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
>> +void
>> +_mesa_texture_parameterf(struct gl_context *ctx,
>> +                         struct gl_texture_object *texObj,
>> +                         GLenum pname, GLfloat param, bool dsa)
>>   {
>>      GLboolean need_update;
>> -   struct gl_texture_object *texObj;
>> -   GET_CURRENT_CONTEXT(ctx);
>> -
>> -   texObj = get_texobj(ctx, target, GL_FALSE);
>> -   if (!texObj)
>> -      return;
>>
>>      switch (pname) {
>>      case GL_TEXTURE_MIN_FILTER:
>> @@ -795,16 +791,24 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
>>                   ((param < INT_MIN) ? INT_MIN : (GLint) (param - 0.5));
>>
>>            p[1] = p[2] = p[3] = 0;
>> -         need_update = set_tex_parameteri(ctx, texObj, pname, p, false);
>> +         need_update = set_tex_parameteri(ctx, texObj, pname, p, dsa);
>>         }
>>         break;
>> +   case GL_TEXTURE_BORDER_COLOR:
>> +   case GL_TEXTURE_SWIZZLE_RGBA:
>> +      {
>> +         _mesa_error(ctx, GL_INVALID_ENUM,
>> +                     "glTex%sParameterf(non-scalar pname)",
>> +                     dsa ? "ture" : "");
>> +         return;
>> +      }
>>      default:
>>         {
>>            /* this will generate an error if pname is illegal */
>>            GLfloat p[4];
>>            p[0] = param;
>>            p[1] = p[2] = p[3] = 0.0F;
>> -         need_update = set_tex_parameterf(ctx, texObj, pname, p, false);
>> +         need_update = set_tex_parameterf(ctx, texObj, pname, p, dsa);
>>         }
>>      }
>>
>> @@ -985,6 +989,19 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
>>   }
>>
>>
>> +void GLAPIENTRY
>> +_mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
>> +{
>> +   struct gl_texture_object *texObj;
>> +   GET_CURRENT_CONTEXT(ctx);
>> +
>> +   texObj = get_texobj(ctx, target, GL_FALSE);
>> +   if (!texObj)
>> +      return;
>> +
>> +   _mesa_texture_parameterf(ctx, texObj, pname, param, false);
>> +}
>> +
>>   /**
>>    * Set tex parameter to integer value(s).  Primarily intended to set
>>    * integer-valued texture border color (for integer-valued textures).
>> @@ -1042,6 +1059,21 @@ _mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
>>      /* XXX no driver hook for TexParameterIuiv() yet */
>>   }
>>
>> +void GLAPIENTRY
>> +_mesa_TextureParameterf( GLuint texture, GLenum pname, GLfloat param )
> Mesa don't use whitespace after opening (and before closing) function braces.
> Other patches in this series also use such whitespaces.

Many years ago I did put spaces there so that style is still found in 
the older code.  But nowadays we omit the spaces.

-Brian



More information about the mesa-dev mailing list