diff options
author | Brian Paul <brianp@vmware.com> | 2013-06-28 08:08:38 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2013-06-28 08:37:59 -0600 |
commit | 74e8a7d1ddafc8dd465795d1fcc85709c5c4c0ba (patch) | |
tree | 97fe989040f6ef7cf583fd3f195006e56bab76e9 /src/gallium/drivers/svga | |
parent | 24b05ff1581b612ab6dbf4937fa4b644b4e61379 (diff) | |
download | external_mesa3d-74e8a7d1ddafc8dd465795d1fcc85709c5c4c0ba.zip external_mesa3d-74e8a7d1ddafc8dd465795d1fcc85709c5c4c0ba.tar.gz external_mesa3d-74e8a7d1ddafc8dd465795d1fcc85709c5c4c0ba.tar.bz2 |
svga: use switch statement in svga_shader_type()
Safer in case the PIPE_SHADER_x tokens get renumbered (as Marek
wanted to do).
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r-- | src/gallium/drivers/svga/svga_state_constants.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gallium/drivers/svga/svga_state_constants.c b/src/gallium/drivers/svga/svga_state_constants.c index 77c9349..1c0edb4 100644 --- a/src/gallium/drivers/svga/svga_state_constants.c +++ b/src/gallium/drivers/svga/svga_state_constants.c @@ -46,13 +46,18 @@ /** * Convert from PIPE_SHADER_* to SVGA3D_SHADERTYPE_* */ -static int +static unsigned svga_shader_type(unsigned shader) { - assert(PIPE_SHADER_VERTEX + 1 == SVGA3D_SHADERTYPE_VS); - assert(PIPE_SHADER_FRAGMENT + 1 == SVGA3D_SHADERTYPE_PS); - assert(shader <= PIPE_SHADER_FRAGMENT); - return shader + 1; + switch (shader) { + case PIPE_SHADER_VERTEX: + return SVGA3D_SHADERTYPE_VS; + case PIPE_SHADER_FRAGMENT: + return SVGA3D_SHADERTYPE_PS; + default: + assert(!"Unexpected shader type"); + return SVGA3D_SHADERTYPE_VS; + } } |