mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 11:38:05 +02:00
Implement glGetTexImage.
In intel_tex_map_images(), convert strides from bytes to texels for Mesa. Store the 3D ImageStride now added to core Mesa.
This commit is contained in:
parent
88c018ee47
commit
4ab3b9aa76
5 changed files with 56 additions and 7 deletions
|
|
@ -201,7 +201,12 @@ void intel_miptree_set_image_offset(struct intel_mipmap_tree *mt,
|
|||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Map a teximage in a mipmap tree.
|
||||
* \param row_stride returns row stride in bytes
|
||||
* \param image_stride returns image stride in bytes (for 3D textures).
|
||||
* \return address of mapping
|
||||
*/
|
||||
GLubyte *intel_miptree_image_map(struct intel_context *intel,
|
||||
struct intel_mipmap_tree *mt,
|
||||
GLuint face,
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ void intelInitTextureFuncs(struct dd_function_table * functions)
|
|||
functions->CopyTexImage2D = intelCopyTexImage2D;
|
||||
functions->CopyTexSubImage1D = intelCopyTexSubImage1D;
|
||||
functions->CopyTexSubImage2D = intelCopyTexSubImage2D;
|
||||
functions->GetTexImage = intelGetTexImage;
|
||||
functions->NewTextureObject = intelNewTextureObject;
|
||||
functions->NewTextureImage = intelNewTextureImage;
|
||||
functions->DeleteTexture = _mesa_delete_texture_object;
|
||||
|
|
|
|||
|
|
@ -119,6 +119,11 @@ void intelCopyTexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
|
|||
GLint xoffset, GLint yoffset,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height );
|
||||
|
||||
void intelGetTexImage( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLenum format, GLenum type, GLvoid *pixels,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage );
|
||||
|
||||
GLuint intel_finalize_mipmap_tree( struct intel_context *intel, GLuint unit );
|
||||
|
||||
void intel_tex_map_images( struct intel_context *intel,
|
||||
|
|
|
|||
|
|
@ -396,5 +396,45 @@ void intelTexImage1D(GLcontext *ctx,
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* Need to map texture image into memory before copying image data,
|
||||
* then unmap it.
|
||||
*/
|
||||
void intelGetTexImage( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLenum format, GLenum type, GLvoid *pixels,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage )
|
||||
{
|
||||
struct intel_context *intel = intel_context( ctx );
|
||||
struct intel_texture_image *intelImage = intel_texture_image(texImage);
|
||||
|
||||
/* Map */
|
||||
#ifdef ALL_IMAGES /* XXX Remove this, just for debug/test */
|
||||
intel_tex_map_images(intel, intel_texture_object(texObj));
|
||||
#else
|
||||
/* XXX what if intelImage->mt is NULL? */
|
||||
if (intelImage->mt) {
|
||||
intelImage->base.Data =
|
||||
intel_miptree_image_map(intel,
|
||||
intelImage->mt,
|
||||
intelImage->face,
|
||||
intelImage->level,
|
||||
&intelImage->base.RowStride,
|
||||
&intelImage->base.ImageStride);
|
||||
}
|
||||
#endif
|
||||
|
||||
_mesa_get_teximage(ctx, target, level, format, type, pixels,
|
||||
texObj, texImage);
|
||||
|
||||
/* Unmap */
|
||||
#ifdef ALL_IMAGES
|
||||
intel_tex_unmap_images(intel, intel_texture_object(texObj));
|
||||
#else
|
||||
if (intelImage->mt) {
|
||||
intel_miptree_image_unmap(intel, intelImage->mt);
|
||||
intelImage->base.Data = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -209,11 +209,6 @@ void intel_tex_map_images( struct intel_context *intel,
|
|||
struct intel_texture_image *intelImage =
|
||||
intel_texture_image(intelObj->base.Image[face][i]);
|
||||
|
||||
/* XXX: Fallbacks will fail for 3d textures because core mesa
|
||||
* doesn't have a place to put ImageStride -- assumes each
|
||||
* teximage's depth slices are packed contiguously. This
|
||||
* isn't true for i915.
|
||||
*/
|
||||
if (intelImage->mt) {
|
||||
intelImage->base.Data =
|
||||
intel_miptree_image_map(intel,
|
||||
|
|
@ -221,7 +216,10 @@ void intel_tex_map_images( struct intel_context *intel,
|
|||
intelImage->face,
|
||||
intelImage->level,
|
||||
&intelImage->base.RowStride,
|
||||
NULL);
|
||||
&intelImage->base.ImageStride);
|
||||
/* convert stride to texels, not bytes */
|
||||
intelImage->base.RowStride /= intelImage->mt->cpp;
|
||||
intelImage->base.ImageStride /= intelImage->mt->cpp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue