}
/* compute offset of the particular 2D image within the texture region */
- imageOffset = intel_miptree_image_offset(intel_image->mt,
+ imageOffset = st_miptree_image_offset(intel_image->mt,
att->CubeMapFace,
att->TextureLevel);
if (att->Texture->Target == GL_TEXTURE_3D) {
- const GLuint *offsets = intel_miptree_depth_offsets(intel_image->mt,
+ const GLuint *offsets = st_miptree_depth_offsets(intel_image->mt,
att->TextureLevel);
imageOffset += offsets[att->Zoffset];
}
*
**************************************************************************/
-#include "intel_context.h"
#include "intel_mipmap_tree.h"
#include "enums.h"
}
struct pipe_mipmap_tree *
-intel_miptree_create(struct intel_context *intel,
+st_miptree_create(struct pipe_context *pipe,
GLenum target,
GLenum internal_format,
GLuint first_level,
mt->compressed = compress_byte ? 1 : 0;
mt->refcount = 1;
- ok = intel->pipe->mipmap_tree_layout(intel->pipe, mt);
+ ok = pipe->mipmap_tree_layout(pipe, mt);
if (ok)
- mt->region = intel->pipe->region_alloc(intel->pipe,
+ mt->region = pipe->region_alloc(pipe,
mt->cpp, mt->pitch, mt->total_height);
if (!mt->region) {
void
-intel_miptree_reference(struct pipe_mipmap_tree **dst,
+st_miptree_reference(struct pipe_mipmap_tree **dst,
struct pipe_mipmap_tree *src)
{
src->refcount++;
}
void
-intel_miptree_release(struct intel_context *intel,
- struct pipe_mipmap_tree **mt)
+st_miptree_release(struct pipe_context *pipe,
+ struct pipe_mipmap_tree **mt)
{
if (!*mt)
return;
DBG("%s deleting %p\n", __FUNCTION__, *mt);
- intel->pipe->region_release(intel->pipe, &((*mt)->region));
+ pipe->region_release(pipe, &((*mt)->region));
for (i = 0; i < MAX_TEXTURE_LEVELS; i++)
if ((*mt)->level[i].image_offset)
* Not sure whether I want to pass gl_texture_image here.
*/
GLboolean
-intel_miptree_match_image(struct pipe_mipmap_tree *mt,
+st_miptree_match_image(struct pipe_mipmap_tree *mt,
struct gl_texture_image *image,
GLuint face, GLuint level)
{
* These functions present that view to mesa:
*/
const GLuint *
-intel_miptree_depth_offsets(struct pipe_mipmap_tree *mt, GLuint level)
+st_miptree_depth_offsets(struct pipe_mipmap_tree *mt, GLuint level)
{
static const GLuint zero = 0;
GLuint
-intel_miptree_image_offset(struct pipe_mipmap_tree * mt,
- GLuint face, GLuint level)
+st_miptree_image_offset(struct pipe_mipmap_tree * mt,
+ GLuint face, GLuint level)
{
if (mt->target == GL_TEXTURE_CUBE_MAP_ARB)
return (mt->level[level].level_offset +
* \return address of mapping
*/
GLubyte *
-intel_miptree_image_map(struct intel_context * intel,
+st_miptree_image_map(struct pipe_context *pipe,
struct pipe_mipmap_tree * mt,
GLuint face,
GLuint level,
memcpy(image_offsets, mt->level[level].image_offset,
mt->level[level].depth * sizeof(GLuint));
- ptr = intel->pipe->region_map(intel->pipe, mt->region);
+ ptr = pipe->region_map(pipe, mt->region);
- return ptr + intel_miptree_image_offset(mt, face, level);
+ return ptr + st_miptree_image_offset(mt, face, level);
}
void
-intel_miptree_image_unmap(struct intel_context *intel,
+st_miptree_image_unmap(struct pipe_context *pipe,
struct pipe_mipmap_tree *mt)
{
DBG("%s\n", __FUNCTION__);
- intel->pipe->region_unmap(intel->pipe, mt->region);
+ pipe->region_unmap(pipe, mt->region);
}
/* Upload data for a particular image.
*/
void
-intel_miptree_image_data(struct intel_context *intel,
+st_miptree_image_data(struct pipe_context *pipe,
struct pipe_mipmap_tree *dst,
GLuint face,
GLuint level,
GLuint src_row_pitch, GLuint src_image_pitch)
{
GLuint depth = dst->level[level].depth;
- GLuint dst_offset = intel_miptree_image_offset(dst, face, level);
- const GLuint *dst_depth_offset = intel_miptree_depth_offsets(dst, level);
+ GLuint dst_offset = st_miptree_image_offset(dst, face, level);
+ const GLuint *dst_depth_offset = st_miptree_depth_offsets(dst, level);
GLuint i;
GLuint height = 0;
height = dst->level[level].height;
if(dst->compressed)
height /= 4;
- intel->pipe->region_data(intel->pipe, dst->region,
+ pipe->region_data(pipe, dst->region,
dst_offset + dst_depth_offset[i], /* dst_offset */
0, 0, /* dstx, dsty */
src,
/* Copy mipmap image between trees
*/
void
-intel_miptree_image_copy(struct intel_context *intel,
+st_miptree_image_copy(struct pipe_context *pipe,
struct pipe_mipmap_tree *dst,
GLuint face, GLuint level,
struct pipe_mipmap_tree *src)
GLuint width = src->level[level].width;
GLuint height = src->level[level].height;
GLuint depth = src->level[level].depth;
- GLuint dst_offset = intel_miptree_image_offset(dst, face, level);
- GLuint src_offset = intel_miptree_image_offset(src, face, level);
- const GLuint *dst_depth_offset = intel_miptree_depth_offsets(dst, level);
- const GLuint *src_depth_offset = intel_miptree_depth_offsets(src, level);
+ GLuint dst_offset = st_miptree_image_offset(dst, face, level);
+ GLuint src_offset = st_miptree_image_offset(src, face, level);
+ const GLuint *dst_depth_offset = st_miptree_depth_offsets(dst, level);
+ const GLuint *src_depth_offset = st_miptree_depth_offsets(src, level);
GLuint i;
if (dst->compressed)
height /= 4;
for (i = 0; i < depth; i++) {
- intel->pipe->region_copy(intel->pipe,
+ pipe->region_copy(pipe,
dst->region, dst_offset + dst_depth_offset[i],
0,
0,
struct pipe_region;
-struct pipe_mipmap_tree *intel_miptree_create(struct intel_context *intel,
+struct pipe_mipmap_tree *st_miptree_create(struct pipe_context *pipe,
GLenum target,
GLenum internal_format,
GLuint first_level,
GLuint cpp,
GLuint compress_byte);
-void intel_miptree_reference(struct pipe_mipmap_tree **dst,
+void st_miptree_reference(struct pipe_mipmap_tree **dst,
struct pipe_mipmap_tree *src);
-void intel_miptree_release(struct intel_context *intel,
+void st_miptree_release(struct pipe_context *pipe,
struct pipe_mipmap_tree **mt);
/* Check if an image fits an existing mipmap tree layout
*/
-GLboolean intel_miptree_match_image(struct pipe_mipmap_tree *mt,
+GLboolean st_miptree_match_image(struct pipe_mipmap_tree *mt,
struct gl_texture_image *image,
GLuint face, GLuint level);
/* Return a pointer to an image within a tree. Return image stride as
* well.
*/
-GLubyte *intel_miptree_image_map(struct intel_context *intel,
+GLubyte *st_miptree_image_map(struct pipe_context *pipe,
struct pipe_mipmap_tree *mt,
GLuint face,
GLuint level,
GLuint * row_stride, GLuint * image_stride);
-void intel_miptree_image_unmap(struct intel_context *intel,
+void st_miptree_image_unmap(struct pipe_context *pipe,
struct pipe_mipmap_tree *mt);
/* Return the linear offset of an image relative to the start of the
* tree:
*/
-GLuint intel_miptree_image_offset(struct pipe_mipmap_tree *mt,
- GLuint face, GLuint level);
+GLuint st_miptree_image_offset(struct pipe_mipmap_tree *mt,
+ GLuint face, GLuint level);
/* Return pointers to each 2d slice within an image. Indexed by depth
* value.
*/
-const GLuint *intel_miptree_depth_offsets(struct pipe_mipmap_tree *mt,
- GLuint level);
+const GLuint *st_miptree_depth_offsets(struct pipe_mipmap_tree *mt,
+ GLuint level);
/* Upload an image into a tree
*/
-void intel_miptree_image_data(struct intel_context *intel,
+void st_miptree_image_data(struct pipe_context *pipe,
struct pipe_mipmap_tree *dst,
GLuint face,
GLuint level,
/* Copy an image between two trees
*/
-void intel_miptree_image_copy(struct intel_context *intel,
+void st_miptree_image_copy(struct pipe_context *pipe,
struct pipe_mipmap_tree *dst,
GLuint face, GLuint level,
struct pipe_mipmap_tree *src);
struct intel_texture_object *intelObj = intel_texture_object(texObj);
if (intelObj->mt)
- intel_miptree_release(intel, &intelObj->mt);
+ st_miptree_release(intel->pipe, &intelObj->mt);
_mesa_delete_texture_object(ctx, texObj);
}
DBG("%s\n", __FUNCTION__);
if (intelImage->mt) {
- intel_miptree_release(intel, &intelImage->mt);
+ st_miptree_release(intel->pipe, &intelImage->mt);
}
if (texImage->Data) {
/* XXX still need the lock ? */
LOCK_HARDWARE(intel);
{
- GLuint image_offset = intel_miptree_image_offset(intelImage->mt,
+ GLuint image_offset = st_miptree_image_offset(intelImage->mt,
intelImage->face,
intelImage->level);
const GLint orig_x = x;
assert(!intelObj->mt);
if (intelImage->base.IsCompressed)
comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat->MesaFormat);
- intelObj->mt = intel_miptree_create(intel,
+ intelObj->mt = st_miptree_create(intel->pipe,
intelObj->base.Target,
intelImage->base.InternalFormat,
firstLevel,
else
src_stride = width;
- dst_offset = intel_miptree_image_offset(intelImage->mt,
+ dst_offset = st_miptree_image_offset(intelImage->mt,
intelImage->face,
intelImage->level);
* Release any old malloced memory.
*/
if (intelImage->mt) {
- intel_miptree_release(intel, &intelImage->mt);
+ st_miptree_release(intel->pipe, &intelImage->mt);
assert(!texImage->Data);
}
else if (texImage->Data) {
intelObj->mt->first_level == level &&
intelObj->mt->last_level == level &&
intelObj->mt->target != GL_TEXTURE_CUBE_MAP_ARB &&
- !intel_miptree_match_image(intelObj->mt, &intelImage->base,
+ !st_miptree_match_image(intelObj->mt, &intelImage->base,
intelImage->face, intelImage->level)) {
DBG("release it\n");
- intel_miptree_release(intel, &intelObj->mt);
+ st_miptree_release(intel->pipe, &intelObj->mt);
assert(!intelObj->mt);
}
assert(!intelImage->mt);
if (intelObj->mt &&
- intel_miptree_match_image(intelObj->mt, &intelImage->base,
+ st_miptree_match_image(intelObj->mt, &intelImage->base,
intelImage->face, intelImage->level)) {
- intel_miptree_reference(&intelImage->mt, intelObj->mt);
+ st_miptree_reference(&intelImage->mt, intelObj->mt);
assert(intelImage->mt);
}
LOCK_HARDWARE(intel);
if (intelImage->mt) {
- texImage->Data = intel_miptree_image_map(intel,
+ texImage->Data = st_miptree_image_map(intel->pipe,
intelImage->mt,
intelImage->face,
intelImage->level,
_mesa_unmap_teximage_pbo(ctx, unpack);
if (intelImage->mt) {
- intel_miptree_image_unmap(intel, intelImage->mt);
+ st_miptree_image_unmap(intel->pipe, intelImage->mt);
texImage->Data = NULL;
}
* kernel. Need to explicitly map and unmap it.
*/
intelImage->base.Data =
- intel_miptree_image_map(intel,
+ st_miptree_image_map(intel->pipe,
intelImage->mt,
intelImage->face,
intelImage->level,
/* Unmap */
if (intelImage->mt) {
- intel_miptree_image_unmap(intel, intelImage->mt);
+ st_miptree_image_unmap(intel->pipe, intelImage->mt);
intelImage->base.Data = NULL;
}
}
return;
if (intelObj->mt)
- intel_miptree_release(intel, &intelObj->mt);
+ st_miptree_release(intel->pipe, &intelObj->mt);
intelObj->imageOverride = GL_TRUE;
intelObj->depthOverride = depth;
* from uploading the buffer under us.
*/
if (intelImage->mt)
- texImage->Data = intel_miptree_image_map(intel,
+ texImage->Data = st_miptree_image_map(intel->pipe,
intelImage->mt,
intelImage->face,
intelImage->level,
_mesa_unmap_teximage_pbo(ctx, packing);
if (intelImage->mt) {
- intel_miptree_image_unmap(intel, intelImage->mt);
+ st_miptree_image_unmap(intel->pipe, intelImage->mt);
texImage->Data = NULL;
}
if (intelImage->mt) {
/* Copy potentially with the blitter:
*/
- intel_miptree_image_copy(intel,
+ st_miptree_image_copy(intel->pipe,
intelObj->mt,
intelImage->face,
intelImage->level, intelImage->mt);
- intel_miptree_release(intel, &intelImage->mt);
+ st_miptree_release(intel->pipe, &intelImage->mt);
}
else {
assert(intelImage->base.Data != NULL);
/* More straightforward upload.
*/
- intel_miptree_image_data(intel,
+ st_miptree_image_data(intel->pipe,
intelObj->mt,
intelImage->face,
intelImage->level,
intelImage->base.Data = NULL;
}
- intel_miptree_reference(&intelImage->mt, intelObj->mt);
+ st_miptree_reference(&intelImage->mt, intelObj->mt);
}
*/
if (firstImage->base.Border) {
if (intelObj->mt) {
- intel_miptree_release(intel, &intelObj->mt);
+ st_miptree_release(intel->pipe, &intelObj->mt);
}
return GL_FALSE;
}
firstImage->mt->last_level >= intelObj->lastLevel) {
if (intelObj->mt)
- intel_miptree_release(intel, &intelObj->mt);
+ st_miptree_release(intel->pipe, &intelObj->mt);
- intel_miptree_reference(&intelObj->mt, firstImage->mt);
+ st_miptree_reference(&intelObj->mt, firstImage->mt);
}
if (firstImage->base.IsCompressed) {
intelObj->mt->depth0 != firstImage->base.Depth ||
intelObj->mt->cpp != cpp ||
intelObj->mt->compressed != firstImage->base.IsCompressed)) {
- intel_miptree_release(intel, &intelObj->mt);
+ st_miptree_release(intel->pipe, &intelObj->mt);
}
/* May need to create a new tree:
*/
if (!intelObj->mt) {
- intelObj->mt = intel_miptree_create(intel,
+ intelObj->mt = st_miptree_create(intel->pipe,
intelObj->base.Target,
firstImage->base.InternalFormat,
intelObj->firstLevel,
if (intelImage->mt) {
intelImage->base.Data =
- intel_miptree_image_map(intel,
+ st_miptree_image_map(intel->pipe,
intelImage->mt,
intelImage->face,
intelImage->level,
intel_texture_image(intelObj->base.Image[face][i]);
if (intelImage->mt) {
- intel_miptree_image_unmap(intel, intelImage->mt);
+ st_miptree_image_unmap(intel->pipe, intelImage->mt);
intelImage->base.Data = NULL;
}
}