From 50a01d2acafb2a937e62b24258e2e777c0cd1489 Mon Sep 17 00:00:00 2001 From: Mark Mueller Date: Mon, 20 Jan 2014 19:08:54 -0800 Subject: [PATCH] mesa: Change many Type A MESA_FORMATs to meet naming standard Update comments. Conversion of the following Type A formats: s/MESA_FORMAT_RGB888\b/MESA_FORMAT_BGR_UNORM8/g s/MESA_FORMAT_BGR888\b/MESA_FORMAT_RGB_UNORM8/g s/MESA_FORMAT_A8\b/MESA_FORMAT_A_UNORM8/g s/MESA_FORMAT_A16\b/MESA_FORMAT_A_UNORM16/g s/MESA_FORMAT_L8\b/MESA_FORMAT_L_UNORM8/g s/MESA_FORMAT_L16\b/MESA_FORMAT_L_UNORM16/g s/MESA_FORMAT_I8\b/MESA_FORMAT_I_UNORM8/g s/MESA_FORMAT_I16\b/MESA_FORMAT_I_UNORM16/g s/MESA_FORMAT_R8\b/MESA_FORMAT_R_UNORM8/g s/MESA_FORMAT_R16\b/MESA_FORMAT_R_UNORM16/g s/MESA_FORMAT_Z16\b/MESA_FORMAT_Z_UNORM16/g s/MESA_FORMAT_Z32\b/MESA_FORMAT_Z_UNORM32/g s/MESA_FORMAT_S8\b/MESA_FORMAT_S_UINT8/g s/MESA_FORMAT_SRGB8\b/MESA_FORMAT_BGR_SRGB8/g s/MESA_FORMAT_RGBA_16\b/MESA_FORMAT_RGBA_UNORM16/g s/MESA_FORMAT_SL8\b/MESA_FORMAT_L_SRGB8/g s/MESA_FORMAT_Z32_FLOAT\b/MESA_FORMAT_Z_FLOAT32/g s/MESA_FORMAT_XBGR16161616_UNORM\b/MESA_FORMAT_RGBX_UNORM16/g s/MESA_FORMAT_XBGR16161616_SNORM\b/MESA_FORMAT_RGBX_SNORM16/g s/MESA_FORMAT_XBGR16161616_FLOAT\b/MESA_FORMAT_RGBX_FLOAT16/g s/MESA_FORMAT_XBGR16161616_UINT\b/MESA_FORMAT_RGBX_UINT16/g s/MESA_FORMAT_XBGR16161616_SINT\b/MESA_FORMAT_RGBX_SINT16/g s/MESA_FORMAT_XBGR32323232_FLOAT\b/MESA_FORMAT_RGBX_FLOAT32/g s/MESA_FORMAT_XBGR32323232_UINT\b/MESA_FORMAT_RGBX_UINT32/g s/MESA_FORMAT_XBGR32323232_SINT\b/MESA_FORMAT_RGBX_SINT32/g s/MESA_FORMAT_XBGR8888_UINT\b/MESA_FORMAT_RGBX_UINT8/g s/MESA_FORMAT_XBGR8888_SINT\b/MESA_FORMAT_RGBX_SINT8/g --- src/mesa/drivers/dri/common/dri_util.c | 4 +- src/mesa/drivers/dri/i915/i830_texstate.c | 6 +- src/mesa/drivers/dri/i915/i830_vtbl.c | 2 +- src/mesa/drivers/dri/i915/i915_context.c | 8 +- src/mesa/drivers/dri/i915/i915_texstate.c | 8 +- src/mesa/drivers/dri/i915/i915_vtbl.c | 2 +- src/mesa/drivers/dri/i915/intel_blit.c | 2 +- src/mesa/drivers/dri/i915/intel_screen.c | 2 +- src/mesa/drivers/dri/i965/brw_blorp.cpp | 10 +- src/mesa/drivers/dri/i965/brw_blorp.h | 4 +- src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 2 +- src/mesa/drivers/dri/i965/brw_clear.c | 4 +- src/mesa/drivers/dri/i965/brw_misc_state.c | 10 +- .../drivers/dri/i965/brw_surface_formats.c | 72 ++-- src/mesa/drivers/dri/i965/brw_tex_layout.c | 6 +- src/mesa/drivers/dri/i965/intel_fbo.c | 4 +- src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 22 +- src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 2 +- src/mesa/drivers/dri/i965/intel_screen.c | 4 +- .../drivers/dri/i965/intel_tex_subimage.c | 4 +- src/mesa/drivers/dri/nouveau/nouveau_fbo.c | 4 +- .../drivers/dri/nouveau/nouveau_texture.c | 12 +- src/mesa/drivers/dri/nouveau/nouveau_util.h | 2 +- src/mesa/drivers/dri/nouveau/nv04_context.c | 4 +- .../drivers/dri/nouveau/nv04_state_frag.c | 4 +- src/mesa/drivers/dri/nouveau/nv04_state_tex.c | 6 +- src/mesa/drivers/dri/nouveau/nv04_surface.c | 40 +- src/mesa/drivers/dri/nouveau/nv10_state_fb.c | 2 +- .../drivers/dri/nouveau/nv10_state_frag.c | 4 +- src/mesa/drivers/dri/nouveau/nv10_state_tex.c | 12 +- src/mesa/drivers/dri/nouveau/nv20_state_fb.c | 2 +- src/mesa/drivers/dri/nouveau/nv20_state_tex.c | 12 +- src/mesa/drivers/dri/r200/r200_blit.c | 24 +- src/mesa/drivers/dri/r200/r200_texstate.c | 26 +- src/mesa/drivers/dri/radeon/radeon_blit.c | 18 +- src/mesa/drivers/dri/radeon/radeon_fbo.c | 6 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 2 +- src/mesa/drivers/dri/radeon/radeon_tex_copy.c | 4 +- src/mesa/drivers/dri/radeon/radeon_texstate.c | 18 +- src/mesa/drivers/dri/radeon/radeon_texture.c | 10 +- .../drivers/haiku/swrast/SoftwareRast.cpp | 2 +- src/mesa/drivers/osmesa/osmesa.c | 14 +- src/mesa/main/debug.c | 10 +- src/mesa/main/fbobject.c | 2 +- src/mesa/main/format_pack.c | 172 ++++---- src/mesa/main/format_unpack.c | 92 ++-- src/mesa/main/formats.c | 240 +++++------ src/mesa/main/formats.h | 397 ++++++++++++++++-- src/mesa/main/shaderimage.c | 12 +- src/mesa/main/texformat.c | 78 ++-- src/mesa/main/teximage.c | 18 +- src/mesa/main/texobj.c | 2 +- src/mesa/main/texstore.c | 134 +++--- src/mesa/state_tracker/st_format.c | 100 ++--- src/mesa/swrast/s_blit.c | 2 +- src/mesa/swrast/s_depth.c | 16 +- src/mesa/swrast/s_renderbuffer.c | 8 +- src/mesa/swrast/s_stencil.c | 4 +- src/mesa/swrast/s_texfetch.c | 54 +-- src/mesa/swrast/s_texfetch_tmp.h | 28 +- src/mesa/swrast/s_texfilter.c | 8 +- src/mesa/swrast/s_triangle.c | 24 +- 62 files changed, 1070 insertions(+), 737 deletions(-) diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 5320ec06d1e..ca5600bc855 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -823,7 +823,7 @@ driGLFormatToImageFormat(mesa_format format) return __DRI_IMAGE_FORMAT_ABGR8888; case MESA_FORMAT_R8G8B8X8_UNORM: return __DRI_IMAGE_FORMAT_XBGR8888; - case MESA_FORMAT_R8: + case MESA_FORMAT_R_UNORM8: return __DRI_IMAGE_FORMAT_R8; case MESA_FORMAT_GR88: return __DRI_IMAGE_FORMAT_GR88; @@ -855,7 +855,7 @@ driImageFormatToGLFormat(uint32_t image_format) case __DRI_IMAGE_FORMAT_XBGR8888: return MESA_FORMAT_R8G8B8X8_UNORM; case __DRI_IMAGE_FORMAT_R8: - return MESA_FORMAT_R8; + return MESA_FORMAT_R_UNORM8; case __DRI_IMAGE_FORMAT_GR88: return MESA_FORMAT_GR88; case __DRI_IMAGE_FORMAT_SARGB8: diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index d6aaf453327..4e90761497f 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -43,11 +43,11 @@ static GLuint translate_texture_format(GLuint mesa_format) { switch (mesa_format) { - case MESA_FORMAT_L8: + case MESA_FORMAT_L_UNORM8: return MAPSURF_8BIT | MT_8BIT_L8; - case MESA_FORMAT_I8: + case MESA_FORMAT_I_UNORM8: return MAPSURF_8BIT | MT_8BIT_I8; - case MESA_FORMAT_A8: + case MESA_FORMAT_A_UNORM8: return MAPSURF_8BIT | MT_8BIT_I8; /* Kludge! */ case MESA_FORMAT_AL88: return MAPSURF_16BIT | MT_16BIT_AY88; diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index 3da4dbe8de2..49c29939c0d 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -597,7 +597,7 @@ i830_render_target_supported(struct intel_context *intel, if (format == MESA_FORMAT_S8_Z24 || format == MESA_FORMAT_X8_Z24 || - format == MESA_FORMAT_Z16) { + format == MESA_FORMAT_Z_UNORM16) { return true; } diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index a11a01002f7..bdb07294039 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -108,9 +108,9 @@ intel_init_texture_formats(struct gl_context *ctx) ctx->TextureFormatSupported[MESA_FORMAT_ARGB4444] = true; ctx->TextureFormatSupported[MESA_FORMAT_ARGB1555] = true; ctx->TextureFormatSupported[MESA_FORMAT_RGB565] = true; - ctx->TextureFormatSupported[MESA_FORMAT_L8] = true; - ctx->TextureFormatSupported[MESA_FORMAT_A8] = true; - ctx->TextureFormatSupported[MESA_FORMAT_I8] = true; + ctx->TextureFormatSupported[MESA_FORMAT_L_UNORM8] = true; + ctx->TextureFormatSupported[MESA_FORMAT_A_UNORM8] = true; + ctx->TextureFormatSupported[MESA_FORMAT_I_UNORM8] = true; ctx->TextureFormatSupported[MESA_FORMAT_AL88] = true; /* Depth and stencil */ @@ -124,7 +124,7 @@ intel_init_texture_formats(struct gl_context *ctx) * combo that actually works, so this can probably be re-enabled. */ /* - ctx->TextureFormatSupported[MESA_FORMAT_Z16] = true; + ctx->TextureFormatSupported[MESA_FORMAT_Z_UNORM16] = true; ctx->TextureFormatSupported[MESA_FORMAT_Z24] = true; */ diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 3e10de36cbd..ffca3901ca3 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -42,11 +42,11 @@ static GLuint translate_texture_format(mesa_format mesa_format, GLenum DepthMode) { switch (mesa_format) { - case MESA_FORMAT_L8: + case MESA_FORMAT_L_UNORM8: return MAPSURF_8BIT | MT_8BIT_L8; - case MESA_FORMAT_I8: + case MESA_FORMAT_I_UNORM8: return MAPSURF_8BIT | MT_8BIT_I8; - case MESA_FORMAT_A8: + case MESA_FORMAT_A_UNORM8: return MAPSURF_8BIT | MT_8BIT_A8; case MESA_FORMAT_AL88: return MAPSURF_16BIT | MT_16BIT_AY88; @@ -70,7 +70,7 @@ translate_texture_format(mesa_format mesa_format, GLenum DepthMode) case MESA_FORMAT_RGB_FXT1: case MESA_FORMAT_RGBA_FXT1: return (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1); - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: if (DepthMode == GL_ALPHA) return (MAPSURF_16BIT | MT_16BIT_A16); else if (DepthMode == GL_INTENSITY) diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index bc1ee55b895..e263da0d79a 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -564,7 +564,7 @@ i915_render_target_supported(struct intel_context *intel, if (format == MESA_FORMAT_S8_Z24 || format == MESA_FORMAT_X8_Z24 || - format == MESA_FORMAT_Z16) { + format == MESA_FORMAT_Z_UNORM16) { return true; } diff --git a/src/mesa/drivers/dri/i915/intel_blit.c b/src/mesa/drivers/dri/i915/intel_blit.c index d4d6b430fbe..5e9fc5ba625 100644 --- a/src/mesa/drivers/dri/i915/intel_blit.c +++ b/src/mesa/drivers/dri/i915/intel_blit.c @@ -466,7 +466,7 @@ intelClearWithBlit(struct gl_context *ctx, GLbitfield mask) clear_val = PACK_COLOR_1555(clear[3], clear[0], clear[1], clear[2]); break; - case MESA_FORMAT_A8: + case MESA_FORMAT_A_UNORM8: clear_val = PACK_COLOR_8888(clear[3], clear[3], clear[3], clear[3]); break; diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 053e73a5e95..9b0262a4a79 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -892,7 +892,7 @@ intelCreateBuffer(__DRIscreen * driScrnPriv, } else if (mesaVis->depthBits == 16) { assert(mesaVis->stencilBits == 0); - rb = intel_create_private_renderbuffer(MESA_FORMAT_Z16); + rb = intel_create_private_renderbuffer(MESA_FORMAT_Z_UNORM16); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base.Base); } else { diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp b/src/mesa/drivers/dri/i965/brw_blorp.cpp index e7f6328d431..e1b782dbba2 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp @@ -87,7 +87,7 @@ brw_blorp_surface_info::set(struct brw_context *brw, this->msaa_layout = mt->msaa_layout; switch (mt->format) { - case MESA_FORMAT_S8: + case MESA_FORMAT_S_UINT8: /* The miptree is a W-tiled stencil buffer. Surface states can't be set * up for W tiling, so we'll need to use Y tiling and have the WM * program swizzle the coordinates. @@ -108,10 +108,10 @@ brw_blorp_surface_info::set(struct brw_context *brw, */ this->brw_surfaceformat = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; break; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: this->brw_surfaceformat = BRW_SURFACEFORMAT_R32_FLOAT; break; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: this->brw_surfaceformat = BRW_SURFACEFORMAT_R16_UNORM; break; default: { @@ -326,8 +326,8 @@ brw_hiz_op_params::brw_hiz_op_params(struct intel_mipmap_tree *mt, assert(intel_miptree_slice_has_hiz(mt, level, layer)); switch (mt->format) { - case MESA_FORMAT_Z16: depth_format = BRW_DEPTHFORMAT_D16_UNORM; break; - case MESA_FORMAT_Z32_FLOAT: depth_format = BRW_DEPTHFORMAT_D32_FLOAT; break; + case MESA_FORMAT_Z_UNORM16: depth_format = BRW_DEPTHFORMAT_D16_UNORM; break; + case MESA_FORMAT_Z_FLOAT32: depth_format = BRW_DEPTHFORMAT_D32_FLOAT; break; case MESA_FORMAT_X8_Z24: depth_format = BRW_DEPTHFORMAT_D24_UNORM_X8_UINT; break; default: assert(0); break; } diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h index 1030e4e0afd..db41497732e 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.h +++ b/src/mesa/drivers/dri/i965/brw_blorp.h @@ -134,11 +134,11 @@ public: /* Setting this flag indicates that the buffer's contents are W-tiled * stencil data, but the surface state should be set up for Y tiled - * MESA_FORMAT_R8 data (this is necessary because surface states don't + * MESA_FORMAT_R_UNORM8 data (this is necessary because surface states don't * support W tiling). * * Since W tiles are 64 pixels wide by 64 pixels high, whereas Y tiles of - * MESA_FORMAT_R8 data are 128 pixels wide by 32 pixels high, the width and + * MESA_FORMAT_R_UNORM8 data are 128 pixels wide by 32 pixels high, the width and * pitch stored in the surface state will be multiplied by 2, and the * height will be halved. Also, since W and Y tiles store their data in a * different order, the width and height will be rounded up to a multiple diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp index d8df4afd08f..55ff1e6bfb2 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp @@ -2030,7 +2030,7 @@ brw_blorp_blit_params::brw_blorp_blit_params(struct brw_context *brw, wm_prog_key.texture_data_type = BRW_REGISTER_TYPE_F; break; case GL_UNSIGNED_INT: - if (src_mt->format == MESA_FORMAT_S8) { + if (src_mt->format == MESA_FORMAT_S_UINT8) { /* We process stencil as though it's an unsigned normalized color */ wm_prog_key.texture_data_type = BRW_REGISTER_TYPE_F; } else { diff --git a/src/mesa/drivers/dri/i965/brw_clear.c b/src/mesa/drivers/dri/i965/brw_clear.c index 659d339e1a5..b463be86ac6 100644 --- a/src/mesa/drivers/dri/i965/brw_clear.c +++ b/src/mesa/drivers/dri/i965/brw_clear.c @@ -141,11 +141,11 @@ brw_fast_clear_depth(struct gl_context *ctx) */ return false; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: depth_clear_value = float_as_int(ctx->Depth.Clear); break; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: /* From the Sandy Bridge PRM, volume 2 part 1, page 314: * * "[DevSNB+]: Several cases exist where Depth Buffer Clear cannot be diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 2375993beaf..438637447de 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -151,9 +151,9 @@ brw_depthbuffer_format(struct brw_context *brw) return BRW_DEPTHFORMAT_D32_FLOAT; switch (drb->mt->format) { - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return BRW_DEPTHFORMAT_D16_UNORM; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: return BRW_DEPTHFORMAT_D32_FLOAT; case MESA_FORMAT_X8_Z24: if (brw->gen >= 6) { @@ -230,7 +230,7 @@ brw_get_depthstencil_tile_masks(struct intel_mipmap_tree *depth_mt, if (stencil_mt->stencil_mt) stencil_mt = stencil_mt->stencil_mt; - if (stencil_mt->format == MESA_FORMAT_S8) { + if (stencil_mt->format == MESA_FORMAT_S_UINT8) { /* Separate stencil buffer uses 64x64 tiles. */ tile_mask_x |= 63; tile_mask_y |= 63; @@ -494,7 +494,7 @@ brw_workaround_depthstencil_alignment(struct brw_context *brw, stencil_mt = get_stencil_miptree(stencil_irb); brw->depthstencil.stencil_mt = stencil_mt; - if (stencil_mt->format == MESA_FORMAT_S8) { + if (stencil_mt->format == MESA_FORMAT_S_UINT8) { /* Note: we can't compute the stencil offset using * intel_region_get_aligned_offset(), because stencil_region claims * that the region is untiled even though it's W tiled. @@ -526,7 +526,7 @@ brw_emit_depthbuffer(struct brw_context *brw) uint32_t width = 1, height = 1; if (stencil_mt) { - separate_stencil = stencil_mt->format == MESA_FORMAT_S8; + separate_stencil = stencil_mt->format == MESA_FORMAT_S_UINT8; /* Gen7 supports only separate stencil */ assert(separate_stencil || brw->gen < 7); diff --git a/src/mesa/drivers/dri/i965/brw_surface_formats.c b/src/mesa/drivers/dri/i965/brw_surface_formats.c index 566d68834f7..651c0f96217 100644 --- a/src/mesa/drivers/dri/i965/brw_surface_formats.c +++ b/src/mesa/drivers/dri/i965/brw_surface_formats.c @@ -327,8 +327,8 @@ brw_format_for_mesa_format(mesa_format mesa_format) [MESA_FORMAT_R8G8B8X8_UNORM] = BRW_SURFACEFORMAT_R8G8B8X8_UNORM, [MESA_FORMAT_B8G8R8X8_UNORM] = BRW_SURFACEFORMAT_B8G8R8X8_UNORM, [MESA_FORMAT_X8R8G8B8_UNORM] = 0, - [MESA_FORMAT_RGB888] = 0, - [MESA_FORMAT_BGR888] = BRW_SURFACEFORMAT_R8G8B8_UNORM, + [MESA_FORMAT_BGR_UNORM8] = 0, + [MESA_FORMAT_RGB_UNORM8] = BRW_SURFACEFORMAT_R8G8B8_UNORM, [MESA_FORMAT_RGB565] = BRW_SURFACEFORMAT_B5G6R5_UNORM, [MESA_FORMAT_RGB565_REV] = 0, [MESA_FORMAT_ARGB4444] = BRW_SURFACEFORMAT_B4G4R4A4_UNORM, @@ -342,33 +342,33 @@ brw_format_for_mesa_format(mesa_format mesa_format) [MESA_FORMAT_AL1616] = BRW_SURFACEFORMAT_L16A16_UNORM, [MESA_FORMAT_AL1616_REV] = 0, [MESA_FORMAT_RGB332] = 0, - [MESA_FORMAT_A8] = BRW_SURFACEFORMAT_A8_UNORM, - [MESA_FORMAT_A16] = BRW_SURFACEFORMAT_A16_UNORM, - [MESA_FORMAT_L8] = BRW_SURFACEFORMAT_L8_UNORM, - [MESA_FORMAT_L16] = BRW_SURFACEFORMAT_L16_UNORM, - [MESA_FORMAT_I8] = BRW_SURFACEFORMAT_I8_UNORM, - [MESA_FORMAT_I16] = BRW_SURFACEFORMAT_I16_UNORM, + [MESA_FORMAT_A_UNORM8] = BRW_SURFACEFORMAT_A8_UNORM, + [MESA_FORMAT_A_UNORM16] = BRW_SURFACEFORMAT_A16_UNORM, + [MESA_FORMAT_L_UNORM8] = BRW_SURFACEFORMAT_L8_UNORM, + [MESA_FORMAT_L_UNORM16] = BRW_SURFACEFORMAT_L16_UNORM, + [MESA_FORMAT_I_UNORM8] = BRW_SURFACEFORMAT_I8_UNORM, + [MESA_FORMAT_I_UNORM16] = BRW_SURFACEFORMAT_I16_UNORM, [MESA_FORMAT_YCBCR_REV] = BRW_SURFACEFORMAT_YCRCB_NORMAL, [MESA_FORMAT_YCBCR] = BRW_SURFACEFORMAT_YCRCB_SWAPUVY, - [MESA_FORMAT_R8] = BRW_SURFACEFORMAT_R8_UNORM, + [MESA_FORMAT_R_UNORM8] = BRW_SURFACEFORMAT_R8_UNORM, [MESA_FORMAT_GR88] = BRW_SURFACEFORMAT_R8G8_UNORM, [MESA_FORMAT_RG88] = 0, - [MESA_FORMAT_R16] = BRW_SURFACEFORMAT_R16_UNORM, + [MESA_FORMAT_R_UNORM16] = BRW_SURFACEFORMAT_R16_UNORM, [MESA_FORMAT_GR1616] = BRW_SURFACEFORMAT_R16G16_UNORM, [MESA_FORMAT_RG1616] = 0, [MESA_FORMAT_ARGB2101010] = BRW_SURFACEFORMAT_B10G10R10A2_UNORM, [MESA_FORMAT_Z24_S8] = 0, [MESA_FORMAT_S8_Z24] = 0, - [MESA_FORMAT_Z16] = 0, + [MESA_FORMAT_Z_UNORM16] = 0, [MESA_FORMAT_X8_Z24] = 0, [MESA_FORMAT_Z24_X8] = 0, - [MESA_FORMAT_Z32] = 0, - [MESA_FORMAT_S8] = 0, + [MESA_FORMAT_Z_UNORM32] = 0, + [MESA_FORMAT_S_UINT8] = 0, - [MESA_FORMAT_SRGB8] = 0, + [MESA_FORMAT_BGR_SRGB8] = 0, [MESA_FORMAT_SRGBA8] = 0, [MESA_FORMAT_SARGB8] = BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB, - [MESA_FORMAT_SL8] = BRW_SURFACEFORMAT_L8_UNORM_SRGB, + [MESA_FORMAT_L_SRGB8] = BRW_SURFACEFORMAT_L8_UNORM_SRGB, [MESA_FORMAT_SLA8] = BRW_SURFACEFORMAT_L8A8_UNORM_SRGB, [MESA_FORMAT_SRGB_DXT1] = BRW_SURFACEFORMAT_DXT1_RGB_SRGB, [MESA_FORMAT_SRGBA_DXT1] = BRW_SURFACEFORMAT_BC1_UNORM_SRGB, @@ -463,7 +463,7 @@ brw_format_for_mesa_format(mesa_format mesa_format) [MESA_FORMAT_SIGNED_GR1616] = BRW_SURFACEFORMAT_R16G16_SNORM, [MESA_FORMAT_SIGNED_RGB_16] = BRW_SURFACEFORMAT_R16G16B16_SNORM, [MESA_FORMAT_SIGNED_RGBA_16] = BRW_SURFACEFORMAT_R16G16B16A16_SNORM, - [MESA_FORMAT_RGBA_16] = BRW_SURFACEFORMAT_R16G16B16A16_UNORM, + [MESA_FORMAT_RGBA_UNORM16] = BRW_SURFACEFORMAT_R16G16B16A16_UNORM, [MESA_FORMAT_RED_RGTC1] = BRW_SURFACEFORMAT_BC4_UNORM, [MESA_FORMAT_SIGNED_RED_RGTC1] = BRW_SURFACEFORMAT_BC4_SNORM, @@ -499,7 +499,7 @@ brw_format_for_mesa_format(mesa_format mesa_format) [MESA_FORMAT_RGB9_E5_FLOAT] = BRW_SURFACEFORMAT_R9G9B9E5_SHAREDEXP, [MESA_FORMAT_R11_G11_B10_FLOAT] = BRW_SURFACEFORMAT_R11G11B10_FLOAT, - [MESA_FORMAT_Z32_FLOAT] = 0, + [MESA_FORMAT_Z_FLOAT32] = 0, [MESA_FORMAT_Z32_FLOAT_X24S8] = 0, [MESA_FORMAT_ARGB2101010_UINT] = BRW_SURFACEFORMAT_B10G10R10A2_UINT, @@ -509,17 +509,17 @@ brw_format_for_mesa_format(mesa_format mesa_format) [MESA_FORMAT_XRGB1555_UNORM] = BRW_SURFACEFORMAT_B5G5R5X1_UNORM, [MESA_FORMAT_XBGR8888_SNORM] = 0, [MESA_FORMAT_XBGR8888_SRGB] = 0, - [MESA_FORMAT_XBGR8888_UINT] = 0, - [MESA_FORMAT_XBGR8888_SINT] = 0, + [MESA_FORMAT_RGBX_UINT8] = 0, + [MESA_FORMAT_RGBX_SINT8] = 0, [MESA_FORMAT_XRGB2101010_UNORM] = BRW_SURFACEFORMAT_B10G10R10X2_UNORM, - [MESA_FORMAT_XBGR16161616_UNORM] = BRW_SURFACEFORMAT_R16G16B16X16_UNORM, - [MESA_FORMAT_XBGR16161616_SNORM] = 0, - [MESA_FORMAT_XBGR16161616_FLOAT] = BRW_SURFACEFORMAT_R16G16B16X16_FLOAT, - [MESA_FORMAT_XBGR16161616_UINT] = 0, - [MESA_FORMAT_XBGR16161616_SINT] = 0, - [MESA_FORMAT_XBGR32323232_FLOAT] = BRW_SURFACEFORMAT_R32G32B32X32_FLOAT, - [MESA_FORMAT_XBGR32323232_UINT] = 0, - [MESA_FORMAT_XBGR32323232_SINT] = 0, + [MESA_FORMAT_RGBX_UNORM16] = BRW_SURFACEFORMAT_R16G16B16X16_UNORM, + [MESA_FORMAT_RGBX_SNORM16] = 0, + [MESA_FORMAT_RGBX_FLOAT16] = BRW_SURFACEFORMAT_R16G16B16X16_FLOAT, + [MESA_FORMAT_RGBX_UINT16] = 0, + [MESA_FORMAT_RGBX_SINT16] = 0, + [MESA_FORMAT_RGBX_FLOAT32] = BRW_SURFACEFORMAT_R32G32B32X32_FLOAT, + [MESA_FORMAT_RGBX_UINT32] = 0, + [MESA_FORMAT_RGBX_SINT32] = 0, }; assert(mesa_format < MESA_FORMAT_COUNT); return table[mesa_format]; @@ -602,9 +602,9 @@ brw_init_surface_formats(struct brw_context *brw) */ brw->format_supported_as_render_target[MESA_FORMAT_S8_Z24] = true; brw->format_supported_as_render_target[MESA_FORMAT_X8_Z24] = true; - brw->format_supported_as_render_target[MESA_FORMAT_S8] = true; - brw->format_supported_as_render_target[MESA_FORMAT_Z16] = true; - brw->format_supported_as_render_target[MESA_FORMAT_Z32_FLOAT] = true; + brw->format_supported_as_render_target[MESA_FORMAT_S_UINT8] = true; + brw->format_supported_as_render_target[MESA_FORMAT_Z_UNORM16] = true; + brw->format_supported_as_render_target[MESA_FORMAT_Z_FLOAT32] = true; brw->format_supported_as_render_target[MESA_FORMAT_Z32_FLOAT_X24S8] = true; /* We remap depth formats to a supported texturing format in @@ -612,7 +612,7 @@ brw_init_surface_formats(struct brw_context *brw) */ ctx->TextureFormatSupported[MESA_FORMAT_S8_Z24] = true; ctx->TextureFormatSupported[MESA_FORMAT_X8_Z24] = true; - ctx->TextureFormatSupported[MESA_FORMAT_Z32_FLOAT] = true; + ctx->TextureFormatSupported[MESA_FORMAT_Z_FLOAT32] = true; ctx->TextureFormatSupported[MESA_FORMAT_Z32_FLOAT_X24S8] = true; /* It appears that Z16 is slower than Z24 (on Intel Ivybridge and newer @@ -627,7 +627,7 @@ brw_init_surface_formats(struct brw_context *brw) * asking for DEPTH_COMPONENT16, so we have to respect that. */ if (_mesa_is_desktop_gl(ctx)) - ctx->TextureFormatSupported[MESA_FORMAT_Z16] = true; + ctx->TextureFormatSupported[MESA_FORMAT_Z_UNORM16] = true; /* On hardware that lacks support for ETC1, we map ETC1 to RGBX * during glCompressedTexImage2D(). See intel_mipmap_tree::wraps_etc1. @@ -694,14 +694,14 @@ translate_tex_format(struct brw_context *brw, switch( mesa_format ) { - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return BRW_SURFACEFORMAT_R16_UNORM; case MESA_FORMAT_S8_Z24: case MESA_FORMAT_X8_Z24: return BRW_SURFACEFORMAT_R24_UNORM_X8_TYPELESS; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: return BRW_SURFACEFORMAT_R32_FLOAT; case MESA_FORMAT_Z32_FLOAT_X24S8: @@ -738,11 +738,11 @@ brw_is_hiz_depth_format(struct brw_context *brw, mesa_format format) return false; switch (format) { - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: case MESA_FORMAT_Z32_FLOAT_X24S8: case MESA_FORMAT_X8_Z24: case MESA_FORMAT_S8_Z24: - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return true; default: return false; diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c index a7e4ddd3a28..61a2eba2f54 100644 --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c @@ -75,10 +75,10 @@ intel_horizontal_texture_alignment_unit(struct brw_context *brw, return i; } - if (format == MESA_FORMAT_S8) + if (format == MESA_FORMAT_S_UINT8) return 8; - if (brw->gen >= 7 && format == MESA_FORMAT_Z16) + if (brw->gen >= 7 && format == MESA_FORMAT_Z_UNORM16) return 8; return 4; @@ -114,7 +114,7 @@ intel_vertical_texture_alignment_unit(struct brw_context *brw, if (_mesa_is_format_compressed(format)) return 4; - if (format == MESA_FORMAT_S8) + if (format == MESA_FORMAT_S_UINT8) return brw->gen >= 7 ? 8 : 4; /* Broadwell only supports VALIGN of 4, 8, and 16. The BSpec says 4 diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c index 961bbc28386..5f6e1b3c391 100644 --- a/src/mesa/drivers/dri/i965/intel_fbo.c +++ b/src/mesa/drivers/dri/i965/intel_fbo.c @@ -206,7 +206,7 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer case GL_STENCIL_INDEX16_EXT: /* These aren't actual texture formats, so force them here. */ if (brw->has_separate_stencil) { - rb->Format = MESA_FORMAT_S8; + rb->Format = MESA_FORMAT_S_UINT8; } else { assert(!brw->must_use_separate_stencil); rb->Format = MESA_FORMAT_S8_Z24; @@ -609,7 +609,7 @@ intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb) fbo_incomplete(fb, "FBO incomplete: separate stencil " "unsupported\n"); } - if (stencil_mt->format != MESA_FORMAT_S8) { + if (stencil_mt->format != MESA_FORMAT_S_UINT8) { fbo_incomplete(fb, "FBO incomplete: separate stencil is %s " "instead of S8\n", _mesa_get_format_name(stencil_mt->format)); diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index 9f3c9a76f07..2a84391f732 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -353,7 +353,7 @@ intel_miptree_create_layout(struct brw_context *brw, (brw->has_separate_stencil && brw_is_hiz_depth_format(brw, format)))) { mt->stencil_mt = intel_miptree_create(brw, mt->target, - MESA_FORMAT_S8, + MESA_FORMAT_S_UINT8, mt->first_level, mt->last_level, mt->logical_width0, @@ -373,7 +373,7 @@ intel_miptree_create_layout(struct brw_context *brw, if (mt->format == MESA_FORMAT_S8_Z24) { mt->format = MESA_FORMAT_X8_Z24; } else if (mt->format == MESA_FORMAT_Z32_FLOAT_X24S8) { - mt->format = MESA_FORMAT_Z32_FLOAT; + mt->format = MESA_FORMAT_Z_FLOAT32; mt->cpp = 4; } else { _mesa_problem(NULL, "Unknown format %s in separate stencil mt\n", @@ -397,7 +397,7 @@ intel_miptree_choose_tiling(struct brw_context *brw, enum intel_miptree_tiling_mode requested, struct intel_mipmap_tree *mt) { - if (format == MESA_FORMAT_S8) { + if (format == MESA_FORMAT_S_UINT8) { /* The stencil buffer is W tiled. However, we request from the kernel a * non-tiled buffer because the GTT is incapable of W fencing. */ @@ -519,7 +519,7 @@ intel_miptree_create(struct brw_context *brw, format = MESA_FORMAT_R8G8B8A8_UNORM; break; case MESA_FORMAT_ETC2_R11_EAC: - format = MESA_FORMAT_R16; + format = MESA_FORMAT_R_UNORM16; break; case MESA_FORMAT_ETC2_SIGNED_R11_EAC: format = MESA_FORMAT_SIGNED_R16; @@ -553,7 +553,7 @@ intel_miptree_create(struct brw_context *brw, total_width = mt->total_width; total_height = mt->total_height; - if (format == MESA_FORMAT_S8) { + if (format == MESA_FORMAT_S_UINT8) { /* Align to size of W tile, 64x64. */ total_width = ALIGN(total_width, 64); total_height = ALIGN(total_height, 64); @@ -920,7 +920,7 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt, mesa_format mt_format = mt->format; if (mt->format == MESA_FORMAT_X8_Z24 && mt->stencil_mt) mt_format = MESA_FORMAT_S8_Z24; - if (mt->format == MESA_FORMAT_Z32_FLOAT && mt->stencil_mt) + if (mt->format == MESA_FORMAT_Z_FLOAT32 && mt->stencil_mt) mt_format = MESA_FORMAT_Z32_FLOAT_X24S8; if (mt->etc_format != MESA_FORMAT_NONE) mt_format = mt->etc_format; @@ -1221,7 +1221,7 @@ intel_miptree_alloc_mcs(struct brw_context *brw, /* 8 bits/pixel are required for MCS data when using 4x MSAA (2 bits for * each sample). */ - format = MESA_FORMAT_R8; + format = MESA_FORMAT_R_UNORM8; break; case 8: /* 32 bits/pixel are required for MCS data when using 8x MSAA (3 bits @@ -2066,7 +2066,7 @@ intel_miptree_map_depthstencil(struct brw_context *brw, { struct intel_mipmap_tree *z_mt = mt; struct intel_mipmap_tree *s_mt = mt->stencil_mt; - bool map_z32f_x24s8 = mt->format == MESA_FORMAT_Z32_FLOAT; + bool map_z32f_x24s8 = mt->format == MESA_FORMAT_Z_FLOAT32; int packed_bpp = map_z32f_x24s8 ? 8 : 4; map->stride = map->w * packed_bpp; @@ -2138,7 +2138,7 @@ intel_miptree_unmap_depthstencil(struct brw_context *brw, { struct intel_mipmap_tree *z_mt = mt; struct intel_mipmap_tree *s_mt = mt->stencil_mt; - bool map_z32f_x24s8 = mt->format == MESA_FORMAT_Z32_FLOAT; + bool map_z32f_x24s8 = mt->format == MESA_FORMAT_Z_FLOAT32; if (map->mode & GL_MAP_WRITE_BIT) { uint32_t *packed_map = map->ptr; @@ -2279,7 +2279,7 @@ intel_miptree_map_singlesample(struct brw_context *brw, intel_miptree_slice_set_needs_hiz_resolve(mt, level, slice); } - if (mt->format == MESA_FORMAT_S8) { + if (mt->format == MESA_FORMAT_S_UINT8) { intel_miptree_map_s8(brw, mt, map, level, slice); } else if (mt->etc_format != MESA_FORMAT_NONE && !(mode & BRW_MAP_DIRECT_BIT)) { @@ -2330,7 +2330,7 @@ intel_miptree_unmap_singlesample(struct brw_context *brw, DBG("%s: mt %p (%s) level %d slice %d\n", __FUNCTION__, mt, _mesa_get_format_name(mt->format), level, slice); - if (mt->format == MESA_FORMAT_S8) { + if (mt->format == MESA_FORMAT_S_UINT8) { intel_miptree_unmap_s8(brw, mt, map, level, slice); } else if (mt->etc_format != MESA_FORMAT_NONE && !(map->mode & BRW_MAP_DIRECT_BIT)) { diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h index 722e346c661..cb2eda60a54 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h @@ -279,7 +279,7 @@ struct intel_mipmap_tree * on hardware where we want or need to use separate stencil, there will be * two miptrees for storing the data. If the depthstencil texture or rb is * MESA_FORMAT_Z32_FLOAT_X24S8, then mt->format will be - * MESA_FORMAT_Z32_FLOAT, otherwise for MESA_FORMAT_S8_Z24 objects it will be + * MESA_FORMAT_Z_FLOAT32, otherwise for MESA_FORMAT_S8_Z24 objects it will be * MESA_FORMAT_X8_Z24. * * For ETC1/ETC2 textures, this is one of the uncompressed mesa texture diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 2f2d478d156..1b884cbcad4 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -1007,7 +1007,7 @@ intelCreateBuffer(__DRIscreen * driScrnPriv, rb = intel_create_private_renderbuffer(MESA_FORMAT_X8_Z24, num_samples); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base.Base); - rb = intel_create_private_renderbuffer(MESA_FORMAT_S8, + rb = intel_create_private_renderbuffer(MESA_FORMAT_S_UINT8, num_samples); _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base.Base); } else { @@ -1023,7 +1023,7 @@ intelCreateBuffer(__DRIscreen * driScrnPriv, } else if (mesaVis->depthBits == 16) { assert(mesaVis->stencilBits == 0); - rb = intel_create_private_renderbuffer(MESA_FORMAT_Z16, + rb = intel_create_private_renderbuffer(MESA_FORMAT_Z_UNORM16, num_samples); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base.Base); } diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c b/src/mesa/drivers/dri/i965/intel_tex_subimage.c index 1def8ca9f58..ce8bbe17e02 100644 --- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c @@ -572,8 +572,8 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx, packing->Invert) return false; - if ((texImage->TexFormat == MESA_FORMAT_L8 && format == GL_LUMINANCE) || - (texImage->TexFormat == MESA_FORMAT_A8 && format == GL_ALPHA)) { + if ((texImage->TexFormat == MESA_FORMAT_L_UNORM8 && format == GL_LUMINANCE) || + (texImage->TexFormat == MESA_FORMAT_A_UNORM8 && format == GL_ALPHA)) { cpp = 1; mem_copy = memcpy; } else if ((texImage->TexFormat == MESA_FORMAT_B8G8R8A8_UNORM) || diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c index 72af5365c86..5d1853374e1 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c @@ -60,7 +60,7 @@ set_renderbuffer_format(struct gl_renderbuffer *rb, GLenum internalFormat) break; case GL_DEPTH_COMPONENT16: rb->_BaseFormat = GL_DEPTH_COMPONENT; - rb->Format = MESA_FORMAT_Z16; + rb->Format = MESA_FORMAT_Z_UNORM16; s->cpp = 2; break; case GL_DEPTH_COMPONENT: @@ -277,7 +277,7 @@ validate_format_bpp(mesa_format format) case MESA_FORMAT_Z24_S8: return 32; case MESA_FORMAT_RGB565: - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return 16; default: return 0; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c index 1a637cc0495..6882e506190 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c @@ -210,7 +210,7 @@ nouveau_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_LUMINANCE16: case GL_LUMINANCE8: case GL_COMPRESSED_LUMINANCE: - return MESA_FORMAT_L8; + return MESA_FORMAT_L_UNORM8; case GL_ALPHA: case GL_ALPHA4: @@ -218,14 +218,14 @@ nouveau_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_ALPHA16: case GL_ALPHA8: case GL_COMPRESSED_ALPHA: - return MESA_FORMAT_A8; + return MESA_FORMAT_A_UNORM8; case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY12: case GL_INTENSITY16: case GL_INTENSITY8: - return MESA_FORMAT_I8; + return MESA_FORMAT_I_UNORM8; case GL_RGB_S3TC: case GL_RGB4_S3TC: @@ -398,9 +398,9 @@ nouveau_texture_reallocate(struct gl_context *ctx, struct gl_texture_object *t) static unsigned get_teximage_placement(struct gl_texture_image *ti) { - if (ti->TexFormat == MESA_FORMAT_A8 || - ti->TexFormat == MESA_FORMAT_L8 || - ti->TexFormat == MESA_FORMAT_I8) + if (ti->TexFormat == MESA_FORMAT_A_UNORM8 || + ti->TexFormat == MESA_FORMAT_L_UNORM8 || + ti->TexFormat == MESA_FORMAT_I_UNORM8) /* 1 cpp formats will have to be swizzled by the CPU, * so leave them in system RAM for now. */ return NOUVEAU_BO_MAP; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_util.h b/src/mesa/drivers/dri/nouveau/nouveau_util.h index 13dc0f936fb..547d1be35a7 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_util.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_util.h @@ -61,7 +61,7 @@ pack_zs_i(mesa_format f, uint32_t z, uint8_t s) return (z & 0xffffff00) | (s & 0xff); case MESA_FORMAT_Z24_X8: return (z & 0xffffff00); - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return (z & 0xffff0000) >> 16; default: assert(0); diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c index 21399532232..93dcd879d34 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_context.c +++ b/src/mesa/drivers/dri/nouveau/nv04_context.c @@ -37,8 +37,8 @@ texunit_needs_combiners(struct gl_texture_unit *u) struct gl_texture_object *t = u->_Current; struct gl_texture_image *ti = t->Image[0][t->BaseLevel]; - return ti->TexFormat == MESA_FORMAT_A8 || - ti->TexFormat == MESA_FORMAT_L8 || + return ti->TexFormat == MESA_FORMAT_A_UNORM8 || + ti->TexFormat == MESA_FORMAT_L_UNORM8 || u->EnvMode == GL_COMBINE || u->EnvMode == GL_COMBINE4_NV || u->EnvMode == GL_BLEND || diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c index 61e259f388a..17d27814063 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c +++ b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c @@ -141,13 +141,13 @@ get_input_arg(struct combiner_state *rc, int arg, int flags) struct gl_texture_object *t = rc->ctx->Texture.Unit[i]._Current; mesa_format format = t->Image[0][t->BaseLevel]->TexFormat; - if (format == MESA_FORMAT_A8) { + if (format == MESA_FORMAT_A_UNORM8) { /* Emulated using I8. */ if (is_color_operand(operand)) return COMBINER_SOURCE(ZERO) | get_input_mapping(rc, operand, flags); - } else if (format == MESA_FORMAT_L8) { + } else if (format == MESA_FORMAT_L_UNORM8) { /* Emulated using I8. */ if (!is_color_operand(operand)) return COMBINER_SOURCE(ZERO) | diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c index ae9548969fb..c4a20fa575c 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c @@ -38,9 +38,9 @@ static uint32_t get_tex_format(struct gl_texture_image *ti) { switch (ti->TexFormat) { - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_I_UNORM8: return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_Y8; case MESA_FORMAT_ARGB1555: return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_A1R5G5B5; diff --git a/src/mesa/drivers/dri/nouveau/nv04_surface.c b/src/mesa/drivers/dri/nouveau/nv04_surface.c index c8390717051..0d8cf3b59e3 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_surface.c +++ b/src/mesa/drivers/dri/nouveau/nv04_surface.c @@ -37,9 +37,9 @@ static inline int swzsurf_format(mesa_format format) { switch (format) { - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_I_UNORM8: case MESA_FORMAT_RGB332: return NV04_SWIZZLED_SURFACE_FORMAT_COLOR_Y8; @@ -54,7 +54,7 @@ swzsurf_format(mesa_format format) case MESA_FORMAT_AL88_REV: case MESA_FORMAT_YCBCR: case MESA_FORMAT_YCBCR_REV: - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return NV04_SWIZZLED_SURFACE_FORMAT_COLOR_R5G6B5; case MESA_FORMAT_A8B8G8R8_UNORM: @@ -64,7 +64,7 @@ swzsurf_format(mesa_format format) case MESA_FORMAT_A8R8G8B8_UNORM: case MESA_FORMAT_S8_Z24: case MESA_FORMAT_Z24_S8: - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: return NV04_SWIZZLED_SURFACE_FORMAT_COLOR_A8R8G8B8; default: @@ -76,9 +76,9 @@ static inline int surf2d_format(mesa_format format) { switch (format) { - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_I_UNORM8: case MESA_FORMAT_RGB332: return NV04_CONTEXT_SURFACES_2D_FORMAT_Y8; @@ -93,7 +93,7 @@ surf2d_format(mesa_format format) case MESA_FORMAT_AL88_REV: case MESA_FORMAT_YCBCR: case MESA_FORMAT_YCBCR_REV: - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return NV04_CONTEXT_SURFACES_2D_FORMAT_R5G6B5; case MESA_FORMAT_A8B8G8R8_UNORM: @@ -103,7 +103,7 @@ surf2d_format(mesa_format format) case MESA_FORMAT_A8R8G8B8_UNORM: case MESA_FORMAT_S8_Z24: case MESA_FORMAT_Z24_S8: - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: return NV04_CONTEXT_SURFACES_2D_FORMAT_Y32; default: @@ -115,9 +115,9 @@ static inline int rect_format(mesa_format format) { switch (format) { - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_I_UNORM8: case MESA_FORMAT_RGB332: return NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A8R8G8B8; @@ -132,7 +132,7 @@ rect_format(mesa_format format) case MESA_FORMAT_AL88_REV: case MESA_FORMAT_YCBCR: case MESA_FORMAT_YCBCR_REV: - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A16R5G6B5; case MESA_FORMAT_A8B8G8R8_UNORM: @@ -142,7 +142,7 @@ rect_format(mesa_format format) case MESA_FORMAT_A8R8G8B8_UNORM: case MESA_FORMAT_S8_Z24: case MESA_FORMAT_Z24_S8: - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: return NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A8R8G8B8; default: @@ -154,9 +154,9 @@ static inline int sifm_format(mesa_format format) { switch (format) { - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_I_UNORM8: case MESA_FORMAT_RGB332: return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_AY8; @@ -171,7 +171,7 @@ sifm_format(mesa_format format) case MESA_FORMAT_AL88_REV: case MESA_FORMAT_YCBCR: case MESA_FORMAT_YCBCR_REV: - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_R5G6B5; case MESA_FORMAT_A8B8G8R8_UNORM: @@ -181,7 +181,7 @@ sifm_format(mesa_format format) case MESA_FORMAT_A8R8G8B8_UNORM: case MESA_FORMAT_S8_Z24: case MESA_FORMAT_Z24_S8: - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A8R8G8B8; default: diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c index 9badefa3db6..4cd47abbd70 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c @@ -42,7 +42,7 @@ get_rt_format(mesa_format format) return NV10_3D_RT_FORMAT_COLOR_A8R8G8B8; case MESA_FORMAT_RGB565: return NV10_3D_RT_FORMAT_COLOR_R5G6B5; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return NV10_3D_RT_FORMAT_DEPTH_Z16; case MESA_FORMAT_Z24_S8: return NV10_3D_RT_FORMAT_DEPTH_Z24S8; diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c index f71cb0d28a4..10f067fdec1 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c @@ -172,13 +172,13 @@ get_input_arg(struct combiner_state *rc, int arg, int flags) struct gl_texture_object *t = rc->ctx->Texture.Unit[i]._Current; mesa_format format = t->Image[0][t->BaseLevel]->TexFormat; - if (format == MESA_FORMAT_A8) { + if (format == MESA_FORMAT_A_UNORM8) { /* Emulated using I8. */ if (is_color_operand(operand)) return RC_IN_SOURCE(ZERO) | get_input_mapping(rc, operand, flags); - } else if (format == MESA_FORMAT_L8) { + } else if (format == MESA_FORMAT_L_UNORM8) { /* Sometimes emulated using I8. */ if (!is_color_operand(operand)) return RC_IN_SOURCE(ZERO) | diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c index 49e908f949a..316ee2abe6a 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c @@ -105,11 +105,11 @@ get_tex_format_pot(struct gl_texture_image *ti) case MESA_FORMAT_RGB565: return NV10_3D_TEX_FORMAT_FORMAT_R5G6B5; - case MESA_FORMAT_A8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_I_UNORM8: return NV10_3D_TEX_FORMAT_FORMAT_I8; - case MESA_FORMAT_L8: + case MESA_FORMAT_L_UNORM8: return NV10_3D_TEX_FORMAT_FORMAT_L8; case MESA_FORMAT_RGB_DXT1: @@ -141,9 +141,9 @@ get_tex_format_rect(struct gl_texture_image *ti) case MESA_FORMAT_B8G8R8X8_UNORM: return NV10_3D_TEX_FORMAT_FORMAT_A8R8G8B8_RECT; - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_I_UNORM8: return NV10_3D_TEX_FORMAT_FORMAT_I8_RECT; default: diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c index cf216a69950..6b6cf3e3d65 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c @@ -42,7 +42,7 @@ get_rt_format(mesa_format format) return NV20_3D_RT_FORMAT_COLOR_A8R8G8B8; case MESA_FORMAT_RGB565: return NV20_3D_RT_FORMAT_COLOR_R5G6B5; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return NV20_3D_RT_FORMAT_DEPTH_Z16; case MESA_FORMAT_Z24_S8: return NV20_3D_RT_FORMAT_DEPTH_Z24S8; diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c index 7af721850e2..198e4f2a489 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c @@ -102,11 +102,11 @@ get_tex_format_pot(struct gl_texture_image *ti) case MESA_FORMAT_RGB565: return NV20_3D_TEX_FORMAT_FORMAT_R5G6B5; - case MESA_FORMAT_A8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_I_UNORM8: return NV20_3D_TEX_FORMAT_FORMAT_I8; - case MESA_FORMAT_L8: + case MESA_FORMAT_L_UNORM8: return NV20_3D_TEX_FORMAT_FORMAT_L8; case MESA_FORMAT_RGB_DXT1: @@ -143,11 +143,11 @@ get_tex_format_rect(struct gl_texture_image *ti) case MESA_FORMAT_RGB565: return NV20_3D_TEX_FORMAT_FORMAT_R5G6B5_RECT; - case MESA_FORMAT_L8: + case MESA_FORMAT_L_UNORM8: return NV20_3D_TEX_FORMAT_FORMAT_L8_RECT; - case MESA_FORMAT_A8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_I_UNORM8: return NV20_3D_TEX_FORMAT_FORMAT_I8_RECT; default: diff --git a/src/mesa/drivers/dri/r200/r200_blit.c b/src/mesa/drivers/dri/r200/r200_blit.c index 142a5175bfd..62e38aabb49 100644 --- a/src/mesa/drivers/dri/r200/r200_blit.c +++ b/src/mesa/drivers/dri/r200/r200_blit.c @@ -47,9 +47,9 @@ unsigned r200_check_blit(mesa_format mesa_format, uint32_t dst_pitch) case MESA_FORMAT_RGB565: case MESA_FORMAT_ARGB4444: case MESA_FORMAT_ARGB1555: - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_I_UNORM8: /* swizzled */ case MESA_FORMAT_A8B8G8R8_UNORM: case MESA_FORMAT_R8G8B8A8_UNORM: @@ -135,11 +135,11 @@ static void inline emit_tx_setup(struct r200_context *r200, case MESA_FORMAT_ARGB1555: txformat |= R200_TXFORMAT_ARGB1555 | R200_TXFORMAT_ALPHA_IN_MAP; break; - case MESA_FORMAT_A8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_I_UNORM8: txformat |= R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP; break; - case MESA_FORMAT_L8: + case MESA_FORMAT_L_UNORM8: txformat |= R200_TXFORMAT_I8; break; case MESA_FORMAT_AL88: @@ -160,9 +160,9 @@ static void inline emit_tx_setup(struct r200_context *r200, case MESA_FORMAT_RGB565: case MESA_FORMAT_ARGB4444: case MESA_FORMAT_ARGB1555: - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_I_UNORM8: default: /* no swizzle required */ BEGIN_BATCH(10); @@ -323,9 +323,9 @@ static inline void emit_cb_setup(struct r200_context *r200, case MESA_FORMAT_ARGB1555: dst_format = RADEON_COLOR_FORMAT_ARGB1555; break; - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_I_UNORM8: dst_format = RADEON_COLOR_FORMAT_RGB8; break; default: diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 80dea79d23f..505c99959c7 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -73,7 +73,7 @@ static const struct tx_table tx_table_be[] = [ MESA_FORMAT_R8G8B8A8_UNORM ] = { R200_TXFORMAT_RGBA8888 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_B8G8R8A8_UNORM ] = { R200_TXFORMAT_ARGB8888 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_A8R8G8B8_UNORM ] = { R200_TXFORMAT_ARGB8888 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, - [ MESA_FORMAT_RGB888 ] = { 0xffffffff, 0 }, + [ MESA_FORMAT_BGR_UNORM8 ] = { 0xffffffff, 0 }, [ MESA_FORMAT_RGB565 ] = { R200_TXFORMAT_RGB565, 0 }, [ MESA_FORMAT_RGB565_REV ] = { R200_TXFORMAT_RGB565, 0 }, [ MESA_FORMAT_ARGB4444 ] = { R200_TXFORMAT_ARGB4444 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, @@ -82,9 +82,9 @@ static const struct tx_table tx_table_be[] = [ MESA_FORMAT_ARGB1555_REV ] = { R200_TXFORMAT_ARGB1555 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_AL88 ] = { R200_TXFORMAT_AL88 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_AL88_REV ] = { R200_TXFORMAT_AL88 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, - [ MESA_FORMAT_A8 ] = { R200_TXFORMAT_A8 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, - [ MESA_FORMAT_L8 ] = { R200_TXFORMAT_L8, 0 }, - [ MESA_FORMAT_I8 ] = { R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, + [ MESA_FORMAT_A_UNORM8 ] = { R200_TXFORMAT_A8 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, + [ MESA_FORMAT_L_UNORM8 ] = { R200_TXFORMAT_L8, 0 }, + [ MESA_FORMAT_I_UNORM8 ] = { R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_YCBCR ] = { R200_TXFORMAT_YCBCR, R200_YUV_TO_RGB }, [ MESA_FORMAT_YCBCR_REV ] = { R200_TXFORMAT_YCBCR_REV, R200_YUV_TO_RGB }, [ MESA_FORMAT_RGB_FXT1 ] = { 0xffffffff, 0 }, @@ -101,7 +101,7 @@ static const struct tx_table tx_table_le[] = [ MESA_FORMAT_R8G8B8A8_UNORM ] = { R200_TXFORMAT_ABGR8888 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_B8G8R8A8_UNORM ] = { R200_TXFORMAT_ARGB8888 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_A8R8G8B8_UNORM ] = { R200_TXFORMAT_ARGB8888 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, - [ MESA_FORMAT_RGB888 ] = { R200_TXFORMAT_ARGB8888, 0 }, + [ MESA_FORMAT_BGR_UNORM8 ] = { R200_TXFORMAT_ARGB8888, 0 }, [ MESA_FORMAT_RGB565 ] = { R200_TXFORMAT_RGB565, 0 }, [ MESA_FORMAT_RGB565_REV ] = { R200_TXFORMAT_RGB565, 0 }, [ MESA_FORMAT_ARGB4444 ] = { R200_TXFORMAT_ARGB4444 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, @@ -110,9 +110,9 @@ static const struct tx_table tx_table_le[] = [ MESA_FORMAT_ARGB1555_REV ] = { R200_TXFORMAT_ARGB1555 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_AL88 ] = { R200_TXFORMAT_AL88 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_AL88_REV ] = { R200_TXFORMAT_AL88 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, - [ MESA_FORMAT_A8 ] = { R200_TXFORMAT_A8 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, - [ MESA_FORMAT_L8 ] = { R200_TXFORMAT_L8, 0 }, - [ MESA_FORMAT_I8 ] = { R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, + [ MESA_FORMAT_A_UNORM8 ] = { R200_TXFORMAT_A8 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, + [ MESA_FORMAT_L_UNORM8 ] = { R200_TXFORMAT_L8, 0 }, + [ MESA_FORMAT_I_UNORM8 ] = { R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_YCBCR ] = { R200_TXFORMAT_YCBCR, R200_YUV_TO_RGB }, [ MESA_FORMAT_YCBCR_REV ] = { R200_TXFORMAT_YCBCR_REV, R200_YUV_TO_RGB }, [ MESA_FORMAT_RGB_FXT1 ] = { 0xffffffff, 0 }, @@ -768,8 +768,8 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format switch (rb->cpp) { case 4: if (texture_format == __DRI_TEXTURE_FORMAT_RGB) { - texFormat = MESA_FORMAT_RGB888; - t->pp_txformat = tx_table_le[MESA_FORMAT_RGB888].format; + texFormat = MESA_FORMAT_BGR_UNORM8; + t->pp_txformat = tx_table_le[MESA_FORMAT_BGR_UNORM8].format; } else { texFormat = MESA_FORMAT_B8G8R8A8_UNORM; @@ -779,9 +779,9 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format break; case 3: default: - texFormat = MESA_FORMAT_RGB888; - t->pp_txformat = tx_table_le[MESA_FORMAT_RGB888].format; - t->pp_txfilter |= tx_table_le[MESA_FORMAT_RGB888].filter; + texFormat = MESA_FORMAT_BGR_UNORM8; + t->pp_txformat = tx_table_le[MESA_FORMAT_BGR_UNORM8].format; + t->pp_txfilter |= tx_table_le[MESA_FORMAT_BGR_UNORM8].filter; break; case 2: texFormat = MESA_FORMAT_RGB565; diff --git a/src/mesa/drivers/dri/radeon/radeon_blit.c b/src/mesa/drivers/dri/radeon/radeon_blit.c index 5e291672f68..a5b78550e6b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_blit.c +++ b/src/mesa/drivers/dri/radeon/radeon_blit.c @@ -47,9 +47,9 @@ unsigned r100_check_blit(mesa_format mesa_format, uint32_t dst_pitch) case MESA_FORMAT_RGB565: case MESA_FORMAT_ARGB4444: case MESA_FORMAT_ARGB1555: - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_I_UNORM8: break; default: return 0; @@ -126,11 +126,11 @@ static void inline emit_tx_setup(struct r100_context *r100, case MESA_FORMAT_ARGB1555: txformat |= RADEON_TXFORMAT_ARGB1555 | RADEON_TXFORMAT_ALPHA_IN_MAP; break; - case MESA_FORMAT_A8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_I_UNORM8: txformat |= RADEON_TXFORMAT_I8 | RADEON_TXFORMAT_ALPHA_IN_MAP; break; - case MESA_FORMAT_L8: + case MESA_FORMAT_L_UNORM8: txformat |= RADEON_TXFORMAT_I8; break; case MESA_FORMAT_AL88: @@ -199,9 +199,9 @@ static inline void emit_cb_setup(struct r100_context *r100, case MESA_FORMAT_ARGB1555: dst_format = RADEON_COLOR_FORMAT_ARGB1555; break; - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_I_UNORM8: dst_format = RADEON_COLOR_FORMAT_RGB8; break; default: diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 7a0ce47e141..f2496e68098 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -315,7 +315,7 @@ radeon_map_renderbuffer(struct gl_context *ctx, mode, out_map, out_stride); return; } - if (rb->Format == MESA_FORMAT_Z16) { + if (rb->Format == MESA_FORMAT_Z_UNORM16) { radeon_map_renderbuffer_z16(ctx, rb, x, y, w, h, mode, out_map, out_stride); return; @@ -423,7 +423,7 @@ radeon_unmap_renderbuffer(struct gl_context *ctx, radeon_unmap_renderbuffer_s8z24(ctx, rb); return; } - if (rb->Format == MESA_FORMAT_Z16) { + if (rb->Format == MESA_FORMAT_Z_UNORM16) { radeon_unmap_renderbuffer_z16(ctx, rb); return; } @@ -511,7 +511,7 @@ radeon_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffe cpp = 4; break; case GL_DEPTH_COMPONENT16: - rb->Format = MESA_FORMAT_Z16; + rb->Format = MESA_FORMAT_Z_UNORM16; cpp = 2; break; case GL_DEPTH_COMPONENT: diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 3dcdcba00d3..2c3186ec433 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -646,7 +646,7 @@ radeonCreateBuffer( __DRIscreen *driScrnPriv, } else if (mesaVis->depthBits == 16) { /* just 16-bit depth buffer, no hw stencil */ struct radeon_renderbuffer *depth = - radeon_create_renderbuffer(MESA_FORMAT_Z16, driDrawPriv); + radeon_create_renderbuffer(MESA_FORMAT_Z_UNORM16, driDrawPriv); _mesa_add_renderbuffer(&rfb->base, BUFFER_DEPTH, &depth->base.Base); depth->has_surface = screen->depthHasSurface; } diff --git a/src/mesa/drivers/dri/radeon/radeon_tex_copy.c b/src/mesa/drivers/dri/radeon/radeon_tex_copy.c index 9e7ecca0f68..f8430cb95c0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex_copy.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex_copy.c @@ -116,8 +116,8 @@ do_copy_texsubimage(struct gl_context *ctx, dst_mesaformat = MESA_FORMAT_B8G8R8A8_UNORM; break; case 1: - src_mesaformat = MESA_FORMAT_A8; - dst_mesaformat = MESA_FORMAT_A8; + src_mesaformat = MESA_FORMAT_A_UNORM8; + dst_mesaformat = MESA_FORMAT_A_UNORM8; break; default: return GL_FALSE; diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index 51c36e9ee84..e79d8dfae17 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -78,7 +78,7 @@ static const struct tx_table tx_table[] = [ MESA_FORMAT_R8G8B8A8_UNORM ] = { RADEON_TXFORMAT_RGBA8888 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_B8G8R8A8_UNORM ] = { RADEON_TXFORMAT_ARGB8888 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_A8R8G8B8_UNORM ] = { RADEON_TXFORMAT_ARGB8888 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, - [ MESA_FORMAT_RGB888 ] = { RADEON_TXFORMAT_ARGB8888, 0 }, + [ MESA_FORMAT_BGR_UNORM8 ] = { RADEON_TXFORMAT_ARGB8888, 0 }, [ MESA_FORMAT_RGB565 ] = { RADEON_TXFORMAT_RGB565, 0 }, [ MESA_FORMAT_RGB565_REV ] = { RADEON_TXFORMAT_RGB565, 0 }, [ MESA_FORMAT_ARGB4444 ] = { RADEON_TXFORMAT_ARGB4444 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, @@ -87,9 +87,9 @@ static const struct tx_table tx_table[] = [ MESA_FORMAT_ARGB1555_REV ] = { RADEON_TXFORMAT_ARGB1555 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_AL88 ] = { RADEON_TXFORMAT_AL88 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_AL88_REV ] = { RADEON_TXFORMAT_AL88 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, - [ MESA_FORMAT_A8 ] = { RADEON_TXFORMAT_A8 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, - [ MESA_FORMAT_L8 ] = { RADEON_TXFORMAT_L8, 0 }, - [ MESA_FORMAT_I8 ] = { RADEON_TXFORMAT_I8 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, + [ MESA_FORMAT_A_UNORM8 ] = { RADEON_TXFORMAT_A8 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, + [ MESA_FORMAT_L_UNORM8 ] = { RADEON_TXFORMAT_L8, 0 }, + [ MESA_FORMAT_I_UNORM8 ] = { RADEON_TXFORMAT_I8 | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }, [ MESA_FORMAT_YCBCR ] = { RADEON_TXFORMAT_YCBCR, RADEON_YUV_TO_RGB }, [ MESA_FORMAT_YCBCR_REV ] = { RADEON_TXFORMAT_YCBCR_REV, RADEON_YUV_TO_RGB }, [ MESA_FORMAT_RGB_FXT1 ] = { 0xffffffff, 0 }, @@ -643,8 +643,8 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_form switch (rb->cpp) { case 4: if (texture_format == __DRI_TEXTURE_FORMAT_RGB) { - t->pp_txformat = tx_table[MESA_FORMAT_RGB888].format; - texFormat = MESA_FORMAT_RGB888; + t->pp_txformat = tx_table[MESA_FORMAT_BGR_UNORM8].format; + texFormat = MESA_FORMAT_BGR_UNORM8; } else { t->pp_txformat = tx_table[MESA_FORMAT_B8G8R8A8_UNORM].format; @@ -654,9 +654,9 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_form break; case 3: default: - texFormat = MESA_FORMAT_RGB888; - t->pp_txformat = tx_table[MESA_FORMAT_RGB888].format; - t->pp_txfilter |= tx_table[MESA_FORMAT_RGB888].filter; + texFormat = MESA_FORMAT_BGR_UNORM8; + t->pp_txformat = tx_table[MESA_FORMAT_BGR_UNORM8].format; + t->pp_txfilter |= tx_table[MESA_FORMAT_BGR_UNORM8].filter; break; case 2: texFormat = MESA_FORMAT_RGB565; diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 15ab677ce39..40b17bb8269 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -349,7 +349,7 @@ mesa_format radeonChooseTextureFormat(struct gl_context * ctx, in wrong rgb values (same as alpha value instead of 0). */ return _radeon_texformat_al88; #else - return MESA_FORMAT_A8; + return MESA_FORMAT_A_UNORM8; #endif case 1: case GL_LUMINANCE: @@ -358,7 +358,7 @@ mesa_format radeonChooseTextureFormat(struct gl_context * ctx, case GL_LUMINANCE12: case GL_LUMINANCE16: case GL_COMPRESSED_LUMINANCE: - return MESA_FORMAT_L8; + return MESA_FORMAT_L_UNORM8; case 2: case GL_LUMINANCE_ALPHA: @@ -377,7 +377,7 @@ mesa_format radeonChooseTextureFormat(struct gl_context * ctx, case GL_INTENSITY12: case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: - return MESA_FORMAT_I8; + return MESA_FORMAT_I_UNORM8; case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_APPLE || @@ -447,7 +447,7 @@ mesa_format radeonChooseTextureFormat(struct gl_context * ctx, case GL_SLUMINANCE: case GL_SLUMINANCE8: case GL_COMPRESSED_SLUMINANCE: - return MESA_FORMAT_SL8; + return MESA_FORMAT_L_SRGB8; case GL_SLUMINANCE_ALPHA: case GL_SLUMINANCE8_ALPHA8: @@ -512,7 +512,7 @@ unsigned radeonIsFormatRenderable(mesa_format mesa_format) switch (mesa_format) { - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: case MESA_FORMAT_S8_Z24: return 1; default: diff --git a/src/mesa/drivers/haiku/swrast/SoftwareRast.cpp b/src/mesa/drivers/haiku/swrast/SoftwareRast.cpp index 095ca1f9d46..a4afbdca0c6 100644 --- a/src/mesa/drivers/haiku/swrast/SoftwareRast.cpp +++ b/src/mesa/drivers/haiku/swrast/SoftwareRast.cpp @@ -601,7 +601,7 @@ MesaSoftwareRast::_SetupRenderBuffer(struct gl_renderbuffer* rb, break; case B_RGB24: rb->_BaseFormat = GL_RGB; - rb->Format = MESA_FORMAT_RGB888; + rb->Format = MESA_FORMAT_BGR_UNORM8; break; case B_RGB16: rb->_BaseFormat = GL_RGB; diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index 9b1e96cfc32..cd137bec533 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -454,7 +454,7 @@ osmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, rb->Format = MESA_FORMAT_A8B8G8R8_UNORM; } else if (osmesa->DataType == GL_UNSIGNED_SHORT) { - rb->Format = MESA_FORMAT_RGBA_16; + rb->Format = MESA_FORMAT_RGBA_UNORM16; } else { rb->Format = MESA_FORMAT_RGBA_FLOAT32; @@ -469,7 +469,7 @@ osmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, } else if (osmesa->DataType == GL_UNSIGNED_SHORT) { _mesa_warning(ctx, "Unsupported OSMesa format BGRA/GLushort"); - rb->Format = MESA_FORMAT_RGBA_16; /* not exactly right */ + rb->Format = MESA_FORMAT_RGBA_UNORM16; /* not exactly right */ } else { _mesa_warning(ctx, "Unsupported OSMesa format BGRA/GLfloat"); @@ -485,7 +485,7 @@ osmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, } else if (osmesa->DataType == GL_UNSIGNED_SHORT) { _mesa_warning(ctx, "Unsupported OSMesa format ARGB/GLushort"); - rb->Format = MESA_FORMAT_RGBA_16; /* not exactly right */ + rb->Format = MESA_FORMAT_RGBA_UNORM16; /* not exactly right */ } else { _mesa_warning(ctx, "Unsupported OSMesa format ARGB/GLfloat"); @@ -494,11 +494,11 @@ osmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, } else if (osmesa->format == OSMESA_RGB) { if (osmesa->DataType == GL_UNSIGNED_BYTE) { - rb->Format = MESA_FORMAT_RGB888; + rb->Format = MESA_FORMAT_BGR_UNORM8; } else if (osmesa->DataType == GL_UNSIGNED_SHORT) { _mesa_warning(ctx, "Unsupported OSMesa format RGB/GLushort"); - rb->Format = MESA_FORMAT_RGBA_16; /* not exactly right */ + rb->Format = MESA_FORMAT_RGBA_UNORM16; /* not exactly right */ } else { _mesa_warning(ctx, "Unsupported OSMesa format RGB/GLfloat"); @@ -507,11 +507,11 @@ osmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, } else if (osmesa->format == OSMESA_BGR) { if (osmesa->DataType == GL_UNSIGNED_BYTE) { - rb->Format = MESA_FORMAT_BGR888; + rb->Format = MESA_FORMAT_RGB_UNORM8; } else if (osmesa->DataType == GL_UNSIGNED_SHORT) { _mesa_warning(ctx, "Unsupported OSMesa format BGR/GLushort"); - rb->Format = MESA_FORMAT_RGBA_16; /* not exactly right */ + rb->Format = MESA_FORMAT_RGBA_UNORM16; /* not exactly right */ } else { _mesa_warning(ctx, "Unsupported OSMesa format BGR/GLfloat"); diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 0b703134749..3a483e46d1f 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -615,17 +615,17 @@ _mesa_print_texture(struct gl_context *ctx, struct gl_texture_image *img) else { /* XXX add more formats or make into a new format utility function */ switch (img->TexFormat) { - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_I_UNORM8: c = 1; break; case MESA_FORMAT_AL88: case MESA_FORMAT_AL88_REV: c = 2; break; - case MESA_FORMAT_RGB888: - case MESA_FORMAT_BGR888: + case MESA_FORMAT_BGR_UNORM8: + case MESA_FORMAT_RGB_UNORM8: c = 3; break; case MESA_FORMAT_A8B8G8R8_UNORM: diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index aad111bd9e3..90ea870ca84 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -2899,7 +2899,7 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, return; } - if (format == MESA_FORMAT_S8) { + if (format == MESA_FORMAT_S_UINT8) { /* special cases */ *params = GL_INDEX; } diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c index dfe4a06bd77..0da0f854d61 100644 --- a/src/mesa/main/format_pack.c +++ b/src/mesa/main/format_pack.c @@ -349,7 +349,7 @@ pack_row_float_XRGB8888_REV(GLuint n, const GLfloat src[][4], void *dst) /* - * MESA_FORMAT_RGB888 + * MESA_FORMAT_BGR_UNORM8 */ static void @@ -398,7 +398,7 @@ pack_row_float_RGB888(GLuint n, const GLfloat src[][4], void *dst) /* - * MESA_FORMAT_BGR888 + * MESA_FORMAT_RGB_UNORM8 */ static void @@ -761,7 +761,7 @@ pack_float_RGB332(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_A8 */ +/* MESA_FORMAT_A_UNORM8 */ static void pack_ubyte_A8(const GLubyte src[4], void *dst) @@ -778,7 +778,7 @@ pack_float_A8(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_A16 */ +/* MESA_FORMAT_A_UNORM16 */ static void pack_ubyte_A16(const GLubyte src[4], void *dst) @@ -795,7 +795,7 @@ pack_float_A16(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_L8 */ +/* MESA_FORMAT_L_UNORM8 */ static void pack_ubyte_L8(const GLubyte src[4], void *dst) @@ -812,7 +812,7 @@ pack_float_L8(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_L16 */ +/* MESA_FORMAT_L_UNORM16 */ static void pack_ubyte_L16(const GLubyte src[4], void *dst) @@ -859,7 +859,7 @@ pack_float_YCBCR_REV(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_R8 */ +/* MESA_FORMAT_R_UNORM8 */ static void pack_ubyte_R8(const GLubyte src[4], void *dst) @@ -918,7 +918,7 @@ pack_float_RG88(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_R16 */ +/* MESA_FORMAT_R_UNORM16 */ static void pack_ubyte_R16(const GLubyte src[4], void *dst) @@ -1032,7 +1032,7 @@ pack_float_ABGR2101010_UINT(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_SRGB8 */ +/* MESA_FORMAT_BGR_SRGB8 */ static void pack_ubyte_SRGB8(const GLubyte src[4], void *dst) @@ -1103,7 +1103,7 @@ pack_float_SARGB8(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_SL8 */ +/* MESA_FORMAT_L_SRGB8 */ static void pack_ubyte_SL8(const GLubyte src[4], void *dst) @@ -1394,7 +1394,7 @@ pack_float_DUDV8(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_RGBA_16 */ +/* MESA_FORMAT_RGBA_UNORM16 */ static void pack_ubyte_RGBA_16(const GLubyte src[4], void *dst) @@ -1764,7 +1764,7 @@ pack_float_XRGB2101010_UNORM(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_XBGR16161616_UNORM */ +/* MESA_FORMAT_RGBX_UNORM16 */ static void pack_ubyte_XBGR16161616_UNORM(const GLubyte src[4], void *dst) @@ -1787,7 +1787,7 @@ pack_float_XBGR16161616_UNORM(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_XBGR16161616_SNORM */ +/* MESA_FORMAT_RGBX_SNORM16 */ static void pack_float_XBGR16161616_SNORM(const GLfloat src[4], void *dst) @@ -1800,7 +1800,7 @@ pack_float_XBGR16161616_SNORM(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_XBGR16161616_FLOAT */ +/* MESA_FORMAT_RGBX_FLOAT16 */ static void pack_float_XBGR16161616_FLOAT(const GLfloat src[4], void *dst) @@ -1812,7 +1812,7 @@ pack_float_XBGR16161616_FLOAT(const GLfloat src[4], void *dst) d[3] = _mesa_float_to_half(1.0); } -/* MESA_FORMAT_XBGR32323232_FLOAT */ +/* MESA_FORMAT_RGBX_FLOAT32 */ static void pack_float_XBGR32323232_FLOAT(const GLfloat src[4], void *dst) @@ -1897,8 +1897,8 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) table[MESA_FORMAT_R8G8B8X8_UNORM] = pack_ubyte_RGBA8888_REV; /* reused */ table[MESA_FORMAT_B8G8R8X8_UNORM] = pack_ubyte_XRGB8888; table[MESA_FORMAT_X8R8G8B8_UNORM] = pack_ubyte_XRGB8888_REV; - table[MESA_FORMAT_RGB888] = pack_ubyte_RGB888; - table[MESA_FORMAT_BGR888] = pack_ubyte_BGR888; + table[MESA_FORMAT_BGR_UNORM8] = pack_ubyte_RGB888; + table[MESA_FORMAT_RGB_UNORM8] = pack_ubyte_BGR888; table[MESA_FORMAT_RGB565] = pack_ubyte_RGB565; table[MESA_FORMAT_RGB565_REV] = pack_ubyte_RGB565_REV; table[MESA_FORMAT_ARGB4444] = pack_ubyte_ARGB4444; @@ -1912,18 +1912,18 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) table[MESA_FORMAT_AL1616] = pack_ubyte_AL1616; table[MESA_FORMAT_AL1616_REV] = pack_ubyte_AL1616_REV; table[MESA_FORMAT_RGB332] = pack_ubyte_RGB332; - table[MESA_FORMAT_A8] = pack_ubyte_A8; - table[MESA_FORMAT_A16] = pack_ubyte_A16; - table[MESA_FORMAT_L8] = pack_ubyte_L8; - table[MESA_FORMAT_L16] = pack_ubyte_L16; - table[MESA_FORMAT_I8] = pack_ubyte_L8; /* reuse pack_ubyte_L8 */ - table[MESA_FORMAT_I16] = pack_ubyte_L16; /* reuse pack_ubyte_L16 */ + table[MESA_FORMAT_A_UNORM8] = pack_ubyte_A8; + table[MESA_FORMAT_A_UNORM16] = pack_ubyte_A16; + table[MESA_FORMAT_L_UNORM8] = pack_ubyte_L8; + table[MESA_FORMAT_L_UNORM16] = pack_ubyte_L16; + table[MESA_FORMAT_I_UNORM8] = pack_ubyte_L8; /* reuse pack_ubyte_L8 */ + table[MESA_FORMAT_I_UNORM16] = pack_ubyte_L16; /* reuse pack_ubyte_L16 */ table[MESA_FORMAT_YCBCR] = pack_ubyte_YCBCR; table[MESA_FORMAT_YCBCR_REV] = pack_ubyte_YCBCR_REV; - table[MESA_FORMAT_R8] = pack_ubyte_R8; + table[MESA_FORMAT_R_UNORM8] = pack_ubyte_R8; table[MESA_FORMAT_GR88] = pack_ubyte_GR88; table[MESA_FORMAT_RG88] = pack_ubyte_RG88; - table[MESA_FORMAT_R16] = pack_ubyte_R16; + table[MESA_FORMAT_R_UNORM16] = pack_ubyte_R16; table[MESA_FORMAT_GR1616] = pack_ubyte_GR1616; table[MESA_FORMAT_RG1616] = pack_ubyte_RG1616; table[MESA_FORMAT_ARGB2101010] = pack_ubyte_ARGB2101010; @@ -1932,17 +1932,17 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) /* should never convert RGBA to these formats */ table[MESA_FORMAT_Z24_S8] = NULL; table[MESA_FORMAT_S8_Z24] = NULL; - table[MESA_FORMAT_Z16] = NULL; + table[MESA_FORMAT_Z_UNORM16] = NULL; table[MESA_FORMAT_X8_Z24] = NULL; table[MESA_FORMAT_Z24_X8] = NULL; - table[MESA_FORMAT_Z32] = NULL; - table[MESA_FORMAT_S8] = NULL; + table[MESA_FORMAT_Z_UNORM32] = NULL; + table[MESA_FORMAT_S_UINT8] = NULL; /* sRGB */ - table[MESA_FORMAT_SRGB8] = pack_ubyte_SRGB8; + table[MESA_FORMAT_BGR_SRGB8] = pack_ubyte_SRGB8; table[MESA_FORMAT_SRGBA8] = pack_ubyte_SRGBA8; table[MESA_FORMAT_SARGB8] = pack_ubyte_SARGB8; - table[MESA_FORMAT_SL8] = pack_ubyte_SL8; + table[MESA_FORMAT_L_SRGB8] = pack_ubyte_SL8; table[MESA_FORMAT_SLA8] = pack_ubyte_SLA8; /* n/a */ @@ -1985,7 +1985,7 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) table[MESA_FORMAT_DUDV8] = pack_ubyte_DUDV8; - table[MESA_FORMAT_RGBA_16] = pack_ubyte_RGBA_16; + table[MESA_FORMAT_RGBA_UNORM16] = pack_ubyte_RGBA_16; /* n/a */ table[MESA_FORMAT_SIGNED_R8] = NULL; @@ -2007,7 +2007,7 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) table[MESA_FORMAT_SIGNED_I16] = NULL; - table[MESA_FORMAT_RGBA_16] = pack_ubyte_RGBA_16; + table[MESA_FORMAT_RGBA_UNORM16] = pack_ubyte_RGBA_16; table[MESA_FORMAT_RGB9_E5_FLOAT] = pack_ubyte_RGB9_E5_FLOAT; table[MESA_FORMAT_R11_G11_B10_FLOAT] = pack_ubyte_R11_G11_B10_FLOAT; @@ -2016,17 +2016,17 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) table[MESA_FORMAT_XRGB1555_UNORM] = pack_ubyte_XRGB1555_UNORM; table[MESA_FORMAT_XBGR8888_SNORM] = NULL; table[MESA_FORMAT_XBGR8888_SRGB] = NULL; - table[MESA_FORMAT_XBGR8888_UINT] = NULL; - table[MESA_FORMAT_XBGR8888_SINT] = NULL; + table[MESA_FORMAT_RGBX_UINT8] = NULL; + table[MESA_FORMAT_RGBX_SINT8] = NULL; table[MESA_FORMAT_XRGB2101010_UNORM] = pack_ubyte_XRGB2101010_UNORM; - table[MESA_FORMAT_XBGR16161616_UNORM] = pack_ubyte_XBGR16161616_UNORM; - table[MESA_FORMAT_XBGR16161616_SNORM] = NULL; - table[MESA_FORMAT_XBGR16161616_FLOAT] = NULL; - table[MESA_FORMAT_XBGR16161616_UINT] = NULL; - table[MESA_FORMAT_XBGR16161616_SINT] = NULL; - table[MESA_FORMAT_XBGR32323232_FLOAT] = NULL; - table[MESA_FORMAT_XBGR32323232_UINT] = NULL; - table[MESA_FORMAT_XBGR32323232_SINT] = NULL; + table[MESA_FORMAT_RGBX_UNORM16] = pack_ubyte_XBGR16161616_UNORM; + table[MESA_FORMAT_RGBX_SNORM16] = NULL; + table[MESA_FORMAT_RGBX_FLOAT16] = NULL; + table[MESA_FORMAT_RGBX_UINT16] = NULL; + table[MESA_FORMAT_RGBX_SINT16] = NULL; + table[MESA_FORMAT_RGBX_FLOAT32] = NULL; + table[MESA_FORMAT_RGBX_UINT32] = NULL; + table[MESA_FORMAT_RGBX_SINT32] = NULL; table[MESA_FORMAT_ABGR2101010] = pack_ubyte_ABGR2101010; @@ -2060,8 +2060,8 @@ _mesa_get_pack_float_rgba_function(mesa_format format) table[MESA_FORMAT_R8G8B8X8_UNORM] = pack_float_RGBA8888_REV; /* reused */ table[MESA_FORMAT_B8G8R8X8_UNORM] = pack_float_XRGB8888; table[MESA_FORMAT_X8R8G8B8_UNORM] = pack_float_XRGB8888_REV; - table[MESA_FORMAT_RGB888] = pack_float_RGB888; - table[MESA_FORMAT_BGR888] = pack_float_BGR888; + table[MESA_FORMAT_BGR_UNORM8] = pack_float_RGB888; + table[MESA_FORMAT_RGB_UNORM8] = pack_float_BGR888; table[MESA_FORMAT_RGB565] = pack_float_RGB565; table[MESA_FORMAT_RGB565_REV] = pack_float_RGB565_REV; table[MESA_FORMAT_ARGB4444] = pack_float_ARGB4444; @@ -2076,18 +2076,18 @@ _mesa_get_pack_float_rgba_function(mesa_format format) table[MESA_FORMAT_AL1616] = pack_float_AL1616; table[MESA_FORMAT_AL1616_REV] = pack_float_AL1616_REV; table[MESA_FORMAT_RGB332] = pack_float_RGB332; - table[MESA_FORMAT_A8] = pack_float_A8; - table[MESA_FORMAT_A16] = pack_float_A16; - table[MESA_FORMAT_L8] = pack_float_L8; - table[MESA_FORMAT_L16] = pack_float_L16; - table[MESA_FORMAT_I8] = pack_float_L8; /* reuse pack_float_L8 */ - table[MESA_FORMAT_I16] = pack_float_L16; /* reuse pack_float_L16 */ + table[MESA_FORMAT_A_UNORM8] = pack_float_A8; + table[MESA_FORMAT_A_UNORM16] = pack_float_A16; + table[MESA_FORMAT_L_UNORM8] = pack_float_L8; + table[MESA_FORMAT_L_UNORM16] = pack_float_L16; + table[MESA_FORMAT_I_UNORM8] = pack_float_L8; /* reuse pack_float_L8 */ + table[MESA_FORMAT_I_UNORM16] = pack_float_L16; /* reuse pack_float_L16 */ table[MESA_FORMAT_YCBCR] = pack_float_YCBCR; table[MESA_FORMAT_YCBCR_REV] = pack_float_YCBCR_REV; - table[MESA_FORMAT_R8] = pack_float_R8; + table[MESA_FORMAT_R_UNORM8] = pack_float_R8; table[MESA_FORMAT_GR88] = pack_float_GR88; table[MESA_FORMAT_RG88] = pack_float_RG88; - table[MESA_FORMAT_R16] = pack_float_R16; + table[MESA_FORMAT_R_UNORM16] = pack_float_R16; table[MESA_FORMAT_GR1616] = pack_float_GR1616; table[MESA_FORMAT_RG1616] = pack_float_RG1616; table[MESA_FORMAT_ARGB2101010] = pack_float_ARGB2101010; @@ -2096,16 +2096,16 @@ _mesa_get_pack_float_rgba_function(mesa_format format) /* should never convert RGBA to these formats */ table[MESA_FORMAT_Z24_S8] = NULL; table[MESA_FORMAT_S8_Z24] = NULL; - table[MESA_FORMAT_Z16] = NULL; + table[MESA_FORMAT_Z_UNORM16] = NULL; table[MESA_FORMAT_X8_Z24] = NULL; table[MESA_FORMAT_Z24_X8] = NULL; - table[MESA_FORMAT_Z32] = NULL; - table[MESA_FORMAT_S8] = NULL; + table[MESA_FORMAT_Z_UNORM32] = NULL; + table[MESA_FORMAT_S_UINT8] = NULL; - table[MESA_FORMAT_SRGB8] = pack_float_SRGB8; + table[MESA_FORMAT_BGR_SRGB8] = pack_float_SRGB8; table[MESA_FORMAT_SRGBA8] = pack_float_SRGBA8; table[MESA_FORMAT_SARGB8] = pack_float_SARGB8; - table[MESA_FORMAT_SL8] = pack_float_SL8; + table[MESA_FORMAT_L_SRGB8] = pack_float_SL8; table[MESA_FORMAT_SLA8] = pack_float_SLA8; /* n/a */ @@ -2149,7 +2149,7 @@ _mesa_get_pack_float_rgba_function(mesa_format format) table[MESA_FORMAT_DUDV8] = pack_float_DUDV8; - table[MESA_FORMAT_RGBA_16] = pack_float_RGBA_16; + table[MESA_FORMAT_RGBA_UNORM16] = pack_float_RGBA_16; table[MESA_FORMAT_SIGNED_R8] = pack_float_SIGNED_R8; table[MESA_FORMAT_SIGNED_RG88_REV] = pack_float_SIGNED_RG88_REV; @@ -2176,17 +2176,17 @@ _mesa_get_pack_float_rgba_function(mesa_format format) table[MESA_FORMAT_XRGB1555_UNORM] = pack_float_XRGB1555_UNORM; table[MESA_FORMAT_XBGR8888_SNORM] = pack_float_XBGR8888_SNORM; table[MESA_FORMAT_XBGR8888_SRGB] = pack_float_XBGR8888_SRGB; - table[MESA_FORMAT_XBGR8888_UINT] = NULL; - table[MESA_FORMAT_XBGR8888_SINT] = NULL; + table[MESA_FORMAT_RGBX_UINT8] = NULL; + table[MESA_FORMAT_RGBX_SINT8] = NULL; table[MESA_FORMAT_XRGB2101010_UNORM] = pack_float_XRGB2101010_UNORM; - table[MESA_FORMAT_XBGR16161616_UNORM] = pack_float_XBGR16161616_UNORM; - table[MESA_FORMAT_XBGR16161616_SNORM] = pack_float_XBGR16161616_SNORM; - table[MESA_FORMAT_XBGR16161616_FLOAT] = pack_float_XBGR16161616_FLOAT; - table[MESA_FORMAT_XBGR16161616_UINT] = NULL; - table[MESA_FORMAT_XBGR16161616_SINT] = NULL; - table[MESA_FORMAT_XBGR32323232_FLOAT] = pack_float_XBGR32323232_FLOAT; - table[MESA_FORMAT_XBGR32323232_UINT] = NULL; - table[MESA_FORMAT_XBGR32323232_SINT] = NULL; + table[MESA_FORMAT_RGBX_UNORM16] = pack_float_XBGR16161616_UNORM; + table[MESA_FORMAT_RGBX_SNORM16] = pack_float_XBGR16161616_SNORM; + table[MESA_FORMAT_RGBX_FLOAT16] = pack_float_XBGR16161616_FLOAT; + table[MESA_FORMAT_RGBX_UINT16] = NULL; + table[MESA_FORMAT_RGBX_SINT16] = NULL; + table[MESA_FORMAT_RGBX_FLOAT32] = pack_float_XBGR32323232_FLOAT; + table[MESA_FORMAT_RGBX_UINT32] = NULL; + table[MESA_FORMAT_RGBX_SINT32] = NULL; table[MESA_FORMAT_ABGR2101010] = pack_float_ABGR2101010; @@ -2221,8 +2221,8 @@ get_pack_float_rgba_row_function(mesa_format format) table[MESA_FORMAT_R8G8B8X8_UNORM] = pack_row_float_RGBA8888_REV; /* reused */ table[MESA_FORMAT_B8G8R8X8_UNORM] = pack_row_float_XRGB8888; table[MESA_FORMAT_X8R8G8B8_UNORM] = pack_row_float_XRGB8888_REV; - table[MESA_FORMAT_RGB888] = pack_row_float_RGB888; - table[MESA_FORMAT_BGR888] = pack_row_float_BGR888; + table[MESA_FORMAT_BGR_UNORM8] = pack_row_float_RGB888; + table[MESA_FORMAT_RGB_UNORM8] = pack_row_float_BGR888; table[MESA_FORMAT_RGB565] = pack_row_float_RGB565; table[MESA_FORMAT_RGB565_REV] = pack_row_float_RGB565_REV; @@ -2254,8 +2254,8 @@ get_pack_ubyte_rgba_row_function(mesa_format format) table[MESA_FORMAT_R8G8B8X8_UNORM] = pack_row_ubyte_RGBA8888_REV; /* reused */ table[MESA_FORMAT_B8G8R8X8_UNORM] = pack_row_ubyte_XRGB8888; table[MESA_FORMAT_X8R8G8B8_UNORM] = pack_row_ubyte_XRGB8888_REV; - table[MESA_FORMAT_RGB888] = pack_row_ubyte_RGB888; - table[MESA_FORMAT_BGR888] = pack_row_ubyte_BGR888; + table[MESA_FORMAT_BGR_UNORM8] = pack_row_ubyte_RGB888; + table[MESA_FORMAT_RGB_UNORM8] = pack_row_ubyte_BGR888; table[MESA_FORMAT_RGB565] = pack_row_ubyte_RGB565; table[MESA_FORMAT_RGB565_REV] = pack_row_ubyte_RGB565_REV; @@ -2432,11 +2432,11 @@ _mesa_get_pack_float_z_func(mesa_format format) case MESA_FORMAT_S8_Z24: case MESA_FORMAT_X8_Z24: return pack_float_z_S8_Z24; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return pack_float_z_Z16; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: return pack_float_z_Z32; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: case MESA_FORMAT_Z32_FLOAT_X24S8: return pack_float_z_Z32_FLOAT; default: @@ -2517,11 +2517,11 @@ _mesa_get_pack_uint_z_func(mesa_format format) case MESA_FORMAT_S8_Z24: case MESA_FORMAT_X8_Z24: return pack_uint_z_S8_Z24; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return pack_uint_z_Z16; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: return pack_uint_z_Z32; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: return pack_uint_z_Z32_FLOAT; case MESA_FORMAT_Z32_FLOAT_X24S8: return pack_uint_z_Z32_FLOAT_X24S8; @@ -2579,7 +2579,7 @@ _mesa_get_pack_ubyte_stencil_func(mesa_format format) return pack_ubyte_stencil_Z24_S8; case MESA_FORMAT_S8_Z24: return pack_ubyte_stencil_S8_Z24; - case MESA_FORMAT_S8: + case MESA_FORMAT_S_UINT8: return pack_ubyte_stencil_S8; case MESA_FORMAT_Z32_FLOAT_X24S8: return pack_ubyte_stencil_Z32_FLOAT_X24S8; @@ -2627,7 +2627,7 @@ _mesa_pack_float_z_row(mesa_format format, GLuint n, } } break; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: { GLushort *d = ((GLushort *) dst); const GLfloat scale = (GLfloat) 0xffff; @@ -2637,7 +2637,7 @@ _mesa_pack_float_z_row(mesa_format format, GLuint n, } } break; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: { GLuint *d = ((GLuint *) dst); const GLdouble scale = (GLdouble) 0xffffffff; @@ -2647,7 +2647,7 @@ _mesa_pack_float_z_row(mesa_format format, GLuint n, } } break; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: memcpy(dst, src, n * sizeof(GLfloat)); break; case MESA_FORMAT_Z32_FLOAT_X24S8: @@ -2699,7 +2699,7 @@ _mesa_pack_uint_z_row(mesa_format format, GLuint n, } } break; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: { GLushort *d = ((GLushort *) dst); GLuint i; @@ -2708,10 +2708,10 @@ _mesa_pack_uint_z_row(mesa_format format, GLuint n, } } break; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: memcpy(dst, src, n * sizeof(GLfloat)); break; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: { GLuint *d = ((GLuint *) dst); const GLdouble scale = 1.0 / (GLdouble) 0xffffffff; @@ -2770,7 +2770,7 @@ _mesa_pack_ubyte_stencil_row(mesa_format format, GLuint n, } } break; - case MESA_FORMAT_S8: + case MESA_FORMAT_S_UINT8: memcpy(dst, src, n * sizeof(GLubyte)); break; case MESA_FORMAT_Z32_FLOAT_X24S8: diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c index be5ef9e28c4..33dc07d80c2 100644 --- a/src/mesa/main/format_unpack.c +++ b/src/mesa/main/format_unpack.c @@ -2327,8 +2327,8 @@ get_unpack_rgba_function(mesa_format format) table[MESA_FORMAT_R8G8B8X8_UNORM] = unpack_RGBX8888_REV; table[MESA_FORMAT_B8G8R8X8_UNORM] = unpack_XRGB8888; table[MESA_FORMAT_X8R8G8B8_UNORM] = unpack_XRGB8888_REV; - table[MESA_FORMAT_RGB888] = unpack_RGB888; - table[MESA_FORMAT_BGR888] = unpack_BGR888; + table[MESA_FORMAT_BGR_UNORM8] = unpack_RGB888; + table[MESA_FORMAT_RGB_UNORM8] = unpack_BGR888; table[MESA_FORMAT_RGB565] = unpack_RGB565; table[MESA_FORMAT_RGB565_REV] = unpack_RGB565_REV; table[MESA_FORMAT_ARGB4444] = unpack_ARGB4444; @@ -2342,18 +2342,18 @@ get_unpack_rgba_function(mesa_format format) table[MESA_FORMAT_AL1616] = unpack_AL1616; table[MESA_FORMAT_AL1616_REV] = unpack_AL1616_REV; table[MESA_FORMAT_RGB332] = unpack_RGB332; - table[MESA_FORMAT_A8] = unpack_A8; - table[MESA_FORMAT_A16] = unpack_A16; - table[MESA_FORMAT_L8] = unpack_L8; - table[MESA_FORMAT_L16] = unpack_L16; - table[MESA_FORMAT_I8] = unpack_I8; - table[MESA_FORMAT_I16] = unpack_I16; + table[MESA_FORMAT_A_UNORM8] = unpack_A8; + table[MESA_FORMAT_A_UNORM16] = unpack_A16; + table[MESA_FORMAT_L_UNORM8] = unpack_L8; + table[MESA_FORMAT_L_UNORM16] = unpack_L16; + table[MESA_FORMAT_I_UNORM8] = unpack_I8; + table[MESA_FORMAT_I_UNORM16] = unpack_I16; table[MESA_FORMAT_YCBCR] = unpack_YCBCR; table[MESA_FORMAT_YCBCR_REV] = unpack_YCBCR_REV; - table[MESA_FORMAT_R8] = unpack_R8; + table[MESA_FORMAT_R_UNORM8] = unpack_R8; table[MESA_FORMAT_GR88] = unpack_GR88; table[MESA_FORMAT_RG88] = unpack_RG88; - table[MESA_FORMAT_R16] = unpack_R16; + table[MESA_FORMAT_R_UNORM16] = unpack_R16; table[MESA_FORMAT_GR1616] = unpack_GR1616; table[MESA_FORMAT_RG1616] = unpack_RG1616; table[MESA_FORMAT_ARGB2101010] = unpack_ARGB2101010; @@ -2361,15 +2361,15 @@ get_unpack_rgba_function(mesa_format format) table[MESA_FORMAT_ABGR2101010_UINT] = unpack_ABGR2101010_UINT; table[MESA_FORMAT_Z24_S8] = unpack_Z24_S8; table[MESA_FORMAT_S8_Z24] = unpack_S8_Z24; - table[MESA_FORMAT_Z16] = unpack_Z16; + table[MESA_FORMAT_Z_UNORM16] = unpack_Z16; table[MESA_FORMAT_X8_Z24] = unpack_X8_Z24; table[MESA_FORMAT_Z24_X8] = unpack_Z24_X8; - table[MESA_FORMAT_Z32] = unpack_Z32; - table[MESA_FORMAT_S8] = unpack_S8; - table[MESA_FORMAT_SRGB8] = unpack_SRGB8; + table[MESA_FORMAT_Z_UNORM32] = unpack_Z32; + table[MESA_FORMAT_S_UINT8] = unpack_S8; + table[MESA_FORMAT_BGR_SRGB8] = unpack_SRGB8; table[MESA_FORMAT_SRGBA8] = unpack_SRGBA8; table[MESA_FORMAT_SARGB8] = unpack_SARGB8; - table[MESA_FORMAT_SL8] = unpack_SL8; + table[MESA_FORMAT_L_SRGB8] = unpack_SL8; table[MESA_FORMAT_SLA8] = unpack_SLA8; table[MESA_FORMAT_SRGB_DXT1] = unpack_SRGB_DXT1; table[MESA_FORMAT_SRGBA_DXT1] = unpack_SRGBA_DXT1; @@ -2463,7 +2463,7 @@ get_unpack_rgba_function(mesa_format format) table[MESA_FORMAT_SIGNED_GR1616] = unpack_SIGNED_GR1616; table[MESA_FORMAT_SIGNED_RGB_16] = unpack_SIGNED_RGB_16; table[MESA_FORMAT_SIGNED_RGBA_16] = unpack_SIGNED_RGBA_16; - table[MESA_FORMAT_RGBA_16] = unpack_RGBA_16; + table[MESA_FORMAT_RGBA_UNORM16] = unpack_RGBA_16; table[MESA_FORMAT_RED_RGTC1] = unpack_RED_RGTC1; table[MESA_FORMAT_SIGNED_RED_RGTC1] = unpack_SIGNED_RED_RGTC1; @@ -2500,24 +2500,24 @@ get_unpack_rgba_function(mesa_format format) table[MESA_FORMAT_RGB9_E5_FLOAT] = unpack_RGB9_E5_FLOAT; table[MESA_FORMAT_R11_G11_B10_FLOAT] = unpack_R11_G11_B10_FLOAT; - table[MESA_FORMAT_Z32_FLOAT] = unpack_Z32_FLOAT; + table[MESA_FORMAT_Z_FLOAT32] = unpack_Z32_FLOAT; table[MESA_FORMAT_Z32_FLOAT_X24S8] = unpack_Z32_FLOAT_X24S8; table[MESA_FORMAT_XRGB4444_UNORM] = unpack_XRGB4444_UNORM; table[MESA_FORMAT_XRGB1555_UNORM] = unpack_XRGB1555_UNORM; table[MESA_FORMAT_XBGR8888_SNORM] = unpack_XBGR8888_SNORM; table[MESA_FORMAT_XBGR8888_SRGB] = unpack_XBGR8888_SRGB; - table[MESA_FORMAT_XBGR8888_UINT] = unpack_XBGR8888_UINT; - table[MESA_FORMAT_XBGR8888_SINT] = unpack_XBGR8888_SINT; + table[MESA_FORMAT_RGBX_UINT8] = unpack_XBGR8888_UINT; + table[MESA_FORMAT_RGBX_SINT8] = unpack_XBGR8888_SINT; table[MESA_FORMAT_XRGB2101010_UNORM] = unpack_XRGB2101010_UNORM; - table[MESA_FORMAT_XBGR16161616_UNORM] = unpack_XBGR16161616_UNORM; - table[MESA_FORMAT_XBGR16161616_SNORM] = unpack_XBGR16161616_SNORM; - table[MESA_FORMAT_XBGR16161616_FLOAT] = unpack_XBGR16161616_FLOAT; - table[MESA_FORMAT_XBGR16161616_UINT] = unpack_XBGR16161616_UINT; - table[MESA_FORMAT_XBGR16161616_SINT] = unpack_XBGR16161616_SINT; - table[MESA_FORMAT_XBGR32323232_FLOAT] = unpack_XBGR32323232_FLOAT; - table[MESA_FORMAT_XBGR32323232_UINT] = unpack_XBGR32323232_UINT; - table[MESA_FORMAT_XBGR32323232_SINT] = unpack_XBGR32323232_SINT; + table[MESA_FORMAT_RGBX_UNORM16] = unpack_XBGR16161616_UNORM; + table[MESA_FORMAT_RGBX_SNORM16] = unpack_XBGR16161616_SNORM; + table[MESA_FORMAT_RGBX_FLOAT16] = unpack_XBGR16161616_FLOAT; + table[MESA_FORMAT_RGBX_UINT16] = unpack_XBGR16161616_UINT; + table[MESA_FORMAT_RGBX_SINT16] = unpack_XBGR16161616_SINT; + table[MESA_FORMAT_RGBX_FLOAT32] = unpack_XBGR32323232_FLOAT; + table[MESA_FORMAT_RGBX_UINT32] = unpack_XBGR32323232_UINT; + table[MESA_FORMAT_RGBX_SINT32] = unpack_XBGR32323232_SINT; table[MESA_FORMAT_ABGR2101010] = unpack_ABGR2101010; @@ -2941,10 +2941,10 @@ _mesa_unpack_ubyte_rgba_row(mesa_format format, GLuint n, case MESA_FORMAT_X8R8G8B8_UNORM: unpack_ubyte_XRGB8888_REV(src, dst, n); break; - case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR_UNORM8: unpack_ubyte_RGB888(src, dst, n); break; - case MESA_FORMAT_BGR888: + case MESA_FORMAT_RGB_UNORM8: unpack_ubyte_BGR888(src, dst, n); break; case MESA_FORMAT_RGB565: @@ -2980,16 +2980,16 @@ _mesa_unpack_ubyte_rgba_row(mesa_format format, GLuint n, case MESA_FORMAT_RGB332: unpack_ubyte_RGB332(src, dst, n); break; - case MESA_FORMAT_A8: + case MESA_FORMAT_A_UNORM8: unpack_ubyte_A8(src, dst, n); break; - case MESA_FORMAT_L8: + case MESA_FORMAT_L_UNORM8: unpack_ubyte_L8(src, dst, n); break; - case MESA_FORMAT_I8: + case MESA_FORMAT_I_UNORM8: unpack_ubyte_I8(src, dst, n); break; - case MESA_FORMAT_R8: + case MESA_FORMAT_R_UNORM8: unpack_ubyte_R8(src, dst, n); break; case MESA_FORMAT_GR88: @@ -3818,24 +3818,24 @@ _mesa_unpack_uint_rgba_row(mesa_format format, GLuint n, unpack_int_rgba_ARGB2101010(src, dst, n); break; - case MESA_FORMAT_XBGR8888_UINT: + case MESA_FORMAT_RGBX_UINT8: unpack_int_rgba_XBGR8888_UINT(src, dst, n); break; - case MESA_FORMAT_XBGR8888_SINT: + case MESA_FORMAT_RGBX_SINT8: unpack_int_rgba_XBGR8888_SINT(src, dst, n); break; - case MESA_FORMAT_XBGR16161616_UINT: + case MESA_FORMAT_RGBX_UINT16: unpack_int_rgba_XBGR16161616_UINT(src, dst, n); break; - case MESA_FORMAT_XBGR16161616_SINT: + case MESA_FORMAT_RGBX_SINT16: unpack_int_rgba_XBGR16161616_SINT(src, dst, n); break; - case MESA_FORMAT_XBGR32323232_UINT: - case MESA_FORMAT_XBGR32323232_SINT: + case MESA_FORMAT_RGBX_UINT32: + case MESA_FORMAT_RGBX_SINT32: unpack_int_rgba_XBGR32323232_UINT(src, dst, n); break; @@ -3978,13 +3978,13 @@ _mesa_unpack_float_z_row(mesa_format format, GLuint n, case MESA_FORMAT_X8_Z24: unpack = unpack_float_z_X8_Z24; break; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: unpack = unpack_float_z_Z16; break; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: unpack = unpack_float_z_Z32; break; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: unpack = unpack_float_z_Z32F; break; case MESA_FORMAT_Z32_FLOAT_X24S8: @@ -4083,13 +4083,13 @@ _mesa_unpack_uint_z_row(mesa_format format, GLuint n, case MESA_FORMAT_X8_Z24: unpack = unpack_uint_z_X8_Z24; break; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: unpack = unpack_uint_z_Z16; break; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: unpack = unpack_uint_z_Z32; break; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: unpack = unpack_uint_z_Z32_FLOAT; break; case MESA_FORMAT_Z32_FLOAT_X24S8: @@ -4146,7 +4146,7 @@ _mesa_unpack_ubyte_stencil_row(mesa_format format, GLuint n, const void *src, GLubyte *dst) { switch (format) { - case MESA_FORMAT_S8: + case MESA_FORMAT_S_UINT8: unpack_ubyte_s_S8(src, dst, n); break; case MESA_FORMAT_Z24_S8: diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index a1e573051f1..99d1e189d8d 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -160,8 +160,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_RGB888, /* Name */ - "MESA_FORMAT_RGB888", /* StrName */ + MESA_FORMAT_BGR_UNORM8, /* Name */ + "MESA_FORMAT_BGR_UNORM8", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ @@ -169,8 +169,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 3 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_BGR888, /* Name */ - "MESA_FORMAT_BGR888", /* StrName */ + MESA_FORMAT_RGB_UNORM8, /* Name */ + "MESA_FORMAT_RGB_UNORM8", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ @@ -295,8 +295,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A8, /* Name */ - "MESA_FORMAT_A8", /* StrName */ + MESA_FORMAT_A_UNORM8, /* Name */ + "MESA_FORMAT_A_UNORM8", /* StrName */ GL_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */ @@ -304,8 +304,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A16, /* Name */ - "MESA_FORMAT_A16", /* StrName */ + MESA_FORMAT_A_UNORM16, /* Name */ + "MESA_FORMAT_A_UNORM16", /* StrName */ GL_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */ @@ -313,8 +313,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_L8, /* Name */ - "MESA_FORMAT_L8", /* StrName */ + MESA_FORMAT_L_UNORM8, /* Name */ + "MESA_FORMAT_L_UNORM8", /* StrName */ GL_LUMINANCE, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -322,8 +322,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_L16, /* Name */ - "MESA_FORMAT_L16", /* StrName */ + MESA_FORMAT_L_UNORM16, /* Name */ + "MESA_FORMAT_L_UNORM16", /* StrName */ GL_LUMINANCE, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -331,8 +331,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_I8, /* Name */ - "MESA_FORMAT_I8", /* StrName */ + MESA_FORMAT_I_UNORM8, /* Name */ + "MESA_FORMAT_I_UNORM8", /* StrName */ GL_INTENSITY, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -340,8 +340,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_I16, /* Name */ - "MESA_FORMAT_I16", /* StrName */ + MESA_FORMAT_I_UNORM16, /* Name */ + "MESA_FORMAT_I_UNORM16", /* StrName */ GL_INTENSITY, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -367,8 +367,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_R8, - "MESA_FORMAT_R8", + MESA_FORMAT_R_UNORM8, + "MESA_FORMAT_R_UNORM8", GL_RED, GL_UNSIGNED_NORMALIZED, 8, 0, 0, 0, @@ -394,8 +394,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_R16, - "MESA_FORMAT_R16", + MESA_FORMAT_R_UNORM16, + "MESA_FORMAT_R_UNORM16", GL_RED, GL_UNSIGNED_NORMALIZED, 16, 0, 0, 0, @@ -448,8 +448,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_Z16, /* Name */ - "MESA_FORMAT_Z16", /* StrName */ + MESA_FORMAT_Z_UNORM16, /* Name */ + "MESA_FORMAT_Z_UNORM16", /* StrName */ GL_DEPTH_COMPONENT, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -475,8 +475,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_Z32, /* Name */ - "MESA_FORMAT_Z32", /* StrName */ + MESA_FORMAT_Z_UNORM32, /* Name */ + "MESA_FORMAT_Z_UNORM32", /* StrName */ GL_DEPTH_COMPONENT, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -484,8 +484,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_S8, /* Name */ - "MESA_FORMAT_S8", /* StrName */ + MESA_FORMAT_S_UINT8, /* Name */ + "MESA_FORMAT_S_UINT8", /* StrName */ GL_STENCIL_INDEX, /* BaseFormat */ GL_UNSIGNED_INT, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -493,8 +493,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_SRGB8, - "MESA_FORMAT_SRGB8", + MESA_FORMAT_BGR_SRGB8, + "MESA_FORMAT_BGR_SRGB8", GL_RGB, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, @@ -520,8 +520,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_SL8, - "MESA_FORMAT_SL8", + MESA_FORMAT_L_SRGB8, + "MESA_FORMAT_L_SRGB8", GL_LUMINANCE, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, @@ -1306,8 +1306,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_RGBA_16, - "MESA_FORMAT_RGBA_16", + MESA_FORMAT_RGBA_UNORM16, + "MESA_FORMAT_RGBA_UNORM16", GL_RGBA, GL_UNSIGNED_NORMALIZED, 16, 16, 16, 16, @@ -1590,8 +1590,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, /* ARB_depth_buffer_float */ { - MESA_FORMAT_Z32_FLOAT, /* Name */ - "MESA_FORMAT_Z32_FLOAT", /* StrName */ + MESA_FORMAT_Z_FLOAT32, /* Name */ + "MESA_FORMAT_Z_FLOAT32", /* StrName */ GL_DEPTH_COMPONENT, /* BaseFormat */ GL_FLOAT, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -1665,8 +1665,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_XBGR8888_UINT, - "MESA_FORMAT_XBGR8888_UINT", + MESA_FORMAT_RGBX_UINT8, + "MESA_FORMAT_RGBX_UINT8", GL_RGB, GL_UNSIGNED_INT, 8, 8, 8, 0, @@ -1674,8 +1674,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_XBGR8888_SINT, - "MESA_FORMAT_XBGR8888_SINT", + MESA_FORMAT_RGBX_SINT8, + "MESA_FORMAT_RGBX_SINT8", GL_RGB, GL_INT, 8, 8, 8, 0, @@ -1692,8 +1692,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_XBGR16161616_UNORM, - "MESA_FORMAT_XBGR16161616_UNORM", + MESA_FORMAT_RGBX_UNORM16, + "MESA_FORMAT_RGBX_UNORM16", GL_RGB, GL_UNSIGNED_NORMALIZED, 16, 16, 16, 0, @@ -1701,8 +1701,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_XBGR16161616_SNORM, - "MESA_FORMAT_XBGR16161616_SNORM", + MESA_FORMAT_RGBX_SNORM16, + "MESA_FORMAT_RGBX_SNORM16", GL_RGB, GL_SIGNED_NORMALIZED, 16, 16, 16, 0, @@ -1710,8 +1710,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_XBGR16161616_FLOAT, - "MESA_FORMAT_XBGR16161616_FLOAT", + MESA_FORMAT_RGBX_FLOAT16, + "MESA_FORMAT_RGBX_FLOAT16", GL_RGB, GL_FLOAT, 16, 16, 16, 0, @@ -1719,8 +1719,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_XBGR16161616_UINT, - "MESA_FORMAT_XBGR16161616_UINT", + MESA_FORMAT_RGBX_UINT16, + "MESA_FORMAT_RGBX_UINT16", GL_RGB, GL_UNSIGNED_INT, 16, 16, 16, 0, @@ -1728,8 +1728,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_XBGR16161616_SINT, - "MESA_FORMAT_XBGR16161616_SINT", + MESA_FORMAT_RGBX_SINT16, + "MESA_FORMAT_RGBX_SINT16", GL_RGB, GL_INT, 16, 16, 16, 0, @@ -1737,8 +1737,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_XBGR32323232_FLOAT, - "MESA_FORMAT_XBGR32323232_FLOAT", + MESA_FORMAT_RGBX_FLOAT32, + "MESA_FORMAT_RGBX_FLOAT32", GL_RGB, GL_FLOAT, 32, 32, 32, 0, @@ -1746,8 +1746,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 16 }, { - MESA_FORMAT_XBGR32323232_UINT, - "MESA_FORMAT_XBGR32323232_UINT", + MESA_FORMAT_RGBX_UINT32, + "MESA_FORMAT_RGBX_UINT32", GL_RGB, GL_UNSIGNED_INT, 32, 32, 32, 0, @@ -1755,8 +1755,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 16 }, { - MESA_FORMAT_XBGR32323232_SINT, - "MESA_FORMAT_XBGR32323232_SINT", + MESA_FORMAT_RGBX_SINT32, + "MESA_FORMAT_RGBX_SINT32", GL_RGB, GL_INT, 32, 32, 32, 0, @@ -2022,10 +2022,10 @@ _mesa_get_format_color_encoding(mesa_format format) { /* XXX this info should be encoded in gl_format_info */ switch (format) { - case MESA_FORMAT_SRGB8: + case MESA_FORMAT_BGR_SRGB8: case MESA_FORMAT_SRGBA8: case MESA_FORMAT_SARGB8: - case MESA_FORMAT_SL8: + case MESA_FORMAT_L_SRGB8: case MESA_FORMAT_SLA8: case MESA_FORMAT_SRGB_DXT1: case MESA_FORMAT_SRGBA_DXT1: @@ -2050,8 +2050,8 @@ mesa_format _mesa_get_srgb_format_linear(mesa_format format) { switch (format) { - case MESA_FORMAT_SRGB8: - format = MESA_FORMAT_RGB888; + case MESA_FORMAT_BGR_SRGB8: + format = MESA_FORMAT_BGR_UNORM8; break; case MESA_FORMAT_SRGBA8: format = MESA_FORMAT_A8B8G8R8_UNORM; @@ -2059,8 +2059,8 @@ _mesa_get_srgb_format_linear(mesa_format format) case MESA_FORMAT_SARGB8: format = MESA_FORMAT_B8G8R8A8_UNORM; break; - case MESA_FORMAT_SL8: - format = MESA_FORMAT_L8; + case MESA_FORMAT_L_SRGB8: + format = MESA_FORMAT_L_UNORM8; break; case MESA_FORMAT_SLA8: format = MESA_FORMAT_AL88; @@ -2105,12 +2105,12 @@ _mesa_get_uncompressed_format(mesa_format format) { switch (format) { case MESA_FORMAT_RGB_FXT1: - return MESA_FORMAT_RGB888; + return MESA_FORMAT_BGR_UNORM8; case MESA_FORMAT_RGBA_FXT1: return MESA_FORMAT_A8B8G8R8_UNORM; case MESA_FORMAT_RGB_DXT1: case MESA_FORMAT_SRGB_DXT1: - return MESA_FORMAT_RGB888; + return MESA_FORMAT_BGR_UNORM8; case MESA_FORMAT_RGBA_DXT1: case MESA_FORMAT_SRGBA_DXT1: return MESA_FORMAT_A8B8G8R8_UNORM; @@ -2121,7 +2121,7 @@ _mesa_get_uncompressed_format(mesa_format format) case MESA_FORMAT_SRGBA_DXT5: return MESA_FORMAT_A8B8G8R8_UNORM; case MESA_FORMAT_RED_RGTC1: - return MESA_FORMAT_R8; + return MESA_FORMAT_R_UNORM8; case MESA_FORMAT_SIGNED_RED_RGTC1: return MESA_FORMAT_SIGNED_R8; case MESA_FORMAT_RG_RGTC2: @@ -2129,7 +2129,7 @@ _mesa_get_uncompressed_format(mesa_format format) case MESA_FORMAT_SIGNED_RG_RGTC2: return MESA_FORMAT_SIGNED_RG88_REV; case MESA_FORMAT_L_LATC1: - return MESA_FORMAT_L8; + return MESA_FORMAT_L_UNORM8; case MESA_FORMAT_SIGNED_L_LATC1: return MESA_FORMAT_SIGNED_L8; case MESA_FORMAT_LA_LATC2: @@ -2139,7 +2139,7 @@ _mesa_get_uncompressed_format(mesa_format format) case MESA_FORMAT_ETC1_RGB8: case MESA_FORMAT_ETC2_RGB8: case MESA_FORMAT_ETC2_SRGB8: - return MESA_FORMAT_RGB888; + return MESA_FORMAT_BGR_UNORM8; case MESA_FORMAT_ETC2_RGBA8_EAC: case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC: case MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1: @@ -2147,7 +2147,7 @@ _mesa_get_uncompressed_format(mesa_format format) return MESA_FORMAT_A8B8G8R8_UNORM; case MESA_FORMAT_ETC2_R11_EAC: case MESA_FORMAT_ETC2_SIGNED_R11_EAC: - return MESA_FORMAT_R16; + return MESA_FORMAT_R_UNORM16; case MESA_FORMAT_ETC2_RG11_EAC: case MESA_FORMAT_ETC2_SIGNED_RG11_EAC: return MESA_FORMAT_GR1616; @@ -2383,8 +2383,8 @@ _mesa_format_to_type_and_comps(mesa_format format, *datatype = GL_UNSIGNED_BYTE; *comps = 4; return; - case MESA_FORMAT_RGB888: - case MESA_FORMAT_BGR888: + case MESA_FORMAT_BGR_UNORM8: + case MESA_FORMAT_RGB_UNORM8: *datatype = GL_UNSIGNED_BYTE; *comps = 3; return; @@ -2439,10 +2439,10 @@ _mesa_format_to_type_and_comps(mesa_format format, *comps = 2; return; - case MESA_FORMAT_R16: - case MESA_FORMAT_A16: - case MESA_FORMAT_L16: - case MESA_FORMAT_I16: + case MESA_FORMAT_R_UNORM16: + case MESA_FORMAT_A_UNORM16: + case MESA_FORMAT_L_UNORM16: + case MESA_FORMAT_I_UNORM16: *datatype = GL_UNSIGNED_SHORT; *comps = 1; return; @@ -2452,11 +2452,11 @@ _mesa_format_to_type_and_comps(mesa_format format, *comps = 3; return; - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: - case MESA_FORMAT_R8: - case MESA_FORMAT_S8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_I_UNORM8: + case MESA_FORMAT_R_UNORM8: + case MESA_FORMAT_S_UINT8: *datatype = GL_UNSIGNED_BYTE; *comps = 1; return; @@ -2477,7 +2477,7 @@ _mesa_format_to_type_and_comps(mesa_format format, *comps = 2; return; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: *datatype = GL_UNSIGNED_SHORT; *comps = 1; return; @@ -2492,12 +2492,12 @@ _mesa_format_to_type_and_comps(mesa_format format, *comps = 1; return; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: *datatype = GL_UNSIGNED_INT; *comps = 1; return; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: *datatype = GL_FLOAT; *comps = 1; return; @@ -2531,7 +2531,7 @@ _mesa_format_to_type_and_comps(mesa_format format, *comps = 4; return; - case MESA_FORMAT_RGBA_16: + case MESA_FORMAT_RGBA_UNORM16: *datatype = GL_UNSIGNED_SHORT; *comps = 4; return; @@ -2557,7 +2557,7 @@ _mesa_format_to_type_and_comps(mesa_format format, *comps = 4; return; - case MESA_FORMAT_SRGB8: + case MESA_FORMAT_BGR_SRGB8: *datatype = GL_UNSIGNED_BYTE; *comps = 3; return; @@ -2566,7 +2566,7 @@ _mesa_format_to_type_and_comps(mesa_format format, *datatype = GL_UNSIGNED_BYTE; *comps = 4; return; - case MESA_FORMAT_SL8: + case MESA_FORMAT_L_SRGB8: *datatype = GL_UNSIGNED_BYTE; *comps = 1; return; @@ -2832,13 +2832,13 @@ _mesa_format_to_type_and_comps(mesa_format format, return; case MESA_FORMAT_XBGR8888_SRGB: - case MESA_FORMAT_XBGR8888_UINT: + case MESA_FORMAT_RGBX_UINT8: *datatype = GL_UNSIGNED_BYTE; *comps = 4; return; case MESA_FORMAT_XBGR8888_SNORM: - case MESA_FORMAT_XBGR8888_SINT: + case MESA_FORMAT_RGBX_SINT8: *datatype = GL_BYTE; *comps = 4; return; @@ -2848,34 +2848,34 @@ _mesa_format_to_type_and_comps(mesa_format format, *comps = 4; return; - case MESA_FORMAT_XBGR16161616_UNORM: - case MESA_FORMAT_XBGR16161616_UINT: + case MESA_FORMAT_RGBX_UNORM16: + case MESA_FORMAT_RGBX_UINT16: *datatype = GL_UNSIGNED_SHORT; *comps = 4; return; - case MESA_FORMAT_XBGR16161616_SNORM: - case MESA_FORMAT_XBGR16161616_SINT: + case MESA_FORMAT_RGBX_SNORM16: + case MESA_FORMAT_RGBX_SINT16: *datatype = GL_SHORT; *comps = 4; return; - case MESA_FORMAT_XBGR16161616_FLOAT: + case MESA_FORMAT_RGBX_FLOAT16: *datatype = GL_HALF_FLOAT; *comps = 4; return; - case MESA_FORMAT_XBGR32323232_FLOAT: + case MESA_FORMAT_RGBX_FLOAT32: *datatype = GL_FLOAT; *comps = 4; return; - case MESA_FORMAT_XBGR32323232_UINT: + case MESA_FORMAT_RGBX_UINT32: *datatype = GL_UNSIGNED_INT; *comps = 4; return; - case MESA_FORMAT_XBGR32323232_SINT: + case MESA_FORMAT_RGBX_SINT32: *datatype = GL_INT; *comps = 4; return; @@ -3025,11 +3025,11 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, case MESA_FORMAT_X8R8G8B8_UNORM: return GL_FALSE; - case MESA_FORMAT_RGB888: - case MESA_FORMAT_SRGB8: + case MESA_FORMAT_BGR_UNORM8: + case MESA_FORMAT_BGR_SRGB8: return format == GL_BGR && type == GL_UNSIGNED_BYTE && littleEndian; - case MESA_FORMAT_BGR888: + case MESA_FORMAT_RGB_UNORM8: return format == GL_RGB && type == GL_UNSIGNED_BYTE && littleEndian; case MESA_FORMAT_RGB565: @@ -3076,18 +3076,18 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, case MESA_FORMAT_RGB332: return format == GL_RGB && type == GL_UNSIGNED_BYTE_3_3_2; - case MESA_FORMAT_A8: + case MESA_FORMAT_A_UNORM8: return format == GL_ALPHA && type == GL_UNSIGNED_BYTE; - case MESA_FORMAT_A16: + case MESA_FORMAT_A_UNORM16: return format == GL_ALPHA && type == GL_UNSIGNED_SHORT && !swapBytes; - case MESA_FORMAT_L8: - case MESA_FORMAT_SL8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_L_SRGB8: return format == GL_LUMINANCE && type == GL_UNSIGNED_BYTE; - case MESA_FORMAT_L16: + case MESA_FORMAT_L_UNORM16: return format == GL_LUMINANCE && type == GL_UNSIGNED_SHORT && !swapBytes; - case MESA_FORMAT_I8: + case MESA_FORMAT_I_UNORM8: return format == GL_INTENSITY && type == GL_UNSIGNED_BYTE; - case MESA_FORMAT_I16: + case MESA_FORMAT_I_UNORM16: return format == GL_INTENSITY && type == GL_UNSIGNED_SHORT && !swapBytes; case MESA_FORMAT_YCBCR: @@ -3099,14 +3099,14 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, ((type == GL_UNSIGNED_SHORT_8_8_MESA && littleEndian == swapBytes) || (type == GL_UNSIGNED_SHORT_8_8_REV_MESA && littleEndian != swapBytes)); - case MESA_FORMAT_R8: + case MESA_FORMAT_R_UNORM8: return format == GL_RED && type == GL_UNSIGNED_BYTE; case MESA_FORMAT_GR88: return format == GL_RG && type == GL_UNSIGNED_BYTE && littleEndian; case MESA_FORMAT_RG88: return GL_FALSE; - case MESA_FORMAT_R16: + case MESA_FORMAT_R_UNORM16: return format == GL_RED && type == GL_UNSIGNED_SHORT && !swapBytes; case MESA_FORMAT_GR1616: @@ -3126,18 +3126,18 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, case MESA_FORMAT_S8_Z24: return GL_FALSE; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return format == GL_DEPTH_COMPONENT && type == GL_UNSIGNED_SHORT && !swapBytes; case MESA_FORMAT_X8_Z24: return GL_FALSE; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: return format == GL_DEPTH_COMPONENT && type == GL_UNSIGNED_INT && !swapBytes; - case MESA_FORMAT_S8: + case MESA_FORMAT_S_UINT8: return format == GL_STENCIL_INDEX && type == GL_UNSIGNED_BYTE; case MESA_FORMAT_SRGB_DXT1: @@ -3346,7 +3346,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, return format == GL_RGB && type == GL_SHORT && !swapBytes; case MESA_FORMAT_SIGNED_RGBA_16: return format == GL_RGBA && type == GL_SHORT && !swapBytes; - case MESA_FORMAT_RGBA_16: + case MESA_FORMAT_RGBA_UNORM16: return format == GL_RGBA && type == GL_UNSIGNED_SHORT && !swapBytes; @@ -3413,7 +3413,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, return format == GL_RGB && type == GL_UNSIGNED_INT_10F_11F_11F_REV && !swapBytes; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: return format == GL_DEPTH_COMPONENT && type == GL_FLOAT && !swapBytes; case MESA_FORMAT_Z32_FLOAT_X24S8: @@ -3424,17 +3424,17 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, case MESA_FORMAT_XRGB1555_UNORM: case MESA_FORMAT_XBGR8888_SNORM: case MESA_FORMAT_XBGR8888_SRGB: - case MESA_FORMAT_XBGR8888_UINT: - case MESA_FORMAT_XBGR8888_SINT: + case MESA_FORMAT_RGBX_UINT8: + case MESA_FORMAT_RGBX_SINT8: case MESA_FORMAT_XRGB2101010_UNORM: - case MESA_FORMAT_XBGR16161616_UNORM: - case MESA_FORMAT_XBGR16161616_SNORM: - case MESA_FORMAT_XBGR16161616_FLOAT: - case MESA_FORMAT_XBGR16161616_UINT: - case MESA_FORMAT_XBGR16161616_SINT: - case MESA_FORMAT_XBGR32323232_FLOAT: - case MESA_FORMAT_XBGR32323232_UINT: - case MESA_FORMAT_XBGR32323232_SINT: + case MESA_FORMAT_RGBX_UNORM16: + case MESA_FORMAT_RGBX_SNORM16: + case MESA_FORMAT_RGBX_FLOAT16: + case MESA_FORMAT_RGBX_UINT16: + case MESA_FORMAT_RGBX_SINT16: + case MESA_FORMAT_RGBX_FLOAT32: + case MESA_FORMAT_RGBX_UINT32: + case MESA_FORMAT_RGBX_SINT32: return GL_FALSE; case MESA_FORMAT_ABGR2101010: diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 1e8ffb451b3..1e3fb8d43f5 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -61,11 +61,278 @@ typedef enum { MESA_FORMAT_NONE = 0, - /** + /** * \name Basic hardware formats + * + * The mesa format name specification is as follows: + * + * There shall be 3 naming format base types: those for component array + * formats (type A); those for compressed formats (type C); and those for packed + * component formats (type P). With type A formats, color component order does not + * change with endianess. Each format name shall begin with MESA_FORMAT_, + * followed by a component label (from the Component Label list below) for each + * component in the order that the component(s) occur in the format, except for + * non-linear color formats where the first letter shall be 'S'. For type P formats, + * each component label is followed by the number of bits that represent it in the + * fundamental data type used by the format. + * + * Following the listing of the component labels shall be an underscore; a compression + * type followed by an underscore for Type C formats only; a storage type from the list + * below; and a bit with for type A formats, which is the bit width for each array element. + * + * + * ---------- Format Base Type A: Array ---------- + * MESA_FORMAT_[component list]_[storage type][array element bit width] + * + * examples: + * MESA_FORMAT_A_SNORM8 - uchar[i] = A + * MESA_FORMAT_RGBA_16 - ushort[i * 4 + 0] = R, ushort[i * 4 + 1] = G, + * ushort[i * 4 + 2] = B, ushort[i * 4 + 3] = A + * MESA_FORMAT_Z_UNORM32 - float[i] = Z + * + * + * + * ---------- Format Base Type C: Compressed ---------- + * MESA_FORMAT_[component list*][_*][compression type][storage type*] + * * where required + * + * examples: + * MESA_FORMAT_RGB_ETC1 + * MESA_FORMAT_RGBA_ETC2 + * MESA_FORMAT_LATC1_UNORM + * MESA_FORMAT_RGBA_FXT1 + * + * + * + * ---------- Format Base Type P: Packed ---------- + * MESA_FORMAT_[[component list,bit width][storage type*][_]][_][storage type**] + * * when type differs between component + * ** when type applies to all components + * + * examples: msb <------ TEXEL BITS -----------> lsb + * MESA_FORMAT_A8B8G8R8_UNORM, AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR + * MESA_FORMAT_R5G6B5_UNORM RRRR RGGG GGGB BBBB + * MESA_FORMAT_B4G4R4X4_UNORM BBBB GGGG RRRR XXXX + * MESA_FORMAT_Z32_FLOAT_S8X24_UINT + * MESA_FORMAT_R10G10B10A2_UINT + * MESA_FORMAT_R9G9B9E5_FLOAT + * + * + * + * ---------- Component Labels: ---------- + * A - Alpha + * B - Blue + * DU - Delta U + * DV - Delta V + * E - Shared Exponent + * G - Green + * I - Intensity + * L - Luminance + * R - Red + * S - Stencil (when not followed by RGB or RGBA) + * U - Chrominance + * V - Chrominance + * Y - Luma + * X - Packing bits + * Z - Depth + * + * + * + * ---------- Type C Compression Types: ---------- + * DXT1 - Color component labels shall be given + * DXT3 - Color component labels shall be given + * DXT5 - Color component labels shall be given + * ETC1 - No other information required + * ETC2 - No other information required + * FXT1 - Color component labels shall be given + * FXT3 - Color component labels shall be given + * LATC1 - Fundamental data type shall be given + * LATC2 - Fundamental data type shall be given + * RGTC1 - Color component labels and data type shall be given + * RGTC2 - Color component labels and data type shall be given + * + * + * + * ---------- Storage Types: ---------- + * FLOAT + * SINT + * UINT + * SNORM + * UNORM + * SRGB - RGB components, or L are UNORMs in sRGB color space. Alpha, if present is linear. + * + * + * ---------- Type A Format List (based on format_unpack.c): + * BGR_UNORM8 + * RGB_UNORM8 + * A_UNORM8 + * A_UNORM16 + * L_UNORM8 + * L_UNORM16 + * I_UNORM8 + * I_UNOMR16 + * R_UNORM8 + * R_UNORM16 + * Z_UNORM16 + * Z_UNORM32 + * Z_FLOAT32 + * S_UINT8 + * BGR_SRGB8 + * L_SRGB8 + * RGBA_FLOAT32 + * RGBA_FLOAT16 + * RGB_FLOAT32 + * RGB_FLOAT16 + * A_FLOAT32 + * A_FLOAT16 + * L_FLOAT32 + * L_FLOAT16 + * LA_FLOAT32 + * LA_FLOAT16 + * I_FLOAT32 + * I_FLOAT16 + * R_FLOAT32 + * R_FLOAT16 + * RG_FLOAT32 + * RG_FLOAT16 + * A_UINT8 + * A_UINT16 + * A_UINT32 + * A_SINT8 + * A_SINT16 + * A_SINT32 + * I_UINT8 + * I_UINT16 + * I_UINT32 + * I_SINT8 + * I_SINT16 + * I_SINT32 + * L_UINT8 + * L_UINT16 + * L_UINT32 + * L_SINT8 + * L_SINT16 + * L_SINT32 + * LA_UINT8 + * LA_UINT16 + * LA_UINT32 + * LA_SINT8 + * LA_SINT16 + * LA_SINT32 + * R_SINT8 + * RG_SINT8 + * RGB_SINT8 + * RGBA_SINT8 + * R_SINT16 + * RG_SINT16 + * RGB_SINT16 + * RGBA_SINT16 + * R_SINT32 + * RG_SINT32 + * RGB_SINT32 + * RGBA_SINT32 + * R_SINT16 + * R_SINT32 + * R_UINT8 + * RG_UINT8 + * RGB_UINT8 + * RGBA_UINT8 + * R_UINT16 + * RG_UINT16 + * RGB_UINT16 + * RGBA_UINT16 + * R_UINT32 + * RG_UINT32 + * RGB_UINT32 + * RGBA_UINT32 + * R_UINT16 + * R_UINT32 + * R_SNORM8 + * R_SNORM16 + * RGB_SNORM16 + * RGBA_SNORM16 + * RGBA_UNORM16 + * A_SNORM8 + * L_SNORM8 + * I_SNORM8 + * A_SNORM16 + * L_SNORM16 + * LA_SNORM16 + * I_SNORM16 + * RGBX_UINT8 + * RGBX_SINT8 + * RGBX_UNORM16 + * RGBX_SNORM16 + * RGBX_FLOAT16 + * RGBX_UINT16 + * RGBX_SINT16 + * RGBX_FLOAT32 + * RGBX_UINT32 + * RGBX_SINT32 + * + * + * + * ---------- Type P Format List (based on format_unpack.c): + * A8B8G8R8_UNORM + * R8G8B8A8_UNORM + * B8G8R8A8_UNORM + * A8R8G8B8_UNORM + * X8B8G8R8_UNORM + * R8G8B8X8_UNORM + * B8G8R8X8_UNORM + * X8R8G8B8_UNORM + * B5G6R5_UNORM + * R5G6B5_UNORM + * B4G4R4A4_UNORM + * A4R4G4B4_UNORM + * A1B5G5R5_UNORM + * B5G5R5A1_UNORM + * A1R5G5B5_UNORM + * L4A4_UNORM + * L8A8_UNORM + * A8L8_UNORM + * L16A16_UNORM + * A16L16_UNORM + * B2G3R3_UNORM + * YCBCR + * YCBCR_REV + * R8G8_UNORM + * G8R8_UNORM + * R16G16_UNORM + * G16R16_UNORM + * B10G10R10A2_UNORM + * B10G10R10A2_UINT + * R10G10B10A2_UINT + * S8_UINT_Z24_UNORM + * Z24_UNORM_S8_UINT + * Z24_UNORM_X8_UINT + * X8_UINT_Z24_UNORM + * Z32_FLOAT_S8X24_UINT + * A8R8G8B8_SRGB + * B8G8R8A8_SRGB + * L8A8_SRGB + * R8G8_SNORM + * X8B8G8R8_SNORM + * A8B8G8R8_SNORM + * R8G8B8A8_SNORM + * R16G16_SNORM + * L8A8_SNORM + * R9G9B9E5_FLOAT + * R11G11B10_FLOAT + * B4G4R4X4_UNORM + * B5G5R5X1_UNORM + * R8G8_SNORM + * R8G8B8X8_SNORM + * R8G8B8X8_SRGB + * B10G10R10X2_UNORM + * R10G10B10A2_UNORM + * G8R8_SINT + * G16R16_SINT + * */ /*@{*/ - /* msb <------ TEXEL BITS -----------> lsb */ + + /* Type P formats */ /* msb <------ TEXEL BITS -----------> lsb */ /* ---- ---- ---- ---- ---- ---- ---- ---- */ MESA_FORMAT_A8B8G8R8_UNORM, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ MESA_FORMAT_R8G8B8A8_UNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ @@ -75,8 +342,12 @@ typedef enum MESA_FORMAT_R8G8B8X8_UNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */ MESA_FORMAT_B8G8R8X8_UNORM, /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */ MESA_FORMAT_X8R8G8B8_UNORM, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */ - MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */ - MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */ + + /* Type A formats */ + MESA_FORMAT_BGR_UNORM8, /* uchar[i * 3] = B, [i * 3 + 1] = G, [i *3 + 2] = R */ + MESA_FORMAT_RGB_UNORM8, /* uchar[i * 3] = R, [i * 3 + 1] = G, [i *3 + 2] = B */ + + /* Type P formats */ MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */ MESA_FORMAT_RGB565_REV, /* GGGB BBBB RRRR RGGG */ MESA_FORMAT_ARGB4444, /* AAAA RRRR GGGG BBBB */ @@ -90,39 +361,66 @@ typedef enum MESA_FORMAT_AL1616, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */ MESA_FORMAT_AL1616_REV, /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */ MESA_FORMAT_RGB332, /* RRRG GGBB */ - MESA_FORMAT_A8, /* AAAA AAAA */ - MESA_FORMAT_A16, /* AAAA AAAA AAAA AAAA */ - MESA_FORMAT_L8, /* LLLL LLLL */ - MESA_FORMAT_L16, /* LLLL LLLL LLLL LLLL */ - MESA_FORMAT_I8, /* IIII IIII */ - MESA_FORMAT_I16, /* IIII IIII IIII IIII */ + + /* Type A formats */ + MESA_FORMAT_A_UNORM8, /* uchar[i] = A */ + MESA_FORMAT_A_UNORM16, /* ushort[i] = A */ + MESA_FORMAT_L_UNORM8, /* uchar[i] = L */ + MESA_FORMAT_L_UNORM16, /* ushort[i] = L */ + MESA_FORMAT_I_UNORM8, /* uchar[i] = I */ + MESA_FORMAT_I_UNORM16, /* ushort[i] = I */ + + /* Type P formats */ MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */ MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */ - MESA_FORMAT_R8, /* RRRR RRRR */ + + /* Type A format(s) */ + MESA_FORMAT_R_UNORM8, /* uchar[i] = R */ + + /* Type P formats */ MESA_FORMAT_GR88, /* GGGG GGGG RRRR RRRR */ MESA_FORMAT_RG88, /* RRRR RRRR GGGG GGGG */ - MESA_FORMAT_R16, /* RRRR RRRR RRRR RRRR */ + + /* Type A format(s) */ + MESA_FORMAT_R_UNORM16, /* ushort[i] = R */ + + /* Type P formats */ MESA_FORMAT_GR1616, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ MESA_FORMAT_RG1616, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */ MESA_FORMAT_ARGB2101010, /* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ MESA_FORMAT_Z24_S8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */ MESA_FORMAT_S8_Z24, /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ - MESA_FORMAT_Z16, /* ZZZZ ZZZZ ZZZZ ZZZZ */ + + /* Type A format(s) */ + MESA_FORMAT_Z_UNORM16, /* ushort[i] = Z */ + + /* Type P formats */ MESA_FORMAT_X8_Z24, /* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ MESA_FORMAT_Z24_X8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */ - MESA_FORMAT_Z32, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ - MESA_FORMAT_S8, /* SSSS SSSS */ + + /* Type A formats */ + MESA_FORMAT_Z_UNORM32, /* uint[i] = Z */ + MESA_FORMAT_S_UINT8, /* uchar[i] = S */ /*@}*/ /** * \name 8-bit/channel sRGB formats */ /*@{*/ - MESA_FORMAT_SRGB8, /* RRRR RRRR GGGG GGGG BBBB BBBB */ + /* Type A format(s) */ + MESA_FORMAT_BGR_SRGB8, /* uchar[i * 3] = B, [i * 3 + 1] = G, [i *3 + 2] = R */ + + /* Type P formats */ MESA_FORMAT_SRGBA8, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ MESA_FORMAT_SARGB8, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ - MESA_FORMAT_SL8, /* LLLL LLLL */ + + /* Type A format(s) */ + MESA_FORMAT_L_SRGB8, /* uchar[i] = L */ + + /* Type P formats */ MESA_FORMAT_SLA8, /* AAAA AAAA LLLL LLLL */ + + /* Type C formats */ MESA_FORMAT_SRGB_DXT1, MESA_FORMAT_SRGBA_DXT1, MESA_FORMAT_SRGBA_DXT3, @@ -133,6 +431,7 @@ typedef enum * \name Compressed texture formats. */ /*@{*/ + /* Type C formats */ MESA_FORMAT_RGB_FXT1, MESA_FORMAT_RGBA_FXT1, MESA_FORMAT_RGB_DXT1, @@ -145,7 +444,9 @@ typedef enum * \name Floating point texture formats. */ /*@{*/ - MESA_FORMAT_RGBA_FLOAT32, + + /* Type A formats */ + MESA_FORMAT_RGBA_FLOAT32, /* float[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = A */ MESA_FORMAT_RGBA_FLOAT16, MESA_FORMAT_RGB_FLOAT32, MESA_FORMAT_RGB_FLOAT16, @@ -168,6 +469,8 @@ typedef enum * XXX Note: these are just stand-ins for some better hardware * formats TBD such as BGRA or ARGB. */ + + /* Type A formats */ MESA_FORMAT_ALPHA_UINT8, MESA_FORMAT_ALPHA_UINT16, MESA_FORMAT_ALPHA_UINT32, @@ -188,7 +491,6 @@ typedef enum MESA_FORMAT_LUMINANCE_INT8, MESA_FORMAT_LUMINANCE_INT16, MESA_FORMAT_LUMINANCE_INT32, - MESA_FORMAT_LUMINANCE_ALPHA_UINT8, MESA_FORMAT_LUMINANCE_ALPHA_UINT16, MESA_FORMAT_LUMINANCE_ALPHA_UINT32, @@ -204,6 +506,7 @@ typedef enum MESA_FORMAT_RG_INT16, MESA_FORMAT_RGB_INT16, MESA_FORMAT_RGBA_INT16, + MESA_FORMAT_R_INT32, MESA_FORMAT_RG_INT32, MESA_FORMAT_RGB_INT32, @@ -212,14 +515,17 @@ typedef enum /** * \name Non-normalized unsigned integer formats. */ + /* Type A format(s) */ MESA_FORMAT_R_UINT8, MESA_FORMAT_RG_UINT8, MESA_FORMAT_RGB_UINT8, MESA_FORMAT_RGBA_UINT8, + MESA_FORMAT_R_UINT16, MESA_FORMAT_RG_UINT16, MESA_FORMAT_RGB_UINT16, MESA_FORMAT_RGBA_UINT16, + MESA_FORMAT_R_UINT32, MESA_FORMAT_RG_UINT32, MESA_FORMAT_RGB_UINT32, @@ -232,19 +538,30 @@ typedef enum */ /*@{*/ MESA_FORMAT_DUDV8, /* DUDU DUDU DVDV DVDV */ + + /* Type A format(s) */ MESA_FORMAT_SIGNED_R8, /* RRRR RRRR */ + + /* Type P formats */ MESA_FORMAT_SIGNED_RG88_REV, /* GGGG GGGG RRRR RRRR */ MESA_FORMAT_SIGNED_RGBX8888, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */ MESA_FORMAT_SIGNED_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ MESA_FORMAT_SIGNED_RGBA8888_REV,/*AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ + + /* Type A format(s) */ MESA_FORMAT_SIGNED_R16, /* RRRR RRRR RRRR RRRR */ + + /* Type P format(s) */ MESA_FORMAT_SIGNED_GR1616, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ + + /* Type A format(s) */ MESA_FORMAT_SIGNED_RGB_16, /* ushort[0]=R, ushort[1]=G, ushort[2]=B */ MESA_FORMAT_SIGNED_RGBA_16, /* ... */ - MESA_FORMAT_RGBA_16, /* ... */ + MESA_FORMAT_RGBA_UNORM16, /* ... */ /*@}*/ /*@{*/ + /* Type C formats */ MESA_FORMAT_RED_RGTC1, MESA_FORMAT_SIGNED_RED_RGTC1, MESA_FORMAT_RG_RGTC2, @@ -270,19 +587,28 @@ typedef enum MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1, MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1, + /* Type A format(s) */ MESA_FORMAT_SIGNED_A8, /* AAAA AAAA */ MESA_FORMAT_SIGNED_L8, /* LLLL LLLL */ + + /* Type P format(s) */ MESA_FORMAT_SIGNED_AL88, /* AAAA AAAA LLLL LLLL */ + + /* Type A format(s) */ MESA_FORMAT_SIGNED_I8, /* IIII IIII */ MESA_FORMAT_SIGNED_A16, /* AAAA AAAA AAAA AAAA */ MESA_FORMAT_SIGNED_L16, /* LLLL LLLL LLLL LLLL */ MESA_FORMAT_SIGNED_AL1616, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */ MESA_FORMAT_SIGNED_I16, /* IIII IIII IIII IIII */ + /* Type P format(s) */ MESA_FORMAT_RGB9_E5_FLOAT, MESA_FORMAT_R11_G11_B10_FLOAT, - MESA_FORMAT_Z32_FLOAT, + /* Type A format(s) */ + MESA_FORMAT_Z_FLOAT32, + + /* Type P formats */ MESA_FORMAT_Z32_FLOAT_X24S8, MESA_FORMAT_ARGB2101010_UINT, @@ -292,20 +618,27 @@ typedef enum MESA_FORMAT_XRGB1555_UNORM, /* xRRR RRGG GGGB BBBB */ MESA_FORMAT_XBGR8888_SNORM, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ MESA_FORMAT_XBGR8888_SRGB, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ - MESA_FORMAT_XBGR8888_UINT, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ - MESA_FORMAT_XBGR8888_SINT, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ + + /* Type A formats */ + MESA_FORMAT_RGBX_UINT8, /* uchar[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = x */ + MESA_FORMAT_RGBX_SINT8, /* char[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = x */ + + /* Type P format(s) */ MESA_FORMAT_XRGB2101010_UNORM, /* xxRR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ - MESA_FORMAT_XBGR16161616_UNORM,/* ushort[3]=x, [2]=B, [1]=G, [0]=R */ - MESA_FORMAT_XBGR16161616_SNORM,/* ... */ - MESA_FORMAT_XBGR16161616_FLOAT,/* ... */ - MESA_FORMAT_XBGR16161616_UINT, /* ... */ - MESA_FORMAT_XBGR16161616_SINT, /* ... */ - MESA_FORMAT_XBGR32323232_FLOAT,/* float[3]=x, [2]=B, [1]=G, [0]=R */ - MESA_FORMAT_XBGR32323232_UINT, /* ... */ - MESA_FORMAT_XBGR32323232_SINT, /* ... */ - MESA_FORMAT_ABGR2101010, + /* Type A format(s) */ + MESA_FORMAT_RGBX_UNORM16, /* ushort[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = x */ + MESA_FORMAT_RGBX_SNORM16, /* ... */ + MESA_FORMAT_RGBX_FLOAT16, /* ... */ + MESA_FORMAT_RGBX_UINT16, /* ... */ + MESA_FORMAT_RGBX_SINT16, /* ... */ + MESA_FORMAT_RGBX_FLOAT32, /* float[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = x */ + MESA_FORMAT_RGBX_UINT32, /* ... */ + MESA_FORMAT_RGBX_SINT32, /* ... */ + + /* Type P formats */ + MESA_FORMAT_ABGR2101010, MESA_FORMAT_SIGNED_RG88, MESA_FORMAT_SIGNED_RG1616, diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c index 3468672d8eb..824607ae31a 100644 --- a/src/mesa/main/shaderimage.c +++ b/src/mesa/main/shaderimage.c @@ -140,7 +140,7 @@ get_image_format(GLenum format) return MESA_FORMAT_R_INT8; case GL_RGBA16: - return MESA_FORMAT_RGBA_16; + return MESA_FORMAT_RGBA_UNORM16; case GL_RGB10_A2: return MESA_FORMAT_ABGR2101010; @@ -155,10 +155,10 @@ get_image_format(GLenum format) return MESA_FORMAT_RG_8; case GL_R16: - return MESA_FORMAT_R16; + return MESA_FORMAT_R_UNORM16; case GL_R8: - return MESA_FORMAT_R8; + return MESA_FORMAT_R_UNORM8; case GL_RGBA16_SNORM: return MESA_FORMAT_SIGNED_RGBA_16; @@ -286,7 +286,7 @@ get_image_format_class(mesa_format format) case MESA_FORMAT_R_INT8: return IMAGE_FORMAT_CLASS_1X8; - case MESA_FORMAT_RGBA_16: + case MESA_FORMAT_RGBA_UNORM16: return IMAGE_FORMAT_CLASS_4X16; case MESA_FORMAT_ABGR2101010: @@ -301,10 +301,10 @@ get_image_format_class(mesa_format format) case MESA_FORMAT_RG_8: return IMAGE_FORMAT_CLASS_2X8; - case MESA_FORMAT_R16: + case MESA_FORMAT_R_UNORM16: return IMAGE_FORMAT_CLASS_1X16; - case MESA_FORMAT_R8: + case MESA_FORMAT_R_UNORM8: return IMAGE_FORMAT_CLASS_1X8; case MESA_FORMAT_SIGNED_RGBA_16: diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 93a6b6d742a..ab31d3ebc1a 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -102,8 +102,8 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, break; case GL_RGBA12: case GL_RGBA16: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UNORM16); RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_UNORM); RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; @@ -116,7 +116,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, } /* fallthrough */ case GL_RGB8: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888); + RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_UNORM8); RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8X8_UNORM); RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; @@ -124,7 +124,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, RETURN_IF_SUPPORTED(MESA_FORMAT_RGB332); RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565); RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565_REV); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888); + RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_UNORM8); RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8X8_UNORM); RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; @@ -140,8 +140,8 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_RGB10: case GL_RGB12: case GL_RGB16: - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR16161616_UNORM); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_UNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UNORM16); RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8X8_UNORM); RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; @@ -150,13 +150,13 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA8: - RETURN_IF_SUPPORTED(MESA_FORMAT_A8); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8); break; case GL_ALPHA12: case GL_ALPHA16: - RETURN_IF_SUPPORTED(MESA_FORMAT_A16); - RETURN_IF_SUPPORTED(MESA_FORMAT_A8); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8); break; /* Luminance formats */ @@ -164,13 +164,13 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_LUMINANCE: case GL_LUMINANCE4: case GL_LUMINANCE8: - RETURN_IF_SUPPORTED(MESA_FORMAT_L8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_UNORM8); break; case GL_LUMINANCE12: case GL_LUMINANCE16: - RETURN_IF_SUPPORTED(MESA_FORMAT_L16); - RETURN_IF_SUPPORTED(MESA_FORMAT_L8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_UNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_UNORM8); break; /* Luminance/Alpha formats */ @@ -196,39 +196,39 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY8: - RETURN_IF_SUPPORTED(MESA_FORMAT_I8); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_UNORM8); break; case GL_INTENSITY12: case GL_INTENSITY16: - RETURN_IF_SUPPORTED(MESA_FORMAT_I16); - RETURN_IF_SUPPORTED(MESA_FORMAT_I8); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_UNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_UNORM8); break; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: - RETURN_IF_SUPPORTED(MESA_FORMAT_Z32); + RETURN_IF_SUPPORTED(MESA_FORMAT_Z_UNORM32); RETURN_IF_SUPPORTED(MESA_FORMAT_X8_Z24); RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24); break; case GL_DEPTH_COMPONENT16: - RETURN_IF_SUPPORTED(MESA_FORMAT_Z16); + RETURN_IF_SUPPORTED(MESA_FORMAT_Z_UNORM16); RETURN_IF_SUPPORTED(MESA_FORMAT_X8_Z24); RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24); break; case GL_COMPRESSED_ALPHA_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_A8); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8); break; case GL_COMPRESSED_LUMINANCE_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_L8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_UNORM8); break; case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_AL88); break; case GL_COMPRESSED_INTENSITY_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_I8); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_UNORM8); break; case GL_COMPRESSED_RGB_ARB: /* We don't use texture compression for 1D and 1D array textures. @@ -243,7 +243,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1); RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1); } - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888); + RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_UNORM8); RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8X8_UNORM); RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; @@ -392,14 +392,14 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, break; case GL_RGB16F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR16161616_FLOAT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_FLOAT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_RGB32F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR32323232_FLOAT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); @@ -430,8 +430,8 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, break; case GL_DEPTH_COMPONENT32F: - ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_Z32_FLOAT]); - return MESA_FORMAT_Z32_FLOAT; + ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_Z_FLOAT32]); + return MESA_FORMAT_Z_FLOAT32; case GL_DEPTH32F_STENCIL8: ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_Z32_FLOAT_X24S8]); return MESA_FORMAT_Z32_FLOAT_X24S8; @@ -491,7 +491,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, break; case GL_RGB16_SNORM: RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGB_16); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR16161616_SNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_SNORM16); /* FALLTHROUGH */ case GL_RGBA16_SNORM: RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16); @@ -522,7 +522,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_SRGB_EXT: case GL_SRGB8_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB8); + RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_SRGB8); RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); break; case GL_SRGB_ALPHA_EXT: @@ -532,7 +532,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, break; case GL_SLUMINANCE_EXT: case GL_SLUMINANCE8_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_SL8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_SRGB8); RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); break; case GL_SLUMINANCE_ALPHA_EXT: @@ -541,7 +541,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); break; case GL_COMPRESSED_SLUMINANCE_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_SL8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_SRGB8); RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); break; case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: @@ -551,7 +551,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_COMPRESSED_SRGB_EXT: if (ctx->Mesa_DXTn) RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1); - RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB8); + RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_SRGB8); RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); break; case GL_COMPRESSED_SRGB_ALPHA_EXT: @@ -660,32 +660,32 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_RGB8UI_EXT: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR8888_UINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_UINT8); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); break; case GL_RGB16UI_EXT: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR16161616_UINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_UINT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); break; case GL_RGB32UI_EXT: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR32323232_UINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_UINT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); break; case GL_RGB8I_EXT: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_INT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR8888_SINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_SINT8); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); break; case GL_RGB16I_EXT: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_INT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR16161616_SINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_SINT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); break; case GL_RGB32I_EXT: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_INT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR32323232_SINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_SINT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); break; case GL_RGBA8UI_EXT: @@ -709,17 +709,17 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_R8: case GL_RED: - RETURN_IF_SUPPORTED(MESA_FORMAT_R8); + RETURN_IF_SUPPORTED(MESA_FORMAT_R_UNORM8); break; case GL_COMPRESSED_RED: if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) RETURN_IF_SUPPORTED(MESA_FORMAT_RED_RGTC1); - RETURN_IF_SUPPORTED(MESA_FORMAT_R8); + RETURN_IF_SUPPORTED(MESA_FORMAT_R_UNORM8); break; case GL_R16: - RETURN_IF_SUPPORTED(MESA_FORMAT_R16); + RETURN_IF_SUPPORTED(MESA_FORMAT_R_UNORM16); break; case GL_RG: diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 023aef4e6eb..03e44759ad0 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -4014,9 +4014,9 @@ get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) if (ctx->API != API_OPENGL_CORE) { switch (internalFormat) { case GL_ALPHA8: - return MESA_FORMAT_A8; + return MESA_FORMAT_A_UNORM8; case GL_ALPHA16: - return MESA_FORMAT_A16; + return MESA_FORMAT_A_UNORM16; case GL_ALPHA16F_ARB: return MESA_FORMAT_ALPHA_FLOAT16; case GL_ALPHA32F_ARB: @@ -4034,9 +4034,9 @@ get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) case GL_ALPHA32UI_EXT: return MESA_FORMAT_ALPHA_UINT32; case GL_LUMINANCE8: - return MESA_FORMAT_L8; + return MESA_FORMAT_L_UNORM8; case GL_LUMINANCE16: - return MESA_FORMAT_L16; + return MESA_FORMAT_L_UNORM16; case GL_LUMINANCE16F_ARB: return MESA_FORMAT_LUMINANCE_FLOAT16; case GL_LUMINANCE32F_ARB: @@ -4074,9 +4074,9 @@ get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) case GL_LUMINANCE_ALPHA32UI_EXT: return MESA_FORMAT_LUMINANCE_ALPHA_UINT32; case GL_INTENSITY8: - return MESA_FORMAT_I8; + return MESA_FORMAT_I_UNORM8; case GL_INTENSITY16: - return MESA_FORMAT_I16; + return MESA_FORMAT_I_UNORM16; case GL_INTENSITY16F_ARB: return MESA_FORMAT_INTENSITY_FLOAT16; case GL_INTENSITY32F_ARB: @@ -4116,7 +4116,7 @@ get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) case GL_RGBA8: return MESA_FORMAT_R8G8B8A8_UNORM; case GL_RGBA16: - return MESA_FORMAT_RGBA_16; + return MESA_FORMAT_RGBA_UNORM16; case GL_RGBA16F_ARB: return MESA_FORMAT_RGBA_FLOAT16; case GL_RGBA32F_ARB: @@ -4156,9 +4156,9 @@ get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) return MESA_FORMAT_RG_UINT32; case GL_R8: - return MESA_FORMAT_R8; + return MESA_FORMAT_R_UNORM8; case GL_R16: - return MESA_FORMAT_R16; + return MESA_FORMAT_R_UNORM16; case GL_R16F: return MESA_FORMAT_R_FLOAT16; case GL_R32F: diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 863b63399a9..8f521147712 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -156,7 +156,7 @@ _mesa_initialize_texture_object( struct gl_context *ctx, obj->_Swizzle = SWIZZLE_NOOP; obj->Sampler.sRGBDecode = GL_DECODE_EXT; obj->BufferObjectFormat = GL_R8; - obj->_BufferObjectFormat = MESA_FORMAT_R8; + obj->_BufferObjectFormat = MESA_FORMAT_R_UNORM8; obj->ImageFormatCompatibilityType = GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE; } diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 258b66e829d..4c1d789eb76 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1012,11 +1012,11 @@ _mesa_texstore_z32(TEXSTORE_PARAMS) const GLuint depthScale = 0xffffffff; GLenum dstType; (void) dims; - ASSERT(dstFormat == MESA_FORMAT_Z32 || - dstFormat == MESA_FORMAT_Z32_FLOAT); + ASSERT(dstFormat == MESA_FORMAT_Z_UNORM32 || + dstFormat == MESA_FORMAT_Z_FLOAT32); ASSERT(_mesa_get_format_bytes(dstFormat) == sizeof(GLuint)); - if (dstFormat == MESA_FORMAT_Z32) + if (dstFormat == MESA_FORMAT_Z_UNORM32) dstType = GL_UNSIGNED_INT; else dstType = GL_FLOAT; @@ -1112,7 +1112,7 @@ _mesa_texstore_z16(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffff; (void) dims; - ASSERT(dstFormat == MESA_FORMAT_Z16); + ASSERT(dstFormat == MESA_FORMAT_Z_UNORM16); ASSERT(_mesa_get_format_bytes(dstFormat) == sizeof(GLushort)); { @@ -1401,7 +1401,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgb888(TEXSTORE_PARAMS) { - ASSERT(dstFormat == MESA_FORMAT_RGB888); + ASSERT(dstFormat == MESA_FORMAT_BGR_UNORM8); ASSERT(_mesa_get_format_bytes(dstFormat) == 3); if (!ctx->_ImageTransferState && @@ -1463,7 +1463,7 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_bgr888(TEXSTORE_PARAMS) { - ASSERT(dstFormat == MESA_FORMAT_BGR888); + ASSERT(dstFormat == MESA_FORMAT_RGB_UNORM8); ASSERT(_mesa_get_format_bytes(dstFormat) == 3); if (!ctx->_ImageTransferState && @@ -1780,10 +1780,10 @@ _mesa_texstore_unorm16(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_R16 || - dstFormat == MESA_FORMAT_A16 || - dstFormat == MESA_FORMAT_L16 || - dstFormat == MESA_FORMAT_I16); + ASSERT(dstFormat == MESA_FORMAT_R_UNORM16 || + dstFormat == MESA_FORMAT_A_UNORM16 || + dstFormat == MESA_FORMAT_L_UNORM16 || + dstFormat == MESA_FORMAT_I_UNORM16); ASSERT(_mesa_get_format_bytes(dstFormat) == 2); { @@ -1822,8 +1822,8 @@ _mesa_texstore_unorm16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_16(TEXSTORE_PARAMS) { - ASSERT(dstFormat == MESA_FORMAT_RGBA_16 || - dstFormat == MESA_FORMAT_XBGR16161616_UNORM); + ASSERT(dstFormat == MESA_FORMAT_RGBA_UNORM16 || + dstFormat == MESA_FORMAT_RGBX_UNORM16); ASSERT(_mesa_get_format_bytes(dstFormat) == 8); { @@ -1876,7 +1876,7 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS) ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGB_16 || dstFormat == MESA_FORMAT_SIGNED_RGBA_16 || - dstFormat == MESA_FORMAT_XBGR16161616_SNORM); + dstFormat == MESA_FORMAT_RGBX_SNORM16); { /* general path */ @@ -1913,7 +1913,7 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS) dstRow += dstRowStride; src += 4 * srcWidth; } - else if (dstFormat == MESA_FORMAT_XBGR16161616_SNORM) { + else if (dstFormat == MESA_FORMAT_RGBX_SNORM16) { for (col = 0; col < srcWidth; col++) { GLuint c; @@ -1955,10 +1955,10 @@ _mesa_texstore_unorm8(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_A8 || - dstFormat == MESA_FORMAT_L8 || - dstFormat == MESA_FORMAT_I8 || - dstFormat == MESA_FORMAT_R8); + ASSERT(dstFormat == MESA_FORMAT_A_UNORM8 || + dstFormat == MESA_FORMAT_L_UNORM8 || + dstFormat == MESA_FORMAT_I_UNORM8 || + dstFormat == MESA_FORMAT_R_UNORM8); ASSERT(_mesa_get_format_bytes(dstFormat) == 1); if (!ctx->_ImageTransferState && @@ -1969,7 +1969,7 @@ _mesa_texstore_unorm8(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if (dstFormat == MESA_FORMAT_A8) { + if (dstFormat == MESA_FORMAT_A_UNORM8) { dstmap[0] = 3; } else { @@ -2634,7 +2634,7 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_s8(TEXSTORE_PARAMS) { - ASSERT(dstFormat == MESA_FORMAT_S8); + ASSERT(dstFormat == MESA_FORMAT_S_UINT8); ASSERT(srcFormat == GL_STENCIL_INDEX); { @@ -2694,7 +2694,7 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) GLint components = _mesa_components_in_format(baseFormat); /* this forces alpha to 1 in _mesa_make_temp_float_image */ - if (dstFormat == MESA_FORMAT_XBGR32323232_FLOAT) { + if (dstFormat == MESA_FORMAT_RGBX_FLOAT32) { baseFormat = GL_RGBA; components = 4; } @@ -2707,7 +2707,7 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_INTENSITY_FLOAT32 || dstFormat == MESA_FORMAT_R_FLOAT32 || dstFormat == MESA_FORMAT_RG_FLOAT32 || - dstFormat == MESA_FORMAT_XBGR32323232_FLOAT); + dstFormat == MESA_FORMAT_RGBX_FLOAT32); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_ALPHA || @@ -2759,7 +2759,7 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) GLint components = _mesa_components_in_format(baseFormat); /* this forces alpha to 1 in _mesa_make_temp_float_image */ - if (dstFormat == MESA_FORMAT_XBGR16161616_FLOAT) { + if (dstFormat == MESA_FORMAT_RGBX_FLOAT16) { baseFormat = GL_RGBA; components = 4; } @@ -2772,7 +2772,7 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_INTENSITY_FLOAT16 || dstFormat == MESA_FORMAT_R_FLOAT16 || dstFormat == MESA_FORMAT_RG_FLOAT16 || - dstFormat == MESA_FORMAT_XBGR16161616_FLOAT); + dstFormat == MESA_FORMAT_RGBX_FLOAT16); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_ALPHA || @@ -2823,7 +2823,7 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS) GLint components = _mesa_components_in_format(baseFormat); /* this forces alpha to 1 in make_temp_uint_image */ - if (dstFormat == MESA_FORMAT_XBGR8888_SINT) { + if (dstFormat == MESA_FORMAT_RGBX_SINT8) { baseFormat = GL_RGBA; components = 4; } @@ -2836,7 +2836,7 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_INTENSITY_INT8 || dstFormat == MESA_FORMAT_LUMINANCE_INT8 || dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_INT8 || - dstFormat == MESA_FORMAT_XBGR8888_SINT); + dstFormat == MESA_FORMAT_RGBX_SINT8); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -2894,7 +2894,7 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS) GLint components = _mesa_components_in_format(baseFormat); /* this forces alpha to 1 in make_temp_uint_image */ - if (dstFormat == MESA_FORMAT_XBGR16161616_SINT) { + if (dstFormat == MESA_FORMAT_RGBX_SINT16) { baseFormat = GL_RGBA; components = 4; } @@ -2907,7 +2907,7 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_LUMINANCE_INT16 || dstFormat == MESA_FORMAT_INTENSITY_INT16 || dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_INT16 || - dstFormat == MESA_FORMAT_XBGR16161616_SINT); + dstFormat == MESA_FORMAT_RGBX_SINT16); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -2965,7 +2965,7 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS) GLint components = _mesa_components_in_format(baseFormat); /* this forces alpha to 1 in make_temp_uint_image */ - if (dstFormat == MESA_FORMAT_XBGR32323232_SINT) { + if (dstFormat == MESA_FORMAT_RGBX_SINT32) { baseFormat = GL_RGBA; components = 4; } @@ -2978,7 +2978,7 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_INTENSITY_INT32 || dstFormat == MESA_FORMAT_LUMINANCE_INT32 || dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_INT32 || - dstFormat == MESA_FORMAT_XBGR32323232_SINT); + dstFormat == MESA_FORMAT_RGBX_SINT32); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -3036,7 +3036,7 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) GLint components = _mesa_components_in_format(baseFormat); /* this forces alpha to 1 in make_temp_uint_image */ - if (dstFormat == MESA_FORMAT_XBGR8888_UINT) { + if (dstFormat == MESA_FORMAT_RGBX_UINT8) { baseFormat = GL_RGBA; components = 4; } @@ -3049,7 +3049,7 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_INTENSITY_UINT8 || dstFormat == MESA_FORMAT_LUMINANCE_UINT8 || dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_UINT8 || - dstFormat == MESA_FORMAT_XBGR8888_UINT); + dstFormat == MESA_FORMAT_RGBX_UINT8); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -3104,7 +3104,7 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) GLint components = _mesa_components_in_format(baseFormat); /* this forces alpha to 1 in make_temp_uint_image */ - if (dstFormat == MESA_FORMAT_XBGR16161616_UINT) { + if (dstFormat == MESA_FORMAT_RGBX_UINT16) { baseFormat = GL_RGBA; components = 4; } @@ -3117,7 +3117,7 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_INTENSITY_UINT16 || dstFormat == MESA_FORMAT_LUMINANCE_UINT16 || dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_UINT16 || - dstFormat == MESA_FORMAT_XBGR16161616_UINT); + dstFormat == MESA_FORMAT_RGBX_UINT16); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -3172,7 +3172,7 @@ _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS) GLint components = _mesa_components_in_format(baseFormat); /* this forces alpha to 1 in make_temp_uint_image */ - if (dstFormat == MESA_FORMAT_XBGR32323232_UINT) { + if (dstFormat == MESA_FORMAT_RGBX_UINT32) { baseFormat = GL_RGBA; components = 4; } @@ -3185,7 +3185,7 @@ _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_INTENSITY_UINT32 || dstFormat == MESA_FORMAT_LUMINANCE_UINT32 || dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_UINT32 || - dstFormat == MESA_FORMAT_XBGR32323232_UINT); + dstFormat == MESA_FORMAT_RGBX_UINT32); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -3238,10 +3238,10 @@ _mesa_texstore_srgb8(TEXSTORE_PARAMS) mesa_format newDstFormat; GLboolean k; - ASSERT(dstFormat == MESA_FORMAT_SRGB8); + ASSERT(dstFormat == MESA_FORMAT_BGR_SRGB8); /* reuse normal rgb texstore code */ - newDstFormat = MESA_FORMAT_RGB888; + newDstFormat = MESA_FORMAT_BGR_UNORM8; k = _mesa_texstore_rgb888(ctx, dims, baseInternalFormat, newDstFormat, @@ -3311,9 +3311,9 @@ _mesa_texstore_sl8(TEXSTORE_PARAMS) mesa_format newDstFormat; GLboolean k; - ASSERT(dstFormat == MESA_FORMAT_SL8); + ASSERT(dstFormat == MESA_FORMAT_L_SRGB8); - newDstFormat = MESA_FORMAT_L8; + newDstFormat = MESA_FORMAT_L_UNORM8; /* _mesa_textore_a8 handles luminance8 too */ k = _mesa_texstore_unorm8(ctx, dims, baseInternalFormat, @@ -3668,8 +3668,8 @@ _mesa_get_texstore_func(mesa_format format) table[MESA_FORMAT_R8G8B8X8_UNORM] = _mesa_texstore_rgba8888; table[MESA_FORMAT_B8G8R8X8_UNORM] = _mesa_texstore_argb8888; table[MESA_FORMAT_X8R8G8B8_UNORM] = _mesa_texstore_argb8888; - table[MESA_FORMAT_RGB888] = _mesa_texstore_rgb888; - table[MESA_FORMAT_BGR888] = _mesa_texstore_bgr888; + table[MESA_FORMAT_BGR_UNORM8] = _mesa_texstore_rgb888; + table[MESA_FORMAT_RGB_UNORM8] = _mesa_texstore_bgr888; table[MESA_FORMAT_RGB565] = _mesa_texstore_rgb565; table[MESA_FORMAT_RGB565_REV] = _mesa_texstore_rgb565; table[MESA_FORMAT_ARGB4444] = store_ubyte_texture; @@ -3683,32 +3683,32 @@ _mesa_get_texstore_func(mesa_format format) table[MESA_FORMAT_AL1616] = _mesa_texstore_unorm1616; table[MESA_FORMAT_AL1616_REV] = _mesa_texstore_unorm1616; table[MESA_FORMAT_RGB332] = store_ubyte_texture; - table[MESA_FORMAT_A8] = _mesa_texstore_unorm8; - table[MESA_FORMAT_A16] = _mesa_texstore_unorm16; - table[MESA_FORMAT_L8] = _mesa_texstore_unorm8; - table[MESA_FORMAT_L16] = _mesa_texstore_unorm16; - table[MESA_FORMAT_I8] = _mesa_texstore_unorm8; - table[MESA_FORMAT_I16] = _mesa_texstore_unorm16; + table[MESA_FORMAT_A_UNORM8] = _mesa_texstore_unorm8; + table[MESA_FORMAT_A_UNORM16] = _mesa_texstore_unorm16; + table[MESA_FORMAT_L_UNORM8] = _mesa_texstore_unorm8; + table[MESA_FORMAT_L_UNORM16] = _mesa_texstore_unorm16; + table[MESA_FORMAT_I_UNORM8] = _mesa_texstore_unorm8; + table[MESA_FORMAT_I_UNORM16] = _mesa_texstore_unorm16; table[MESA_FORMAT_YCBCR] = _mesa_texstore_ycbcr; table[MESA_FORMAT_YCBCR_REV] = _mesa_texstore_ycbcr; - table[MESA_FORMAT_R8] = _mesa_texstore_unorm8; + table[MESA_FORMAT_R_UNORM8] = _mesa_texstore_unorm8; table[MESA_FORMAT_GR88] = _mesa_texstore_unorm88; table[MESA_FORMAT_RG88] = _mesa_texstore_unorm88; - table[MESA_FORMAT_R16] = _mesa_texstore_unorm16; + table[MESA_FORMAT_R_UNORM16] = _mesa_texstore_unorm16; table[MESA_FORMAT_GR1616] = _mesa_texstore_unorm1616; table[MESA_FORMAT_RG1616] = _mesa_texstore_unorm1616; table[MESA_FORMAT_ARGB2101010] = _mesa_texstore_argb2101010; table[MESA_FORMAT_Z24_S8] = _mesa_texstore_z24_s8; table[MESA_FORMAT_S8_Z24] = _mesa_texstore_s8_z24; - table[MESA_FORMAT_Z16] = _mesa_texstore_z16; + table[MESA_FORMAT_Z_UNORM16] = _mesa_texstore_z16; table[MESA_FORMAT_X8_Z24] = _mesa_texstore_x8_z24; table[MESA_FORMAT_Z24_X8] = _mesa_texstore_z24_x8; - table[MESA_FORMAT_Z32] = _mesa_texstore_z32; - table[MESA_FORMAT_S8] = _mesa_texstore_s8; - table[MESA_FORMAT_SRGB8] = _mesa_texstore_srgb8; + table[MESA_FORMAT_Z_UNORM32] = _mesa_texstore_z32; + table[MESA_FORMAT_S_UINT8] = _mesa_texstore_s8; + table[MESA_FORMAT_BGR_SRGB8] = _mesa_texstore_srgb8; table[MESA_FORMAT_SRGBA8] = _mesa_texstore_srgba8; table[MESA_FORMAT_SARGB8] = _mesa_texstore_sargb8; - table[MESA_FORMAT_SL8] = _mesa_texstore_sl8; + table[MESA_FORMAT_L_SRGB8] = _mesa_texstore_sl8; table[MESA_FORMAT_SLA8] = _mesa_texstore_sla8; table[MESA_FORMAT_SRGB_DXT1] = _mesa_texstore_rgb_dxt1; table[MESA_FORMAT_SRGBA_DXT1] = _mesa_texstore_rgba_dxt1; @@ -3746,7 +3746,7 @@ _mesa_get_texstore_func(mesa_format format) table[MESA_FORMAT_SIGNED_GR1616] = _mesa_texstore_snorm1616; table[MESA_FORMAT_SIGNED_RGB_16] = _mesa_texstore_signed_rgba_16; table[MESA_FORMAT_SIGNED_RGBA_16] = _mesa_texstore_signed_rgba_16; - table[MESA_FORMAT_RGBA_16] = _mesa_texstore_rgba_16; + table[MESA_FORMAT_RGBA_UNORM16] = _mesa_texstore_rgba_16; table[MESA_FORMAT_RED_RGTC1] = _mesa_texstore_red_rgtc1; table[MESA_FORMAT_SIGNED_RED_RGTC1] = _mesa_texstore_signed_red_rgtc1; table[MESA_FORMAT_RG_RGTC2] = _mesa_texstore_rg_rgtc2; @@ -3778,7 +3778,7 @@ _mesa_get_texstore_func(mesa_format format) table[MESA_FORMAT_SIGNED_I16] = _mesa_texstore_snorm16; table[MESA_FORMAT_RGB9_E5_FLOAT] = _mesa_texstore_rgb9_e5; table[MESA_FORMAT_R11_G11_B10_FLOAT] = _mesa_texstore_r11_g11_b10f; - table[MESA_FORMAT_Z32_FLOAT] = _mesa_texstore_z32; + table[MESA_FORMAT_Z_FLOAT32] = _mesa_texstore_z32; table[MESA_FORMAT_Z32_FLOAT_X24S8] = _mesa_texstore_z32f_x24s8; table[MESA_FORMAT_ALPHA_UINT8] = _mesa_texstore_rgba_uint8; @@ -3842,17 +3842,17 @@ _mesa_get_texstore_func(mesa_format format) table[MESA_FORMAT_XRGB1555_UNORM] = store_ubyte_texture; table[MESA_FORMAT_XBGR8888_SNORM] = _mesa_texstore_signed_rgbx8888; table[MESA_FORMAT_XBGR8888_SRGB] = _mesa_texstore_srgba8; - table[MESA_FORMAT_XBGR8888_UINT] = _mesa_texstore_rgba_uint8; - table[MESA_FORMAT_XBGR8888_SINT] = _mesa_texstore_rgba_int8; + table[MESA_FORMAT_RGBX_UINT8] = _mesa_texstore_rgba_uint8; + table[MESA_FORMAT_RGBX_SINT8] = _mesa_texstore_rgba_int8; table[MESA_FORMAT_XRGB2101010_UNORM] = _mesa_texstore_argb2101010; - table[MESA_FORMAT_XBGR16161616_UNORM] = _mesa_texstore_rgba_16; - table[MESA_FORMAT_XBGR16161616_SNORM] = _mesa_texstore_signed_rgba_16; - table[MESA_FORMAT_XBGR16161616_FLOAT] = _mesa_texstore_rgba_float16; - table[MESA_FORMAT_XBGR16161616_UINT] = _mesa_texstore_rgba_uint16; - table[MESA_FORMAT_XBGR16161616_SINT] = _mesa_texstore_rgba_int16; - table[MESA_FORMAT_XBGR32323232_FLOAT] = _mesa_texstore_rgba_float32; - table[MESA_FORMAT_XBGR32323232_UINT] = _mesa_texstore_rgba_uint32; - table[MESA_FORMAT_XBGR32323232_SINT] = _mesa_texstore_rgba_int32; + table[MESA_FORMAT_RGBX_UNORM16] = _mesa_texstore_rgba_16; + table[MESA_FORMAT_RGBX_SNORM16] = _mesa_texstore_signed_rgba_16; + table[MESA_FORMAT_RGBX_FLOAT16] = _mesa_texstore_rgba_float16; + table[MESA_FORMAT_RGBX_UINT16] = _mesa_texstore_rgba_uint16; + table[MESA_FORMAT_RGBX_SINT16] = _mesa_texstore_rgba_int16; + table[MESA_FORMAT_RGBX_FLOAT32] = _mesa_texstore_rgba_float32; + table[MESA_FORMAT_RGBX_UINT32] = _mesa_texstore_rgba_uint32; + table[MESA_FORMAT_RGBX_SINT32] = _mesa_texstore_rgba_int32; table[MESA_FORMAT_ABGR2101010] = _mesa_texstore_abgr2101010; diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 059a103db8d..021fdb462de 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -89,21 +89,21 @@ st_mesa_format_to_pipe_format(mesa_format mesaFormat) return PIPE_FORMAT_L8A8_UNORM; case MESA_FORMAT_AL1616: return PIPE_FORMAT_L16A16_UNORM; - case MESA_FORMAT_A8: + case MESA_FORMAT_A_UNORM8: return PIPE_FORMAT_A8_UNORM; - case MESA_FORMAT_A16: + case MESA_FORMAT_A_UNORM16: return PIPE_FORMAT_A16_UNORM; - case MESA_FORMAT_L8: + case MESA_FORMAT_L_UNORM8: return PIPE_FORMAT_L8_UNORM; - case MESA_FORMAT_L16: + case MESA_FORMAT_L_UNORM16: return PIPE_FORMAT_L16_UNORM; - case MESA_FORMAT_I8: + case MESA_FORMAT_I_UNORM8: return PIPE_FORMAT_I8_UNORM; - case MESA_FORMAT_I16: + case MESA_FORMAT_I_UNORM16: return PIPE_FORMAT_I16_UNORM; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return PIPE_FORMAT_Z16_UNORM; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: return PIPE_FORMAT_Z32_UNORM; case MESA_FORMAT_Z24_S8: return PIPE_FORMAT_S8_UINT_Z24_UNORM; @@ -113,9 +113,9 @@ st_mesa_format_to_pipe_format(mesa_format mesaFormat) return PIPE_FORMAT_X8Z24_UNORM; case MESA_FORMAT_X8_Z24: return PIPE_FORMAT_Z24X8_UNORM; - case MESA_FORMAT_S8: + case MESA_FORMAT_S_UINT8: return PIPE_FORMAT_S8_UINT; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: return PIPE_FORMAT_Z32_FLOAT; case MESA_FORMAT_Z32_FLOAT_X24S8: return PIPE_FORMAT_Z32_FLOAT_S8X24_UINT; @@ -139,9 +139,9 @@ st_mesa_format_to_pipe_format(mesa_format mesaFormat) return PIPE_FORMAT_DXT5_SRGBA; case MESA_FORMAT_SLA8: return PIPE_FORMAT_L8A8_SRGB; - case MESA_FORMAT_SL8: + case MESA_FORMAT_L_SRGB8: return PIPE_FORMAT_L8_SRGB; - case MESA_FORMAT_SRGB8: + case MESA_FORMAT_BGR_SRGB8: return PIPE_FORMAT_R8G8B8_SRGB; case MESA_FORMAT_SRGBA8: return PIPE_FORMAT_A8B8G8R8_SRGB; @@ -180,15 +180,15 @@ st_mesa_format_to_pipe_format(mesa_format mesaFormat) case MESA_FORMAT_RG_FLOAT16: return PIPE_FORMAT_R16G16_FLOAT; - case MESA_FORMAT_R8: + case MESA_FORMAT_R_UNORM8: return PIPE_FORMAT_R8_UNORM; - case MESA_FORMAT_R16: + case MESA_FORMAT_R_UNORM16: return PIPE_FORMAT_R16_UNORM; case MESA_FORMAT_GR88: return PIPE_FORMAT_R8G8_UNORM; case MESA_FORMAT_GR1616: return PIPE_FORMAT_R16G16_UNORM; - case MESA_FORMAT_RGBA_16: + case MESA_FORMAT_RGBA_UNORM16: return PIPE_FORMAT_R16G16B16A16_UNORM; /* signed int formats */ @@ -370,27 +370,27 @@ st_mesa_format_to_pipe_format(mesa_format mesaFormat) return PIPE_FORMAT_R8G8B8X8_SNORM; case MESA_FORMAT_XBGR8888_SRGB: return PIPE_FORMAT_R8G8B8X8_SRGB; - case MESA_FORMAT_XBGR8888_UINT: + case MESA_FORMAT_RGBX_UINT8: return PIPE_FORMAT_R8G8B8X8_UINT; - case MESA_FORMAT_XBGR8888_SINT: + case MESA_FORMAT_RGBX_SINT8: return PIPE_FORMAT_R8G8B8X8_SINT; case MESA_FORMAT_XRGB2101010_UNORM: return PIPE_FORMAT_B10G10R10X2_UNORM; - case MESA_FORMAT_XBGR16161616_UNORM: + case MESA_FORMAT_RGBX_UNORM16: return PIPE_FORMAT_R16G16B16X16_UNORM; - case MESA_FORMAT_XBGR16161616_SNORM: + case MESA_FORMAT_RGBX_SNORM16: return PIPE_FORMAT_R16G16B16X16_SNORM; - case MESA_FORMAT_XBGR16161616_FLOAT: + case MESA_FORMAT_RGBX_FLOAT16: return PIPE_FORMAT_R16G16B16X16_FLOAT; - case MESA_FORMAT_XBGR16161616_UINT: + case MESA_FORMAT_RGBX_UINT16: return PIPE_FORMAT_R16G16B16X16_UINT; - case MESA_FORMAT_XBGR16161616_SINT: + case MESA_FORMAT_RGBX_SINT16: return PIPE_FORMAT_R16G16B16X16_SINT; - case MESA_FORMAT_XBGR32323232_FLOAT: + case MESA_FORMAT_RGBX_FLOAT32: return PIPE_FORMAT_R32G32B32X32_FLOAT; - case MESA_FORMAT_XBGR32323232_UINT: + case MESA_FORMAT_RGBX_UINT32: return PIPE_FORMAT_R32G32B32X32_UINT; - case MESA_FORMAT_XBGR32323232_SINT: + case MESA_FORMAT_RGBX_SINT32: return PIPE_FORMAT_R32G32B32X32_SINT; default: @@ -439,27 +439,27 @@ st_pipe_format_to_mesa_format(enum pipe_format format) case PIPE_FORMAT_L16A16_UNORM: return MESA_FORMAT_AL1616; case PIPE_FORMAT_A8_UNORM: - return MESA_FORMAT_A8; + return MESA_FORMAT_A_UNORM8; case PIPE_FORMAT_A16_UNORM: - return MESA_FORMAT_A16; + return MESA_FORMAT_A_UNORM16; case PIPE_FORMAT_L8_UNORM: - return MESA_FORMAT_L8; + return MESA_FORMAT_L_UNORM8; case PIPE_FORMAT_L16_UNORM: - return MESA_FORMAT_L16; + return MESA_FORMAT_L_UNORM16; case PIPE_FORMAT_I8_UNORM: - return MESA_FORMAT_I8; + return MESA_FORMAT_I_UNORM8; case PIPE_FORMAT_I16_UNORM: - return MESA_FORMAT_I16; + return MESA_FORMAT_I_UNORM16; case PIPE_FORMAT_S8_UINT: - return MESA_FORMAT_S8; + return MESA_FORMAT_S_UINT8; case PIPE_FORMAT_R16G16B16A16_UNORM: - return MESA_FORMAT_RGBA_16; + return MESA_FORMAT_RGBA_UNORM16; case PIPE_FORMAT_Z16_UNORM: - return MESA_FORMAT_Z16; + return MESA_FORMAT_Z_UNORM16; case PIPE_FORMAT_Z32_UNORM: - return MESA_FORMAT_Z32; + return MESA_FORMAT_Z_UNORM32; case PIPE_FORMAT_S8_UINT_Z24_UNORM: return MESA_FORMAT_Z24_S8; case PIPE_FORMAT_X8Z24_UNORM: @@ -469,7 +469,7 @@ st_pipe_format_to_mesa_format(enum pipe_format format) case PIPE_FORMAT_Z24_UNORM_S8_UINT: return MESA_FORMAT_S8_Z24; case PIPE_FORMAT_Z32_FLOAT: - return MESA_FORMAT_Z32_FLOAT; + return MESA_FORMAT_Z_FLOAT32; case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: return MESA_FORMAT_Z32_FLOAT_X24S8; @@ -497,9 +497,9 @@ st_pipe_format_to_mesa_format(enum pipe_format format) case PIPE_FORMAT_L8A8_SRGB: return MESA_FORMAT_SLA8; case PIPE_FORMAT_L8_SRGB: - return MESA_FORMAT_SL8; + return MESA_FORMAT_L_SRGB8; case PIPE_FORMAT_R8G8B8_SRGB: - return MESA_FORMAT_SRGB8; + return MESA_FORMAT_BGR_SRGB8; case PIPE_FORMAT_A8B8G8R8_SRGB: return MESA_FORMAT_SRGBA8; case PIPE_FORMAT_B8G8R8A8_SRGB: @@ -538,9 +538,9 @@ st_pipe_format_to_mesa_format(enum pipe_format format) return MESA_FORMAT_RG_FLOAT16; case PIPE_FORMAT_R8_UNORM: - return MESA_FORMAT_R8; + return MESA_FORMAT_R_UNORM8; case PIPE_FORMAT_R16_UNORM: - return MESA_FORMAT_R16; + return MESA_FORMAT_R_UNORM16; case PIPE_FORMAT_R8G8_UNORM: return MESA_FORMAT_GR88; case PIPE_FORMAT_R16G16_UNORM: @@ -726,27 +726,27 @@ st_pipe_format_to_mesa_format(enum pipe_format format) case PIPE_FORMAT_R8G8B8X8_SRGB: return MESA_FORMAT_XBGR8888_SRGB; case PIPE_FORMAT_R8G8B8X8_UINT: - return MESA_FORMAT_XBGR8888_UINT; + return MESA_FORMAT_RGBX_UINT8; case PIPE_FORMAT_R8G8B8X8_SINT: - return MESA_FORMAT_XBGR8888_SINT; + return MESA_FORMAT_RGBX_SINT8; case PIPE_FORMAT_B10G10R10X2_UNORM: return MESA_FORMAT_XRGB2101010_UNORM; case PIPE_FORMAT_R16G16B16X16_UNORM: - return MESA_FORMAT_XBGR16161616_UNORM; + return MESA_FORMAT_RGBX_UNORM16; case PIPE_FORMAT_R16G16B16X16_SNORM: - return MESA_FORMAT_XBGR16161616_SNORM; + return MESA_FORMAT_RGBX_SNORM16; case PIPE_FORMAT_R16G16B16X16_FLOAT: - return MESA_FORMAT_XBGR16161616_FLOAT; + return MESA_FORMAT_RGBX_FLOAT16; case PIPE_FORMAT_R16G16B16X16_UINT: - return MESA_FORMAT_XBGR16161616_UINT; + return MESA_FORMAT_RGBX_UINT16; case PIPE_FORMAT_R16G16B16X16_SINT: - return MESA_FORMAT_XBGR16161616_SINT; + return MESA_FORMAT_RGBX_SINT16; case PIPE_FORMAT_R32G32B32X32_FLOAT: - return MESA_FORMAT_XBGR32323232_FLOAT; + return MESA_FORMAT_RGBX_FLOAT32; case PIPE_FORMAT_R32G32B32X32_UINT: - return MESA_FORMAT_XBGR32323232_UINT; + return MESA_FORMAT_RGBX_UINT32; case PIPE_FORMAT_R32G32B32X32_SINT: - return MESA_FORMAT_XBGR32323232_SINT; + return MESA_FORMAT_RGBX_SINT32; default: assert(0); diff --git a/src/mesa/swrast/s_blit.c b/src/mesa/swrast/s_blit.c index dc9c87cce77..aadcd959109 100644 --- a/src/mesa/swrast/s_blit.c +++ b/src/mesa/swrast/s_blit.c @@ -166,7 +166,7 @@ blit_nearest(struct gl_context *ctx, * using the core helpers for pack/unpack, we avoid needing to handle * masking for things like DEPTH copies of Z24S8. */ - if (readRb->Format == MESA_FORMAT_Z32_FLOAT || + if (readRb->Format == MESA_FORMAT_Z_FLOAT32 || readRb->Format == MESA_FORMAT_Z32_FLOAT_X24S8) { mode = UNPACK_Z_FLOAT; } else { diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c index 7f3c76de40a..b00b949abb2 100644 --- a/src/mesa/swrast/s_depth.c +++ b/src/mesa/swrast/s_depth.c @@ -217,7 +217,7 @@ get_z32_values(struct gl_context *ctx, struct gl_renderbuffer *rb, const GLubyte *map = _swrast_pixel_address(rb, 0, 0); GLuint i; - if (rb->Format == MESA_FORMAT_Z32) { + if (rb->Format == MESA_FORMAT_Z_UNORM32) { const GLint rowStride = srb->RowStride; for (i = 0; i < count; i++) { if (x[i] >= 0 && y[i] >= 0 && x[i] < w && y[i] < h) { @@ -252,7 +252,7 @@ put_z32_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLubyte *map = _swrast_pixel_address(rb, 0, 0); GLuint i; - if (rb->Format == MESA_FORMAT_Z32) { + if (rb->Format == MESA_FORMAT_Z_UNORM32) { const GLint rowStride = srb->RowStride; for (i = 0; i < count; i++) { if (mask[i] && x[i] >= 0 && y[i] >= 0 && x[i] < w && y[i] < h) { @@ -300,12 +300,12 @@ _swrast_depth_test_span(struct gl_context *ctx, SWspan *span) else zStart = _swrast_pixel_address(rb, span->x, span->y); - if (rb->Format == MESA_FORMAT_Z16 && !(span->arrayMask & SPAN_XY)) { + if (rb->Format == MESA_FORMAT_Z_UNORM16 && !(span->arrayMask & SPAN_XY)) { /* directly read/write row of 16-bit Z values */ zBufferVals = zStart; ztest16 = GL_TRUE; } - else if (rb->Format == MESA_FORMAT_Z32 && !(span->arrayMask & SPAN_XY)) { + else if (rb->Format == MESA_FORMAT_Z_UNORM32 && !(span->arrayMask & SPAN_XY)) { /* directly read/write row of 32-bit Z values */ zBufferVals = zStart; } @@ -439,7 +439,7 @@ _swrast_depth_bounds_test( struct gl_context *ctx, SWspan *span ) else zStart = _swrast_pixel_address(rb, span->x, span->y); - if (rb->Format == MESA_FORMAT_Z32 && !(span->arrayMask & SPAN_XY)) { + if (rb->Format == MESA_FORMAT_Z_UNORM32 && !(span->arrayMask & SPAN_XY)) { /* directly access 32-bit values in the depth buffer */ zBufferVals = (const GLuint *) zStart; } @@ -567,7 +567,7 @@ _swrast_clear_depth_buffer(struct gl_context *ctx) } switch (rb->Format) { - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: { GLfloat clear = (GLfloat) ctx->Depth.Clear; GLushort clearVal = 0; @@ -587,8 +587,8 @@ _swrast_clear_depth_buffer(struct gl_context *ctx) } } break; - case MESA_FORMAT_Z32: - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_UNORM32: + case MESA_FORMAT_Z_FLOAT32: { GLfloat clear = (GLfloat) ctx->Depth.Clear; GLuint clearVal = 0; diff --git a/src/mesa/swrast/s_renderbuffer.c b/src/mesa/swrast/s_renderbuffer.c index 28c1eb07be9..8638ea4a9d2 100644 --- a/src/mesa/swrast/s_renderbuffer.c +++ b/src/mesa/swrast/s_renderbuffer.c @@ -69,7 +69,7 @@ soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, case GL_RGB10: case GL_RGB12: case GL_RGB16: - rb->Format = MESA_FORMAT_RGB888; + rb->Format = MESA_FORMAT_BGR_UNORM8; break; case GL_RGBA: case GL_RGBA2: @@ -95,17 +95,17 @@ soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, case GL_STENCIL_INDEX4_EXT: case GL_STENCIL_INDEX8_EXT: case GL_STENCIL_INDEX16_EXT: - rb->Format = MESA_FORMAT_S8; + rb->Format = MESA_FORMAT_S_UINT8; break; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT16: - rb->Format = MESA_FORMAT_Z16; + rb->Format = MESA_FORMAT_Z_UNORM16; break; case GL_DEPTH_COMPONENT24: rb->Format = MESA_FORMAT_X8_Z24; break; case GL_DEPTH_COMPONENT32: - rb->Format = MESA_FORMAT_Z32; + rb->Format = MESA_FORMAT_Z_UNORM32; break; case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c index 27f11583138..8b30469ad32 100644 --- a/src/mesa/swrast/s_stencil.c +++ b/src/mesa/swrast/s_stencil.c @@ -300,7 +300,7 @@ get_s8_values(struct gl_context *ctx, struct gl_renderbuffer *rb, const GLubyte *map = _swrast_pixel_address(rb, 0, 0); GLuint i; - if (rb->Format == MESA_FORMAT_S8) { + if (rb->Format == MESA_FORMAT_S_UINT8) { const GLint rowStride = srb->RowStride; for (i = 0; i < count; i++) { if (x[i] >= 0 && y[i] >= 0 && x[i] < w && y[i] < h) { @@ -587,7 +587,7 @@ _swrast_clear_stencil_buffer(struct gl_context *ctx) } switch (rb->Format) { - case MESA_FORMAT_S8: + case MESA_FORMAT_S_UINT8: { GLubyte clear = ctx->Stencil.Clear & writeMask & 0xff; GLubyte mask = (~writeMask) & 0xff; diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c index 7a5ff447c34..c481f6bdcab 100644 --- a/src/mesa/swrast/s_texfetch.c +++ b/src/mesa/swrast/s_texfetch.c @@ -197,13 +197,13 @@ texfetch_funcs[] = fetch_texel_3d_f_xrgb8888_rev }, { - MESA_FORMAT_RGB888, + MESA_FORMAT_BGR_UNORM8, fetch_texel_1d_f_rgb888, fetch_texel_2d_f_rgb888, fetch_texel_3d_f_rgb888 }, { - MESA_FORMAT_BGR888, + MESA_FORMAT_RGB_UNORM8, fetch_texel_1d_f_bgr888, fetch_texel_2d_f_bgr888, fetch_texel_3d_f_bgr888 @@ -287,37 +287,37 @@ texfetch_funcs[] = fetch_texel_3d_f_rgb332 }, { - MESA_FORMAT_A8, + MESA_FORMAT_A_UNORM8, fetch_texel_1d_f_a8, fetch_texel_2d_f_a8, fetch_texel_3d_f_a8 }, { - MESA_FORMAT_A16, + MESA_FORMAT_A_UNORM16, fetch_texel_1d_f_a16, fetch_texel_2d_f_a16, fetch_texel_3d_f_a16 }, { - MESA_FORMAT_L8, + MESA_FORMAT_L_UNORM8, fetch_texel_1d_f_l8, fetch_texel_2d_f_l8, fetch_texel_3d_f_l8 }, { - MESA_FORMAT_L16, + MESA_FORMAT_L_UNORM16, fetch_texel_1d_f_l16, fetch_texel_2d_f_l16, fetch_texel_3d_f_l16 }, { - MESA_FORMAT_I8, + MESA_FORMAT_I_UNORM8, fetch_texel_1d_f_i8, fetch_texel_2d_f_i8, fetch_texel_3d_f_i8 }, { - MESA_FORMAT_I16, + MESA_FORMAT_I_UNORM16, fetch_texel_1d_f_i16, fetch_texel_2d_f_i16, fetch_texel_3d_f_i16 @@ -335,7 +335,7 @@ texfetch_funcs[] = fetch_texel_3d_f_ycbcr_rev }, { - MESA_FORMAT_R8, + MESA_FORMAT_R_UNORM8, fetch_texel_1d_f_r8, fetch_texel_2d_f_r8, fetch_texel_3d_f_r8 @@ -353,7 +353,7 @@ texfetch_funcs[] = fetch_texel_3d_f_rg88 }, { - MESA_FORMAT_R16, + MESA_FORMAT_R_UNORM16, fetch_texel_1d_f_r16, fetch_texel_2d_f_r16, fetch_texel_3d_f_r16 @@ -389,7 +389,7 @@ texfetch_funcs[] = fetch_texel_3d_f_s8_z24 }, { - MESA_FORMAT_Z16, + MESA_FORMAT_Z_UNORM16, fetch_texel_1d_f_z16, fetch_texel_2d_f_z16, fetch_texel_3d_f_z16 @@ -407,19 +407,19 @@ texfetch_funcs[] = fetch_texel_3d_f_z24_s8 }, { - MESA_FORMAT_Z32, + MESA_FORMAT_Z_UNORM32, fetch_texel_1d_f_z32, fetch_texel_2d_f_z32, fetch_texel_3d_f_z32 }, { - MESA_FORMAT_S8, + MESA_FORMAT_S_UINT8, NULL, NULL, NULL }, { - MESA_FORMAT_SRGB8, + MESA_FORMAT_BGR_SRGB8, fetch_texel_1d_srgb8, fetch_texel_2d_srgb8, fetch_texel_3d_srgb8 @@ -437,7 +437,7 @@ texfetch_funcs[] = fetch_texel_3d_sargb8 }, { - MESA_FORMAT_SL8, + MESA_FORMAT_L_SRGB8, fetch_texel_1d_sl8, fetch_texel_2d_sl8, fetch_texel_3d_sl8 @@ -993,7 +993,7 @@ texfetch_funcs[] = fetch_texel_3d_signed_rgba_16 }, { - MESA_FORMAT_RGBA_16, + MESA_FORMAT_RGBA_UNORM16, fetch_texel_1d_rgba_16, fetch_texel_2d_rgba_16, fetch_texel_3d_rgba_16 @@ -1173,7 +1173,7 @@ texfetch_funcs[] = fetch_texel_3d_r11_g11_b10f }, { - MESA_FORMAT_Z32_FLOAT, + MESA_FORMAT_Z_FLOAT32, fetch_texel_1d_f_r_f32, /* Reuse the R32F functions. */ fetch_texel_2d_f_r_f32, fetch_texel_3d_f_r_f32 @@ -1221,13 +1221,13 @@ texfetch_funcs[] = NULL }, { - MESA_FORMAT_XBGR8888_UINT, + MESA_FORMAT_RGBX_UINT8, NULL, NULL, NULL }, { - MESA_FORMAT_XBGR8888_SINT, + MESA_FORMAT_RGBX_SINT8, NULL, NULL, NULL @@ -1239,49 +1239,49 @@ texfetch_funcs[] = NULL }, { - MESA_FORMAT_XBGR16161616_UNORM, + MESA_FORMAT_RGBX_UNORM16, fetch_texel_1d_xbgr16161616_unorm, fetch_texel_2d_xbgr16161616_unorm, fetch_texel_3d_xbgr16161616_unorm }, { - MESA_FORMAT_XBGR16161616_SNORM, + MESA_FORMAT_RGBX_SNORM16, NULL, NULL, NULL }, { - MESA_FORMAT_XBGR16161616_FLOAT, + MESA_FORMAT_RGBX_FLOAT16, fetch_texel_1d_xbgr16161616_float, fetch_texel_2d_xbgr16161616_float, fetch_texel_3d_xbgr16161616_float }, { - MESA_FORMAT_XBGR16161616_UINT, + MESA_FORMAT_RGBX_UINT16, NULL, NULL, NULL }, { - MESA_FORMAT_XBGR16161616_SINT, + MESA_FORMAT_RGBX_SINT16, NULL, NULL, NULL }, { - MESA_FORMAT_XBGR32323232_FLOAT, + MESA_FORMAT_RGBX_FLOAT32, fetch_texel_1d_xbgr32323232_float, fetch_texel_2d_xbgr32323232_float, fetch_texel_3d_xbgr32323232_float }, { - MESA_FORMAT_XBGR32323232_UINT, + MESA_FORMAT_RGBX_UINT32, NULL, NULL, NULL }, { - MESA_FORMAT_XBGR32323232_SINT, + MESA_FORMAT_RGBX_SINT32, NULL, NULL, NULL diff --git a/src/mesa/swrast/s_texfetch_tmp.h b/src/mesa/swrast/s_texfetch_tmp.h index c5171ecd1ee..30fe1b8df09 100644 --- a/src/mesa/swrast/s_texfetch_tmp.h +++ b/src/mesa/swrast/s_texfetch_tmp.h @@ -69,7 +69,7 @@ #endif -/* MESA_FORMAT_Z32 ***********************************************************/ +/* MESA_FORMAT_Z_UNORM32 ***********************************************************/ /* Fetch depth texel from 1D, 2D or 3D 32-bit depth texture, * returning 1 GLfloat. @@ -83,7 +83,7 @@ static void FETCH(f_z32)( const struct swrast_texture_image *texImage, } -/* MESA_FORMAT_Z16 ***********************************************************/ +/* MESA_FORMAT_Z_UNORM16 ***********************************************************/ /* Fetch depth texel from 1D, 2D or 3D 16-bit depth texture, * returning 1 GLfloat. @@ -518,7 +518,7 @@ static void FETCH(f_xrgb8888_rev)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_RGB888 ********************************************************/ +/* MESA_FORMAT_BGR_UNORM8 ********************************************************/ /* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */ static void FETCH(f_rgb888)( const struct swrast_texture_image *texImage, @@ -534,7 +534,7 @@ static void FETCH(f_rgb888)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_BGR888 ********************************************************/ +/* MESA_FORMAT_RGB_UNORM8 ********************************************************/ /* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */ static void FETCH(f_bgr888)( const struct swrast_texture_image *texImage, @@ -750,7 +750,7 @@ static void FETCH(f_al88)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_R8 ************************************************************/ +/* MESA_FORMAT_R_UNORM8 ************************************************************/ /* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */ static void FETCH(f_r8)(const struct swrast_texture_image *texImage, @@ -766,7 +766,7 @@ static void FETCH(f_r8)(const struct swrast_texture_image *texImage, -/* MESA_FORMAT_R16 ***********************************************************/ +/* MESA_FORMAT_R_UNORM16 ***********************************************************/ /* Fetch texel from 1D, 2D or 3D r16 texture, return 4 GLchans */ static void FETCH(f_r16)(const struct swrast_texture_image *texImage, @@ -879,7 +879,7 @@ static void FETCH(f_rgb332)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_A8 ************************************************************/ +/* MESA_FORMAT_A_UNORM8 ************************************************************/ /* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */ static void FETCH(f_a8)( const struct swrast_texture_image *texImage, @@ -895,7 +895,7 @@ static void FETCH(f_a8)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_A16 ************************************************************/ +/* MESA_FORMAT_A_UNORM16 ************************************************************/ /* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */ static void FETCH(f_a16)( const struct swrast_texture_image *texImage, @@ -911,7 +911,7 @@ static void FETCH(f_a16)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_L8 ************************************************************/ +/* MESA_FORMAT_L_UNORM8 ************************************************************/ /* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */ static void FETCH(f_l8)( const struct swrast_texture_image *texImage, @@ -927,7 +927,7 @@ static void FETCH(f_l8)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_L16 ***********************************************************/ +/* MESA_FORMAT_L_UNORM16 ***********************************************************/ /* Fetch texel from 1D, 2D or 3D l16 texture, return 4 GLchans */ static void FETCH(f_l16)( const struct swrast_texture_image *texImage, @@ -943,7 +943,7 @@ static void FETCH(f_l16)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_I8 ************************************************************/ +/* MESA_FORMAT_I_UNORM8 ************************************************************/ /* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */ static void FETCH(f_i8)( const struct swrast_texture_image *texImage, @@ -959,7 +959,7 @@ static void FETCH(f_i8)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_I16 ***********************************************************/ +/* MESA_FORMAT_I_UNORM16 ***********************************************************/ /* Fetch texel from 1D, 2D or 3D i16 texture, return 4 GLchans */ static void FETCH(f_i16)( const struct swrast_texture_image *texImage, @@ -976,7 +976,7 @@ static void FETCH(f_i16)( const struct swrast_texture_image *texImage, /* Fetch texel from 1D, 2D or 3D srgb8 texture, return 4 GLfloats */ -/* Note: component order is same as for MESA_FORMAT_RGB888 */ +/* Note: component order is same as for MESA_FORMAT_BGR_UNORM8 */ static void FETCH(srgb8)(const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { @@ -1415,7 +1415,7 @@ FETCH(signed_rgba_16)(const struct swrast_texture_image *texImage, -/* MESA_FORMAT_RGBA_16 ***********************************************/ +/* MESA_FORMAT_RGBA_UNORM16 ***********************************************/ static void FETCH(rgba_16)(const struct swrast_texture_image *texImage, diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 6e87fc910e4..c3fd900b443 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -1428,7 +1428,7 @@ opt_sample_rgb_2d(struct gl_context *ctx, ASSERT(samp->WrapS==GL_REPEAT); ASSERT(samp->WrapT==GL_REPEAT); ASSERT(img->Border==0); - ASSERT(img->TexFormat == MESA_FORMAT_RGB888); + ASSERT(img->TexFormat == MESA_FORMAT_BGR_UNORM8); ASSERT(swImg->_IsPowerOfTwo); (void) swImg; @@ -1521,7 +1521,7 @@ sample_lambda_2d(struct gl_context *ctx, case GL_NEAREST: if (repeatNoBorderPOT) { switch (tImg->TexFormat) { - case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR_UNORM8: opt_sample_rgb_2d(ctx, samp, tObj, m, texcoords + minStart, NULL, rgba + minStart); break; @@ -1578,7 +1578,7 @@ sample_lambda_2d(struct gl_context *ctx, case GL_NEAREST: if (repeatNoBorderPOT) { switch (tImg->TexFormat) { - case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR_UNORM8: opt_sample_rgb_2d(ctx, samp, tObj, m, texcoords + magStart, NULL, rgba + magStart); break; @@ -3760,7 +3760,7 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx, sampler->WrapT == GL_REPEAT && swImg->_IsPowerOfTwo && img->Border == 0) { - if (img->TexFormat == MESA_FORMAT_RGB888) + if (img->TexFormat == MESA_FORMAT_BGR_UNORM8) func = &opt_sample_rgb_2d; else if (img->TexFormat == MESA_FORMAT_A8B8G8R8_UNORM) func = &opt_sample_rgba_2d; diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index b694bbe6188..00383fb84f8 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -136,7 +136,7 @@ _swrast_culltriangle( struct gl_context *ctx, const GLubyte *texture = (const GLubyte *) swImg->ImageSlices[0]; \ const GLint smask = texImg->Width - 1; \ const GLint tmask = texImg->Height - 1; \ - ASSERT(texImg->TexFormat == MESA_FORMAT_RGB888); \ + ASSERT(texImg->TexFormat == MESA_FORMAT_BGR_UNORM8); \ if (!rb || !texture) { \ return; \ } @@ -194,7 +194,7 @@ _swrast_culltriangle( struct gl_context *ctx, const GLubyte *texture = (const GLubyte *) swImg->ImageSlices[0]; \ const GLint smask = texImg->Width - 1; \ const GLint tmask = texImg->Height - 1; \ - ASSERT(texImg->TexFormat == MESA_FORMAT_RGB888); \ + ASSERT(texImg->TexFormat == MESA_FORMAT_BGR_UNORM8); \ if (!rb || !texture) { \ return; \ } @@ -417,7 +417,7 @@ affine_span(struct gl_context *ctx, SWspan *span, switch (info->filter) { case GL_NEAREST: switch (info->format) { - case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR_UNORM8: switch (info->envmode) { case GL_MODULATE: SPAN_NEAREST(NEAREST_RGB;MODULATE,3); @@ -466,7 +466,7 @@ affine_span(struct gl_context *ctx, SWspan *span, span->intTex[0] -= FIXED_HALF; span->intTex[1] -= FIXED_HALF; switch (info->format) { - case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR_UNORM8: switch (info->envmode) { case GL_MODULATE: SPAN_LINEAR(LINEAR_RGB;MODULATE,3); @@ -572,7 +572,7 @@ affine_span(struct gl_context *ctx, SWspan *span, } \ \ switch (info.format) { \ - case MESA_FORMAT_RGB888: \ + case MESA_FORMAT_BGR_UNORM8: \ info.tbytesline = texImg->Width * 3; \ break; \ case MESA_FORMAT_A8B8G8R8_UNORM: \ @@ -689,7 +689,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span, switch (info->filter) { case GL_NEAREST: switch (info->format) { - case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR_UNORM8: switch (info->envmode) { case GL_MODULATE: SPAN_NEAREST(NEAREST_RGB;MODULATE,3); @@ -736,7 +736,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span, case GL_LINEAR: switch (info->format) { - case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR_UNORM8: switch (info->envmode) { case GL_MODULATE: SPAN_LINEAR(LINEAR_RGB;MODULATE,3); @@ -838,7 +838,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span, } \ \ switch (info.format) { \ - case MESA_FORMAT_RGB888: \ + case MESA_FORMAT_BGR_UNORM8: \ info.tbytesline = texImg->Width * 3; \ break; \ case MESA_FORMAT_A8B8G8R8_UNORM: \ @@ -887,7 +887,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span, ASSERT(ctx->Depth.Test); \ ASSERT(!ctx->Depth.Mask); \ ASSERT(ctx->Depth.Func == GL_LESS); \ - assert(rb->Format == MESA_FORMAT_Z16); \ + assert(rb->Format == MESA_FORMAT_Z_UNORM16); \ if (!q) { \ return; \ } @@ -1025,7 +1025,7 @@ _swrast_choose_triangle( struct gl_context *ctx ) ctx->Depth.Func == GL_LESS && !ctx->Stencil._Enabled && depthRb && - depthRb->Format == MESA_FORMAT_Z16) { + depthRb->Format == MESA_FORMAT_Z_UNORM16) { if (ctx->Color.ColorMask[0][0] == 0 && ctx->Color.ColorMask[0][1] == 0 && ctx->Color.ColorMask[0][2] == 0 && @@ -1080,7 +1080,7 @@ _swrast_choose_triangle( struct gl_context *ctx ) && texImg->Border == 0 && (_mesa_format_row_stride(format, texImg->Width) == swImg->RowStride) - && (format == MESA_FORMAT_RGB888 || format == MESA_FORMAT_A8B8G8R8_UNORM) + && (format == MESA_FORMAT_BGR_UNORM8 || format == MESA_FORMAT_A8B8G8R8_UNORM) && minFilter == magFilter && ctx->Light.Model.ColorControl == GL_SINGLE_COLOR && !swrast->_FogEnabled @@ -1088,7 +1088,7 @@ _swrast_choose_triangle( struct gl_context *ctx ) && ctx->Texture.Unit[0].EnvMode != GL_COMBINE4_NV) { if (ctx->Hint.PerspectiveCorrection==GL_FASTEST) { if (minFilter == GL_NEAREST - && format == MESA_FORMAT_RGB888 + && format == MESA_FORMAT_BGR_UNORM8 && (envMode == GL_REPLACE || envMode == GL_DECAL) && ((swrast->_RasterMask == (DEPTH_BIT | TEXTURE_BIT) && ctx->Depth.Func == GL_LESS -- 2.30.2