aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_sampler_view.c
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2017-10-10 13:58:44 +0200
committerNicolai Hähnle <[email protected]>2017-10-10 13:58:44 +0200
commit288dea076e3311530214aaaa53884a6d920b590a (patch)
tree1e7ab9427d7eea482da086be26a4d4b084eadca4 /src/mesa/state_tracker/st_sampler_view.c
parentd245724399b7ac9e2ddf99d381f7fe092204006a (diff)
st/mesa: fix import of EGL images with non-zero level or layer
In GL state, textures created from EGL images look like plain 2D textures with a single level, so we use the existing layer_override facility and add an analogous level_override one. Fixes dEQP-EGL.functional.image.create.gles2_cubemap_{positive,negative}_{x,y,z}_rgba_texture Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_sampler_view.c')
-rw-r--r--src/mesa/state_tracker/st_sampler_view.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/mesa/state_tracker/st_sampler_view.c b/src/mesa/state_tracker/st_sampler_view.c
index fbf0aaeb03a..014b4d26784 100644
--- a/src/mesa/state_tracker/st_sampler_view.c
+++ b/src/mesa/state_tracker/st_sampler_view.c
@@ -379,9 +379,12 @@ st_create_texture_sampler_view_from_stobj(struct st_context *st,
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 {
@@ -389,6 +392,7 @@ st_create_texture_sampler_view_from_stobj(struct st_context *st,
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);
@@ -419,9 +423,9 @@ st_get_texture_sampler_view_from_stobj(struct st_context *st,
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 ||