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

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

Issue 786123002: Update from https://crrev.com/307330 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 4476 matching lines...) Expand 10 before | Expand all | Expand 10 after
4487 break; 4487 break;
4488 default: 4488 default:
4489 NOTREACHED(); 4489 NOTREACHED();
4490 return; 4490 return;
4491 } 4491 }
4492 } 4492 }
4493 translated_attachments[i] = attachment; 4493 translated_attachments[i] = attachment;
4494 } 4494 }
4495 4495
4496 ScopedRenderTo do_render(framebuffer); 4496 ScopedRenderTo do_render(framebuffer);
4497 glDiscardFramebufferEXT(target, numAttachments, translated_attachments.get()); 4497 if (feature_info_->gl_version_info().is_es3) {
4498 glInvalidateFramebuffer(
4499 target, numAttachments, translated_attachments.get());
4500 } else {
4501 glDiscardFramebufferEXT(
4502 target, numAttachments, translated_attachments.get());
4503 }
4498 } 4504 }
4499 4505
4500 void GLES2DecoderImpl::DoEnableVertexAttribArray(GLuint index) { 4506 void GLES2DecoderImpl::DoEnableVertexAttribArray(GLuint index) {
4501 if (state_.vertex_attrib_manager->Enable(index, true)) { 4507 if (state_.vertex_attrib_manager->Enable(index, true)) {
4502 glEnableVertexAttribArray(index); 4508 glEnableVertexAttribArray(index);
4503 } else { 4509 } else {
4504 LOCAL_SET_GL_ERROR( 4510 LOCAL_SET_GL_ERROR(
4505 GL_INVALID_VALUE, "glEnableVertexAttribArray", "index out of range"); 4511 GL_INVALID_VALUE, "glEnableVertexAttribArray", "index out of range");
4506 } 4512 }
4507 } 4513 }
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
5488 5494
5489 void GLES2DecoderImpl::RenderbufferStorageMultisampleHelper( 5495 void GLES2DecoderImpl::RenderbufferStorageMultisampleHelper(
5490 const FeatureInfo* feature_info, 5496 const FeatureInfo* feature_info,
5491 GLenum target, 5497 GLenum target,
5492 GLsizei samples, 5498 GLsizei samples,
5493 GLenum internal_format, 5499 GLenum internal_format,
5494 GLsizei width, 5500 GLsizei width,
5495 GLsizei height) { 5501 GLsizei height) {
5496 // TODO(sievers): This could be resolved at the GL binding level, but the 5502 // TODO(sievers): This could be resolved at the GL binding level, but the
5497 // binding process is currently a bit too 'brute force'. 5503 // binding process is currently a bit too 'brute force'.
5498 if (feature_info->feature_flags().is_angle) { 5504 if (feature_info->gl_version_info().is_angle) {
5499 glRenderbufferStorageMultisampleANGLE( 5505 glRenderbufferStorageMultisampleANGLE(
5500 target, samples, internal_format, width, height); 5506 target, samples, internal_format, width, height);
5501 } else if (feature_info->feature_flags().use_core_framebuffer_multisample) { 5507 } else if (feature_info->feature_flags().use_core_framebuffer_multisample) {
5502 glRenderbufferStorageMultisample( 5508 glRenderbufferStorageMultisample(
5503 target, samples, internal_format, width, height); 5509 target, samples, internal_format, width, height);
5504 } else { 5510 } else {
5505 glRenderbufferStorageMultisampleEXT( 5511 glRenderbufferStorageMultisampleEXT(
5506 target, samples, internal_format, width, height); 5512 target, samples, internal_format, width, height);
5507 } 5513 }
5508 } 5514 }
5509 5515
5510 void GLES2DecoderImpl::BlitFramebufferHelper(GLint srcX0, 5516 void GLES2DecoderImpl::BlitFramebufferHelper(GLint srcX0,
5511 GLint srcY0, 5517 GLint srcY0,
5512 GLint srcX1, 5518 GLint srcX1,
5513 GLint srcY1, 5519 GLint srcY1,
5514 GLint dstX0, 5520 GLint dstX0,
5515 GLint dstY0, 5521 GLint dstY0,
5516 GLint dstX1, 5522 GLint dstX1,
5517 GLint dstY1, 5523 GLint dstY1,
5518 GLbitfield mask, 5524 GLbitfield mask,
5519 GLenum filter) { 5525 GLenum filter) {
5520 // TODO(sievers): This could be resolved at the GL binding level, but the 5526 // TODO(sievers): This could be resolved at the GL binding level, but the
5521 // binding process is currently a bit too 'brute force'. 5527 // binding process is currently a bit too 'brute force'.
5522 if (feature_info_->feature_flags().is_angle) { 5528 if (feature_info_->gl_version_info().is_angle) {
5523 glBlitFramebufferANGLE( 5529 glBlitFramebufferANGLE(
5524 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); 5530 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
5525 } else if (feature_info_->feature_flags().use_core_framebuffer_multisample) { 5531 } else if (feature_info_->feature_flags().use_core_framebuffer_multisample) {
5526 glBlitFramebuffer( 5532 glBlitFramebuffer(
5527 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); 5533 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
5528 } else { 5534 } else {
5529 glBlitFramebufferEXT( 5535 glBlitFramebufferEXT(
5530 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); 5536 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
5531 } 5537 }
5532 } 5538 }
(...skipping 2325 matching lines...) Expand 10 before | Expand all | Expand 10 after
7858 read_x, ry, read_width, 1, format, type, dst + dest_row_offset); 7864 read_x, ry, read_width, 1, format, type, dst + dest_row_offset);
7859 } 7865 }
7860 dst += padded_row_size; 7866 dst += padded_row_size;
7861 } 7867 }
7862 } else { 7868 } else {
7863 if (async && features().use_async_readpixels) { 7869 if (async && features().use_async_readpixels) {
7864 GLuint buffer = 0; 7870 GLuint buffer = 0;
7865 glGenBuffersARB(1, &buffer); 7871 glGenBuffersARB(1, &buffer);
7866 glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, buffer); 7872 glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, buffer);
7867 // For ANGLE client version 2, GL_STREAM_READ is not available. 7873 // For ANGLE client version 2, GL_STREAM_READ is not available.
7868 const GLenum usage_hint = 7874 const GLenum usage_hint = feature_info_->gl_version_info().is_angle ?
7869 features().is_angle ? GL_STATIC_DRAW : GL_STREAM_READ; 7875 GL_STATIC_DRAW : GL_STREAM_READ;
7870 glBufferData(GL_PIXEL_PACK_BUFFER_ARB, pixels_size, NULL, usage_hint); 7876 glBufferData(GL_PIXEL_PACK_BUFFER_ARB, pixels_size, NULL, usage_hint);
7871 GLenum error = glGetError(); 7877 GLenum error = glGetError();
7872 if (error == GL_NO_ERROR) { 7878 if (error == GL_NO_ERROR) {
7873 glReadPixels(x, y, width, height, format, type, 0); 7879 glReadPixels(x, y, width, height, format, type, 0);
7874 pending_readpixel_fences_.push(linked_ptr<FenceCallback>( 7880 pending_readpixel_fences_.push(linked_ptr<FenceCallback>(
7875 new FenceCallback())); 7881 new FenceCallback()));
7876 WaitForReadPixels(base::Bind( 7882 WaitForReadPixels(base::Bind(
7877 &GLES2DecoderImpl::FinishReadPixels, 7883 &GLES2DecoderImpl::FinishReadPixels,
7878 base::internal::SupportsWeakPtrBase::StaticAsWeakPtr 7884 base::internal::SupportsWeakPtrBase::StaticAsWeakPtr
7879 <GLES2DecoderImpl>(this), 7885 <GLES2DecoderImpl>(this),
(...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after
9696 SetServiceId(offscreen_target_color_texture_->id()); 9702 SetServiceId(offscreen_target_color_texture_->id());
9697 9703
9698 offscreen_saved_color_texture_.swap(offscreen_target_color_texture_); 9704 offscreen_saved_color_texture_.swap(offscreen_target_color_texture_);
9699 offscreen_target_frame_buffer_->AttachRenderTexture( 9705 offscreen_target_frame_buffer_->AttachRenderTexture(
9700 offscreen_target_color_texture_.get()); 9706 offscreen_target_color_texture_.get());
9701 } 9707 }
9702 9708
9703 // Ensure the side effects of the copy are visible to the parent 9709 // Ensure the side effects of the copy are visible to the parent
9704 // context. There is no need to do this for ANGLE because it uses a 9710 // context. There is no need to do this for ANGLE because it uses a
9705 // single D3D device for all contexts. 9711 // single D3D device for all contexts.
9706 if (!feature_info_->feature_flags().is_angle) 9712 if (!feature_info_->gl_version_info().is_angle)
9707 glFlush(); 9713 glFlush();
9708 } 9714 }
9709 } else { 9715 } else {
9710 if (!surface_->SwapBuffers()) { 9716 if (!surface_->SwapBuffers()) {
9711 LOG(ERROR) << "Context lost because SwapBuffers failed."; 9717 LOG(ERROR) << "Context lost because SwapBuffers failed.";
9712 LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); 9718 LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB);
9713 } 9719 }
9714 } 9720 }
9715 9721
9716 // This may be a slow command. Exit command processing to allow for 9722 // This may be a slow command. Exit command processing to allow for
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after
11496 } 11502 }
11497 } 11503 }
11498 11504
11499 // Include the auto-generated part of this file. We split this because it means 11505 // Include the auto-generated part of this file. We split this because it means
11500 // we can easily edit the non-auto generated parts right here in this file 11506 // we can easily edit the non-auto generated parts right here in this file
11501 // instead of having to edit some template or the code generator. 11507 // instead of having to edit some template or the code generator.
11502 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 11508 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
11503 11509
11504 } // namespace gles2 11510 } // namespace gles2
11505 } // namespace gpu 11511 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698