#include "state_tracker/st_gen_mipmap.h"
#include "state_tracker/st_atom.h"
#include "state_tracker/st_sampler_view.h"
+#include "state_tracker/st_util.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#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.
*/
struct st_texture_object *stObj = st_texture_object(texObj);
pipe_resource_reference(&stObj->pt, NULL);
- st_texture_release_all_sampler_views(st, stObj);
- st_texture_free_sampler_views(stObj);
+ st_delete_texture_sampler_views(st, stObj);
simple_mtx_destroy(&stObj->validate_mutex);
_mesa_delete_texture_object(ctx, texObj);
}
/* not a mipmap minification filter */
return FALSE;
+ /* If the following sequence of GL calls is used:
+ * glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, ...
+ * glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ *
+ * we would needlessly allocate a mipmapped texture, because the initial
+ * MinFilter is GL_NEAREST_MIPMAP_LINEAR. Catch this case and don't
+ * allocate a mipmapped texture by default. This may cause texture
+ * reallocation later, but GL_NEAREST_MIPMAP_LINEAR is pretty rare.
+ */
+ if (stObj->base.Sampler.MinFilter == GL_NEAREST_MIPMAP_LINEAR)
+ return FALSE;
+
if (stObj->base.Target == GL_TEXTURE_3D)
/* 3D textures are seldom mipmapped */
return FALSE;
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 */
case GL_STENCIL_INDEX:
switch (srcFormat) {
+ case GL_DEPTH_STENCIL:
case GL_STENCIL_INDEX:
return PIPE_MASK_S;
default:
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!?! */
{
/* debug checks */
{
- const struct gl_texture_image MAYBE_UNUSED *dstImage =
+ ASSERTED const struct gl_texture_image *dstImage =
stObj->base.Image[stImage->base.Face][dstLevel];
assert(dstImage);
assert(dstImage->Width == stImage->base.Width);