summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c4
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c30
-rw-r--r--src/mesa/state_tracker/st_format.c62
-rw-r--r--src/mesa/state_tracker/st_format.h3
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c2
-rw-r--r--src/mesa/state_tracker/st_texture.c2
6 files changed, 52 insertions, 51 deletions
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 6da57e817b..081c09c1fb 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -338,7 +338,7 @@ make_texture(struct st_context *st,
GLcontext *ctx = st->ctx;
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
- const struct gl_texture_format *mformat;
+ gl_format mformat;
struct pipe_texture *pt;
enum pipe_format pipeFormat;
GLuint cpp;
@@ -350,7 +350,7 @@ make_texture(struct st_context *st,
mformat = st_ChooseTextureFormat(ctx, baseFormat, format, type);
assert(mformat);
- pipeFormat = st_mesa_format_to_pipe_format(mformat->MesaFormat);
+ pipeFormat = st_mesa_format_to_pipe_format(mformat);
assert(pipeFormat);
cpp = st_sizeof_format(pipeFormat);
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index d96484c439..716fbc8b29 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -95,9 +95,9 @@ gl_target_to_pipe(GLenum target)
* format.
*/
static GLuint
-compressed_num_bytes(GLuint mesaFormat)
+compressed_num_bytes(gl_format format)
{
- switch(mesaFormat) {
+ switch (format) {
#if FEATURE_texture_fxt1
case MESA_FORMAT_RGB_FXT1:
case MESA_FORMAT_RGBA_FXT1:
@@ -117,9 +117,9 @@ compressed_num_bytes(GLuint mesaFormat)
static GLboolean
-is_compressed_mesa_format(const struct gl_texture_format *format)
+is_compressed_mesa_format(gl_format format)
{
- switch (format->MesaFormat) {
+ switch (format) {
case MESA_FORMAT_RGB_DXT1:
case MESA_FORMAT_RGBA_DXT1:
case MESA_FORMAT_RGBA_DXT3:
@@ -338,7 +338,7 @@ guess_and_alloc_texture(struct st_context *st,
lastLevel = firstLevel + MAX2(MAX2(l2width, l2height), l2depth);
}
- fmt = st_mesa_format_to_pipe_format(stImage->base.TexFormat->MesaFormat);
+ fmt = st_mesa_format_to_pipe_format(stImage->base.TexFormat);
usage = default_usage(fmt);
@@ -411,7 +411,7 @@ compress_with_blit(GLcontext * ctx,
const GLuint dstImageOffsets[1] = {0};
struct st_texture_image *stImage = st_texture_image(texImage);
struct pipe_screen *screen = ctx->st->pipe->screen;
- const struct gl_texture_format *mesa_format;
+ gl_format mesa_format;
struct pipe_texture templ;
struct pipe_texture *src_tex;
struct pipe_surface *dst_surface;
@@ -443,7 +443,7 @@ compress_with_blit(GLcontext * ctx,
*/
memset(&templ, 0, sizeof(templ));
templ.target = PIPE_TEXTURE_2D;
- templ.format = st_mesa_format_to_pipe_format(mesa_format->MesaFormat);
+ templ.format = st_mesa_format_to_pipe_format(mesa_format);
pf_get_block(templ.format, &templ.block);
templ.width[0] = width;
templ.height[0] = height;
@@ -559,17 +559,17 @@ st_TexImage(GLcontext * ctx,
_mesa_set_fetch_functions(texImage, dims);
- if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
/* must be a compressed format */
texelBytes = 0;
texImage->IsCompressed = GL_TRUE;
texImage->CompressedSize =
ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
texImage->Height, texImage->Depth,
- texImage->TexFormat->MesaFormat);
+ texImage->TexFormat);
}
else {
- texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
+ texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
/* Minimum pitch of 32 bytes */
if (postConvWidth * texelBytes < 32) {
@@ -699,7 +699,7 @@ st_TexImage(GLcontext * ctx,
if (texImage->IsCompressed) {
sizeInBytes = texImage->CompressedSize;
dstRowStride =
- _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width);
+ _mesa_compressed_row_stride(texImage->TexFormat, width);
assert(dims != 3);
}
else {
@@ -1824,10 +1824,10 @@ st_finalize_texture(GLcontext *ctx,
/* FIXME: determine format block instead of cpp */
if (firstImage->base.IsCompressed) {
- cpp = compressed_num_bytes(firstImage->base.TexFormat->MesaFormat);
+ cpp = compressed_num_bytes(firstImage->base.TexFormat);
}
else {
- cpp = _mesa_get_format_bytes(firstImage->base.TexFormat->MesaFormat);
+ cpp = _mesa_get_format_bytes(firstImage->base.TexFormat);
}
/* If we already have a gallium texture, check that it matches the texture
@@ -1835,7 +1835,7 @@ st_finalize_texture(GLcontext *ctx,
*/
if (stObj->pt) {
const enum pipe_format fmt =
- st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat);
+ st_mesa_format_to_pipe_format(firstImage->base.TexFormat);
if (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) ||
stObj->pt->format != fmt ||
stObj->pt->last_level < stObj->lastLevel ||
@@ -1854,7 +1854,7 @@ st_finalize_texture(GLcontext *ctx,
*/
if (!stObj->pt) {
const enum pipe_format fmt =
- st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat);
+ st_mesa_format_to_pipe_format(firstImage->base.TexFormat);
GLuint usage = default_usage(fmt);
stObj->pt = st_texture_create(ctx->st,
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index dcb90a3107..6f76e2d8c0 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -629,74 +629,74 @@ st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat)
}
-static const struct gl_texture_format *
+static gl_format
translate_gallium_format_to_mesa_format(enum pipe_format format)
{
switch (format) {
case PIPE_FORMAT_A8R8G8B8_UNORM:
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
case PIPE_FORMAT_A1R5G5B5_UNORM:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case PIPE_FORMAT_A4R4G4B4_UNORM:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case PIPE_FORMAT_R5G6B5_UNORM:
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
case PIPE_FORMAT_A8L8_UNORM:
- return &_mesa_texformat_al88;
+ return MESA_FORMAT_AL88;
case PIPE_FORMAT_A8_UNORM:
- return &_mesa_texformat_a8;
+ return MESA_FORMAT_A8;
case PIPE_FORMAT_L8_UNORM:
- return &_mesa_texformat_l8;
+ return MESA_FORMAT_L8;
case PIPE_FORMAT_I8_UNORM:
- return &_mesa_texformat_i8;
+ return MESA_FORMAT_I8;
case PIPE_FORMAT_Z16_UNORM:
- return &_mesa_texformat_z16;
+ return MESA_FORMAT_Z16;
case PIPE_FORMAT_Z32_UNORM:
- return &_mesa_texformat_z32;
+ return MESA_FORMAT_Z32;
case PIPE_FORMAT_Z24S8_UNORM:
- return &_mesa_texformat_z24_s8;
+ return MESA_FORMAT_Z24_S8;
case PIPE_FORMAT_S8Z24_UNORM:
- return &_mesa_texformat_s8_z24;
+ return MESA_FORMAT_S8_Z24;
case PIPE_FORMAT_YCBCR:
- return &_mesa_texformat_ycbcr;
+ return MESA_FORMAT_YCBCR;
case PIPE_FORMAT_YCBCR_REV:
- return &_mesa_texformat_ycbcr_rev;
+ return MESA_FORMAT_YCBCR_REV;
#if FEATURE_texture_s3tc
case PIPE_FORMAT_DXT1_RGB:
- return &_mesa_texformat_rgb_dxt1;
+ return MESA_FORMAT_RGB_DXT1;
case PIPE_FORMAT_DXT1_RGBA:
- return &_mesa_texformat_rgba_dxt1;
+ return MESA_FORMAT_RGBA_DXT1;
case PIPE_FORMAT_DXT3_RGBA:
- return &_mesa_texformat_rgba_dxt3;
+ return MESA_FORMAT_RGBA_DXT3;
case PIPE_FORMAT_DXT5_RGBA:
- return &_mesa_texformat_rgba_dxt5;
+ return MESA_FORMAT_RGBA_DXT5;
#if FEATURE_EXT_texture_sRGB
case PIPE_FORMAT_DXT1_SRGB:
- return &_mesa_texformat_srgb_dxt1;
+ return MESA_FORMAT_SRGB_DXT1;
case PIPE_FORMAT_DXT1_SRGBA:
- return &_mesa_texformat_srgba_dxt1;
+ return MESA_FORMAT_SRGBA_DXT1;
case PIPE_FORMAT_DXT3_SRGBA:
- return &_mesa_texformat_srgba_dxt3;
+ return MESA_FORMAT_SRGBA_DXT3;
case PIPE_FORMAT_DXT5_SRGBA:
- return &_mesa_texformat_srgba_dxt5;
+ return MESA_FORMAT_SRGBA_DXT5;
#endif
#endif
#if FEATURE_EXT_texture_sRGB
case PIPE_FORMAT_A8L8_SRGB:
- return &_mesa_texformat_sla8;
+ return MESA_FORMAT_SLA8;
case PIPE_FORMAT_L8_SRGB:
- return &_mesa_texformat_sl8;
+ return MESA_FORMAT_SL8;
case PIPE_FORMAT_R8G8B8_SRGB:
- return &_mesa_texformat_srgb8;
+ return MESA_FORMAT_SRGB8;
case PIPE_FORMAT_R8G8B8A8_SRGB:
- return &_mesa_texformat_srgba8;
+ return MESA_FORMAT_SRGBA8;
case PIPE_FORMAT_A8R8G8B8_SRGB:
- return &_mesa_texformat_sargb8;
+ return MESA_FORMAT_SARGB8;
#endif
/* XXX add additional cases */
default:
assert(0);
- return NULL;
+ return MESA_FORMAT_NONE;
}
}
@@ -704,7 +704,7 @@ translate_gallium_format_to_mesa_format(enum pipe_format format)
/**
* Called via ctx->Driver.chooseTextureFormat().
*/
-const struct gl_texture_format *
+gl_format
st_ChooseTextureFormat(GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type)
{
@@ -716,7 +716,7 @@ st_ChooseTextureFormat(GLcontext *ctx, GLint internalFormat,
pFormat = st_choose_format(ctx->st->pipe, internalFormat, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_SAMPLER);
if (pFormat == PIPE_FORMAT_NONE)
- return NULL;
+ return MESA_FORMAT_NONE;
return translate_gallium_format_to_mesa_format(pFormat);
}
diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h
index 9d9e02fe9b..1a8c6ea98f 100644
--- a/src/mesa/state_tracker/st_format.h
+++ b/src/mesa/state_tracker/st_format.h
@@ -29,6 +29,7 @@
#ifndef ST_FORMAT_H
#define ST_FORMAT_H
+#include "main/formats.h"
struct pipe_format_info
{
@@ -71,7 +72,7 @@ extern enum pipe_format
st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat);
-extern const struct gl_texture_format *
+extern gl_format
st_ChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
GLenum format, GLenum type);
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index 63a6956a7a..58f6933652 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -115,7 +115,7 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
assert(target != GL_TEXTURE_3D); /* not done yet */
- _mesa_format_to_type_and_comps(texObj->Image[face][baseLevel]->TexFormat->MesaFormat,
+ _mesa_format_to_type_and_comps(texObj->Image[face][baseLevel]->TexFormat,
&datatype, &comps);
for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index bbc2830e69..1790e1b28d 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -128,7 +128,7 @@ st_texture_match_image(const struct pipe_texture *pt,
/* Check if this image's format matches the established texture's format.
*/
- if (st_mesa_format_to_pipe_format(image->TexFormat->MesaFormat) != pt->format)
+ if (st_mesa_format_to_pipe_format(image->TexFormat) != pt->format)
return GL_FALSE;
/* Test if this image's size matches what's expected in the