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

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

Issue 2259523002: Fix gles2_conform_test failures when Mac switching to core profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 4 years, 4 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 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 892
893 // Deletes the TransformFeedback info for the given transformfeedback. 893 // Deletes the TransformFeedback info for the given transformfeedback.
894 void RemoveTransformFeedback(GLuint client_id) { 894 void RemoveTransformFeedback(GLuint client_id) {
895 transform_feedback_manager_->RemoveTransformFeedback(client_id); 895 transform_feedback_manager_->RemoveTransformFeedback(client_id);
896 } 896 }
897 897
898 // Get the size (in pixels) of the currently bound frame buffer (either FBO 898 // Get the size (in pixels) of the currently bound frame buffer (either FBO
899 // or regular back buffer). 899 // or regular back buffer).
900 gfx::Size GetBoundReadFrameBufferSize(); 900 gfx::Size GetBoundReadFrameBufferSize();
901 901
902 // Get the service side ID for the bound read frame buffer.
903 // If it's back buffer, 0 is returned.
904 GLuint GetBoundReadFrameBufferServiceId();
905
902 // Get the format/type of the currently bound frame buffer (either FBO or 906 // Get the format/type of the currently bound frame buffer (either FBO or
903 // regular back buffer). 907 // regular back buffer).
904 // If the color image is a renderbuffer, returns 0 for type. 908 // If the color image is a renderbuffer, returns 0 for type.
905 GLenum GetBoundReadFrameBufferTextureType(); 909 GLenum GetBoundReadFrameBufferTextureType();
906 GLenum GetBoundReadFrameBufferInternalFormat(); 910 GLenum GetBoundReadFrameBufferInternalFormat();
907 911
908 // Get the i-th draw buffer's internal format/type from the bound framebuffer. 912 // Get the i-th draw buffer's internal format/type from the bound framebuffer.
909 // If no framebuffer is bound, or no image is attached, or the DrawBuffers 913 // If no framebuffer is bound, or no image is attached, or the DrawBuffers
910 // setting for that image is GL_NONE, return 0. 914 // setting for that image is GL_NONE, return 0.
911 GLenum GetBoundColorDrawBufferType(GLint drawbuffer_i); 915 GLenum GetBoundColorDrawBufferType(GLint drawbuffer_i);
(...skipping 3395 matching lines...) Expand 10 before | Expand all | Expand 10 after
4307 return gfx::Size(attachment->width(), attachment->height()); 4311 return gfx::Size(attachment->width(), attachment->height());
4308 } 4312 }
4309 return gfx::Size(0, 0); 4313 return gfx::Size(0, 0);
4310 } else if (offscreen_target_frame_buffer_.get()) { 4314 } else if (offscreen_target_frame_buffer_.get()) {
4311 return offscreen_size_; 4315 return offscreen_size_;
4312 } else { 4316 } else {
4313 return surface_->GetSize(); 4317 return surface_->GetSize();
4314 } 4318 }
4315 } 4319 }
4316 4320
4321 GLuint GLES2DecoderImpl::GetBoundReadFrameBufferServiceId() {
4322 Framebuffer* framebuffer =
4323 GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER_EXT);
4324 if (framebuffer) {
4325 return framebuffer->service_id();
4326 }
4327 if (offscreen_resolved_frame_buffer_.get()) {
4328 return offscreen_resolved_frame_buffer_->id();
4329 }
4330 if (offscreen_target_frame_buffer_.get()) {
4331 return offscreen_target_frame_buffer_->id();
4332 }
4333 if (surface_.get()) {
4334 return surface_->GetBackingFrameBufferObject();
4335 }
4336 return 0;
4337 }
4338
4317 GLenum GLES2DecoderImpl::GetBoundReadFrameBufferTextureType() { 4339 GLenum GLES2DecoderImpl::GetBoundReadFrameBufferTextureType() {
4318 Framebuffer* framebuffer = 4340 Framebuffer* framebuffer =
4319 GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER_EXT); 4341 GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER_EXT);
4320 if (framebuffer) { 4342 if (framebuffer) {
4321 return framebuffer->GetReadBufferTextureType(); 4343 return framebuffer->GetReadBufferTextureType();
4322 } else { // Back buffer. 4344 } else { // Back buffer.
4323 if (back_buffer_read_buffer_ == GL_NONE) 4345 if (back_buffer_read_buffer_ == GL_NONE)
4324 return 0; 4346 return 0;
4325 return GL_UNSIGNED_BYTE; 4347 return GL_UNSIGNED_BYTE;
4326 } 4348 }
(...skipping 4704 matching lines...) Expand 10 before | Expand all | Expand 10 after
9031 glDisableVertexAttribArray(attrib_index); 9053 glDisableVertexAttribArray(attrib_index);
9032 } 9054 }
9033 } 9055 }
9034 } 9056 }
9035 9057
9036 bool GLES2DecoderImpl::SimulateFixedAttribs( 9058 bool GLES2DecoderImpl::SimulateFixedAttribs(
9037 const char* function_name, 9059 const char* function_name,
9038 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount) { 9060 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount) {
9039 DCHECK(simulated); 9061 DCHECK(simulated);
9040 *simulated = false; 9062 *simulated = false;
9041 if (gl_version_info().BehavesLikeGLES()) 9063 if (gl_version_info().SupportsFixedType())
9042 return true; 9064 return true;
9043 9065
9044 if (!state_.vertex_attrib_manager->HaveFixedAttribs()) { 9066 if (!state_.vertex_attrib_manager->HaveFixedAttribs()) {
9045 return true; 9067 return true;
9046 } 9068 }
9047 9069
9048 LOCAL_PERFORMANCE_WARNING( 9070 LOCAL_PERFORMANCE_WARNING(
9049 "GL_FIXED attributes have a significant performance penalty"); 9071 "GL_FIXED attributes have a significant performance penalty");
9050 9072
9051 // NOTE: we could be smart and try to check if a buffer is used 9073 // NOTE: we could be smart and try to check if a buffer is used
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
10259 state_.vertex_attrib_manager 10281 state_.vertex_attrib_manager
10260 ->SetAttribInfo(indx, 10282 ->SetAttribInfo(indx,
10261 state_.bound_array_buffer.get(), 10283 state_.bound_array_buffer.get(),
10262 size, 10284 size,
10263 type, 10285 type,
10264 normalized, 10286 normalized,
10265 stride, 10287 stride,
10266 stride != 0 ? stride : group_size, 10288 stride != 0 ? stride : group_size,
10267 offset, 10289 offset,
10268 GL_FALSE); 10290 GL_FALSE);
10269 // We support GL_FIXED natively on EGL/GLES2 implementations 10291 if (type != GL_FIXED || gl_version_info().SupportsFixedType()) {
10270 if (type != GL_FIXED || gl_version_info().is_es) {
10271 glVertexAttribPointer(indx, size, type, normalized, stride, ptr); 10292 glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
10272 } 10293 }
10273 return error::kNoError; 10294 return error::kNoError;
10274 } 10295 }
10275 10296
10276 void GLES2DecoderImpl::DoViewport(GLint x, GLint y, GLsizei width, 10297 void GLES2DecoderImpl::DoViewport(GLint x, GLint y, GLsizei width,
10277 GLsizei height) { 10298 GLsizei height) {
10278 state_.viewport_x = x; 10299 state_.viewport_x = x;
10279 state_.viewport_y = y; 10300 state_.viewport_y = y;
10280 state_.viewport_width = std::min(width, viewport_max_width_); 10301 state_.viewport_width = std::min(width, viewport_max_width_);
(...skipping 2735 matching lines...) Expand 10 before | Expand all | Expand 10 after
13016 memset(zero.get(), 0, pixels_size); 13037 memset(zero.get(), 0, pixels_size);
13017 glTexImage2D(target, level, TextureManager::AdjustTexInternalFormat( 13038 glTexImage2D(target, level, TextureManager::AdjustTexInternalFormat(
13018 feature_info_.get(), internal_format), 13039 feature_info_.get(), internal_format),
13019 width, height, border, format, type, zero.get()); 13040 width, height, border, format, type, zero.get());
13020 if (copyHeight > 0 && copyWidth > 0) { 13041 if (copyHeight > 0 && copyWidth > 0) {
13021 GLint dx = copyX - x; 13042 GLint dx = copyX - x;
13022 GLint dy = copyY - y; 13043 GLint dy = copyY - y;
13023 GLint destX = dx; 13044 GLint destX = dx;
13024 GLint destY = dy; 13045 GLint destY = dy;
13025 if (requires_luma_blit) { 13046 if (requires_luma_blit) {
13026 copy_tex_image_blit_->DoCopyTexSubImage2DToLUMAComatabilityTexture( 13047 copy_tex_image_blit_->DoCopyTexSubImage2DToLUMACompatibilityTexture(
13027 this, texture->service_id(), texture->target(), target, format, 13048 this, texture->service_id(), texture->target(), target, format,
13028 type, level, destX, destY, copyX, copyY, copyWidth, copyHeight, 13049 type, level, destX, destY, copyX, copyY, copyWidth, copyHeight,
13029 framebuffer_state_.bound_read_framebuffer->service_id(), 13050 GetBoundReadFrameBufferServiceId(),
13030 framebuffer_state_.bound_read_framebuffer 13051 GetBoundReadFrameBufferInternalFormat());
13031 ->GetReadBufferInternalFormat());
13032 } else { 13052 } else {
13033 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, 13053 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY,
13034 copyWidth, copyHeight); 13054 copyWidth, copyHeight);
13035 } 13055 }
13036 } 13056 }
13037 } else { 13057 } else {
13038 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( 13058 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat(
13039 feature_info_.get(), internal_format); 13059 feature_info_.get(), internal_format);
13040 13060
13041 // The service id and target of the texture attached to READ_FRAMEBUFFER. 13061 // The service id and target of the texture attached to READ_FRAMEBUFFER.
13042 GLuint source_texture_service_id = 0; 13062 GLuint source_texture_service_id = 0;
13043 GLenum source_texture_target = 0; 13063 GLenum source_texture_target = 0;
13044 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format); 13064 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format);
13045 bool use_workaround = NeedsCopyTextureImageWorkaround( 13065 bool use_workaround = NeedsCopyTextureImageWorkaround(
13046 final_internal_format, channels_exist, &source_texture_service_id, 13066 final_internal_format, channels_exist, &source_texture_service_id,
13047 &source_texture_target); 13067 &source_texture_target);
13048 if (requires_luma_blit) { 13068 if (requires_luma_blit) {
13049 copy_tex_image_blit_->DoCopyTexImage2DToLUMAComatabilityTexture( 13069 copy_tex_image_blit_->DoCopyTexImage2DToLUMACompatibilityTexture(
13050 this, texture->service_id(), texture->target(), target, format, 13070 this, texture->service_id(), texture->target(), target, format,
13051 type, level, internal_format, copyX, copyY, copyWidth, copyHeight, 13071 type, level, internal_format, copyX, copyY, copyWidth, copyHeight,
13052 framebuffer_state_.bound_read_framebuffer->service_id(), 13072 GetBoundReadFrameBufferServiceId(),
13053 framebuffer_state_.bound_read_framebuffer 13073 GetBoundReadFrameBufferInternalFormat());
13054 ->GetReadBufferInternalFormat());
13055 } else if (use_workaround) { 13074 } else if (use_workaround) {
13056 GLenum dest_texture_target = target; 13075 GLenum dest_texture_target = target;
13057 GLenum framebuffer_target = features().chromium_framebuffer_multisample 13076 GLenum framebuffer_target = features().chromium_framebuffer_multisample
13058 ? GL_READ_FRAMEBUFFER_EXT 13077 ? GL_READ_FRAMEBUFFER_EXT
13059 : GL_FRAMEBUFFER; 13078 : GL_FRAMEBUFFER;
13060 13079
13061 GLenum temp_internal_format = 0; 13080 GLenum temp_internal_format = 0;
13062 if (channels_exist == GLES2Util::kRGBA) { 13081 if (channels_exist == GLES2Util::kRGBA) {
13063 temp_internal_format = GL_RGBA; 13082 temp_internal_format = GL_RGBA;
13064 } else if (channels_exist == GLES2Util::kRGB) { 13083 } else if (channels_exist == GLES2Util::kRGB) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
13192 // Write all pixels in below. 13211 // Write all pixels in below.
13193 texture_manager()->SetLevelCleared(texture_ref, target, level, true); 13212 texture_manager()->SetLevelCleared(texture_ref, target, level, true);
13194 } 13213 }
13195 13214
13196 if (copyHeight > 0 && copyWidth > 0) { 13215 if (copyHeight > 0 && copyWidth > 0) {
13197 if (CopyTexImageResourceManager::CopyTexImageRequiresBlit( 13216 if (CopyTexImageResourceManager::CopyTexImageRequiresBlit(
13198 feature_info_.get(), internal_format)) { 13217 feature_info_.get(), internal_format)) {
13199 if (!InitializeCopyTexImageBlitter("glCopyTexSubImage2D")) { 13218 if (!InitializeCopyTexImageBlitter("glCopyTexSubImage2D")) {
13200 return; 13219 return;
13201 } 13220 }
13202 copy_tex_image_blit_->DoCopyTexSubImage2DToLUMAComatabilityTexture( 13221 copy_tex_image_blit_->DoCopyTexSubImage2DToLUMACompatibilityTexture(
13203 this, texture->service_id(), texture->target(), target, 13222 this, texture->service_id(), texture->target(), target,
13204 internal_format, type, level, xoffset, yoffset, x, y, width, height, 13223 internal_format, type, level, xoffset, yoffset, x, y, width, height,
13205 framebuffer_state_.bound_read_framebuffer->service_id(), 13224 GetBoundReadFrameBufferServiceId(),
13206 framebuffer_state_.bound_read_framebuffer 13225 GetBoundReadFrameBufferInternalFormat());
13207 ->GetReadBufferInternalFormat());
13208 } else { 13226 } else {
13209 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, copyWidth, 13227 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, copyWidth,
13210 copyHeight); 13228 copyHeight);
13211 } 13229 }
13212 } 13230 }
13213 13231
13214 // This may be a slow command. Exit command processing to allow for 13232 // This may be a slow command. Exit command processing to allow for
13215 // context preemption and GPU watchdog checks. 13233 // context preemption and GPU watchdog checks.
13216 ExitCommandProcessingEarly(); 13234 ExitCommandProcessingEarly();
13217 } 13235 }
(...skipping 4544 matching lines...) Expand 10 before | Expand all | Expand 10 after
17762 } 17780 }
17763 17781
17764 // Include the auto-generated part of this file. We split this because it means 17782 // Include the auto-generated part of this file. We split this because it means
17765 // we can easily edit the non-auto generated parts right here in this file 17783 // we can easily edit the non-auto generated parts right here in this file
17766 // instead of having to edit some template or the code generator. 17784 // instead of having to edit some template or the code generator.
17767 #include "base/macros.h" 17785 #include "base/macros.h"
17768 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17786 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17769 17787
17770 } // namespace gles2 17788 } // namespace gles2
17771 } // namespace gpu 17789 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_copy_tex_image.cc ('k') | gpu/gles2_conform_support/gles2_conform_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698