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 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: suppress fixed_type test 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 return 0;
piman 2016/08/17 20:30:45 You need return surface_.get() ? surface_->GetBack
4334 }
4335
4317 GLenum GLES2DecoderImpl::GetBoundReadFrameBufferTextureType() { 4336 GLenum GLES2DecoderImpl::GetBoundReadFrameBufferTextureType() {
4318 Framebuffer* framebuffer = 4337 Framebuffer* framebuffer =
4319 GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER_EXT); 4338 GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER_EXT);
4320 if (framebuffer) { 4339 if (framebuffer) {
4321 return framebuffer->GetReadBufferTextureType(); 4340 return framebuffer->GetReadBufferTextureType();
4322 } else { // Back buffer. 4341 } else { // Back buffer.
4323 if (back_buffer_read_buffer_ == GL_NONE) 4342 if (back_buffer_read_buffer_ == GL_NONE)
4324 return 0; 4343 return 0;
4325 return GL_UNSIGNED_BYTE; 4344 return GL_UNSIGNED_BYTE;
4326 } 4345 }
(...skipping 8689 matching lines...) Expand 10 before | Expand all | Expand 10 after
13016 memset(zero.get(), 0, pixels_size); 13035 memset(zero.get(), 0, pixels_size);
13017 glTexImage2D(target, level, TextureManager::AdjustTexInternalFormat( 13036 glTexImage2D(target, level, TextureManager::AdjustTexInternalFormat(
13018 feature_info_.get(), internal_format), 13037 feature_info_.get(), internal_format),
13019 width, height, border, format, type, zero.get()); 13038 width, height, border, format, type, zero.get());
13020 if (copyHeight > 0 && copyWidth > 0) { 13039 if (copyHeight > 0 && copyWidth > 0) {
13021 GLint dx = copyX - x; 13040 GLint dx = copyX - x;
13022 GLint dy = copyY - y; 13041 GLint dy = copyY - y;
13023 GLint destX = dx; 13042 GLint destX = dx;
13024 GLint destY = dy; 13043 GLint destY = dy;
13025 if (requires_luma_blit) { 13044 if (requires_luma_blit) {
13026 copy_tex_image_blit_->DoCopyTexSubImage2DToLUMAComatabilityTexture( 13045 copy_tex_image_blit_->DoCopyTexSubImage2DToLUMACompatabilityTexture(
13027 this, texture->service_id(), texture->target(), target, format, 13046 this, texture->service_id(), texture->target(), target, format,
13028 type, level, destX, destY, copyX, copyY, copyWidth, copyHeight, 13047 type, level, destX, destY, copyX, copyY, copyWidth, copyHeight,
13029 framebuffer_state_.bound_read_framebuffer->service_id(), 13048 GetBoundReadFrameBufferServiceId(),
13030 framebuffer_state_.bound_read_framebuffer 13049 GetBoundReadFrameBufferInternalFormat());
13031 ->GetReadBufferInternalFormat());
13032 } else { 13050 } else {
13033 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, 13051 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY,
13034 copyWidth, copyHeight); 13052 copyWidth, copyHeight);
13035 } 13053 }
13036 } 13054 }
13037 } else { 13055 } else {
13038 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( 13056 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat(
13039 feature_info_.get(), internal_format); 13057 feature_info_.get(), internal_format);
13040 13058
13041 // The service id and target of the texture attached to READ_FRAMEBUFFER. 13059 // The service id and target of the texture attached to READ_FRAMEBUFFER.
13042 GLuint source_texture_service_id = 0; 13060 GLuint source_texture_service_id = 0;
13043 GLenum source_texture_target = 0; 13061 GLenum source_texture_target = 0;
13044 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format); 13062 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format);
13045 bool use_workaround = NeedsCopyTextureImageWorkaround( 13063 bool use_workaround = NeedsCopyTextureImageWorkaround(
13046 final_internal_format, channels_exist, &source_texture_service_id, 13064 final_internal_format, channels_exist, &source_texture_service_id,
13047 &source_texture_target); 13065 &source_texture_target);
13048 if (requires_luma_blit) { 13066 if (requires_luma_blit) {
13049 copy_tex_image_blit_->DoCopyTexImage2DToLUMAComatabilityTexture( 13067 copy_tex_image_blit_->DoCopyTexImage2DToLUMACompatabilityTexture(
13050 this, texture->service_id(), texture->target(), target, format, 13068 this, texture->service_id(), texture->target(), target, format,
13051 type, level, internal_format, copyX, copyY, copyWidth, copyHeight, 13069 type, level, internal_format, copyX, copyY, copyWidth, copyHeight,
13052 framebuffer_state_.bound_read_framebuffer->service_id(), 13070 GetBoundReadFrameBufferServiceId(),
13053 framebuffer_state_.bound_read_framebuffer 13071 GetBoundReadFrameBufferInternalFormat());
13054 ->GetReadBufferInternalFormat());
13055 } else if (use_workaround) { 13072 } else if (use_workaround) {
13056 GLenum dest_texture_target = target; 13073 GLenum dest_texture_target = target;
13057 GLenum framebuffer_target = features().chromium_framebuffer_multisample 13074 GLenum framebuffer_target = features().chromium_framebuffer_multisample
13058 ? GL_READ_FRAMEBUFFER_EXT 13075 ? GL_READ_FRAMEBUFFER_EXT
13059 : GL_FRAMEBUFFER; 13076 : GL_FRAMEBUFFER;
13060 13077
13061 GLenum temp_internal_format = 0; 13078 GLenum temp_internal_format = 0;
13062 if (channels_exist == GLES2Util::kRGBA) { 13079 if (channels_exist == GLES2Util::kRGBA) {
13063 temp_internal_format = GL_RGBA; 13080 temp_internal_format = GL_RGBA;
13064 } else if (channels_exist == GLES2Util::kRGB) { 13081 } else if (channels_exist == GLES2Util::kRGB) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
13192 // Write all pixels in below. 13209 // Write all pixels in below.
13193 texture_manager()->SetLevelCleared(texture_ref, target, level, true); 13210 texture_manager()->SetLevelCleared(texture_ref, target, level, true);
13194 } 13211 }
13195 13212
13196 if (copyHeight > 0 && copyWidth > 0) { 13213 if (copyHeight > 0 && copyWidth > 0) {
13197 if (CopyTexImageResourceManager::CopyTexImageRequiresBlit( 13214 if (CopyTexImageResourceManager::CopyTexImageRequiresBlit(
13198 feature_info_.get(), internal_format)) { 13215 feature_info_.get(), internal_format)) {
13199 if (!InitializeCopyTexImageBlitter("glCopyTexSubImage2D")) { 13216 if (!InitializeCopyTexImageBlitter("glCopyTexSubImage2D")) {
13200 return; 13217 return;
13201 } 13218 }
13202 copy_tex_image_blit_->DoCopyTexSubImage2DToLUMAComatabilityTexture( 13219 copy_tex_image_blit_->DoCopyTexSubImage2DToLUMACompatabilityTexture(
13203 this, texture->service_id(), texture->target(), target, 13220 this, texture->service_id(), texture->target(), target,
13204 internal_format, type, level, xoffset, yoffset, x, y, width, height, 13221 internal_format, type, level, xoffset, yoffset, x, y, width, height,
13205 framebuffer_state_.bound_read_framebuffer->service_id(), 13222 GetBoundReadFrameBufferServiceId(),
13206 framebuffer_state_.bound_read_framebuffer 13223 GetBoundReadFrameBufferInternalFormat());
13207 ->GetReadBufferInternalFormat());
13208 } else { 13224 } else {
13209 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, copyWidth, 13225 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, copyWidth,
13210 copyHeight); 13226 copyHeight);
13211 } 13227 }
13212 } 13228 }
13213 13229
13214 // This may be a slow command. Exit command processing to allow for 13230 // This may be a slow command. Exit command processing to allow for
13215 // context preemption and GPU watchdog checks. 13231 // context preemption and GPU watchdog checks.
13216 ExitCommandProcessingEarly(); 13232 ExitCommandProcessingEarly();
13217 } 13233 }
(...skipping 4544 matching lines...) Expand 10 before | Expand all | Expand 10 after
17762 } 17778 }
17763 17779
17764 // Include the auto-generated part of this file. We split this because it means 17780 // 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 17781 // 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. 17782 // instead of having to edit some template or the code generator.
17767 #include "base/macros.h" 17783 #include "base/macros.h"
17768 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17784 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17769 17785
17770 } // namespace gles2 17786 } // namespace gles2
17771 } // namespace gpu 17787 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698