From fb523cb6ad3ffef22ab4b9cce9e53859c17c5739 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 16 Apr 2016 14:05:47 +0200 Subject: gallium: merge PIPE_SWIZZLE_* and UTIL_FORMAT_SWIZZLE_* Use PIPE_SWIZZLE_* everywhere. Use X/Y/Z/W/0/1 instead of RED, GREEN, BLUE, ALPHA, ZERO, ONE. The new enum is called pipe_swizzle. Acked-by: Jose Fonseca --- src/gallium/state_trackers/nine/basetexture9.c | 36 +++++++++++++------------- src/gallium/state_trackers/nine/device9.c | 8 +++--- 2 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src/gallium/state_trackers/nine') diff --git a/src/gallium/state_trackers/nine/basetexture9.c b/src/gallium/state_trackers/nine/basetexture9.c index c4eb813e9f8..829a7c61f50 100644 --- a/src/gallium/state_trackers/nine/basetexture9.c +++ b/src/gallium/state_trackers/nine/basetexture9.c @@ -483,9 +483,9 @@ NineBaseTexture9_CreatePipeResource( struct NineBaseTexture9 *This, return D3D_OK; } -#define SWIZZLE_TO_REPLACE(s) (s == UTIL_FORMAT_SWIZZLE_0 || \ - s == UTIL_FORMAT_SWIZZLE_1 || \ - s == UTIL_FORMAT_SWIZZLE_NONE) +#define SWIZZLE_TO_REPLACE(s) (s == PIPE_SWIZZLE_0 || \ + s == PIPE_SWIZZLE_1 || \ + s == PIPE_SWIZZLE_NONE) HRESULT NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This, @@ -511,10 +511,10 @@ NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This, pipe_sampler_view_reference(&This->view[sRGB], NULL); - swizzle[0] = PIPE_SWIZZLE_RED; - swizzle[1] = PIPE_SWIZZLE_GREEN; - swizzle[2] = PIPE_SWIZZLE_BLUE; - swizzle[3] = PIPE_SWIZZLE_ALPHA; + swizzle[0] = PIPE_SWIZZLE_X; + swizzle[1] = PIPE_SWIZZLE_Y; + swizzle[2] = PIPE_SWIZZLE_Z; + swizzle[3] = PIPE_SWIZZLE_W; desc = util_format_description(resource->format); if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) { /* msdn doc is incomplete here and wrong. @@ -528,19 +528,19 @@ NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This, * all channel */ if (This->format == D3DFMT_DF16 || This->format == D3DFMT_DF24) { - swizzle[1] = PIPE_SWIZZLE_ZERO; - swizzle[2] = PIPE_SWIZZLE_ZERO; - swizzle[3] = PIPE_SWIZZLE_ONE; + swizzle[1] = PIPE_SWIZZLE_0; + swizzle[2] = PIPE_SWIZZLE_0; + swizzle[3] = PIPE_SWIZZLE_1; } else { - swizzle[1] = PIPE_SWIZZLE_RED; - swizzle[2] = PIPE_SWIZZLE_RED; - swizzle[3] = PIPE_SWIZZLE_RED; + swizzle[1] = PIPE_SWIZZLE_X; + swizzle[2] = PIPE_SWIZZLE_X; + swizzle[3] = PIPE_SWIZZLE_X; } } else if (resource->format == PIPE_FORMAT_RGTC2_UNORM) { - swizzle[0] = PIPE_SWIZZLE_GREEN; - swizzle[1] = PIPE_SWIZZLE_RED; - swizzle[2] = PIPE_SWIZZLE_ONE; - swizzle[3] = PIPE_SWIZZLE_ONE; + swizzle[0] = PIPE_SWIZZLE_Y; + swizzle[1] = PIPE_SWIZZLE_X; + swizzle[2] = PIPE_SWIZZLE_1; + swizzle[3] = PIPE_SWIZZLE_1; } else if (resource->format != PIPE_FORMAT_A8_UNORM && resource->format != PIPE_FORMAT_RGTC1_UNORM) { /* exceptions: @@ -550,7 +550,7 @@ NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This, * should have 1.0 for non-defined values */ for (i = 0; i < 4; i++) { if (SWIZZLE_TO_REPLACE(desc->swizzle[i])) - swizzle[i] = PIPE_SWIZZLE_ONE; + swizzle[i] = PIPE_SWIZZLE_1; } } diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index e4403f0db03..74ba3040ce4 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -383,10 +383,10 @@ NineDevice9_ctor( struct NineDevice9 *This, templ.u.tex.last_layer = 0; templ.u.tex.first_level = 0; templ.u.tex.last_level = 0; - templ.swizzle_r = PIPE_SWIZZLE_ZERO; - templ.swizzle_g = PIPE_SWIZZLE_ZERO; - templ.swizzle_b = PIPE_SWIZZLE_ZERO; - templ.swizzle_a = PIPE_SWIZZLE_ONE; + templ.swizzle_r = PIPE_SWIZZLE_0; + templ.swizzle_g = PIPE_SWIZZLE_0; + templ.swizzle_b = PIPE_SWIZZLE_0; + templ.swizzle_a = PIPE_SWIZZLE_1; templ.target = This->dummy_texture->target; This->dummy_sampler_view = This->pipe->create_sampler_view(This->pipe, This->dummy_texture, &templ); -- cgit v1.2.3