diff options
author | marha <marha@users.sourceforge.net> | 2011-08-30 08:04:44 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-08-30 08:08:15 +0200 |
commit | 82ce0534a7bc89f1ed93b4b952b30ceb3d94210d (patch) | |
tree | a2b73894a436b1158cf0e8e2f2ea946478529d12 /mesalib/src/mesa/state_tracker/st_cb_texture.c | |
parent | 01df5d59e56a1b060568f8cad2e89f7eea22fc70 (diff) | |
download | vcxsrv-82ce0534a7bc89f1ed93b4b952b30ceb3d94210d.tar.gz vcxsrv-82ce0534a7bc89f1ed93b4b952b30ceb3d94210d.tar.bz2 vcxsrv-82ce0534a7bc89f1ed93b4b952b30ceb3d94210d.zip |
mesa git update 30 aug 2011
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_cb_texture.c')
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_texture.c | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index a3b2ba9e7..e4be7fba4 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -142,9 +142,9 @@ st_DeleteTextureObject(struct gl_context *ctx, } -/** called via ctx->Driver.FreeTexImageData() */ +/** called via ctx->Driver.FreeTextureImageBuffer() */ static void -st_FreeTextureImageData(struct gl_context * ctx, struct gl_texture_image *texImage) +st_FreeTextureImageBuffer(struct gl_context * ctx, struct gl_texture_image *texImage) { struct st_texture_image *stImage = st_texture_image(texImage); @@ -161,6 +161,49 @@ st_FreeTextureImageData(struct gl_context * ctx, struct gl_texture_image *texIma } +/** called via ctx->Driver.MapTextureImage() */ +static void +st_MapTextureImage(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLuint slice, GLuint x, GLuint y, GLuint w, GLuint h, + GLbitfield mode, + GLubyte **mapOut, GLint *rowStrideOut) +{ + struct st_context *st = st_context(ctx); + struct st_texture_image *stImage = st_texture_image(texImage); + unsigned pipeMode; + GLubyte *map; + + pipeMode = 0x0; + if (mode & GL_MAP_READ_BIT) + pipeMode |= PIPE_TRANSFER_READ; + if (mode & GL_MAP_WRITE_BIT) + pipeMode |= PIPE_TRANSFER_WRITE; + + map = st_texture_image_map(st, stImage, slice, pipeMode, x, y, w, h); + if (map) { + *mapOut = map; + *rowStrideOut = stImage->transfer->stride; + } + else { + *mapOut = NULL; + *rowStrideOut = 0; + } +} + + +/** called via ctx->Driver.UnmapTextureImage() */ +static void +st_UnmapTextureImage(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLuint slice) +{ + struct st_context *st = st_context(ctx); + struct st_texture_image *stImage = st_texture_image(texImage); + st_texture_image_unmap(st, stImage); +} + + /** * From linux kernel i386 header files, copes with odd sizes better * than COPY_DWORDS would: @@ -1880,7 +1923,9 @@ st_init_texture_functions(struct dd_function_table *functions) functions->NewTextureObject = st_NewTextureObject; functions->NewTextureImage = st_NewTextureImage; functions->DeleteTexture = st_DeleteTextureObject; - functions->FreeTexImageData = st_FreeTextureImageData; + functions->FreeTextureImageBuffer = st_FreeTextureImageBuffer; + functions->MapTextureImage = st_MapTextureImage; + functions->UnmapTextureImage = st_UnmapTextureImage; functions->TextureMemCpy = do_memcpy; |