mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 04:20:18 +01:00
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:
parent
fc31d9b733
commit
cc4afb2101
1 changed files with 14 additions and 1 deletions
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue