📄 texformat_tmp.h
字号:
#if DIM == 3
static void store_texel_depth_component16(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLushort *depth = (const GLushort *) texel;
GLushort *dst = USHORT_ADDR(texImage, i, j, k);
dst[0] = *depth;
}
#endif
/* MESA_FORMAT_RGBA_F32 ******************************************************/
/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture, returning 4 GLchans.
*/
static void FETCH(rgba_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 4 );
UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]);
UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], src[1]);
UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], src[2]);
UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[3]);
}
/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture, returning 4 GLfloats.
*/
static void FETCH(f_rgba_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 4 );
texel[RCOMP] = src[0];
texel[GCOMP] = src[1];
texel[BCOMP] = src[2];
texel[ACOMP] = src[3];
}
#if DIM == 3
static void store_texel_rgba_f32(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *depth = (const GLfloat *) texel;
GLfloat *dst = FLOAT_ADDR(texImage, i, j, k, 1);
dst[0] = depth[RCOMP];
dst[1] = depth[GCOMP];
dst[2] = depth[BCOMP];
dst[3] = depth[ACOMP];
}
#endif
/* MESA_FORMAT_RGBA_F16 ******************************************************/
/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
* returning 4 GLchans.
*/
static void FETCH(rgba_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 4 );
UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0]));
UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], _mesa_half_to_float(src[1]));
UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], _mesa_half_to_float(src[2]));
UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], _mesa_half_to_float(src[3]));
}
/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_rgba_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 4 );
texel[RCOMP] = _mesa_half_to_float(src[0]);
texel[GCOMP] = _mesa_half_to_float(src[1]);
texel[BCOMP] = _mesa_half_to_float(src[2]);
texel[ACOMP] = _mesa_half_to_float(src[3]);
}
#if DIM == 3
static void store_texel_rgba_f16(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *depth = (const GLfloat *) texel;
GLhalfARB *dst = HALF_ADDR(texImage, i, j, k, 1);
dst[0] = _mesa_float_to_half(*depth);
}
#endif
/* MESA_FORMAT_RGB_F32 *******************************************************/
/* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture,
* returning 4 GLchans.
*/
static void FETCH(rgb_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 3 );
UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]);
UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], src[1]);
UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], src[2]);
texel[ACOMP] = CHAN_MAX;
}
/* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_rgb_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 3 );
texel[RCOMP] = src[0];
texel[GCOMP] = src[1];
texel[BCOMP] = src[2];
texel[ACOMP] = 1.0F;
}
#if DIM == 3
static void store_texel_rgb_f32(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *depth = (const GLfloat *) texel;
GLfloat *dst = FLOAT_ADDR(texImage, i, j, k, 1);
dst[0] = *depth;
}
#endif
/* MESA_FORAMT_RGB_F16 *******************************************************/
/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
* returning 4 GLchans.
*/
static void FETCH(rgb_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 3 );
UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0]));
UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], _mesa_half_to_float(src[1]));
UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], _mesa_half_to_float(src[2]));
texel[ACOMP] = CHAN_MAX;
}
/* Fetch texel from 1D, 2D or 3D RGB_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_rgb_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 3 );
texel[RCOMP] = _mesa_half_to_float(src[0]);
texel[GCOMP] = _mesa_half_to_float(src[1]);
texel[BCOMP] = _mesa_half_to_float(src[2]);
texel[ACOMP] = 1.0F;
}
#if DIM == 3
static void store_texel_rgb_f16(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *depth = (const GLfloat *) texel;
GLhalfARB *dst = HALF_ADDR(texImage, i, j, k, 1);
dst[0] = _mesa_float_to_half(*depth);
}
#endif
/* MESA_FORMAT_ALPHA_F32 *****************************************************/
/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
* returning 4 GLchans.
*/
static void FETCH(alpha_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 1 );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = 0;
UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[0]);
}
/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_alpha_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 1 );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = 0.0F;
texel[ACOMP] = src[0];
}
#if DIM == 3
static void store_texel_alpha_f32(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *rgba = (const GLfloat *) texel;
GLfloat *dst = FLOAT_ADDR(texImage, i, j, k, 1);
dst[0] = rgba[ACOMP];
}
#endif
/* MESA_FORMAT_ALPHA_F32 *****************************************************/
/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
* returning 4 GLchans.
*/
static void FETCH(alpha_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 1 );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = 0;
UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], _mesa_half_to_float(src[0]));
}
/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_alpha_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 1 );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = 0.0F;
texel[ACOMP] = _mesa_half_to_float(src[0]);
}
#if DIM == 3
static void store_texel_alpha_f16(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *rgba = (const GLfloat *) texel;
GLhalfARB *dst = HALF_ADDR(texImage, i, j, k, 1);
dst[0] = _mesa_float_to_half(rgba[ACOMP]);
}
#endif
/* MESA_FORMAT_LUMINANCE_F32 *************************************************/
/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
* returning 4 GLchans.
*/
static void FETCH(luminance_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 1 );
UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]);
texel[GCOMP] =
texel[BCOMP] = texel[RCOMP];
texel[ACOMP] = CHAN_MAX;
}
/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_luminance_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 1 );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = src[0];
texel[ACOMP] = 1.0F;
}
#if DIM == 3
static void store_texel_luminance_f32(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *rgba = (const GLfloat *) texel;
GLfloat *dst = FLOAT_ADDR(texImage, i, j, k, 1);
dst[0] = rgba[RCOMP];
}
#endif
/* MESA_FORMAT_LUMINANCE_F16 *************************************************/
/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
* returning 4 GLchans.
*/
static void FETCH(luminance_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 1 );
UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0]));
texel[GCOMP] =
texel[BCOMP] = texel[RCOMP];
texel[ACOMP] = CHAN_MAX;
}
/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_luminance_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 1 );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = _mesa_half_to_float(src[0]);
texel[ACOMP] = 1.0F;
}
#if DIM == 3
static void store_texel_luminance_f16(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
const GLfloat *rgba = (const GLfloat *) texel;
GLhalfARB *dst = HALF_ADDR(texImage, i, j, k, 1);
dst[0] = _mesa_float_to_half(rgba[RCOMP]);
}
#endif
/* MESA_FORMAT_LUMINANCE_ALPHA_F32 *******************************************/
/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
* returning 4 GLchans.
*/
static void FETCH(luminance_alpha_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 2 );
UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]);
texel[GCOMP] =
texel[BCOMP] = texel[RCOMP];
UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[1]);
}
/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_luminance_alpha_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 2 );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = src[0];
texel[ACOMP] = src[1];
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -