mesa: move gl_texture_image::FetchTexel fields to swrast
This also involves passing swrast_texture_image instead of gl_texture_image into all the fetch functions.
This commit is contained in:
@@ -1252,37 +1252,6 @@ typedef enum
|
|||||||
#define ENABLE_TEXMAT(unit) (1 << (unit))
|
#define ENABLE_TEXMAT(unit) (1 << (unit))
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Texel fetch function prototype. We use texel fetch functions to
|
|
||||||
* extract RGBA, color indexes and depth components out of 1D, 2D and 3D
|
|
||||||
* texture images. These functions help to isolate us from the gritty
|
|
||||||
* details of all the various texture image encodings.
|
|
||||||
*
|
|
||||||
* \param texImage texture image.
|
|
||||||
* \param col texel column.
|
|
||||||
* \param row texel row.
|
|
||||||
* \param img texel image level/layer.
|
|
||||||
* \param texelOut output texel (up to 4 GLchans)
|
|
||||||
*/
|
|
||||||
typedef void (*FetchTexelFuncC)( const struct gl_texture_image *texImage,
|
|
||||||
GLint col, GLint row, GLint img,
|
|
||||||
GLchan *texelOut );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* As above, but returns floats.
|
|
||||||
* Used for depth component images and for upcoming signed/float
|
|
||||||
* texture images.
|
|
||||||
*/
|
|
||||||
typedef void (*FetchTexelFuncF)( const struct gl_texture_image *texImage,
|
|
||||||
GLint col, GLint row, GLint img,
|
|
||||||
GLfloat *texelOut );
|
|
||||||
|
|
||||||
|
|
||||||
typedef void (*StoreTexelFunc)(struct gl_texture_image *texImage,
|
|
||||||
GLint col, GLint row, GLint img,
|
|
||||||
const void *texel);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Texture image state. Describes the dimensions of a texture image,
|
* Texture image state. Describes the dimensions of a texture image,
|
||||||
* the texel format and pointers to Texel Fetch functions.
|
* the texel format and pointers to Texel Fetch functions.
|
||||||
@@ -1320,9 +1289,6 @@ struct gl_texture_image
|
|||||||
/** Cube map face: index into gl_texture_object::Image[] array */
|
/** Cube map face: index into gl_texture_object::Image[] array */
|
||||||
GLuint Face;
|
GLuint Face;
|
||||||
|
|
||||||
FetchTexelFuncC FetchTexelc; /**< GLchan texel fetch function pointer */
|
|
||||||
FetchTexelFuncF FetchTexelf; /**< Float texel fetch function pointer */
|
|
||||||
|
|
||||||
GLuint RowStride; /**< Padded width in units of texels */
|
GLuint RowStride; /**< Padded width in units of texels */
|
||||||
GLuint *ImageOffsets; /**< if 3D texture: array [Depth] of offsets to
|
GLuint *ImageOffsets; /**< if 3D texture: array [Depth] of offsets to
|
||||||
each 2D slice in 'Data', in texels */
|
each 2D slice in 'Data', in texels */
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#include "texcompress_fxt1.h"
|
#include "texcompress_fxt1.h"
|
||||||
#include "texcompress_rgtc.h"
|
#include "texcompress_rgtc.h"
|
||||||
#include "texcompress_s3tc.h"
|
#include "texcompress_s3tc.h"
|
||||||
|
#include "swrast/s_context.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -451,15 +452,15 @@ _mesa_decompress_image(gl_format format, GLuint width, GLuint height,
|
|||||||
const GLubyte *src, GLint srcRowStride,
|
const GLubyte *src, GLint srcRowStride,
|
||||||
GLfloat *dest)
|
GLfloat *dest)
|
||||||
{
|
{
|
||||||
void (*fetch)(const struct gl_texture_image *texImage,
|
void (*fetch)(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
struct gl_texture_image texImage; /* dummy teximage */
|
struct swrast_texture_image texImage; /* dummy teximage */
|
||||||
GLuint i, j;
|
GLuint i, j;
|
||||||
|
|
||||||
/* setup dummy texture image info */
|
/* setup dummy texture image info */
|
||||||
memset(&texImage, 0, sizeof(texImage));
|
memset(&texImage, 0, sizeof(texImage));
|
||||||
texImage.Data = (void *) src;
|
texImage.Base.Data = (void *) src;
|
||||||
texImage.RowStride = srcRowStride;
|
texImage.Base.RowStride = srcRowStride;
|
||||||
|
|
||||||
switch (format) {
|
switch (format) {
|
||||||
/* DXT formats */
|
/* DXT formats */
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
#include "texcompress.h"
|
#include "texcompress.h"
|
||||||
#include "texcompress_fxt1.h"
|
#include "texcompress_fxt1.h"
|
||||||
#include "texstore.h"
|
#include "texstore.h"
|
||||||
|
#include "swrast/s_context.h"
|
||||||
|
|
||||||
|
|
||||||
#if FEATURE_texture_fxt1
|
#if FEATURE_texture_fxt1
|
||||||
@@ -167,13 +168,13 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_rgba_fxt1( const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel )
|
GLint i, GLint j, GLint k, GLfloat *texel )
|
||||||
{
|
{
|
||||||
/* just sample as GLchan and convert to float here */
|
/* just sample as GLchan and convert to float here */
|
||||||
GLchan rgba[4];
|
GLchan rgba[4];
|
||||||
(void) k;
|
(void) k;
|
||||||
fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, rgba);
|
fxt1_decode_1(texImage->Base.Data, texImage->Base.RowStride, i, j, rgba);
|
||||||
texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
|
texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
|
||||||
texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
|
texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
|
||||||
texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
|
texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
|
||||||
@@ -182,13 +183,13 @@ _mesa_fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_rgb_fxt1( const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel )
|
GLint i, GLint j, GLint k, GLfloat *texel )
|
||||||
{
|
{
|
||||||
/* just sample as GLchan and convert to float here */
|
/* just sample as GLchan and convert to float here */
|
||||||
GLchan rgba[4];
|
GLchan rgba[4];
|
||||||
(void) k;
|
(void) k;
|
||||||
fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, rgba);
|
fxt1_decode_1(texImage->Base.Data, texImage->Base.RowStride, i, j, rgba);
|
||||||
texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
|
texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]);
|
||||||
texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
|
texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]);
|
||||||
texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
|
texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]);
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
#include "mfeatures.h"
|
#include "mfeatures.h"
|
||||||
#include "texstore.h"
|
#include "texstore.h"
|
||||||
|
|
||||||
struct gl_texture_image;
|
struct swrast_texture_image;
|
||||||
|
|
||||||
#if FEATURE_texture_fxt1
|
#if FEATURE_texture_fxt1
|
||||||
|
|
||||||
@@ -40,11 +40,11 @@ extern GLboolean
|
|||||||
_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS);
|
_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_rgba_fxt1(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_rgba_fxt1(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_rgb_fxt1(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_rgb_fxt1(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
#else /* FEATURE_texture_fxt1 */
|
#else /* FEATURE_texture_fxt1 */
|
||||||
|
@@ -43,6 +43,8 @@
|
|||||||
#include "texcompress.h"
|
#include "texcompress.h"
|
||||||
#include "texcompress_rgtc.h"
|
#include "texcompress_rgtc.h"
|
||||||
#include "texstore.h"
|
#include "texstore.h"
|
||||||
|
#include "swrast/s_context.h"
|
||||||
|
|
||||||
|
|
||||||
#define RGTC_DEBUG 0
|
#define RGTC_DEBUG 0
|
||||||
|
|
||||||
@@ -323,11 +325,11 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_red_rgtc1(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_red_rgtc1(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel)
|
GLint i, GLint j, GLint k, GLfloat *texel)
|
||||||
{
|
{
|
||||||
GLubyte red;
|
GLubyte red;
|
||||||
unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data),
|
unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data),
|
||||||
i, j, &red, 1);
|
i, j, &red, 1);
|
||||||
texel[RCOMP] = UBYTE_TO_FLOAT(red);
|
texel[RCOMP] = UBYTE_TO_FLOAT(red);
|
||||||
texel[GCOMP] = 0.0;
|
texel[GCOMP] = 0.0;
|
||||||
@@ -336,11 +338,11 @@ _mesa_fetch_texel_2d_f_red_rgtc1(const struct gl_texture_image *texImage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel)
|
GLint i, GLint j, GLint k, GLfloat *texel)
|
||||||
{
|
{
|
||||||
GLbyte red;
|
GLbyte red;
|
||||||
signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
|
signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data),
|
||||||
i, j, &red, 1);
|
i, j, &red, 1);
|
||||||
texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
|
texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
|
||||||
texel[GCOMP] = 0.0;
|
texel[GCOMP] = 0.0;
|
||||||
@@ -349,13 +351,13 @@ _mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct gl_texture_image *texImage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_rg_rgtc2(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_rg_rgtc2(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel)
|
GLint i, GLint j, GLint k, GLfloat *texel)
|
||||||
{
|
{
|
||||||
GLubyte red, green;
|
GLubyte red, green;
|
||||||
unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data),
|
unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data),
|
||||||
i, j, &red, 2);
|
i, j, &red, 2);
|
||||||
unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data) + 8,
|
unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data) + 8,
|
||||||
i, j, &green, 2);
|
i, j, &green, 2);
|
||||||
texel[RCOMP] = UBYTE_TO_FLOAT(red);
|
texel[RCOMP] = UBYTE_TO_FLOAT(red);
|
||||||
texel[GCOMP] = UBYTE_TO_FLOAT(green);
|
texel[GCOMP] = UBYTE_TO_FLOAT(green);
|
||||||
@@ -364,13 +366,13 @@ _mesa_fetch_texel_2d_f_rg_rgtc2(const struct gl_texture_image *texImage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel)
|
GLint i, GLint j, GLint k, GLfloat *texel)
|
||||||
{
|
{
|
||||||
GLbyte red, green;
|
GLbyte red, green;
|
||||||
signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
|
signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data),
|
||||||
i, j, &red, 2);
|
i, j, &red, 2);
|
||||||
signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data) + 8,
|
signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data) + 8,
|
||||||
i, j, &green, 2);
|
i, j, &green, 2);
|
||||||
texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
|
texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
|
||||||
texel[GCOMP] = BYTE_TO_FLOAT_TEX(green);
|
texel[GCOMP] = BYTE_TO_FLOAT_TEX(green);
|
||||||
@@ -379,11 +381,11 @@ _mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct gl_texture_image *texImage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_l_latc1(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_l_latc1(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel)
|
GLint i, GLint j, GLint k, GLfloat *texel)
|
||||||
{
|
{
|
||||||
GLubyte red;
|
GLubyte red;
|
||||||
unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data),
|
unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data),
|
||||||
i, j, &red, 1);
|
i, j, &red, 1);
|
||||||
texel[RCOMP] =
|
texel[RCOMP] =
|
||||||
texel[GCOMP] =
|
texel[GCOMP] =
|
||||||
@@ -392,11 +394,11 @@ _mesa_fetch_texel_2d_f_l_latc1(const struct gl_texture_image *texImage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_signed_l_latc1(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_signed_l_latc1(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel)
|
GLint i, GLint j, GLint k, GLfloat *texel)
|
||||||
{
|
{
|
||||||
GLbyte red;
|
GLbyte red;
|
||||||
signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
|
signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data),
|
||||||
i, j, &red, 1);
|
i, j, &red, 1);
|
||||||
texel[RCOMP] =
|
texel[RCOMP] =
|
||||||
texel[GCOMP] =
|
texel[GCOMP] =
|
||||||
@@ -405,13 +407,13 @@ _mesa_fetch_texel_2d_f_signed_l_latc1(const struct gl_texture_image *texImage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_la_latc2(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_la_latc2(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel)
|
GLint i, GLint j, GLint k, GLfloat *texel)
|
||||||
{
|
{
|
||||||
GLubyte red, green;
|
GLubyte red, green;
|
||||||
unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data),
|
unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data),
|
||||||
i, j, &red, 2);
|
i, j, &red, 2);
|
||||||
unsigned_fetch_texel_rgtc(texImage->RowStride, (GLubyte *)(texImage->Data) + 8,
|
unsigned_fetch_texel_rgtc(texImage->Base.RowStride, (GLubyte *)(texImage->Base.Data) + 8,
|
||||||
i, j, &green, 2);
|
i, j, &green, 2);
|
||||||
texel[RCOMP] =
|
texel[RCOMP] =
|
||||||
texel[GCOMP] =
|
texel[GCOMP] =
|
||||||
@@ -420,13 +422,13 @@ _mesa_fetch_texel_2d_f_la_latc2(const struct gl_texture_image *texImage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_signed_la_latc2(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_signed_la_latc2(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel)
|
GLint i, GLint j, GLint k, GLfloat *texel)
|
||||||
{
|
{
|
||||||
GLbyte red, green;
|
GLbyte red, green;
|
||||||
signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data),
|
signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data),
|
||||||
i, j, &red, 2);
|
i, j, &red, 2);
|
||||||
signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Data) + 8,
|
signed_fetch_texel_rgtc(texImage->Base.RowStride, (GLbyte *)(texImage->Base.Data) + 8,
|
||||||
i, j, &green, 2);
|
i, j, &green, 2);
|
||||||
texel[RCOMP] =
|
texel[RCOMP] =
|
||||||
texel[GCOMP] =
|
texel[GCOMP] =
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "mfeatures.h"
|
#include "mfeatures.h"
|
||||||
#include "texstore.h"
|
#include "texstore.h"
|
||||||
|
|
||||||
struct gl_texture_image;
|
struct swrast_texture_image;
|
||||||
|
|
||||||
extern GLboolean
|
extern GLboolean
|
||||||
_mesa_texstore_red_rgtc1(TEXSTORE_PARAMS);
|
_mesa_texstore_red_rgtc1(TEXSTORE_PARAMS);
|
||||||
@@ -43,35 +43,35 @@ extern GLboolean
|
|||||||
_mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS);
|
_mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_red_rgtc1(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_red_rgtc1(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_rg_rgtc2(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_rg_rgtc2(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_l_latc1(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_l_latc1(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_signed_l_latc1(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_signed_l_latc1(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_la_latc2(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_la_latc2(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_signed_la_latc2(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_signed_la_latc2(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -44,6 +44,7 @@
|
|||||||
#include "texcompress.h"
|
#include "texcompress.h"
|
||||||
#include "texcompress_s3tc.h"
|
#include "texcompress_s3tc.h"
|
||||||
#include "texstore.h"
|
#include "texstore.h"
|
||||||
|
#include "swrast/s_context.h"
|
||||||
|
|
||||||
|
|
||||||
#if FEATURE_texture_s3tc
|
#if FEATURE_texture_s3tc
|
||||||
@@ -388,14 +389,14 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage,
|
fetch_texel_2d_rgb_dxt1( const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLchan *texel )
|
GLint i, GLint j, GLint k, GLchan *texel )
|
||||||
{
|
{
|
||||||
(void) k;
|
(void) k;
|
||||||
if (fetch_ext_rgb_dxt1) {
|
if (fetch_ext_rgb_dxt1) {
|
||||||
ASSERT (sizeof(GLchan) == sizeof(GLubyte));
|
ASSERT (sizeof(GLchan) == sizeof(GLubyte));
|
||||||
fetch_ext_rgb_dxt1(texImage->RowStride,
|
fetch_ext_rgb_dxt1(texImage->Base.RowStride,
|
||||||
(GLubyte *)(texImage)->Data, i, j, texel);
|
(GLubyte *)(texImage)->Base.Data, i, j, texel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgb_dxt1");
|
_mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgb_dxt1");
|
||||||
@@ -403,7 +404,7 @@ fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_rgb_dxt1(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel)
|
GLint i, GLint j, GLint k, GLfloat *texel)
|
||||||
{
|
{
|
||||||
/* just sample as GLchan and convert to float here */
|
/* just sample as GLchan and convert to float here */
|
||||||
@@ -417,13 +418,13 @@ _mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage,
|
fetch_texel_2d_rgba_dxt1( const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLchan *texel )
|
GLint i, GLint j, GLint k, GLchan *texel )
|
||||||
{
|
{
|
||||||
(void) k;
|
(void) k;
|
||||||
if (fetch_ext_rgba_dxt1) {
|
if (fetch_ext_rgba_dxt1) {
|
||||||
fetch_ext_rgba_dxt1(texImage->RowStride,
|
fetch_ext_rgba_dxt1(texImage->Base.RowStride,
|
||||||
(GLubyte *)(texImage)->Data, i, j, texel);
|
(GLubyte *)(texImage)->Base.Data, i, j, texel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt1\n");
|
_mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt1\n");
|
||||||
@@ -431,7 +432,7 @@ fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_rgba_dxt1(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel)
|
GLint i, GLint j, GLint k, GLfloat *texel)
|
||||||
{
|
{
|
||||||
/* just sample as GLchan and convert to float here */
|
/* just sample as GLchan and convert to float here */
|
||||||
@@ -445,13 +446,14 @@ _mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage,
|
fetch_texel_2d_rgba_dxt3( const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLchan *texel )
|
GLint i, GLint j, GLint k, GLchan *texel )
|
||||||
{
|
{
|
||||||
(void) k;
|
(void) k;
|
||||||
if (fetch_ext_rgba_dxt3) {
|
if (fetch_ext_rgba_dxt3) {
|
||||||
ASSERT (sizeof(GLchan) == sizeof(GLubyte));
|
ASSERT (sizeof(GLchan) == sizeof(GLubyte));
|
||||||
fetch_ext_rgba_dxt3(texImage->RowStride, (GLubyte *)(texImage)->Data,
|
fetch_ext_rgba_dxt3(texImage->Base.RowStride,
|
||||||
|
(GLubyte *)(texImage)->Base.Data,
|
||||||
i, j, texel);
|
i, j, texel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -460,7 +462,7 @@ fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_rgba_dxt3(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel)
|
GLint i, GLint j, GLint k, GLfloat *texel)
|
||||||
{
|
{
|
||||||
/* just sample as GLchan and convert to float here */
|
/* just sample as GLchan and convert to float here */
|
||||||
@@ -474,12 +476,13 @@ _mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage,
|
fetch_texel_2d_rgba_dxt5( const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLchan *texel )
|
GLint i, GLint j, GLint k, GLchan *texel )
|
||||||
{
|
{
|
||||||
(void) k;
|
(void) k;
|
||||||
if (fetch_ext_rgba_dxt5) {
|
if (fetch_ext_rgba_dxt5) {
|
||||||
fetch_ext_rgba_dxt5(texImage->RowStride, (GLubyte *)(texImage)->Data,
|
fetch_ext_rgba_dxt5(texImage->Base.RowStride,
|
||||||
|
(GLubyte *)(texImage)->Base.Data,
|
||||||
i, j, texel);
|
i, j, texel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -488,7 +491,7 @@ fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_rgba_dxt5(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel)
|
GLint i, GLint j, GLint k, GLfloat *texel)
|
||||||
{
|
{
|
||||||
/* just sample as GLchan and convert to float here */
|
/* just sample as GLchan and convert to float here */
|
||||||
@@ -502,7 +505,7 @@ _mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage,
|
|||||||
|
|
||||||
#if FEATURE_EXT_texture_sRGB
|
#if FEATURE_EXT_texture_sRGB
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_srgb_dxt1( const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel )
|
GLint i, GLint j, GLint k, GLfloat *texel )
|
||||||
{
|
{
|
||||||
/* just sample as GLchan and convert to float here */
|
/* just sample as GLchan and convert to float here */
|
||||||
@@ -515,7 +518,7 @@ _mesa_fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_srgba_dxt1(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel)
|
GLint i, GLint j, GLint k, GLfloat *texel)
|
||||||
{
|
{
|
||||||
/* just sample as GLchan and convert to float here */
|
/* just sample as GLchan and convert to float here */
|
||||||
@@ -528,7 +531,7 @@ _mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_srgba_dxt3(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel)
|
GLint i, GLint j, GLint k, GLfloat *texel)
|
||||||
{
|
{
|
||||||
/* just sample as GLchan and convert to float here */
|
/* just sample as GLchan and convert to float here */
|
||||||
@@ -541,7 +544,7 @@ _mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_srgba_dxt5(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel)
|
GLint i, GLint j, GLint k, GLfloat *texel)
|
||||||
{
|
{
|
||||||
/* just sample as GLchan and convert to float here */
|
/* just sample as GLchan and convert to float here */
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
#include "texstore.h"
|
#include "texstore.h"
|
||||||
|
|
||||||
struct gl_context;
|
struct gl_context;
|
||||||
struct gl_texture_image;
|
struct swrast_texture_image;
|
||||||
|
|
||||||
#if FEATURE_texture_s3tc
|
#if FEATURE_texture_s3tc
|
||||||
|
|
||||||
@@ -48,35 +48,35 @@ extern GLboolean
|
|||||||
_mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS);
|
_mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_rgb_dxt1(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_rgba_dxt1(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_rgba_dxt3(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_rgba_dxt5(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_srgb_dxt1(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_srgb_dxt1(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_srgba_dxt1(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_srgba_dxt3(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage,
|
_mesa_fetch_texel_2d_f_srgba_dxt5(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel);
|
GLint i, GLint j, GLint k, GLfloat *texel);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
|
@@ -1076,8 +1076,6 @@ clear_teximage_fields(struct gl_texture_image *img)
|
|||||||
img->DepthLog2 = 0;
|
img->DepthLog2 = 0;
|
||||||
img->Data = NULL;
|
img->Data = NULL;
|
||||||
img->TexFormat = MESA_FORMAT_NONE;
|
img->TexFormat = MESA_FORMAT_NONE;
|
||||||
img->FetchTexelc = NULL;
|
|
||||||
img->FetchTexelf = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -109,6 +109,27 @@ typedef void (*validate_texture_image_func)(struct gl_context *ctx,
|
|||||||
_NEW_DEPTH)
|
_NEW_DEPTH)
|
||||||
|
|
||||||
|
|
||||||
|
struct swrast_texture_image;
|
||||||
|
|
||||||
|
|
||||||
|
typedef void (*FetchTexelFuncC)(const struct swrast_texture_image *texImage,
|
||||||
|
GLint col, GLint row, GLint img,
|
||||||
|
GLchan *texelOut);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* As above, but returns floats.
|
||||||
|
* Used for depth component images and for upcoming signed/float
|
||||||
|
* texture images.
|
||||||
|
*/
|
||||||
|
typedef void (*FetchTexelFuncF)(const struct swrast_texture_image *texImage,
|
||||||
|
GLint col, GLint row, GLint img,
|
||||||
|
GLfloat *texelOut);
|
||||||
|
|
||||||
|
|
||||||
|
typedef void (*StoreTexelFunc)(struct swrast_texture_image *texImage,
|
||||||
|
GLint col, GLint row, GLint img,
|
||||||
|
const void *texel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subclass of gl_texture_image.
|
* Subclass of gl_texture_image.
|
||||||
* We need extra fields/info to keep tracking of mapped texture buffers,
|
* We need extra fields/info to keep tracking of mapped texture buffers,
|
||||||
@@ -118,7 +139,25 @@ struct swrast_texture_image
|
|||||||
{
|
{
|
||||||
struct gl_texture_image Base;
|
struct gl_texture_image Base;
|
||||||
|
|
||||||
/* XXX new members coming soon */
|
#if 0
|
||||||
|
/** used for mipmap LOD computation */
|
||||||
|
GLfloat WidthScale, HeightScale, DepthScale;
|
||||||
|
GLboolean _IsPowerOfTwo; /**< Are all dimensions powers of two? */
|
||||||
|
|
||||||
|
GLubyte *Data; /**< The actual texture data in malloc'd memory */
|
||||||
|
|
||||||
|
GLint TexelSize; /**< bytes per texel block */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
FetchTexelFuncC FetchTexelc;
|
||||||
|
FetchTexelFuncF FetchTexelf;
|
||||||
|
StoreTexelFunc Store;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/** These fields only valid when texture memory is mapped */
|
||||||
|
GLubyte **SliceMaps; /**< points to OneMap or a malloc'd array */
|
||||||
|
GLint RowStride; /**< bytes per row of blocks */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -137,7 +176,6 @@ swrast_texture_image_const(const struct gl_texture_image *img)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \struct SWcontext
|
* \struct SWcontext
|
||||||
* \brief Per-context state that's private to the software rasterizer module.
|
* \brief Per-context state that's private to the software rasterizer module.
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#include "main/texcompress_s3tc.h"
|
#include "main/texcompress_s3tc.h"
|
||||||
#include "main/texcompress_rgtc.h"
|
#include "main/texcompress_rgtc.h"
|
||||||
#include "main/teximage.h"
|
#include "main/teximage.h"
|
||||||
|
#include "s_context.h"
|
||||||
#include "s_texfetch.h"
|
#include "s_texfetch.h"
|
||||||
#include "../../gallium/auxiliary/util/u_format_rgb9e5.h"
|
#include "../../gallium/auxiliary/util/u_format_rgb9e5.h"
|
||||||
#include "../../gallium/auxiliary/util/u_format_r11g11b10f.h"
|
#include "../../gallium/auxiliary/util/u_format_r11g11b10f.h"
|
||||||
@@ -90,7 +91,7 @@ nonlinear_to_linear(GLubyte cs8)
|
|||||||
*
|
*
|
||||||
* Have to have this so the FetchTexel function pointer is never NULL.
|
* Have to have this so the FetchTexel function pointer is never NULL.
|
||||||
*/
|
*/
|
||||||
static void fetch_null_texelf( const struct gl_texture_image *texImage,
|
static void fetch_null_texelf( const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texel )
|
GLint i, GLint j, GLint k, GLfloat *texel )
|
||||||
{
|
{
|
||||||
(void) texImage; (void) i; (void) j; (void) k;
|
(void) texImage; (void) i; (void) j; (void) k;
|
||||||
@@ -101,7 +102,7 @@ static void fetch_null_texelf( const struct gl_texture_image *texImage,
|
|||||||
_mesa_warning(NULL, "fetch_null_texelf() called!");
|
_mesa_warning(NULL, "fetch_null_texelf() called!");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void store_null_texel(struct gl_texture_image *texImage,
|
static void store_null_texel(struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, const void *texel)
|
GLint i, GLint j, GLint k, const void *texel)
|
||||||
{
|
{
|
||||||
(void) texImage;
|
(void) texImage;
|
||||||
@@ -964,11 +965,11 @@ _mesa_get_texel_store_func(gl_format format)
|
|||||||
* Adaptor for fetching a GLchan texel from a float-valued texture.
|
* Adaptor for fetching a GLchan texel from a float-valued texture.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
fetch_texel_float_to_chan(const struct gl_texture_image *texImage,
|
fetch_texel_float_to_chan(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLchan *texelOut)
|
GLint i, GLint j, GLint k, GLchan *texelOut)
|
||||||
{
|
{
|
||||||
GLfloat temp[4];
|
GLfloat temp[4];
|
||||||
GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
|
GLenum baseFormat = _mesa_get_format_base_format(texImage->Base.TexFormat);
|
||||||
|
|
||||||
ASSERT(texImage->FetchTexelf);
|
ASSERT(texImage->FetchTexelf);
|
||||||
texImage->FetchTexelf(texImage, i, j, k, temp);
|
texImage->FetchTexelf(texImage, i, j, k, temp);
|
||||||
@@ -992,7 +993,7 @@ fetch_texel_float_to_chan(const struct gl_texture_image *texImage,
|
|||||||
* Adaptor for fetching a float texel from a GLchan-valued texture.
|
* Adaptor for fetching a float texel from a GLchan-valued texture.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
fetch_texel_chan_to_float(const struct gl_texture_image *texImage,
|
fetch_texel_chan_to_float(const struct swrast_texture_image *texImage,
|
||||||
GLint i, GLint j, GLint k, GLfloat *texelOut)
|
GLint i, GLint j, GLint k, GLfloat *texelOut)
|
||||||
{
|
{
|
||||||
GLchan temp[4];
|
GLchan temp[4];
|
||||||
@@ -1019,14 +1020,14 @@ fetch_texel_chan_to_float(const struct gl_texture_image *texImage,
|
|||||||
/**
|
/**
|
||||||
* Initialize the texture image's FetchTexelc and FetchTexelf methods.
|
* Initialize the texture image's FetchTexelc and FetchTexelf methods.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims)
|
set_fetch_functions(struct swrast_texture_image *texImage, GLuint dims)
|
||||||
{
|
{
|
||||||
gl_format format = texImage->TexFormat;
|
gl_format format = texImage->Base.TexFormat;
|
||||||
|
|
||||||
ASSERT(dims == 1 || dims == 2 || dims == 3);
|
ASSERT(dims == 1 || dims == 2 || dims == 3);
|
||||||
|
|
||||||
if (texImage->TexObject->Sampler.sRGBDecode == GL_SKIP_DECODE_EXT &&
|
if (texImage->Base.TexObject->Sampler.sRGBDecode == GL_SKIP_DECODE_EXT &&
|
||||||
_mesa_get_format_color_encoding(format) == GL_SRGB) {
|
_mesa_get_format_color_encoding(format) == GL_SRGB) {
|
||||||
format = _mesa_get_srgb_format_linear(format);
|
format = _mesa_get_srgb_format_linear(format);
|
||||||
}
|
}
|
||||||
@@ -1050,7 +1051,8 @@ _mesa_update_fetch_functions(struct gl_texture_object *texObj)
|
|||||||
for (face = 0; face < 6; face++) {
|
for (face = 0; face < 6; face++) {
|
||||||
for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
|
for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
|
||||||
if (texObj->Image[face][i]) {
|
if (texObj->Image[face][i]) {
|
||||||
_mesa_set_fetch_functions(texObj->Image[face][i], dims);
|
set_fetch_functions(swrast_texture_image(texObj->Image[face][i]),
|
||||||
|
dims);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -35,9 +35,6 @@ _mesa_get_texel_store_func(gl_format format);
|
|||||||
extern FetchTexelFuncF
|
extern FetchTexelFuncF
|
||||||
_mesa_get_texel_fetch_func(gl_format format, GLuint dims);
|
_mesa_get_texel_fetch_func(gl_format format, GLuint dims);
|
||||||
|
|
||||||
extern void
|
|
||||||
_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_update_fetch_functions(struct gl_texture_object *texObj);
|
_mesa_update_fetch_functions(struct gl_texture_object *texObj);
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -802,6 +802,7 @@ sample_1d_nearest(struct gl_context *ctx,
|
|||||||
const struct gl_texture_image *img,
|
const struct gl_texture_image *img,
|
||||||
const GLfloat texcoord[4], GLfloat rgba[4])
|
const GLfloat texcoord[4], GLfloat rgba[4])
|
||||||
{
|
{
|
||||||
|
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
|
||||||
const GLint width = img->Width2; /* without border, power of two */
|
const GLint width = img->Width2; /* without border, power of two */
|
||||||
GLint i;
|
GLint i;
|
||||||
i = nearest_texel_location(tObj->Sampler.WrapS, img, width, texcoord[0]);
|
i = nearest_texel_location(tObj->Sampler.WrapS, img, width, texcoord[0]);
|
||||||
@@ -812,7 +813,7 @@ sample_1d_nearest(struct gl_context *ctx,
|
|||||||
get_border_color(tObj, img, rgba);
|
get_border_color(tObj, img, rgba);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i, 0, 0, rgba);
|
swImg->FetchTexelf(swImg, i, 0, 0, rgba);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -826,6 +827,7 @@ sample_1d_linear(struct gl_context *ctx,
|
|||||||
const struct gl_texture_image *img,
|
const struct gl_texture_image *img,
|
||||||
const GLfloat texcoord[4], GLfloat rgba[4])
|
const GLfloat texcoord[4], GLfloat rgba[4])
|
||||||
{
|
{
|
||||||
|
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
|
||||||
const GLint width = img->Width2;
|
const GLint width = img->Width2;
|
||||||
GLint i0, i1;
|
GLint i0, i1;
|
||||||
GLbitfield useBorderColor = 0x0;
|
GLbitfield useBorderColor = 0x0;
|
||||||
@@ -848,13 +850,13 @@ sample_1d_linear(struct gl_context *ctx,
|
|||||||
get_border_color(tObj, img, t0);
|
get_border_color(tObj, img, t0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i0, 0, 0, t0);
|
swImg->FetchTexelf(swImg, i0, 0, 0, t0);
|
||||||
}
|
}
|
||||||
if (useBorderColor & I1BIT) {
|
if (useBorderColor & I1BIT) {
|
||||||
get_border_color(tObj, img, t1);
|
get_border_color(tObj, img, t1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i1, 0, 0, t1);
|
swImg->FetchTexelf(swImg, i1, 0, 0, t1);
|
||||||
}
|
}
|
||||||
|
|
||||||
lerp_rgba(rgba, a, t0, t1);
|
lerp_rgba(rgba, a, t0, t1);
|
||||||
@@ -1060,6 +1062,7 @@ sample_2d_nearest(struct gl_context *ctx,
|
|||||||
const GLfloat texcoord[4],
|
const GLfloat texcoord[4],
|
||||||
GLfloat rgba[])
|
GLfloat rgba[])
|
||||||
{
|
{
|
||||||
|
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
|
||||||
const GLint width = img->Width2; /* without border, power of two */
|
const GLint width = img->Width2; /* without border, power of two */
|
||||||
const GLint height = img->Height2; /* without border, power of two */
|
const GLint height = img->Height2; /* without border, power of two */
|
||||||
GLint i, j;
|
GLint i, j;
|
||||||
@@ -1077,7 +1080,7 @@ sample_2d_nearest(struct gl_context *ctx,
|
|||||||
get_border_color(tObj, img, rgba);
|
get_border_color(tObj, img, rgba);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i, j, 0, rgba);
|
swImg->FetchTexelf(swImg, i, j, 0, rgba);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1093,6 +1096,7 @@ sample_2d_linear(struct gl_context *ctx,
|
|||||||
const GLfloat texcoord[4],
|
const GLfloat texcoord[4],
|
||||||
GLfloat rgba[])
|
GLfloat rgba[])
|
||||||
{
|
{
|
||||||
|
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
|
||||||
const GLint width = img->Width2;
|
const GLint width = img->Width2;
|
||||||
const GLint height = img->Height2;
|
const GLint height = img->Height2;
|
||||||
GLint i0, j0, i1, j1;
|
GLint i0, j0, i1, j1;
|
||||||
@@ -1121,25 +1125,25 @@ sample_2d_linear(struct gl_context *ctx,
|
|||||||
get_border_color(tObj, img, t00);
|
get_border_color(tObj, img, t00);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i0, j0, 0, t00);
|
swImg->FetchTexelf(swImg, i0, j0, 0, t00);
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I1BIT | J0BIT)) {
|
if (useBorderColor & (I1BIT | J0BIT)) {
|
||||||
get_border_color(tObj, img, t10);
|
get_border_color(tObj, img, t10);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i1, j0, 0, t10);
|
swImg->FetchTexelf(swImg, i1, j0, 0, t10);
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I0BIT | J1BIT)) {
|
if (useBorderColor & (I0BIT | J1BIT)) {
|
||||||
get_border_color(tObj, img, t01);
|
get_border_color(tObj, img, t01);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i0, j1, 0, t01);
|
swImg->FetchTexelf(swImg, i0, j1, 0, t01);
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I1BIT | J1BIT)) {
|
if (useBorderColor & (I1BIT | J1BIT)) {
|
||||||
get_border_color(tObj, img, t11);
|
get_border_color(tObj, img, t11);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i1, j1, 0, t11);
|
swImg->FetchTexelf(swImg, i1, j1, 0, t11);
|
||||||
}
|
}
|
||||||
|
|
||||||
lerp_rgba_2d(rgba, a, b, t00, t10, t01, t11);
|
lerp_rgba_2d(rgba, a, b, t00, t10, t01, t11);
|
||||||
@@ -1157,6 +1161,7 @@ sample_2d_linear_repeat(struct gl_context *ctx,
|
|||||||
const GLfloat texcoord[4],
|
const GLfloat texcoord[4],
|
||||||
GLfloat rgba[])
|
GLfloat rgba[])
|
||||||
{
|
{
|
||||||
|
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
|
||||||
const GLint width = img->Width2;
|
const GLint width = img->Width2;
|
||||||
const GLint height = img->Height2;
|
const GLint height = img->Height2;
|
||||||
GLint i0, j0, i1, j1;
|
GLint i0, j0, i1, j1;
|
||||||
@@ -1173,10 +1178,10 @@ sample_2d_linear_repeat(struct gl_context *ctx,
|
|||||||
linear_repeat_texel_location(width, texcoord[0], &i0, &i1, &wi);
|
linear_repeat_texel_location(width, texcoord[0], &i0, &i1, &wi);
|
||||||
linear_repeat_texel_location(height, texcoord[1], &j0, &j1, &wj);
|
linear_repeat_texel_location(height, texcoord[1], &j0, &j1, &wj);
|
||||||
|
|
||||||
img->FetchTexelf(img, i0, j0, 0, t00);
|
swImg->FetchTexelf(swImg, i0, j0, 0, t00);
|
||||||
img->FetchTexelf(img, i1, j0, 0, t10);
|
swImg->FetchTexelf(swImg, i1, j0, 0, t10);
|
||||||
img->FetchTexelf(img, i0, j1, 0, t01);
|
swImg->FetchTexelf(swImg, i0, j1, 0, t01);
|
||||||
img->FetchTexelf(img, i1, j1, 0, t11);
|
swImg->FetchTexelf(swImg, i1, j1, 0, t11);
|
||||||
|
|
||||||
lerp_rgba_2d(rgba, wi, wj, t00, t10, t01, t11);
|
lerp_rgba_2d(rgba, wi, wj, t00, t10, t01, t11);
|
||||||
}
|
}
|
||||||
@@ -1934,6 +1939,7 @@ sample_3d_nearest(struct gl_context *ctx,
|
|||||||
const GLfloat texcoord[4],
|
const GLfloat texcoord[4],
|
||||||
GLfloat rgba[4])
|
GLfloat rgba[4])
|
||||||
{
|
{
|
||||||
|
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
|
||||||
const GLint width = img->Width2; /* without border, power of two */
|
const GLint width = img->Width2; /* without border, power of two */
|
||||||
const GLint height = img->Height2; /* without border, power of two */
|
const GLint height = img->Height2; /* without border, power of two */
|
||||||
const GLint depth = img->Depth2; /* without border, power of two */
|
const GLint depth = img->Depth2; /* without border, power of two */
|
||||||
@@ -1951,7 +1957,7 @@ sample_3d_nearest(struct gl_context *ctx,
|
|||||||
get_border_color(tObj, img, rgba);
|
get_border_color(tObj, img, rgba);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i, j, k, rgba);
|
swImg->FetchTexelf(swImg, i, j, k, rgba);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1966,6 +1972,7 @@ sample_3d_linear(struct gl_context *ctx,
|
|||||||
const GLfloat texcoord[4],
|
const GLfloat texcoord[4],
|
||||||
GLfloat rgba[4])
|
GLfloat rgba[4])
|
||||||
{
|
{
|
||||||
|
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
|
||||||
const GLint width = img->Width2;
|
const GLint width = img->Width2;
|
||||||
const GLint height = img->Height2;
|
const GLint height = img->Height2;
|
||||||
const GLint depth = img->Depth2;
|
const GLint depth = img->Depth2;
|
||||||
@@ -2002,50 +2009,50 @@ sample_3d_linear(struct gl_context *ctx,
|
|||||||
get_border_color(tObj, img, t000);
|
get_border_color(tObj, img, t000);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i0, j0, k0, t000);
|
swImg->FetchTexelf(swImg, i0, j0, k0, t000);
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I1BIT | J0BIT | K0BIT)) {
|
if (useBorderColor & (I1BIT | J0BIT | K0BIT)) {
|
||||||
get_border_color(tObj, img, t100);
|
get_border_color(tObj, img, t100);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i1, j0, k0, t100);
|
swImg->FetchTexelf(swImg, i1, j0, k0, t100);
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I0BIT | J1BIT | K0BIT)) {
|
if (useBorderColor & (I0BIT | J1BIT | K0BIT)) {
|
||||||
get_border_color(tObj, img, t010);
|
get_border_color(tObj, img, t010);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i0, j1, k0, t010);
|
swImg->FetchTexelf(swImg, i0, j1, k0, t010);
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I1BIT | J1BIT | K0BIT)) {
|
if (useBorderColor & (I1BIT | J1BIT | K0BIT)) {
|
||||||
get_border_color(tObj, img, t110);
|
get_border_color(tObj, img, t110);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i1, j1, k0, t110);
|
swImg->FetchTexelf(swImg, i1, j1, k0, t110);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useBorderColor & (I0BIT | J0BIT | K1BIT)) {
|
if (useBorderColor & (I0BIT | J0BIT | K1BIT)) {
|
||||||
get_border_color(tObj, img, t001);
|
get_border_color(tObj, img, t001);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i0, j0, k1, t001);
|
swImg->FetchTexelf(swImg, i0, j0, k1, t001);
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I1BIT | J0BIT | K1BIT)) {
|
if (useBorderColor & (I1BIT | J0BIT | K1BIT)) {
|
||||||
get_border_color(tObj, img, t101);
|
get_border_color(tObj, img, t101);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i1, j0, k1, t101);
|
swImg->FetchTexelf(swImg, i1, j0, k1, t101);
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I0BIT | J1BIT | K1BIT)) {
|
if (useBorderColor & (I0BIT | J1BIT | K1BIT)) {
|
||||||
get_border_color(tObj, img, t011);
|
get_border_color(tObj, img, t011);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i0, j1, k1, t011);
|
swImg->FetchTexelf(swImg, i0, j1, k1, t011);
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I1BIT | J1BIT | K1BIT)) {
|
if (useBorderColor & (I1BIT | J1BIT | K1BIT)) {
|
||||||
get_border_color(tObj, img, t111);
|
get_border_color(tObj, img, t111);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i1, j1, k1, t111);
|
swImg->FetchTexelf(swImg, i1, j1, k1, t111);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* trilinear interpolation of samples */
|
/* trilinear interpolation of samples */
|
||||||
@@ -2544,6 +2551,7 @@ sample_nearest_rect(struct gl_context *ctx,
|
|||||||
GLfloat rgba[][4])
|
GLfloat rgba[][4])
|
||||||
{
|
{
|
||||||
const struct gl_texture_image *img = tObj->Image[0][0];
|
const struct gl_texture_image *img = tObj->Image[0][0];
|
||||||
|
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
|
||||||
const GLint width = img->Width;
|
const GLint width = img->Width;
|
||||||
const GLint height = img->Height;
|
const GLint height = img->Height;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
@@ -2565,7 +2573,7 @@ sample_nearest_rect(struct gl_context *ctx,
|
|||||||
if (col < 0 || col >= width || row < 0 || row >= height)
|
if (col < 0 || col >= width || row < 0 || row >= height)
|
||||||
get_border_color(tObj, img, rgba[i]);
|
get_border_color(tObj, img, rgba[i]);
|
||||||
else
|
else
|
||||||
img->FetchTexelf(img, col, row, 0, rgba[i]);
|
swImg->FetchTexelf(swImg, col, row, 0, rgba[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2577,6 +2585,7 @@ sample_linear_rect(struct gl_context *ctx,
|
|||||||
const GLfloat lambda[], GLfloat rgba[][4])
|
const GLfloat lambda[], GLfloat rgba[][4])
|
||||||
{
|
{
|
||||||
const struct gl_texture_image *img = tObj->Image[0][0];
|
const struct gl_texture_image *img = tObj->Image[0][0];
|
||||||
|
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
|
||||||
const GLint width = img->Width;
|
const GLint width = img->Width;
|
||||||
const GLint height = img->Height;
|
const GLint height = img->Height;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
@@ -2612,22 +2621,22 @@ sample_linear_rect(struct gl_context *ctx,
|
|||||||
if (useBorderColor & (I0BIT | J0BIT))
|
if (useBorderColor & (I0BIT | J0BIT))
|
||||||
get_border_color(tObj, img, t00);
|
get_border_color(tObj, img, t00);
|
||||||
else
|
else
|
||||||
img->FetchTexelf(img, i0, j0, 0, t00);
|
swImg->FetchTexelf(swImg, i0, j0, 0, t00);
|
||||||
|
|
||||||
if (useBorderColor & (I1BIT | J0BIT))
|
if (useBorderColor & (I1BIT | J0BIT))
|
||||||
get_border_color(tObj, img, t10);
|
get_border_color(tObj, img, t10);
|
||||||
else
|
else
|
||||||
img->FetchTexelf(img, i1, j0, 0, t10);
|
swImg->FetchTexelf(swImg, i1, j0, 0, t10);
|
||||||
|
|
||||||
if (useBorderColor & (I0BIT | J1BIT))
|
if (useBorderColor & (I0BIT | J1BIT))
|
||||||
get_border_color(tObj, img, t01);
|
get_border_color(tObj, img, t01);
|
||||||
else
|
else
|
||||||
img->FetchTexelf(img, i0, j1, 0, t01);
|
swImg->FetchTexelf(swImg, i0, j1, 0, t01);
|
||||||
|
|
||||||
if (useBorderColor & (I1BIT | J1BIT))
|
if (useBorderColor & (I1BIT | J1BIT))
|
||||||
get_border_color(tObj, img, t11);
|
get_border_color(tObj, img, t11);
|
||||||
else
|
else
|
||||||
img->FetchTexelf(img, i1, j1, 0, t11);
|
swImg->FetchTexelf(swImg, i1, j1, 0, t11);
|
||||||
|
|
||||||
lerp_rgba_2d(rgba[i], a, b, t00, t10, t01, t11);
|
lerp_rgba_2d(rgba[i], a, b, t00, t10, t01, t11);
|
||||||
}
|
}
|
||||||
@@ -2686,6 +2695,7 @@ sample_2d_array_nearest(struct gl_context *ctx,
|
|||||||
const GLfloat texcoord[4],
|
const GLfloat texcoord[4],
|
||||||
GLfloat rgba[4])
|
GLfloat rgba[4])
|
||||||
{
|
{
|
||||||
|
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
|
||||||
const GLint width = img->Width2; /* without border, power of two */
|
const GLint width = img->Width2; /* without border, power of two */
|
||||||
const GLint height = img->Height2; /* without border, power of two */
|
const GLint height = img->Height2; /* without border, power of two */
|
||||||
const GLint depth = img->Depth;
|
const GLint depth = img->Depth;
|
||||||
@@ -2704,7 +2714,7 @@ sample_2d_array_nearest(struct gl_context *ctx,
|
|||||||
get_border_color(tObj, img, rgba);
|
get_border_color(tObj, img, rgba);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i, j, array, rgba);
|
swImg->FetchTexelf(swImg, i, j, array, rgba);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2719,6 +2729,7 @@ sample_2d_array_linear(struct gl_context *ctx,
|
|||||||
const GLfloat texcoord[4],
|
const GLfloat texcoord[4],
|
||||||
GLfloat rgba[4])
|
GLfloat rgba[4])
|
||||||
{
|
{
|
||||||
|
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
|
||||||
const GLint width = img->Width2;
|
const GLint width = img->Width2;
|
||||||
const GLint height = img->Height2;
|
const GLint height = img->Height2;
|
||||||
const GLint depth = img->Depth;
|
const GLint depth = img->Depth;
|
||||||
@@ -2755,25 +2766,25 @@ sample_2d_array_linear(struct gl_context *ctx,
|
|||||||
get_border_color(tObj, img, t00);
|
get_border_color(tObj, img, t00);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i0, j0, array, t00);
|
swImg->FetchTexelf(swImg, i0, j0, array, t00);
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I1BIT | J0BIT)) {
|
if (useBorderColor & (I1BIT | J0BIT)) {
|
||||||
get_border_color(tObj, img, t10);
|
get_border_color(tObj, img, t10);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i1, j0, array, t10);
|
swImg->FetchTexelf(swImg, i1, j0, array, t10);
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I0BIT | J1BIT)) {
|
if (useBorderColor & (I0BIT | J1BIT)) {
|
||||||
get_border_color(tObj, img, t01);
|
get_border_color(tObj, img, t01);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i0, j1, array, t01);
|
swImg->FetchTexelf(swImg, i0, j1, array, t01);
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I1BIT | J1BIT)) {
|
if (useBorderColor & (I1BIT | J1BIT)) {
|
||||||
get_border_color(tObj, img, t11);
|
get_border_color(tObj, img, t11);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i1, j1, array, t11);
|
swImg->FetchTexelf(swImg, i1, j1, array, t11);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* trilinear interpolation of samples */
|
/* trilinear interpolation of samples */
|
||||||
@@ -2996,6 +3007,7 @@ sample_1d_array_nearest(struct gl_context *ctx,
|
|||||||
const GLfloat texcoord[4],
|
const GLfloat texcoord[4],
|
||||||
GLfloat rgba[4])
|
GLfloat rgba[4])
|
||||||
{
|
{
|
||||||
|
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
|
||||||
const GLint width = img->Width2; /* without border, power of two */
|
const GLint width = img->Width2; /* without border, power of two */
|
||||||
const GLint height = img->Height;
|
const GLint height = img->Height;
|
||||||
GLint i;
|
GLint i;
|
||||||
@@ -3011,7 +3023,7 @@ sample_1d_array_nearest(struct gl_context *ctx,
|
|||||||
get_border_color(tObj, img, rgba);
|
get_border_color(tObj, img, rgba);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i, array, 0, rgba);
|
swImg->FetchTexelf(swImg, i, array, 0, rgba);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3026,6 +3038,7 @@ sample_1d_array_linear(struct gl_context *ctx,
|
|||||||
const GLfloat texcoord[4],
|
const GLfloat texcoord[4],
|
||||||
GLfloat rgba[4])
|
GLfloat rgba[4])
|
||||||
{
|
{
|
||||||
|
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
|
||||||
const GLint width = img->Width2;
|
const GLint width = img->Width2;
|
||||||
const GLint height = img->Height;
|
const GLint height = img->Height;
|
||||||
GLint i0, i1;
|
GLint i0, i1;
|
||||||
@@ -3054,13 +3067,13 @@ sample_1d_array_linear(struct gl_context *ctx,
|
|||||||
get_border_color(tObj, img, t0);
|
get_border_color(tObj, img, t0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i0, array, 0, t0);
|
swImg->FetchTexelf(swImg, i0, array, 0, t0);
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I1BIT | K0BIT)) {
|
if (useBorderColor & (I1BIT | K0BIT)) {
|
||||||
get_border_color(tObj, img, t1);
|
get_border_color(tObj, img, t1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i1, array, 0, t1);
|
swImg->FetchTexelf(swImg, i1, array, 0, t1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bilinear interpolation of samples */
|
/* bilinear interpolation of samples */
|
||||||
@@ -3388,6 +3401,7 @@ sample_depth_texture( struct gl_context *ctx,
|
|||||||
{
|
{
|
||||||
const GLint level = choose_depth_texture_level(tObj, lambda[0]);
|
const GLint level = choose_depth_texture_level(tObj, lambda[0]);
|
||||||
const struct gl_texture_image *img = tObj->Image[0][level];
|
const struct gl_texture_image *img = tObj->Image[0][level];
|
||||||
|
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
|
||||||
const GLint width = img->Width;
|
const GLint width = img->Width;
|
||||||
const GLint height = img->Height;
|
const GLint height = img->Height;
|
||||||
const GLint depth = img->Depth;
|
const GLint depth = img->Depth;
|
||||||
@@ -3423,7 +3437,7 @@ sample_depth_texture( struct gl_context *ctx,
|
|||||||
|
|
||||||
if (col >= 0 && row >= 0 && col < width && row < height &&
|
if (col >= 0 && row >= 0 && col < width && row < height &&
|
||||||
slice >= 0 && slice < depth) {
|
slice >= 0 && slice < depth) {
|
||||||
img->FetchTexelf(img, col, row, slice, &depthSample);
|
swImg->FetchTexelf(swImg, col, row, slice, &depthSample);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
depthSample = tObj->Sampler.BorderColor.f[0];
|
depthSample = tObj->Sampler.BorderColor.f[0];
|
||||||
@@ -3492,13 +3506,13 @@ sample_depth_texture( struct gl_context *ctx,
|
|||||||
depth00 = tObj->Sampler.BorderColor.f[0];
|
depth00 = tObj->Sampler.BorderColor.f[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i0, j0, slice, &depth00);
|
swImg->FetchTexelf(swImg, i0, j0, slice, &depth00);
|
||||||
}
|
}
|
||||||
if (useBorderTexel & (I1BIT | J0BIT)) {
|
if (useBorderTexel & (I1BIT | J0BIT)) {
|
||||||
depth10 = tObj->Sampler.BorderColor.f[0];
|
depth10 = tObj->Sampler.BorderColor.f[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i1, j0, slice, &depth10);
|
swImg->FetchTexelf(swImg, i1, j0, slice, &depth10);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tObj->Target != GL_TEXTURE_1D_ARRAY_EXT) {
|
if (tObj->Target != GL_TEXTURE_1D_ARRAY_EXT) {
|
||||||
@@ -3506,13 +3520,13 @@ sample_depth_texture( struct gl_context *ctx,
|
|||||||
depth01 = tObj->Sampler.BorderColor.f[0];
|
depth01 = tObj->Sampler.BorderColor.f[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i0, j1, slice, &depth01);
|
swImg->FetchTexelf(swImg, i0, j1, slice, &depth01);
|
||||||
}
|
}
|
||||||
if (useBorderTexel & (I1BIT | J1BIT)) {
|
if (useBorderTexel & (I1BIT | J1BIT)) {
|
||||||
depth11 = tObj->Sampler.BorderColor.f[0];
|
depth11 = tObj->Sampler.BorderColor.f[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
img->FetchTexelf(img, i1, j1, slice, &depth11);
|
swImg->FetchTexelf(swImg, i1, j1, slice, &depth11);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
#include "main/teximage.h"
|
#include "main/teximage.h"
|
||||||
#include "main/renderbuffer.h"
|
#include "main/renderbuffer.h"
|
||||||
#include "swrast/swrast.h"
|
#include "swrast/swrast.h"
|
||||||
|
#include "swrast/s_context.h"
|
||||||
#include "swrast/s_texfetch.h"
|
#include "swrast/s_texfetch.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -20,7 +21,7 @@
|
|||||||
struct texture_renderbuffer
|
struct texture_renderbuffer
|
||||||
{
|
{
|
||||||
struct gl_renderbuffer Base; /**< Base class object */
|
struct gl_renderbuffer Base; /**< Base class object */
|
||||||
struct gl_texture_image *TexImage;
|
struct swrast_texture_image *TexImage;
|
||||||
StoreTexelFunc Store;
|
StoreTexelFunc Store;
|
||||||
FetchTexelFuncF Fetchf;
|
FetchTexelFuncF Fetchf;
|
||||||
GLint Yoffset; /**< Layer for 1D array textures. */
|
GLint Yoffset; /**< Layer for 1D array textures. */
|
||||||
@@ -42,8 +43,8 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count
|
|||||||
const GLint z = trb->Zoffset;
|
const GLint z = trb->Zoffset;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
||||||
ASSERT(trb->TexImage->Width == rb->Width);
|
ASSERT(trb->TexImage->Base.Width == rb->Width);
|
||||||
ASSERT(trb->TexImage->Height == rb->Height);
|
ASSERT(trb->TexImage->Base.Height == rb->Height);
|
||||||
|
|
||||||
y += trb->Yoffset;
|
y += trb->Yoffset;
|
||||||
|
|
||||||
@@ -468,7 +469,7 @@ texture_put_mono_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
store_nop(struct gl_texture_image *texImage,
|
store_nop(struct swrast_texture_image *texImage,
|
||||||
GLint col, GLint row, GLint img,
|
GLint col, GLint row, GLint img,
|
||||||
const void *texel)
|
const void *texel)
|
||||||
{
|
{
|
||||||
@@ -534,17 +535,17 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
|
|||||||
(void) ctx;
|
(void) ctx;
|
||||||
ASSERT(trb);
|
ASSERT(trb);
|
||||||
|
|
||||||
trb->TexImage = _mesa_get_attachment_teximage(att);
|
trb->TexImage = swrast_texture_image(_mesa_get_attachment_teximage(att));
|
||||||
ASSERT(trb->TexImage);
|
ASSERT(trb->TexImage);
|
||||||
|
|
||||||
trb->Store = _mesa_get_texel_store_func(trb->TexImage->TexFormat);
|
trb->Store = _mesa_get_texel_store_func(trb->TexImage->Base.TexFormat);
|
||||||
if (!trb->Store) {
|
if (!trb->Store) {
|
||||||
/* we'll never draw into some textures (compressed formats) */
|
/* we'll never draw into some textures (compressed formats) */
|
||||||
trb->Store = store_nop;
|
trb->Store = store_nop;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!trb->TexImage->FetchTexelf) {
|
if (!trb->TexImage->FetchTexelf) {
|
||||||
_mesa_update_fetch_functions(trb->TexImage->TexObject);
|
_mesa_update_fetch_functions(trb->TexImage->Base.TexObject);
|
||||||
}
|
}
|
||||||
trb->Fetchf = trb->TexImage->FetchTexelf;
|
trb->Fetchf = trb->TexImage->FetchTexelf;
|
||||||
assert(trb->Fetchf);
|
assert(trb->Fetchf);
|
||||||
@@ -558,13 +559,13 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
|
|||||||
trb->Zoffset = att->Zoffset;
|
trb->Zoffset = att->Zoffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
trb->Base.Width = trb->TexImage->Width;
|
trb->Base.Width = trb->TexImage->Base.Width;
|
||||||
trb->Base.Height = trb->TexImage->Height;
|
trb->Base.Height = trb->TexImage->Base.Height;
|
||||||
trb->Base.InternalFormat = trb->TexImage->InternalFormat;
|
trb->Base.InternalFormat = trb->TexImage->Base.InternalFormat;
|
||||||
trb->Base.Format = trb->TexImage->TexFormat;
|
trb->Base.Format = trb->TexImage->Base.TexFormat;
|
||||||
|
|
||||||
/* XXX may need more special cases here */
|
/* XXX may need more special cases here */
|
||||||
switch (trb->TexImage->TexFormat) {
|
switch (trb->TexImage->Base.TexFormat) {
|
||||||
case MESA_FORMAT_Z24_S8:
|
case MESA_FORMAT_Z24_S8:
|
||||||
trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
|
trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
|
||||||
trb->Base._BaseFormat = GL_DEPTH_STENCIL;
|
trb->Base._BaseFormat = GL_DEPTH_STENCIL;
|
||||||
@@ -609,7 +610,7 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
|
|||||||
trb->Base.DataType = CHAN_TYPE;
|
trb->Base.DataType = CHAN_TYPE;
|
||||||
trb->Base._BaseFormat = GL_RGBA;
|
trb->Base._BaseFormat = GL_RGBA;
|
||||||
}
|
}
|
||||||
trb->Base.Data = trb->TexImage->Data;
|
trb->Base.Data = trb->TexImage->Base.Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user