Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 1988303002: Fix depth texture sampling on compatibility profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 5221 matching lines...) Expand 10 before | Expand all | Expand 10 after
5232 if (texture_ref) { 5232 if (texture_ref) {
5233 Texture* texture = texture_ref->texture(); 5233 Texture* texture = texture_ref->texture();
5234 // Check that we are not trying to bind it to a different target. 5234 // Check that we are not trying to bind it to a different target.
5235 if (texture->target() != 0 && texture->target() != target) { 5235 if (texture->target() != 0 && texture->target() != target) {
5236 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 5236 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
5237 "glBindTexture", 5237 "glBindTexture",
5238 "texture bound to more than 1 target."); 5238 "texture bound to more than 1 target.");
5239 return; 5239 return;
5240 } 5240 }
5241 LogClientServiceForInfo(texture, client_id, "glBindTexture"); 5241 LogClientServiceForInfo(texture, client_id, "glBindTexture");
5242 glBindTexture(target, texture->service_id());
5242 if (texture->target() == 0) { 5243 if (texture->target() == 0) {
5243 texture_manager()->SetTarget(texture_ref, target); 5244 texture_manager()->SetTarget(texture_ref, target);
5245 if (!feature_info_->gl_version_info().BehavesLikeGLES() &&
5246 feature_info_->gl_version_info().IsAtLeastGL(3, 2)) {
5247 // In Desktop GL core profile and GL ES, depth textures are always
5248 // sampled to the RED channel, whereas on Desktop GL compatibility
5249 // proifle, they are sampled to RED, LUMINANCE, INTENSITY, or ALPHA
5250 // channel, depending on the DEPTH_TEXTURE_MODE value.
5251 // In theory we only need to apply this for depth textures, but it is
5252 // simpler to apply to all textures.
5253 glTexParameteri(target, GL_DEPTH_TEXTURE_MODE, GL_RED);
5254 }
5244 } 5255 }
5245 glBindTexture(target, texture->service_id());
5246 } else { 5256 } else {
5247 glBindTexture(target, 0); 5257 glBindTexture(target, 0);
5248 } 5258 }
5249 5259
5250 TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; 5260 TextureUnit& unit = state_.texture_units[state_.active_texture_unit];
5251 unit.bind_target = target; 5261 unit.bind_target = target;
5252 unit.GetInfoForTarget(target) = texture_ref; 5262 unit.GetInfoForTarget(target) = texture_ref;
5253 } 5263 }
5254 5264
5255 void GLES2DecoderImpl::DoBindSampler(GLuint unit, GLuint client_id) { 5265 void GLES2DecoderImpl::DoBindSampler(GLuint unit, GLuint client_id) {
(...skipping 11529 matching lines...) Expand 10 before | Expand all | Expand 10 after
16785 } 16795 }
16786 16796
16787 // Include the auto-generated part of this file. We split this because it means 16797 // Include the auto-generated part of this file. We split this because it means
16788 // we can easily edit the non-auto generated parts right here in this file 16798 // we can easily edit the non-auto generated parts right here in this file
16789 // instead of having to edit some template or the code generator. 16799 // instead of having to edit some template or the code generator.
16790 #include "base/macros.h" 16800 #include "base/macros.h"
16791 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 16801 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
16792 16802
16793 } // namespace gles2 16803 } // namespace gles2
16794 } // namespace gpu 16804 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/build_gles2_cmd_buffer.py ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698