mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
mesa: minor code movement
This commit is contained in:
parent
1f196b786d
commit
bc143b1a9f
2 changed files with 33 additions and 36 deletions
|
|
@ -153,38 +153,6 @@ _mesa_glenum_to_compressed_format(GLenum format)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return the address of the pixel at (col, row, img) in a
|
||||
* compressed texture image.
|
||||
* \param col, row, img - image position (3D), should be a multiple of the
|
||||
* format's block size.
|
||||
* \param format - compressed image format
|
||||
* \param width - image width (stride) in pixels
|
||||
* \param image - the image address
|
||||
* \return address of pixel at (row, col, img)
|
||||
*/
|
||||
GLubyte *
|
||||
_mesa_compressed_image_address(GLint col, GLint row, GLint img,
|
||||
gl_format mesaFormat,
|
||||
GLsizei width, const GLubyte *image)
|
||||
{
|
||||
/* XXX only 2D images implemented, not 3D */
|
||||
const GLuint blockSize = _mesa_get_format_bytes(mesaFormat);
|
||||
GLuint bw, bh;
|
||||
GLint offset;
|
||||
|
||||
_mesa_get_format_block_size(mesaFormat, &bw, &bh);
|
||||
|
||||
ASSERT(col % bw == 0);
|
||||
ASSERT(row % bh == 0);
|
||||
|
||||
offset = ((width + bw - 1) / bw) * (row / bh) + col / bw;
|
||||
offset *= blockSize;
|
||||
|
||||
return (GLubyte *) image + offset;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Given a compressed MESA_FORMAT_x value, return the corresponding
|
||||
* GLenum for that format.
|
||||
|
|
@ -233,3 +201,33 @@ _mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return the address of the pixel at (col, row, img) in a
|
||||
* compressed texture image.
|
||||
* \param col, row, img - image position (3D), should be a multiple of the
|
||||
* format's block size.
|
||||
* \param format - compressed image format
|
||||
* \param width - image width (stride) in pixels
|
||||
* \param image - the image address
|
||||
* \return address of pixel at (row, col, img)
|
||||
*/
|
||||
GLubyte *
|
||||
_mesa_compressed_image_address(GLint col, GLint row, GLint img,
|
||||
gl_format mesaFormat,
|
||||
GLsizei width, const GLubyte *image)
|
||||
{
|
||||
/* XXX only 2D images implemented, not 3D */
|
||||
const GLuint blockSize = _mesa_get_format_bytes(mesaFormat);
|
||||
GLuint bw, bh;
|
||||
GLint offset;
|
||||
|
||||
_mesa_get_format_block_size(mesaFormat, &bw, &bh);
|
||||
|
||||
ASSERT(col % bw == 0);
|
||||
ASSERT(row % bh == 0);
|
||||
|
||||
offset = ((width + bw - 1) / bw) * (row / bh) + col / bw;
|
||||
offset *= blockSize;
|
||||
|
||||
return (GLubyte *) image + offset;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,16 +36,15 @@ _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all);
|
|||
extern gl_format
|
||||
_mesa_glenum_to_compressed_format(GLenum format);
|
||||
|
||||
extern GLenum
|
||||
_mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat);
|
||||
|
||||
extern GLubyte *
|
||||
_mesa_compressed_image_address(GLint col, GLint row, GLint img,
|
||||
gl_format mesaFormat,
|
||||
GLsizei width, const GLubyte *image);
|
||||
|
||||
|
||||
extern GLenum
|
||||
_mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat);
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_init_texture_s3tc( GLcontext *ctx );
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue