mesa: demystify material_attrib()
the next commit would break this magic math Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
This commit is contained in:
@@ -836,7 +836,20 @@ static void build_hpos( struct tnl_program *p )
|
||||
|
||||
static GLuint material_attrib( GLuint side, GLuint property )
|
||||
{
|
||||
return (property - STATE_AMBIENT) * 2 + side;
|
||||
switch (property) {
|
||||
case STATE_AMBIENT:
|
||||
return MAT_ATTRIB_FRONT_AMBIENT + side;
|
||||
case STATE_DIFFUSE:
|
||||
return MAT_ATTRIB_FRONT_DIFFUSE + side;
|
||||
case STATE_SPECULAR:
|
||||
return MAT_ATTRIB_FRONT_SPECULAR + side;
|
||||
case STATE_EMISSION:
|
||||
return MAT_ATTRIB_FRONT_EMISSION + side;
|
||||
case STATE_SHININESS:
|
||||
return MAT_ATTRIB_FRONT_SHININESS + side;
|
||||
default:
|
||||
unreachable("invalid value");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user