static void
intelTexImage(struct gl_context * ctx,
GLint dims,
- GLenum target, GLint level,
+ struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint height, GLint depth,
GLenum format, GLenum type, const void *pixels,
const struct gl_pixelstore_attrib *unpack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage, GLsizei imageSize)
+ GLsizei imageSize)
{
DBG("%s target %s level %d %dx%dx%d\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(target), level, width, height, depth);
+ _mesa_lookup_enum_by_nr(texImage->TexObject->Target),
+ texImage->Level, width, height, depth);
/* Attempt to use the blitter for PBO image uploads.
*/
DBG("%s: upload image %dx%dx%d pixels %p\n",
__FUNCTION__, width, height, depth, pixels);
- _mesa_store_teximage3d(ctx, target, level, internalFormat,
+ _mesa_store_teximage3d(ctx, texImage, internalFormat,
width, height, depth, 0,
- format, type, pixels,
- unpack, texObj, texImage);
+ format, type, pixels, unpack);
}
static void
intelTexImage3D(struct gl_context * ctx,
- GLenum target, GLint level,
+ struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint height, GLint depth,
GLint border,
GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *unpack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
+ const struct gl_pixelstore_attrib *unpack)
{
- intelTexImage(ctx, 3, target, level,
+ intelTexImage(ctx, 3, texImage,
internalFormat, width, height, depth,
- format, type, pixels, unpack, texObj, texImage, 0);
+ format, type, pixels, unpack, 0);
}
static void
intelTexImage2D(struct gl_context * ctx,
- GLenum target, GLint level,
+ struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *unpack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
+ const struct gl_pixelstore_attrib *unpack)
{
- intelTexImage(ctx, 2, target, level,
+ intelTexImage(ctx, 2, texImage,
internalFormat, width, height, 1,
- format, type, pixels, unpack, texObj, texImage, 0);
+ format, type, pixels, unpack, 0);
}
static void
intelTexImage1D(struct gl_context * ctx,
- GLenum target, GLint level,
+ struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *unpack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
+ const struct gl_pixelstore_attrib *unpack)
{
- intelTexImage(ctx, 1, target, level,
+ intelTexImage(ctx, 1, texImage,
internalFormat, width, 1, 1,
- format, type, pixels, unpack, texObj, texImage, 0);
+ format, type, pixels, unpack, 0);
}
}
static void
-nouveau_teximage(struct gl_context *ctx, GLint dims, GLenum target, GLint level,
+nouveau_teximage(struct gl_context *ctx, GLint dims,
+ struct gl_texture_image *ti,
GLint internalFormat,
GLint width, GLint height, GLint depth, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *t,
- struct gl_texture_image *ti)
+ const struct gl_pixelstore_attrib *packing)
{
+ struct gl_texture_object *t = ti->TexObject;
+ const GLuint level = ti->Level;
struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
struct nouveau_teximage *nti = to_nouveau_teximage(ti);
int ret;
}
static void
-nouveau_teximage_1d(struct gl_context *ctx, GLenum target, GLint level,
+nouveau_teximage_1d(struct gl_context *ctx,
+ struct gl_texture_image *ti,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *t,
- struct gl_texture_image *ti)
+ const struct gl_pixelstore_attrib *packing)
{
- nouveau_teximage(ctx, 1, target, level, internalFormat,
+ nouveau_teximage(ctx, 1, ti, internalFormat,
width, 1, 1, border, format, type, pixels,
- packing, t, ti);
+ packing);
}
static void
-nouveau_teximage_2d(struct gl_context *ctx, GLenum target, GLint level,
+nouveau_teximage_2d(struct gl_context *ctx,
+ struct gl_texture_image *ti,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *t,
- struct gl_texture_image *ti)
+ const struct gl_pixelstore_attrib *packing)
{
- nouveau_teximage(ctx, 2, target, level, internalFormat,
+ nouveau_teximage(ctx, 2, ti, internalFormat,
width, height, 1, border, format, type, pixels,
- packing, t, ti);
+ packing);
}
static void
-nouveau_teximage_3d(struct gl_context *ctx, GLenum target, GLint level,
+nouveau_teximage_3d(struct gl_context *ctx,
+ struct gl_texture_image *ti,
GLint internalFormat,
GLint width, GLint height, GLint depth, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *t,
- struct gl_texture_image *ti)
+ const struct gl_pixelstore_attrib *packing)
{
- nouveau_teximage(ctx, 3, target, level, internalFormat,
+ nouveau_teximage(ctx, 3, ti, internalFormat,
width, height, depth, border, format, type, pixels,
- packing, t, ti);
+ packing);
}
static void
*/
static void radeon_teximage(
struct gl_context *ctx, int dims,
- GLenum target, GLint level,
+ struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint height, GLint depth,
GLsizei imageSize,
GLenum format, GLenum type, const GLvoid * pixels,
const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage,
int compressed)
{
- _mesa_store_teximage3d(ctx, target, level, internalFormat,
+ _mesa_store_teximage3d(ctx, texImage, internalFormat,
width, height, depth, 0,
format, type, pixels,
- packing, texObj, texImage);
+ packing);
}
-void radeonTexImage1D(struct gl_context * ctx, GLenum target, GLint level,
+static void
+radeonTexImage1D(struct gl_context * ctx,
+ struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid * pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
+ const struct gl_pixelstore_attrib *packing)
{
- radeon_teximage(ctx, 1, target, level, internalFormat, width, 1, 1,
- 0, format, type, pixels, packing, texObj, texImage, 0);
+ radeon_teximage(ctx, 1, texImage, internalFormat, width, 1, 1,
+ 0, format, type, pixels, packing, 0);
}
-void radeonTexImage2D(struct gl_context * ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const GLvoid * pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
+static void
+radeonTexImage2D(struct gl_context * ctx,
+ struct gl_texture_image *texImage,
+ GLint internalFormat,
+ GLint width, GLint height, GLint border,
+ GLenum format, GLenum type, const GLvoid * pixels,
+ const struct gl_pixelstore_attrib *packing)
{
- radeon_teximage(ctx, 2, target, level, internalFormat, width, height, 1,
- 0, format, type, pixels, packing, texObj, texImage, 0);
+ radeon_teximage(ctx, 2, texImage, internalFormat, width, height, 1,
+ 0, format, type, pixels, packing, 0);
}
-void radeonTexImage3D(struct gl_context * ctx, GLenum target, GLint level,
+static void
+radeonTexImage3D(struct gl_context * ctx,
+ struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint height, GLint depth,
GLint border,
GLenum format, GLenum type, const GLvoid * pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
+ const struct gl_pixelstore_attrib *packing)
{
- radeon_teximage(ctx, 3, target, level, internalFormat, width, height, depth,
- 0, format, type, pixels, packing, texObj, texImage, 0);
+ radeon_teximage(ctx, 3, texImage, internalFormat, width, height, depth,
+ 0, format, type, pixels, packing, 0);
}
unsigned radeonIsFormatRenderable(gl_format mesa_format)
GLenum format,
GLenum type, GLboolean fbo);
-void radeonTexImage1D(struct gl_context * ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type, const GLvoid * pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-void radeonTexImage2D(struct gl_context * ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const GLvoid * pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
void radeonCompressedTexImage2D(struct gl_context * ctx, GLenum target,
GLint level, GLint internalFormat,
GLint width, GLint height, GLint border,
GLsizei imageSize, const GLvoid * data,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
-void radeonTexImage3D(struct gl_context * ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint depth,
- GLint border,
- GLenum format, GLenum type, const GLvoid * pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
+
void radeonTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level,
GLint xoffset,
GLsizei width,
* fully initialized.
* The parameters are the same as glTexImage1D(), plus:
* \param packing describes how to unpack the source data.
- * \param texObj is the target texture object.
- * \param texImage is the target texture image.
+ * \param texImage is the destination texture image.
*/
- void (*TexImage1D)( struct gl_context *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage );
+ void (*TexImage1D)(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ GLint internalFormat,
+ GLint width, GLint border,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing);
/**
* Called by glTexImage2D().
*
* \sa dd_function_table::TexImage1D.
*/
- void (*TexImage2D)( struct gl_context *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage );
+ void (*TexImage2D)(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ GLint internalFormat,
+ GLint width, GLint height, GLint border,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing);
/**
* Called by glTexImage3D().
*
* \sa dd_function_table::TexImage1D.
*/
- void (*TexImage3D)( struct gl_context *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint depth, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage );
+ void (*TexImage3D)(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ GLint internalFormat,
+ GLint width, GLint height, GLint depth, GLint border,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *packing);
/**
* Called by glTexSubImage1D(). Replace a subset of the target texture
ASSERT(ctx->Driver.TexImage3D);
switch (dims) {
case 1:
- ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
+ ctx->Driver.TexImage1D(ctx, texImage, internalFormat,
width, border, format,
- type, pixels, unpack, texObj,
- texImage);
+ type, pixels, unpack);
break;
case 2:
- ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
+ ctx->Driver.TexImage2D(ctx, texImage, internalFormat,
width, height, border, format,
- type, pixels, unpack, texObj,
- texImage);
+ type, pixels, unpack);
break;
case 3:
- ctx->Driver.TexImage3D(ctx, target, level, internalFormat,
+ ctx->Driver.TexImage3D(ctx, texImage, internalFormat,
width, height, depth, border, format,
- type, pixels, unpack, texObj,
- texImage);
+ type, pixels, unpack);
break;
default:
_mesa_problem(ctx, "invalid dims=%u in teximage()", dims);
/* Allocate texture memory (no pixel data yet) */
if (dims == 1) {
- ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
+ ctx->Driver.TexImage1D(ctx, texImage, internalFormat,
width, border, GL_NONE, GL_NONE, NULL,
- &ctx->Unpack, texObj, texImage);
+ &ctx->Unpack);
}
else {
- ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
+ ctx->Driver.TexImage2D(ctx, texImage, internalFormat,
width, height, border, GL_NONE, GL_NONE,
- NULL, &ctx->Unpack, texObj, texImage);
+ NULL, &ctx->Unpack);
}
if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY,
ASSERT(texImage->TexFormat != MESA_FORMAT_NONE);
/* set image data */
- ctx->Driver.TexImage2D(ctx, GL_TEXTURE_2D, 0, GL_RGBA,
+ ctx->Driver.TexImage2D(ctx, texImage, GL_RGBA,
8, 8, 0,
GL_RGBA, GL_UNSIGNED_BYTE, texels,
- &ctx->DefaultPacking, texObj, texImage);
+ &ctx->DefaultPacking);
_mesa_test_texobj_completeness(ctx, texObj);
assert(texObj->_Complete);
* This is the fallback for Driver.TexImage1D().
*/
void
-_mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_store_teximage1d(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
+ const struct gl_pixelstore_attrib *packing)
{
if (width == 0)
return;
* This is the fallback for Driver.TexImage2D().
*/
void
-_mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_store_teximage2d(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
+ const struct gl_pixelstore_attrib *packing)
{
if (width == 0 || height == 0)
return;
* This is the fallback for Driver.TexImage3D().
*/
void
-_mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_store_teximage3d(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint height, GLint depth, GLint border,
GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
+ const struct gl_pixelstore_attrib *packing)
{
if (width == 0 || height == 0 || depth == 0)
return;
GLbitfield transferOps);
extern void
-_mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_store_teximage1d(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
+ const struct gl_pixelstore_attrib *packing);
extern void
-_mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_store_teximage2d(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
+ const struct gl_pixelstore_attrib *packing);
extern void
-_mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_store_teximage3d(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint height, GLint depth, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
+ const struct gl_pixelstore_attrib *packing);
extern void
static void
st_TexImage(struct gl_context * ctx,
GLint dims,
- GLenum target, GLint level,
+ struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint height, GLint depth,
GLint border,
GLenum format, GLenum type, const void *pixels,
const struct gl_pixelstore_attrib *unpack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage,
GLsizei imageSize, GLboolean compressed_src)
{
struct st_context *st = st_context(ctx);
+ struct gl_texture_object *texObj = texImage->TexObject;
struct st_texture_object *stObj = st_texture_object(texObj);
struct st_texture_image *stImage = st_texture_image(texImage);
+ const GLenum target = texObj->Target;
+ const GLuint level = texImage->Level;
GLuint dstRowStride = 0;
enum pipe_transfer_usage transfer_usage = 0;
GLubyte *dstMap;
static void
st_TexImage3D(struct gl_context * ctx,
- GLenum target, GLint level,
+ struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint height, GLint depth,
GLint border,
GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *unpack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
+ const struct gl_pixelstore_attrib *unpack)
{
- st_TexImage(ctx, 3, target, level, internalFormat, width, height, depth,
- border, format, type, pixels, unpack, texObj, texImage,
- 0, GL_FALSE);
+ st_TexImage(ctx, 3, texImage, internalFormat, width, height, depth, border,
+ format, type, pixels, unpack, 0, GL_FALSE);
}
static void
st_TexImage2D(struct gl_context * ctx,
- GLenum target, GLint level,
+ struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *unpack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
+ const struct gl_pixelstore_attrib *unpack)
{
- st_TexImage(ctx, 2, target, level, internalFormat, width, height, 1, border,
- format, type, pixels, unpack, texObj, texImage, 0, GL_FALSE);
+ st_TexImage(ctx, 2, texImage, internalFormat, width, height, 1, border,
+ format, type, pixels, unpack, 0, GL_FALSE);
}
static void
st_TexImage1D(struct gl_context * ctx,
- GLenum target, GLint level,
+ struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *unpack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
+ const struct gl_pixelstore_attrib *unpack)
{
- st_TexImage(ctx, 1, target, level, internalFormat, width, 1, 1, border,
- format, type, pixels, unpack, texObj, texImage, 0, GL_FALSE);
+ st_TexImage(ctx, 1, texImage, internalFormat, width, 1, 1, border,
+ format, type, pixels, unpack, 0, GL_FALSE);
}
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
- st_TexImage(ctx, 2, target, level, internalFormat, width, height, 1, border,
- 0, 0, data, &ctx->Unpack, texObj, texImage, imageSize, GL_TRUE);
+ st_TexImage(ctx, 2, texImage, internalFormat, width, height, 1, border,
+ 0, 0, data, &ctx->Unpack, imageSize, GL_TRUE);
}
16, 16, 1, 0, /* w, h, d, border */
GL_RGBA, MESA_FORMAT_RGBA8888);
- st_TexImage(st->ctx, 2, target,
- 0, GL_RGBA, /* level, intformat */
+ st_TexImage(st->ctx, 2,
+ texImg,
+ GL_RGBA, /* level, intformat */
16, 16, 1, 0, /* w, h, d, border */
GL_RGBA, GL_UNSIGNED_BYTE, pixels,
&st->ctx->DefaultPacking,
- texObj, texImg,
- 0, 0);
+ 0, GL_FALSE);
texObj->Sampler.MinFilter = GL_NEAREST;
texObj->Sampler.MagFilter = GL_NEAREST;