#include "util/u_upload_mgr.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_tile.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "util/u_surface.h"
#include "util/u_sampler.h"
#include "util/u_math.h"
if (!obj)
return NULL;
+ obj->level_override = -1;
+ obj->layer_override = -1;
+
/* Pre-allocate a sampler views container to save a branch in the
* fast path.
*/
st_texture_release_all_sampler_views(st, stObj);
}
+bool
+st_astc_format_fallback(const struct st_context *st, mesa_format format)
+{
+ if (!_mesa_is_format_astc_2d(format))
+ return false;
+
+ if (format == MESA_FORMAT_RGBA_ASTC_5x5 ||
+ format == MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5)
+ return !st->has_astc_5x5_ldr;
+
+ return !st->has_astc_2d_ldr;
+}
bool
st_compressed_format_fallback(struct st_context *st, mesa_format format)
if (_mesa_is_format_etc2(format))
return !st->has_etc2;
- if (_mesa_is_format_astc_2d(format))
- return !st->has_astc_2d_ldr;
+ if (st_astc_format_fallback(st, format))
+ return true;
return false;
}
if (stImage->base.Level > 0 || stObj->base.GenerateMipmap)
return TRUE;
+ /* If the application has explicitly called glTextureParameter to set
+ * GL_TEXTURE_MAX_LEVEL, such that (max - base) > 0, then they're trying
+ * to communicate that they will have multiple miplevels.
+ *
+ * Core Mesa will initialize MaxLevel to value much larger than
+ * MAX_TEXTURE_LEVELS, so we check that to see if it's been set at all.
+ */
+ if (stObj->base.MaxLevel < MAX_TEXTURE_LEVELS &&
+ stObj->base.MaxLevel - stObj->base.BaseLevel > 0)
+ return TRUE;
+
if (stImage->base._BaseFormat == GL_DEPTH_COMPONENT ||
stImage->base._BaseFormat == GL_DEPTH_STENCIL_EXT)
/* depth/stencil textures are seldom mipmapped */
assert(!st_texture_image(texImage)->pt);
_mesa_clear_texture_object(ctx, texObj, texImage);
- stObj->layer_override = 0;
- stObj->level_override = 0;
+ stObj->layer_override = -1;
+ stObj->level_override = -1;
pipe_resource_reference(&stObj->pt, NULL);
/* oops, need to init this image again */
CSO_BIT_DEPTH_STENCIL_ALPHA |
CSO_BIT_RASTERIZER |
CSO_BIT_STREAM_OUTPUTS |
- CSO_BIT_PAUSE_QUERIES |
+ (st->active_queries ? CSO_BIT_PAUSE_QUERIES : 0) |
CSO_BIT_SAMPLE_MASK |
CSO_BIT_MIN_SAMPLES |
CSO_BIT_RENDER_CONDITION |
case PIPE_FORMAT_ASTC_12x10:
case PIPE_FORMAT_ASTC_12x12:
case PIPE_FORMAT_BPTC_RGBA_UNORM:
+ case PIPE_FORMAT_FXT1_RGB:
+ case PIPE_FORMAT_FXT1_RGBA:
dst_glformat = GL_RGBA8;
break;
case PIPE_FORMAT_RGTC1_SNORM:
}
dst_format = st_choose_format(st, dst_glformat, format, type,
- pipe_target, 0, 0, bind, FALSE);
+ pipe_target, 0, 0, bind,
+ false, false);
if (dst_format == PIPE_FORMAT_NONE) {
/* unable to get an rgba format!?! */
slice, 0, 0);
/* get float[4] rgba row from surface */
- pipe_get_tile_rgba_format(tex_xfer, map, 0, 0, width, height,
- dst_format, rgba);
+ pipe_get_tile_rgba(tex_xfer, map, 0, 0, width, height, dst_format,
+ rgba);
_mesa_format_convert(dest, dstMesaFormat, dstStride,
rgba, RGBA32_FLOAT, srcStride,
data = malloc(width * sizeof(uint));
if (data) {
+ unsigned dst_stride = (stImage->pt->target == PIPE_TEXTURE_1D_ARRAY ?
+ transfer->layer_stride : transfer->stride);
/* To avoid a large temp memory allocation, do copy row by row */
for (row = 0; row < height; row++, srcY += yStep) {
- pipe_get_tile_z(src_trans, map, 0, srcY, width, 1, data);
+ util_format_unpack_z_32unorm(strb->texture->format,
+ data, (uint8_t *)map + src_trans->stride * srcY,
+ width);
if (scaleOrBias) {
_mesa_scale_and_bias_depth_uint(ctx, width, data);
}
- if (stImage->pt->target == PIPE_TEXTURE_1D_ARRAY) {
- pipe_put_tile_z(transfer, texDest + row*transfer->layer_stride,
- 0, 0, width, 1, data);
- }
- else {
- pipe_put_tile_z(transfer, texDest, 0, row, width, 1, data);
- }
+ util_format_pack_z_32unorm(stImage->pt->format,
+ texDest + row * dst_stride, data, width);
}
}
else {
/* XXX this usually involves a lot of int/float conversion.
* try to avoid that someday.
*/
- pipe_get_tile_rgba_format(src_trans, map, 0, 0, width, height,
- util_format_linear(strb->texture->format),
- tempSrc);
+ pipe_get_tile_rgba(src_trans, map, 0, 0, width, height,
+ util_format_linear(strb->texture->format),
+ tempSrc);
/* Store into texture memory.
* Note that this does some special things such as pixel transfer