renderer: set more texture-view state up-front

These settings can't change in the lifetime of the texture-view,
so let's set them up front instead of re-setting them on every re-emit.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
macos/master
Erik Faye-Lund 6 years ago
parent e54daddc47
commit 14972df3a6
  1. 21
      src/vrend_renderer.c

@ -1889,6 +1889,25 @@ int vrend_create_sampler_view(struct vrend_context *ctx,
base_layer, max_layer - base_layer + 1);
glBindTexture(view->texture->target, view->id);
if (util_format_is_depth_or_stencil(view->format)) {
if (vrend_state.use_core_profile == false) {
/* setting depth texture mode is deprecated in core profile */
if (view->depth_texture_mode != GL_RED) {
glTexParameteri(view->texture->target, GL_DEPTH_TEXTURE_MODE, GL_RED);
view->depth_texture_mode = GL_RED;
}
}
if (has_feature(feat_stencil_texturing)) {
const struct util_format_description *desc = util_format_description(view->format);
if (!util_format_has_depth(desc)) {
glTexParameteri(view->texture->target, GL_DEPTH_STENCIL_TEXTURE_MODE, GL_STENCIL_INDEX);
} else {
glTexParameteri(view->texture->target, GL_DEPTH_STENCIL_TEXTURE_MODE, GL_DEPTH_COMPONENT);
}
}
}
glTexParameteri(view->texture->target, GL_TEXTURE_BASE_LEVEL, base_level);
glTexParameteri(view->texture->target, GL_TEXTURE_MAX_LEVEL, max_level);
glTexParameteri(view->texture->target, GL_TEXTURE_SWIZZLE_R, view->gl_swizzle_r);
@ -2570,6 +2589,7 @@ void vrend_set_single_sampler_view(struct vrend_context *ctx,
return;
}
if (!view->texture->is_buffer) {
if (view->texture->id == view->id) {
glBindTexture(view->target, view->id);
if (util_format_is_depth_or_stencil(view->format)) {
@ -2590,7 +2610,6 @@ void vrend_set_single_sampler_view(struct vrend_context *ctx,
}
}
if (view->texture->id == view->id) {
if (tex->cur_base != (view->val1 & 0xff)) {
int base_level = view->val1 & 0xff;
glTexParameteri(view->texture->target, GL_TEXTURE_BASE_LEVEL, base_level);

Loading…
Cancel
Save