struct intel_mipmap_tree * intel_miptree_create(struct intel_context *intel, GLenum target, GLenum base_format, GLenum internal_format, GLuint first_level, GLuint last_level, GLuint width0, GLuint height0, GLuint depth0, GLuint cpp, GLuint compress_byte, GLboolean expect_accelerated_upload) { struct intel_mipmap_tree *mt; uint32_t tiling = I915_TILING_NONE; if (intel->use_texture_tiling && compress_byte == 0) { if (intel->gen >= 4 && (base_format == GL_DEPTH_COMPONENT || base_format == GL_DEPTH_STENCIL_EXT)) tiling = I915_TILING_Y; else if (width0 >= 64) tiling = I915_TILING_X; } mt = intel_miptree_create_internal(intel, target, internal_format, first_level, last_level, width0, height0, depth0, cpp, compress_byte, tiling); /* * pitch == 0 || height == 0 indicates the null texture */ if (!mt || !mt->total_height) { free(mt); return NULL; } mt->region = intel_region_alloc(intel->intelScreen, tiling, mt->cpp, mt->total_width, mt->total_height, expect_accelerated_upload); if (!mt->region) { free(mt); return NULL; } return mt; }
struct intel_mipmap_tree * intel_miptree_create_for_region(struct intel_context *intel, GLenum target, GLenum internal_format, GLuint first_level, GLuint last_level, struct intel_region *region, GLuint depth0, GLuint compress_byte) { struct intel_mipmap_tree *mt; mt = intel_miptree_create_internal(intel, target, internal_format, first_level, last_level, region->width, region->height, 1, region->cpp, compress_byte); if (!mt) return mt; #if 0 if (mt->pitch != region->pitch) { fprintf(stderr, "region pitch (%d) doesn't match mipmap tree pitch (%d)\n", region->pitch, mt->pitch); free(mt); return NULL; } #else /* The mipmap tree pitch is aligned to 64 bytes to make sure render * to texture works, but we don't need that for texturing from a * pixmap. Just override it here. */ mt->pitch = region->pitch; #endif intel_region_reference(&mt->region, region); return mt; }
struct intel_mipmap_tree * intel_miptree_create_for_region(struct intel_context *intel, GLenum target, GLenum internal_format, GLuint first_level, GLuint last_level, struct intel_region *region, GLuint depth0, GLuint compress_byte) { struct intel_mipmap_tree *mt; mt = intel_miptree_create_internal(intel, target, internal_format, first_level, last_level, region->width, region->height, 1, region->cpp, compress_byte, I915_TILING_NONE); if (!mt) return mt; intel_region_reference(&mt->region, region); return mt; }
struct intel_mipmap_tree * intel_miptree_create(struct intel_context *intel, GLenum target, GLenum internal_format, GLuint first_level, GLuint last_level, GLuint width0, GLuint height0, GLuint depth0, GLuint cpp, GLuint compress_byte, GLboolean expect_accelerated_upload) { struct intel_mipmap_tree *mt; mt = intel_miptree_create_internal(intel, target, internal_format, first_level, last_level, width0, height0, depth0, cpp, compress_byte); /* * pitch == 0 || height == 0 indicates the null texture */ if (!mt || !mt->pitch || !mt->total_height) return NULL; mt->region = intel_region_alloc(intel, mt->cpp, mt->pitch, mt->total_height, mt->pitch, expect_accelerated_upload); if (!mt->region) { free(mt); return NULL; } return mt; }