summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2012-08-10 21:31:57 -0700
committerIan Romanick <[email protected]>2012-08-14 14:39:19 -0700
commit9bcb9fad65f0926d665317d6830e9812baafcf86 (patch)
tree6830c3a02d65d522353f9d618ce9eb67094a7c36 /src/mesa
parent92b614172f750f93f218cd78a9f3c066c3629cab (diff)
intel: Implement ARB_texture_storage
This is basically cut-and-paste from the swrast implementation, and it could probably be (slightly) more optimal. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rwxr-xr-xsrc/mesa/drivers/dri/intel/intel_extensions.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex.c26
2 files changed, 27 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c
index 76b56a2a917..746184f5c6c 100755
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -57,6 +57,7 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.ARB_texture_env_combine = true;
ctx->Extensions.ARB_texture_env_crossbar = true;
ctx->Extensions.ARB_texture_env_dot3 = true;
+ ctx->Extensions.ARB_texture_storage = true;
ctx->Extensions.ARB_vertex_array_object = true;
ctx->Extensions.ARB_vertex_program = true;
ctx->Extensions.ARB_vertex_shader = true;
diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c
index 92481b9b55f..4abe9885369 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.c
+++ b/src/mesa/drivers/dri/intel/intel_tex.c
@@ -110,6 +110,31 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx,
return true;
}
+/**
+ * Called via ctx->Driver.AllocTextureStorage()
+ * Just have to allocate memory for the texture images.
+ */
+static GLboolean
+intel_alloc_texture_storage(struct gl_context *ctx,
+ struct gl_texture_object *texObj,
+ GLsizei levels, GLsizei width,
+ GLsizei height, GLsizei depth)
+{
+ const int numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
+ int face;
+ int level;
+
+ for (face = 0; face < numFaces; face++) {
+ for (level = 0; level < levels; level++) {
+ struct gl_texture_image *const texImage = texObj->Image[face][level];
+ if (!intel_alloc_texture_image_buffer(ctx, texImage))
+ return false;
+ }
+ }
+
+ return true;
+}
+
static void
intel_free_texture_image_buffer(struct gl_context * ctx,
struct gl_texture_image *texImage)
@@ -191,6 +216,7 @@ intelInitTextureFuncs(struct dd_function_table *functions)
functions->DeleteTexture = intelDeleteTextureObject;
functions->AllocTextureImageBuffer = intel_alloc_texture_image_buffer;
functions->FreeTextureImageBuffer = intel_free_texture_image_buffer;
+ functions->AllocTextureStorage = intel_alloc_texture_storage;
functions->MapTextureImage = intel_map_texture_image;
functions->UnmapTextureImage = intel_unmap_texture_image;
}