[Mesa-dev] [PATCH 2/5] glsl: Get rid of hardcoded arrays of shader target names.

Kenneth Graunke kenneth at whitecape.org
Tue Dec 17 12:03:29 PST 2013


On 12/17/2013 11:50 AM, Brian Paul wrote:
> On 12/17/2013 12:28 PM, Paul Berry wrote:
[snip]
>> How about this idea instead: rather than use function overloading to
>> distinguish between the two meanings of _mesa_glsl_shader_target_name(),
>> have two functions with separate names, e.g.:
>>
>> const char *_mesa_gl_shader_type_to_string(unsigned): converts
>> MESA_SHADER_VERTEX -> "vertex", etc.
>>
>> const char *_mesa_shader_target_enum_to_string(GLenum): converts
>> GL_VERTEX_SHADER -> "vertex", etc.
>>
>> That would eliminate the need for typecasts, and it would reduce the
>> danger of someone calling the wrong function by mistake.
> 
> That sounds fine.  Though I think slightly shorter functions names could
> be used:
> 
> _mesa_shader_type_to_string(), _mesa_shader_enum_to_string()
> 
> But no big deal.
> 
> -Brian

I like the idea of renaming the functions, and prefer the shorter names.

--Ken


More information about the mesa-dev mailing list