diff options
author | Brian Paul <brianp@vmware.com> | 2011-10-31 10:52:57 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2011-10-31 10:52:57 -0600 |
commit | 12d69fca096facf0ddb4642faaed4d5f02d76848 (patch) | |
tree | bbc6ab14015b8f75141e87c74eb2fcf40223ea47 /src/mesa | |
parent | e0a0496971dfd6c0f22b3870e6320128fa895d4d (diff) |
swrast: implement GL_ARB_texture_storage
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/common/driverfuncs.c | 3 | ||||
-rw-r--r-- | src/mesa/main/extensions.c | 1 | ||||
-rw-r--r-- | src/mesa/swrast/s_texture.c | 32 | ||||
-rw-r--r-- | src/mesa/swrast/swrast.h | 7 |
4 files changed, 43 insertions, 0 deletions
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 80db4bde8d3..920271626a9 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -218,6 +218,9 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->EndList = NULL; driver->BeginCallList = NULL; driver->EndCallList = NULL; + + /* GL_ARB_texture_storage */ + driver->AllocTextureStorage = _swrast_AllocTextureStorage; } diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 14f6f1f3afa..b0fe4c34702 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -422,6 +422,7 @@ _mesa_enable_sw_extensions(struct gl_context *ctx) ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; ctx->Extensions.ARB_texture_rg = GL_TRUE; ctx->Extensions.ARB_texture_compression_rgtc = GL_TRUE; + ctx->Extensions.ARB_texture_storage = GL_TRUE; ctx->Extensions.ARB_vertex_array_object = GL_TRUE; #if FEATURE_ARB_vertex_program ctx->Extensions.ARB_vertex_program = GL_TRUE; diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index fb1edb318dd..ba67c6fa417 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -359,3 +359,35 @@ _swrast_unmap_renderbuffers(struct gl_context *ctx) if (ctx->ReadBuffer != ctx->DrawBuffer) map_unmap_renderbuffers(ctx, ctx->ReadBuffer, GL_FALSE); } + + + +/** + * Called via ctx->Driver.AllocTextureStorage() + * Just have to allocate memory for the texture images. + */ +GLboolean +_swrast_AllocTextureStorage(struct gl_context *ctx, + struct gl_texture_object *texObj, + GLsizei levels, GLsizei width, + GLsizei height, GLsizei depth) +{ + const GLint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; + GLint face, level; + + for (face = 0; face < numFaces; face++) { + for (level = 0; level < levels; level++) { + struct gl_texture_image *texImage = texObj->Image[face][level]; + if (!_swrast_alloc_texture_image_buffer(ctx, texImage, + texImage->TexFormat, + texImage->Width, + texImage->Height, + texImage->Depth)) { + return GL_FALSE; + } + } + } + + return GL_TRUE; +} + diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index 06cc651580d..08d565ba03f 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -249,6 +249,13 @@ _swrast_finish_render_texture(struct gl_context *ctx, +extern GLboolean +_swrast_AllocTextureStorage(struct gl_context *ctx, + struct gl_texture_object *texObj, + GLsizei levels, GLsizei width, + GLsizei height, GLsizei depth); + + /** * The driver interface for the software rasterizer. * XXX this may go away. |