diff options
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r-- | mesalib/src/mesa/main/enums.c | 7 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texstore.c | 26 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_fbo.c | 9 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_texture.c | 18 | ||||
-rw-r--r-- | mesalib/src/mesa/swrast/s_texture.c | 21 | ||||
-rw-r--r-- | mesalib/src/mesa/swrast/swrast.h | 4 |
6 files changed, 66 insertions, 19 deletions
diff --git a/mesalib/src/mesa/main/enums.c b/mesalib/src/mesa/main/enums.c index b00a738bc..c92a9a166 100644 --- a/mesalib/src/mesa/main/enums.c +++ b/mesalib/src/mesa/main/enums.c @@ -4460,7 +4460,7 @@ static const enum_elt all_enums[2340] = { 45645, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ { 45676, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ { 45711, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES */ - { 45746, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ + { 45746, 0x0000884F }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ { 45775, 0x00008071 }, /* GL_TEXTURE_DEPTH */ { 45792, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ { 45814, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ @@ -4723,7 +4723,7 @@ static const enum_elt all_enums[2340] = { 52477, 0x00000D17 }, /* GL_ZOOM_Y */ }; -static const unsigned reduced_enums[1571] = +static const unsigned reduced_enums[1572] = { 556, /* GL_FALSE */ 853, /* GL_LINES */ @@ -5806,6 +5806,7 @@ static const unsigned reduced_enums[1571] = 2038, /* GL_TEXTURE_COMPARE_MODE */ 2036, /* GL_TEXTURE_COMPARE_FUNC */ 284, /* GL_COMPARE_REF_TO_TEXTURE */ + 2079, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ 1400, /* GL_POINT_SPRITE */ 347, /* GL_COORD_REPLACE */ 1405, /* GL_POINT_SPRITE_R_MODE_NV */ @@ -5917,7 +5918,7 @@ static const unsigned reduced_enums[1571] = 1368, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ 400, /* GL_DEPTH24_STENCIL8 */ 2134, /* GL_TEXTURE_STENCIL_SIZE */ - 2079, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ + 1096, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ 1094, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ 1097, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ 1101, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index 8c51a948e..e8190c392 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -1350,6 +1350,32 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && + dstFormat == MESA_FORMAT_ARGB8888 && + srcFormat == GL_LUMINANCE_ALPHA && + baseInternalFormat == GL_RGBA && + srcType == GL_UNSIGNED_BYTE) { + /* special case of storing LA -> ARGB8888 */ + int img, row, col; + const GLint srcRowStride = + _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); + for (img = 0; img < srcDepth; img++) { + const GLubyte *srcRow = (const GLubyte *) + _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, + srcHeight, srcFormat, srcType, img, 0, 0); + GLubyte *dstRow = dstSlices[img]; + for (row = 0; row < srcHeight; row++) { + GLuint *d4 = (GLuint *) dstRow; + for (col = 0; col < srcWidth; col++) { + GLubyte l = srcRow[col * 2 + 0], a = srcRow[col * 2 + 1]; + d4[col] = PACK_COLOR_8888(a, l, l, l); + } + dstRow += dstRowStride; + srcRow += srcRowStride; + } + } + } + else if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && dstFormat == MESA_FORMAT_ARGB8888 && srcFormat == GL_RGBA && baseInternalFormat == GL_RGBA && diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c index 300c3f0eb..953295c0e 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c +++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c @@ -278,9 +278,16 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw) case PIPE_FORMAT_R16G16_UNORM: strb->Base.InternalFormat = GL_RG16; break; + case PIPE_FORMAT_R32G32B32A32_FLOAT: + strb->Base.InternalFormat = GL_RGBA32F; + break; + case PIPE_FORMAT_R16G16B16A16_FLOAT: + strb->Base.InternalFormat = GL_RGBA16F; + break; default: _mesa_problem(NULL, - "Unexpected format in st_new_renderbuffer_fb"); + "Unexpected format %s in st_new_renderbuffer_fb", + util_format_name(format)); free(strb); return NULL; } diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index 74ae2d11d..d887455e6 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -137,15 +137,7 @@ st_DeleteTextureObject(struct gl_context *ctx, if (stObj->pt) pipe_resource_reference(&stObj->pt, NULL); if (stObj->sampler_view) { - if (stObj->sampler_view->context != st->pipe) { - /* Take "ownership" of this texture sampler view by setting - * its context pointer to this context. This avoids potential - * crashes when the texture object is shared among contexts - * and the original/owner context has already been destroyed. - */ - stObj->sampler_view->context = st->pipe; - } - pipe_sampler_view_reference(&stObj->sampler_view, NULL); + pipe_sampler_view_release(st->pipe, &stObj->sampler_view); } _mesa_delete_texture_object(ctx, texObj); } @@ -450,7 +442,7 @@ st_AllocTextureImageBuffer(struct gl_context *ctx, /* The parent texture object does not have space for this image */ pipe_resource_reference(&stObj->pt, NULL); - pipe_sampler_view_reference(&stObj->sampler_view, NULL); + pipe_sampler_view_release(st->pipe, &stObj->sampler_view); if (!guess_and_alloc_texture(st, stObj, stImage)) { /* Probably out of memory. @@ -717,7 +709,7 @@ decompress_with_blit(struct gl_context * ctx, /* destroy the temp / dest surface */ util_destroy_rgba_surface(dst_texture, dst_surface); - pipe_sampler_view_reference(&src_view, NULL); + pipe_sampler_view_release(pipe, &src_view); } @@ -1260,7 +1252,7 @@ st_finalize_texture(struct gl_context *ctx, firstImage->pt != stObj->pt && (!stObj->pt || firstImage->pt->last_level >= stObj->pt->last_level)) { pipe_resource_reference(&stObj->pt, firstImage->pt); - pipe_sampler_view_reference(&stObj->sampler_view, NULL); + pipe_sampler_view_release(st->pipe, &stObj->sampler_view); } /* Find gallium format for the Mesa texture */ @@ -1300,7 +1292,7 @@ st_finalize_texture(struct gl_context *ctx, * gallium texture now. We'll make a new one below. */ pipe_resource_reference(&stObj->pt, NULL); - pipe_sampler_view_reference(&stObj->sampler_view, NULL); + pipe_sampler_view_release(st->pipe, &stObj->sampler_view); st->dirty.st |= ST_NEW_FRAMEBUFFER; } } diff --git a/mesalib/src/mesa/swrast/s_texture.c b/mesalib/src/mesa/swrast/s_texture.c index 72d309300..9718367a8 100644 --- a/mesalib/src/mesa/swrast/s_texture.c +++ b/mesalib/src/mesa/swrast/s_texture.c @@ -96,6 +96,25 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx, swImg->ImageOffsets[i] = i * width * height; } + _swrast_init_texture_image(texImage, width, height, depth); + + return GL_TRUE; +} + + +/** + * Code that overrides ctx->Driver.AllocTextureImageBuffer may use this to + * initialize the fields of swrast_texture_image without allocating the image + * buffer or initializing ImageOffsets or RowStride. + * + * Returns GL_TRUE on success, GL_FALSE on memory allocation failure. + */ +void +_swrast_init_texture_image(struct gl_texture_image *texImage, GLsizei width, + GLsizei height, GLsizei depth) +{ + struct swrast_texture_image *swImg = swrast_texture_image(texImage); + if ((width == 1 || _mesa_is_pow_two(texImage->Width2)) && (height == 1 || _mesa_is_pow_two(texImage->Height2)) && (depth == 1 || _mesa_is_pow_two(texImage->Depth2))) @@ -115,8 +134,6 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx, swImg->HeightScale = (GLfloat) texImage->Height; swImg->DepthScale = (GLfloat) texImage->Depth; } - - return GL_TRUE; } diff --git a/mesalib/src/mesa/swrast/swrast.h b/mesalib/src/mesa/swrast/swrast.h index 468d22f0b..ad19eeecc 100644 --- a/mesalib/src/mesa/swrast/swrast.h +++ b/mesalib/src/mesa/swrast/swrast.h @@ -192,6 +192,10 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx, GLsizei height, GLsizei depth); extern void +_swrast_init_texture_image(struct gl_texture_image *texImage, GLsizei width, + GLsizei height, GLsizei depth); + +extern void _swrast_free_texture_image_buffer(struct gl_context *ctx, struct gl_texture_image *texImage); |