mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
mesa, util: move RGB9E5 conversion functions to gallium/util
Also use MAX3 and incorporate Ian's suggestion in texformat.c. I don't think wrapping u_format_rgb9e5.h in another header and thus making it more complicated is worth it.
This commit is contained in:
parent
de9f55437a
commit
1271424615
7 changed files with 8 additions and 17 deletions
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "u_math.h"
|
||||
#include "u_format_other.h"
|
||||
#include "../../../mesa/main/rgb9e5.h"
|
||||
#include "u_format_rgb9e5.h"
|
||||
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -87,15 +87,6 @@ static INLINE float rgb9e5_ClampRange(float x)
|
|||
}
|
||||
}
|
||||
|
||||
static INLINE float rgb9e5_MaxOf3(float x, float y, float z)
|
||||
{
|
||||
if (x > y) {
|
||||
return MAX2(x, z);
|
||||
} else {
|
||||
return MAX2(y, z);
|
||||
}
|
||||
}
|
||||
|
||||
/* Ok, FloorLog2 is not correct for the denorm and zero values, but we
|
||||
are going to do a max of this value with the minimum rgb9e5 exponent
|
||||
that will hide these problem cases. */
|
||||
|
|
@ -120,7 +111,7 @@ static INLINE unsigned float3_to_rgb9e5(const float rgb[3])
|
|||
gc = rgb9e5_ClampRange(rgb[1]);
|
||||
bc = rgb9e5_ClampRange(rgb[2]);
|
||||
|
||||
maxrgb = rgb9e5_MaxOf3(rc, gc, bc);
|
||||
maxrgb = MAX3(rc, gc, bc);
|
||||
exp_shared = MAX2(-RGB9E5_EXP_BIAS-1, rgb9e5_FloorLog2(maxrgb)) + 1 + RGB9E5_EXP_BIAS;
|
||||
assert(exp_shared <= RGB9E5_MAX_VALID_BIASED_EXP);
|
||||
assert(exp_shared >= 0);
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
#include "texstore.h"
|
||||
#include "image.h"
|
||||
#include "macros.h"
|
||||
#include "rgb9e5.h"
|
||||
#include "../../gallium/auxiliary/util/u_format_rgb9e5.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
#include "pack.h"
|
||||
#include "pixeltransfer.h"
|
||||
#include "imports.h"
|
||||
#include "rgb9e5.h"
|
||||
#include "../../gallium/auxiliary/util/u_format_rgb9e5.h"
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#include "texcompress_rgtc.h"
|
||||
#include "texfetch.h"
|
||||
#include "teximage.h"
|
||||
#include "rgb9e5.h"
|
||||
#include "../../gallium/auxiliary/util/u_format_rgb9e5.h"
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -385,8 +385,8 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
|
|||
if (ctx->Extensions.EXT_texture_shared_exponent) {
|
||||
switch (internalFormat) {
|
||||
case GL_RGB9_E5:
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGB9_E5_FLOAT);
|
||||
break;
|
||||
ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_RGB9_E5_FLOAT]);
|
||||
return MESA_FORMAT_RGB9_E5_FLOAT;
|
||||
default:
|
||||
; /* fallthrough */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
#include "teximage.h"
|
||||
#include "texstore.h"
|
||||
#include "enums.h"
|
||||
#include "rgb9e5.h"
|
||||
#include "../../gallium/auxiliary/util/u_format_rgb9e5.h"
|
||||
|
||||
|
||||
enum {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue