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

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

Issue 996163003: Offscreen framebuffer creation on Mali-400 GPU (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: JSON version updated Created 5 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
« no previous file with comments | « no previous file | gpu/config/gpu_driver_bug_list_json.cc » ('j') | 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 <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 2606 matching lines...) Expand 10 before | Expand all | Expand 10 after
2617 const bool rgb8_supported = 2617 const bool rgb8_supported =
2618 context_->HasExtension("GL_OES_rgb8_rgba8"); 2618 context_->HasExtension("GL_OES_rgb8_rgba8");
2619 // The only available default render buffer formats in GLES2 have very 2619 // The only available default render buffer formats in GLES2 have very
2620 // little precision. Don't enable multisampling unless 8-bit render 2620 // little precision. Don't enable multisampling unless 8-bit render
2621 // buffer formats are available--instead fall back to 8-bit textures. 2621 // buffer formats are available--instead fall back to 8-bit textures.
2622 if (rgb8_supported && offscreen_target_samples_ > 1) { 2622 if (rgb8_supported && offscreen_target_samples_ > 1) {
2623 offscreen_target_color_format_ = attrib_parser.alpha_size > 0 ? 2623 offscreen_target_color_format_ = attrib_parser.alpha_size > 0 ?
2624 GL_RGBA8 : GL_RGB8; 2624 GL_RGBA8 : GL_RGB8;
2625 } else { 2625 } else {
2626 offscreen_target_samples_ = 1; 2626 offscreen_target_samples_ = 1;
2627 offscreen_target_color_format_ = attrib_parser.alpha_size > 0 ? 2627 offscreen_target_color_format_ =
2628 GL_RGBA : GL_RGB; 2628 attrib_parser.alpha_size > 0 || workarounds().disable_gl_rgb_format
2629 ? GL_RGBA
2630 : GL_RGB;
2629 } 2631 }
2630 2632
2631 // ANGLE only supports packed depth/stencil formats, so use it if it is 2633 // ANGLE only supports packed depth/stencil formats, so use it if it is
2632 // available. 2634 // available.
2633 const bool depth24_stencil8_supported = 2635 const bool depth24_stencil8_supported =
2634 feature_info_->feature_flags().packed_depth24_stencil8; 2636 feature_info_->feature_flags().packed_depth24_stencil8;
2635 VLOG(1) << "GL_OES_packed_depth_stencil " 2637 VLOG(1) << "GL_OES_packed_depth_stencil "
2636 << (depth24_stencil8_supported ? "" : "not ") << "supported."; 2638 << (depth24_stencil8_supported ? "" : "not ") << "supported.";
2637 if ((attrib_parser.depth_size > 0 || attrib_parser.stencil_size > 0) && 2639 if ((attrib_parser.depth_size > 0 || attrib_parser.stencil_size > 0) &&
2638 depth24_stencil8_supported) { 2640 depth24_stencil8_supported) {
2639 offscreen_target_depth_format_ = GL_DEPTH24_STENCIL8; 2641 offscreen_target_depth_format_ = GL_DEPTH24_STENCIL8;
2640 offscreen_target_stencil_format_ = 0; 2642 offscreen_target_stencil_format_ = 0;
2641 } else { 2643 } else {
2642 // It may be the case that this depth/stencil combination is not 2644 // It may be the case that this depth/stencil combination is not
2643 // supported, but this will be checked later by CheckFramebufferStatus. 2645 // supported, but this will be checked later by CheckFramebufferStatus.
2644 offscreen_target_depth_format_ = attrib_parser.depth_size > 0 ? 2646 offscreen_target_depth_format_ = attrib_parser.depth_size > 0 ?
2645 GL_DEPTH_COMPONENT16 : 0; 2647 GL_DEPTH_COMPONENT16 : 0;
2646 offscreen_target_stencil_format_ = attrib_parser.stencil_size > 0 ? 2648 offscreen_target_stencil_format_ = attrib_parser.stencil_size > 0 ?
2647 GL_STENCIL_INDEX8 : 0; 2649 GL_STENCIL_INDEX8 : 0;
2648 } 2650 }
2649 } else { 2651 } else {
2650 offscreen_target_color_format_ = attrib_parser.alpha_size > 0 ? 2652 offscreen_target_color_format_ =
2651 GL_RGBA : GL_RGB; 2653 attrib_parser.alpha_size > 0 || workarounds().disable_gl_rgb_format
2654 ? GL_RGBA
2655 : GL_RGB;
2652 2656
2653 // If depth is requested at all, use the packed depth stencil format if 2657 // If depth is requested at all, use the packed depth stencil format if
2654 // it's available, as some desktop GL drivers don't support any non-packed 2658 // it's available, as some desktop GL drivers don't support any non-packed
2655 // formats for depth attachments. 2659 // formats for depth attachments.
2656 const bool depth24_stencil8_supported = 2660 const bool depth24_stencil8_supported =
2657 feature_info_->feature_flags().packed_depth24_stencil8; 2661 feature_info_->feature_flags().packed_depth24_stencil8;
2658 VLOG(1) << "GL_EXT_packed_depth_stencil " 2662 VLOG(1) << "GL_EXT_packed_depth_stencil "
2659 << (depth24_stencil8_supported ? "" : "not ") << "supported."; 2663 << (depth24_stencil8_supported ? "" : "not ") << "supported.";
2660 2664
2661 if ((attrib_parser.depth_size > 0 || attrib_parser.stencil_size > 0) && 2665 if ((attrib_parser.depth_size > 0 || attrib_parser.stencil_size > 0) &&
2662 depth24_stencil8_supported) { 2666 depth24_stencil8_supported) {
2663 offscreen_target_depth_format_ = GL_DEPTH24_STENCIL8; 2667 offscreen_target_depth_format_ = GL_DEPTH24_STENCIL8;
2664 offscreen_target_stencil_format_ = 0; 2668 offscreen_target_stencil_format_ = 0;
2665 } else { 2669 } else {
2666 offscreen_target_depth_format_ = attrib_parser.depth_size > 0 ? 2670 offscreen_target_depth_format_ = attrib_parser.depth_size > 0 ?
2667 GL_DEPTH_COMPONENT : 0; 2671 GL_DEPTH_COMPONENT : 0;
2668 offscreen_target_stencil_format_ = attrib_parser.stencil_size > 0 ? 2672 offscreen_target_stencil_format_ = attrib_parser.stencil_size > 0 ?
2669 GL_STENCIL_INDEX : 0; 2673 GL_STENCIL_INDEX : 0;
2670 } 2674 }
2671 } 2675 }
2672 2676
2673 offscreen_saved_color_format_ = attrib_parser.alpha_size > 0 ? 2677 offscreen_saved_color_format_ =
2674 GL_RGBA : GL_RGB; 2678 attrib_parser.alpha_size > 0 || workarounds().disable_gl_rgb_format
2679 ? GL_RGBA
2680 : GL_RGB;
2675 2681
2676 // Create the target frame buffer. This is the one that the client renders 2682 // Create the target frame buffer. This is the one that the client renders
2677 // directly to. 2683 // directly to.
2678 offscreen_target_frame_buffer_.reset(new BackFramebuffer(this)); 2684 offscreen_target_frame_buffer_.reset(new BackFramebuffer(this));
2679 offscreen_target_frame_buffer_->Create(); 2685 offscreen_target_frame_buffer_->Create();
2680 // Due to GLES2 format limitations, either the color texture (for 2686 // Due to GLES2 format limitations, either the color texture (for
2681 // non-multisampling) or the color render buffer (for multisampling) will be 2687 // non-multisampling) or the color render buffer (for multisampling) will be
2682 // attached to the offscreen frame buffer. The render buffer has more 2688 // attached to the offscreen frame buffer. The render buffer has more
2683 // limited formats available to it, but the texture can't do multisampling. 2689 // limited formats available to it, but the texture can't do multisampling.
2684 if (IsOffscreenBufferMultisampled()) { 2690 if (IsOffscreenBufferMultisampled()) {
(...skipping 10055 matching lines...) Expand 10 before | Expand all | Expand 10 after
12740 } 12746 }
12741 } 12747 }
12742 12748
12743 // Include the auto-generated part of this file. We split this because it means 12749 // Include the auto-generated part of this file. We split this because it means
12744 // we can easily edit the non-auto generated parts right here in this file 12750 // we can easily edit the non-auto generated parts right here in this file
12745 // instead of having to edit some template or the code generator. 12751 // instead of having to edit some template or the code generator.
12746 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 12752 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
12747 12753
12748 } // namespace gles2 12754 } // namespace gles2
12749 } // namespace gpu 12755 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/config/gpu_driver_bug_list_json.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698