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.
*/
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 */
templ.format = format;
- if (stObj->level_override) {
+ if (stObj->level_override >= 0) {
templ.u.tex.first_level = templ.u.tex.last_level = stObj->level_override;
} else {
templ.u.tex.first_level = stObj->base.MinLevel + stObj->base.BaseLevel;
templ.u.tex.last_level = last_level(stObj);
}
- if (stObj->layer_override) {
+ if (stObj->layer_override >= 0) {
templ.u.tex.first_layer = templ.u.tex.last_layer = stObj->layer_override;
} else {
templ.u.tex.first_layer = stObj->base.MinLayer;
assert(!check_sampler_swizzle(st, stObj, view, glsl130_or_later));
assert(get_sampler_view_format(st, stObj, srgb_skip_decode) == view->format);
assert(gl_target_to_pipe(stObj->base.Target) == view->target);
- assert(stObj->level_override ||
+ assert(stObj->level_override >= 0 ||
stObj->base.MinLevel + stObj->base.BaseLevel == view->u.tex.first_level);
- assert(stObj->level_override || last_level(stObj) == view->u.tex.last_level);
- assert(stObj->layer_override || stObj->base.MinLayer == view->u.tex.first_layer);
- assert(stObj->layer_override || last_layer(stObj) == view->u.tex.last_layer);
- assert(!stObj->layer_override ||
+ assert(stObj->level_override >= 0 || last_level(stObj) == view->u.tex.last_level);
+ assert(stObj->layer_override >= 0 || stObj->base.MinLayer == view->u.tex.first_layer);
+ assert(stObj->layer_override >= 0 || last_layer(stObj) == view->u.tex.last_layer);
+ assert(stObj->layer_override < 0 ||
(stObj->layer_override == view->u.tex.first_layer &&
stObj->layer_override == view->u.tex.last_layer));
return view;
*/
enum pipe_format surface_format;
- /* When non-zero, samplers should use this level instead of the level
+ /* When non-negative, samplers should use this level instead of the level
* range specified by the GL state.
*
* This is used for EGL images, which may correspond to a single level out
* of an imported pipe_resources with multiple mip levels.
*/
- uint level_override;
+ int level_override;
- /* When non-zero, samplers should use this layer instead of the one
+ /* When non-negative, samplers should use this layer instead of the one
* specified by the GL state.
*
* This is used for EGL images and VDPAU interop, where imported
* with different fields in the case of VDPAU) even though the GL state
* describes one non-array texture per field.
*/
- uint layer_override;
+ int layer_override;
/**
* Set when the texture images of this texture object might not all be in
struct pipe_resource *res;
mesa_format texFormat;
- uint layer_override = 0;
+ int layer_override = -1;
if (output) {
res = st_vdpau_output_surface_dma_buf(ctx, vdpSurface);
pipe_resource_reference(&stImage->pt, res);
stObj->surface_format = res->format;
- stObj->level_override = 0;
+ stObj->level_override = -1;
stObj->layer_override = layer_override;
_mesa_dirty_texobj(ctx, texObj);
st_texture_release_all_sampler_views(st, stObj);
pipe_resource_reference(&stImage->pt, NULL);
- stObj->level_override = 0;
- stObj->layer_override = 0;
+ stObj->level_override = -1;
+ stObj->layer_override = -1;
_mesa_dirty_texobj(ctx, texObj);