stimg->texture->width0, stimg->texture->height0,
1, 0, internalFormat, texFormat);
- /* FIXME create a non-default sampler view from the stimg? */
pipe_resource_reference(&stObj->pt, stimg->texture);
st_texture_release_all_sampler_views(st, stObj);
pipe_resource_reference(&stImage->pt, stObj->pt);
stObj->surface_format = stimg->format;
+ stObj->level_override = stimg->level;
+ stObj->layer_override = stimg->layer;
_mesa_dirty_texobj(ctx, texObj);
}
assert(!st_texture_image(texImage)->pt);
_mesa_clear_texture_object(ctx, texObj, texImage);
+ stObj->layer_override = 0;
+ stObj->level_override = 0;
pipe_resource_reference(&stObj->pt, NULL);
/* oops, need to init this image again */
templ.format = format;
- templ.u.tex.first_level = stObj->base.MinLevel + stObj->base.BaseLevel;
- templ.u.tex.last_level = last_level(stObj);
- assert(templ.u.tex.first_level <= templ.u.tex.last_level);
+ if (stObj->level_override) {
+ 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) {
templ.u.tex.first_layer = templ.u.tex.last_layer = stObj->layer_override;
} else {
templ.u.tex.last_layer = last_layer(stObj);
}
assert(templ.u.tex.first_layer <= templ.u.tex.last_layer);
+ assert(templ.u.tex.first_level <= templ.u.tex.last_level);
templ.target = gl_target_to_pipe(stObj->base.Target);
templ.swizzle_r = GET_SWZ(swizzle, 0);
assert(!check_sampler_swizzle(st, stObj, view, glsl130_or_later));
assert(get_sampler_view_format(st, stObj, samp) == view->format);
assert(gl_target_to_pipe(stObj->base.Target) == view->target);
- assert(stObj->base.MinLevel + stObj->base.BaseLevel ==
- view->u.tex.first_level);
- assert(last_level(stObj) == view->u.tex.last_level);
+ assert(stObj->level_override ||
+ 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 ||
*/
enum pipe_format surface_format;
+ /* When non-zero, 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;
+
/* When non-zero, samplers should use this layer instead of the one
* specified by the GL state.
*
- * This is used for VDPAU interop, where imported pipe_resources may be
- * array textures (containing layers with different fields) even though the
- * GL state describes one non-array texture per field.
+ * This is used for EGL images and VDPAU interop, where imported
+ * pipe_resources may be cube, 3D, or array textures (containing layers
+ * with different fields in the case of VDPAU) even though the GL state
+ * describes one non-array texture per field.
*/
uint layer_override;
pipe_resource_reference(&stImage->pt, res);
stObj->surface_format = res->format;
+ stObj->level_override = 0;
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;
_mesa_dirty_texobj(ctx, texObj);