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

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

Issue 2510163003: Initialize depth texture using tex{Sub}Image2D except for ANGLE ES2 (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12181 matching lines...) Expand 10 before | Expand all | Expand 10 after
12192 int level, 12192 int level,
12193 unsigned format, 12193 unsigned format,
12194 unsigned type, 12194 unsigned type,
12195 int xoffset, 12195 int xoffset,
12196 int yoffset, 12196 int yoffset,
12197 int width, 12197 int width,
12198 int height) { 12198 int height) {
12199 DCHECK(target != GL_TEXTURE_3D && target != GL_TEXTURE_2D_ARRAY && 12199 DCHECK(target != GL_TEXTURE_3D && target != GL_TEXTURE_2D_ARRAY &&
12200 target != GL_TEXTURE_EXTERNAL_OES); 12200 target != GL_TEXTURE_EXTERNAL_OES);
12201 uint32_t channels = GLES2Util::GetChannelsForFormat(format); 12201 uint32_t channels = GLES2Util::GetChannelsForFormat(format);
12202 if ((feature_info_->feature_flags().angle_depth_texture || 12202 if ((channels & GLES2Util::kDepth) != 0 &&
12203 feature_info_->IsWebGL2OrES3Context()) 12203 feature_info_->feature_flags().angle_depth_texture &&
12204 && (channels & GLES2Util::kDepth) != 0) { 12204 feature_info_->gl_version_info().is_es2) {
Kai Ninomiya 2016/11/17 20:41:22 I think the logic here is valid but doesn't quite
Zhenyao Mo 2016/11/17 20:46:58 You are right. I can move feature_info_->feature_
12205 // It's a depth format and ANGLE doesn't allow texImage2D or texSubImage2D 12205 // It's a depth format and ANGLE doesn't allow texImage2D or texSubImage2D
12206 // on depth formats. 12206 // on depth formats in ES2.
12207 GLuint fb = 0; 12207 GLuint fb = 0;
12208 glGenFramebuffersEXT(1, &fb); 12208 glGenFramebuffersEXT(1, &fb);
12209 glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fb); 12209 glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fb);
12210 12210
12211 glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT, 12211 glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT,
12212 target, texture->service_id(), level); 12212 target, texture->service_id(), level);
12213 bool have_stencil = (channels & GLES2Util::kStencil) != 0; 12213 bool have_stencil = (channels & GLES2Util::kStencil) != 0;
12214 if (have_stencil) { 12214 if (have_stencil) {
12215 glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT, 12215 glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT,
12216 target, texture->service_id(), level); 12216 target, texture->service_id(), level);
(...skipping 6648 matching lines...) Expand 10 before | Expand all | Expand 10 after
18865 } 18865 }
18866 18866
18867 // Include the auto-generated part of this file. We split this because it means 18867 // Include the auto-generated part of this file. We split this because it means
18868 // we can easily edit the non-auto generated parts right here in this file 18868 // we can easily edit the non-auto generated parts right here in this file
18869 // instead of having to edit some template or the code generator. 18869 // instead of having to edit some template or the code generator.
18870 #include "base/macros.h" 18870 #include "base/macros.h"
18871 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 18871 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
18872 18872
18873 } // namespace gles2 18873 } // namespace gles2
18874 } // namespace gpu 18874 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698