OLD | NEW |
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 0.0f, 1.0f, 0.0f, 0.0f, | 103 0.0f, 1.0f, 0.0f, 0.0f, |
104 0.0f, 0.0f, 1.0f, 0.0f, | 104 0.0f, 0.0f, 1.0f, 0.0f, |
105 0.0f, 0.0f, 0.0f, 1.0f}; | 105 0.0f, 0.0f, 0.0f, 1.0f}; |
106 | 106 |
107 bool PrecisionMeetsSpecForHighpFloat(GLint rangeMin, | 107 bool PrecisionMeetsSpecForHighpFloat(GLint rangeMin, |
108 GLint rangeMax, | 108 GLint rangeMax, |
109 GLint precision) { | 109 GLint precision) { |
110 return (rangeMin >= 62) && (rangeMax >= 62) && (precision >= 16); | 110 return (rangeMin >= 62) && (rangeMax >= 62) && (precision >= 16); |
111 } | 111 } |
112 | 112 |
113 void GetShaderPrecisionFormatImpl(GLenum shader_type, | 113 void GetShaderPrecisionFormatImpl(const gl::GLVersionInfo& gl_version_info, |
114 GLenum precision_type, | 114 GLenum shader_type, |
115 GLint* range, GLint* precision) { | 115 GLenum precision_type, |
| 116 GLint* range, |
| 117 GLint* precision) { |
116 switch (precision_type) { | 118 switch (precision_type) { |
117 case GL_LOW_INT: | 119 case GL_LOW_INT: |
118 case GL_MEDIUM_INT: | 120 case GL_MEDIUM_INT: |
119 case GL_HIGH_INT: | 121 case GL_HIGH_INT: |
120 // These values are for a 32-bit twos-complement integer format. | 122 // These values are for a 32-bit twos-complement integer format. |
121 range[0] = 31; | 123 range[0] = 31; |
122 range[1] = 30; | 124 range[1] = 30; |
123 *precision = 0; | 125 *precision = 0; |
124 break; | 126 break; |
125 case GL_LOW_FLOAT: | 127 case GL_LOW_FLOAT: |
126 case GL_MEDIUM_FLOAT: | 128 case GL_MEDIUM_FLOAT: |
127 case GL_HIGH_FLOAT: | 129 case GL_HIGH_FLOAT: |
128 // These values are for an IEEE single-precision floating-point format. | 130 // These values are for an IEEE single-precision floating-point format. |
129 range[0] = 127; | 131 range[0] = 127; |
130 range[1] = 127; | 132 range[1] = 127; |
131 *precision = 23; | 133 *precision = 23; |
132 break; | 134 break; |
133 default: | 135 default: |
134 NOTREACHED(); | 136 NOTREACHED(); |
135 break; | 137 break; |
136 } | 138 } |
137 | 139 |
138 if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2 && | 140 if (gl_version_info.is_es) { |
139 gl::g_driver_gl.fn.glGetShaderPrecisionFormatFn) { | |
140 // This function is sometimes defined even though it's really just | 141 // This function is sometimes defined even though it's really just |
141 // a stub, so we need to set range and precision as if it weren't | 142 // a stub, so we need to set range and precision as if it weren't |
142 // defined before calling it. | 143 // defined before calling it. |
143 // On Mac OS with some GPUs, calling this generates a | 144 // On Mac OS with some GPUs, calling this generates a |
144 // GL_INVALID_OPERATION error. Avoid calling it on non-GLES2 | 145 // GL_INVALID_OPERATION error. Avoid calling it on non-GLES2 |
145 // platforms. | 146 // platforms. |
146 glGetShaderPrecisionFormat(shader_type, precision_type, | 147 glGetShaderPrecisionFormat(shader_type, precision_type, |
147 range, precision); | 148 range, precision); |
148 | 149 |
149 // TODO(brianderson): Make the following official workarounds. | 150 // TODO(brianderson): Make the following official workarounds. |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 void Destroy(bool have_context) override; | 592 void Destroy(bool have_context) override; |
592 void SetSurface(const scoped_refptr<gl::GLSurface>& surface) override; | 593 void SetSurface(const scoped_refptr<gl::GLSurface>& surface) override; |
593 void ReleaseSurface() override; | 594 void ReleaseSurface() override; |
594 void TakeFrontBuffer(const Mailbox& mailbox) override; | 595 void TakeFrontBuffer(const Mailbox& mailbox) override; |
595 void ReturnFrontBuffer(const Mailbox& mailbox, bool is_lost) override; | 596 void ReturnFrontBuffer(const Mailbox& mailbox, bool is_lost) override; |
596 bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override; | 597 bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override; |
597 bool MakeCurrent() override; | 598 bool MakeCurrent() override; |
598 GLES2Util* GetGLES2Util() override { return &util_; } | 599 GLES2Util* GetGLES2Util() override { return &util_; } |
599 gl::GLContext* GetGLContext() override { return context_.get(); } | 600 gl::GLContext* GetGLContext() override { return context_.get(); } |
600 ContextGroup* GetContextGroup() override { return group_.get(); } | 601 ContextGroup* GetContextGroup() override { return group_.get(); } |
| 602 const FeatureInfo* GetFeatureInfo() const override { |
| 603 return feature_info_.get(); |
| 604 } |
601 Capabilities GetCapabilities() override; | 605 Capabilities GetCapabilities() override; |
602 void RestoreState(const ContextState* prev_state) override; | 606 void RestoreState(const ContextState* prev_state) override; |
603 | 607 |
604 void RestoreActiveTexture() const override { state_.RestoreActiveTexture(); } | 608 void RestoreActiveTexture() const override { state_.RestoreActiveTexture(); } |
605 void RestoreAllTextureUnitBindings( | 609 void RestoreAllTextureUnitBindings( |
606 const ContextState* prev_state) const override { | 610 const ContextState* prev_state) const override { |
607 state_.RestoreAllTextureUnitBindings(prev_state); | 611 state_.RestoreAllTextureUnitBindings(prev_state); |
608 } | 612 } |
609 void RestoreActiveTextureUnitBinding(unsigned int target) const override { | 613 void RestoreActiveTextureUnitBinding(unsigned int target) const override { |
610 state_.RestoreActiveTextureUnitBinding(target); | 614 state_.RestoreActiveTextureUnitBinding(target); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 ImageManager* image_manager() { return image_manager_.get(); } | 822 ImageManager* image_manager() { return image_manager_.get(); } |
819 | 823 |
820 VertexArrayManager* vertex_array_manager() { | 824 VertexArrayManager* vertex_array_manager() { |
821 return vertex_array_manager_.get(); | 825 return vertex_array_manager_.get(); |
822 } | 826 } |
823 | 827 |
824 MemoryTracker* memory_tracker() { | 828 MemoryTracker* memory_tracker() { |
825 return group_->memory_tracker(); | 829 return group_->memory_tracker(); |
826 } | 830 } |
827 | 831 |
| 832 const gl::GLVersionInfo& gl_version_info() { |
| 833 return feature_info_->gl_version_info(); |
| 834 } |
| 835 |
828 bool EnsureGPUMemoryAvailable(size_t estimated_size) { | 836 bool EnsureGPUMemoryAvailable(size_t estimated_size) { |
829 MemoryTracker* tracker = memory_tracker(); | 837 MemoryTracker* tracker = memory_tracker(); |
830 if (tracker) { | 838 if (tracker) { |
831 return tracker->EnsureGPUMemoryAvailable(estimated_size); | 839 return tracker->EnsureGPUMemoryAvailable(estimated_size); |
832 } | 840 } |
833 return true; | 841 return true; |
834 } | 842 } |
835 | 843 |
836 bool IsOffscreenBufferMultisampled() const { | 844 bool IsOffscreenBufferMultisampled() const { |
837 return offscreen_target_samples_ > 1; | 845 return offscreen_target_samples_ > 1; |
(...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3029 break; | 3037 break; |
3030 } | 3038 } |
3031 } | 3039 } |
3032 | 3040 |
3033 if (!supported) { | 3041 if (!supported) { |
3034 Destroy(true); | 3042 Destroy(true); |
3035 return false; | 3043 return false; |
3036 } | 3044 } |
3037 } | 3045 } |
3038 | 3046 |
3039 bool needs_emulation = feature_info_->gl_version_info().IsLowerThanGL(4, 2); | 3047 bool needs_emulation = gl_version_info().IsLowerThanGL(4, 2); |
3040 transform_feedback_manager_.reset(new TransformFeedbackManager( | 3048 transform_feedback_manager_.reset(new TransformFeedbackManager( |
3041 group_->max_transform_feedback_separate_attribs(), needs_emulation)); | 3049 group_->max_transform_feedback_separate_attribs(), needs_emulation)); |
3042 | 3050 |
3043 if (feature_info_->context_type() == CONTEXT_TYPE_WEBGL2 || | 3051 if (feature_info_->context_type() == CONTEXT_TYPE_WEBGL2 || |
3044 feature_info_->context_type() == CONTEXT_TYPE_OPENGLES3) { | 3052 feature_info_->context_type() == CONTEXT_TYPE_OPENGLES3) { |
3045 if (!feature_info_->IsES3Capable()) { | 3053 if (!feature_info_->IsES3Capable()) { |
3046 LOG(ERROR) << "Underlying driver does not support ES3."; | 3054 LOG(ERROR) << "Underlying driver does not support ES3."; |
3047 Destroy(true); | 3055 Destroy(true); |
3048 return false; | 3056 return false; |
3049 } | 3057 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3085 // vertex_attrib_manager is set to default_vertex_attrib_manager by this call | 3093 // vertex_attrib_manager is set to default_vertex_attrib_manager by this call |
3086 DoBindVertexArrayOES(0); | 3094 DoBindVertexArrayOES(0); |
3087 | 3095 |
3088 query_manager_.reset(new QueryManager(this, feature_info_.get())); | 3096 query_manager_.reset(new QueryManager(this, feature_info_.get())); |
3089 | 3097 |
3090 image_manager_.reset(new ImageManager); | 3098 image_manager_.reset(new ImageManager); |
3091 | 3099 |
3092 util_.set_num_compressed_texture_formats( | 3100 util_.set_num_compressed_texture_formats( |
3093 validators_->compressed_texture_format.GetValues().size()); | 3101 validators_->compressed_texture_format.GetValues().size()); |
3094 | 3102 |
3095 if (!feature_info_->gl_version_info().BehavesLikeGLES()) { | 3103 if (!gl_version_info().BehavesLikeGLES()) { |
3096 // We have to enable vertex array 0 on GL with compatibility profile or it | 3104 // We have to enable vertex array 0 on GL with compatibility profile or it |
3097 // won't render. Note that ES or GL with core profile does not have this | 3105 // won't render. Note that ES or GL with core profile does not have this |
3098 // issue. | 3106 // issue. |
3099 glEnableVertexAttribArray(0); | 3107 glEnableVertexAttribArray(0); |
3100 } | 3108 } |
3101 glGenBuffersARB(1, &attrib_0_buffer_id_); | 3109 glGenBuffersARB(1, &attrib_0_buffer_id_); |
3102 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); | 3110 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); |
3103 glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 0, NULL); | 3111 glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 0, NULL); |
3104 glBindBuffer(GL_ARRAY_BUFFER, 0); | 3112 glBindBuffer(GL_ARRAY_BUFFER, 0); |
3105 glGenBuffersARB(1, &fixed_attrib_buffer_id_); | 3113 glGenBuffersARB(1, &fixed_attrib_buffer_id_); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3153 // glGetIntegerv() throws a GL error, it leaves its argument unchanged. | 3161 // glGetIntegerv() throws a GL error, it leaves its argument unchanged. |
3154 GLint max_sample_count = 1; | 3162 GLint max_sample_count = 1; |
3155 glGetIntegerv(GL_MAX_SAMPLES_EXT, &max_sample_count); | 3163 glGetIntegerv(GL_MAX_SAMPLES_EXT, &max_sample_count); |
3156 offscreen_target_samples_ = std::min(attrib_helper.samples, | 3164 offscreen_target_samples_ = std::min(attrib_helper.samples, |
3157 max_sample_count); | 3165 max_sample_count); |
3158 } else { | 3166 } else { |
3159 offscreen_target_samples_ = 1; | 3167 offscreen_target_samples_ = 1; |
3160 } | 3168 } |
3161 offscreen_target_buffer_preserved_ = attrib_helper.buffer_preserved; | 3169 offscreen_target_buffer_preserved_ = attrib_helper.buffer_preserved; |
3162 | 3170 |
3163 if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2) { | 3171 if (gl_version_info().is_es) { |
3164 const bool rgb8_supported = | 3172 const bool rgb8_supported = context_->HasExtension("GL_OES_rgb8_rgba8"); |
3165 context_->HasExtension("GL_OES_rgb8_rgba8"); | |
3166 // The only available default render buffer formats in GLES2 have very | 3173 // The only available default render buffer formats in GLES2 have very |
3167 // little precision. Don't enable multisampling unless 8-bit render | 3174 // little precision. Don't enable multisampling unless 8-bit render |
3168 // buffer formats are available--instead fall back to 8-bit textures. | 3175 // buffer formats are available--instead fall back to 8-bit textures. |
3169 if (rgb8_supported && offscreen_target_samples_ > 1) { | 3176 if (rgb8_supported && offscreen_target_samples_ > 1) { |
3170 offscreen_target_color_format_ = | 3177 offscreen_target_color_format_ = |
3171 offscreen_buffer_texture_needs_alpha ? GL_RGBA8 : GL_RGB8; | 3178 offscreen_buffer_texture_needs_alpha ? GL_RGBA8 : GL_RGB8; |
3172 } else { | 3179 } else { |
3173 offscreen_target_samples_ = 1; | 3180 offscreen_target_samples_ = 1; |
3174 offscreen_target_color_format_ = | 3181 offscreen_target_color_format_ = |
3175 offscreen_buffer_texture_needs_alpha || | 3182 offscreen_buffer_texture_needs_alpha || |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3302 // we ask for. In other words, if we ask for RGB and we get RGBA then we'll | 3309 // we ask for. In other words, if we ask for RGB and we get RGBA then we'll |
3303 // make it appear RGB. If on the other hand we ask for RGBA nd get RGB we | 3310 // make it appear RGB. If on the other hand we ask for RGBA nd get RGB we |
3304 // can't do anything about that. | 3311 // can't do anything about that. |
3305 | 3312 |
3306 if (!surfaceless_) { | 3313 if (!surfaceless_) { |
3307 GLint depth_bits = 0; | 3314 GLint depth_bits = 0; |
3308 GLint stencil_bits = 0; | 3315 GLint stencil_bits = 0; |
3309 | 3316 |
3310 bool default_fb = (GetBackbufferServiceId() == 0); | 3317 bool default_fb = (GetBackbufferServiceId() == 0); |
3311 | 3318 |
3312 if (feature_info_->gl_version_info().is_desktop_core_profile) { | 3319 if (gl_version_info().is_desktop_core_profile) { |
3313 glGetFramebufferAttachmentParameterivEXT( | 3320 glGetFramebufferAttachmentParameterivEXT( |
3314 GL_FRAMEBUFFER, | 3321 GL_FRAMEBUFFER, |
3315 default_fb ? GL_BACK_LEFT : GL_COLOR_ATTACHMENT0, | 3322 default_fb ? GL_BACK_LEFT : GL_COLOR_ATTACHMENT0, |
3316 GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, &alpha_bits); | 3323 GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, &alpha_bits); |
3317 glGetFramebufferAttachmentParameterivEXT( | 3324 glGetFramebufferAttachmentParameterivEXT( |
3318 GL_FRAMEBUFFER, | 3325 GL_FRAMEBUFFER, |
3319 default_fb ? GL_DEPTH : GL_DEPTH_ATTACHMENT, | 3326 default_fb ? GL_DEPTH : GL_DEPTH_ATTACHMENT, |
3320 GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, &depth_bits); | 3327 GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, &depth_bits); |
3321 glGetFramebufferAttachmentParameterivEXT( | 3328 glGetFramebufferAttachmentParameterivEXT( |
3322 GL_FRAMEBUFFER, | 3329 GL_FRAMEBUFFER, |
(...skipping 18 matching lines...) Expand all Loading... |
3341 state_.viewport_width = surface->GetSize().width(); | 3348 state_.viewport_width = surface->GetSize().width(); |
3342 state_.viewport_height = surface->GetSize().height(); | 3349 state_.viewport_height = surface->GetSize().height(); |
3343 } | 3350 } |
3344 | 3351 |
3345 // OpenGL ES 2.0 implicitly enables the desktop GL capability | 3352 // OpenGL ES 2.0 implicitly enables the desktop GL capability |
3346 // VERTEX_PROGRAM_POINT_SIZE and doesn't expose this enum. This fact | 3353 // VERTEX_PROGRAM_POINT_SIZE and doesn't expose this enum. This fact |
3347 // isn't well documented; it was discovered in the Khronos OpenGL ES | 3354 // isn't well documented; it was discovered in the Khronos OpenGL ES |
3348 // mailing list archives. It also implicitly enables the desktop GL | 3355 // mailing list archives. It also implicitly enables the desktop GL |
3349 // capability GL_POINT_SPRITE to provide access to the gl_PointCoord | 3356 // capability GL_POINT_SPRITE to provide access to the gl_PointCoord |
3350 // variable in fragment shaders. | 3357 // variable in fragment shaders. |
3351 if (!feature_info_->gl_version_info().BehavesLikeGLES()) { | 3358 if (!gl_version_info().BehavesLikeGLES()) { |
3352 glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); | 3359 glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); |
3353 glEnable(GL_POINT_SPRITE); | 3360 glEnable(GL_POINT_SPRITE); |
3354 } else if (feature_info_->gl_version_info().is_desktop_core_profile) { | 3361 } else if (gl_version_info().is_desktop_core_profile) { |
3355 // The desktop core profile changed how program point size mode is | 3362 // The desktop core profile changed how program point size mode is |
3356 // enabled. | 3363 // enabled. |
3357 glEnable(GL_PROGRAM_POINT_SIZE); | 3364 glEnable(GL_PROGRAM_POINT_SIZE); |
3358 } | 3365 } |
3359 | 3366 |
3360 // ES3 requires seamless cubemap. ES2 does not. | 3367 // ES3 requires seamless cubemap. ES2 does not. |
3361 // However, when ES2 is implemented on top of DX11, seamless cubemap is | 3368 // However, when ES2 is implemented on top of DX11, seamless cubemap is |
3362 // always enabled and there is no way to disable it. | 3369 // always enabled and there is no way to disable it. |
3363 // Therefore, it seems OK to also always enable it on top of Desktop GL for | 3370 // Therefore, it seems OK to also always enable it on top of Desktop GL for |
3364 // both ES2 and ES3 contexts. | 3371 // both ES2 and ES3 contexts. |
3365 if (!feature_info_->workarounds().disable_texture_cube_map_seamless && | 3372 if (!feature_info_->workarounds().disable_texture_cube_map_seamless && |
3366 feature_info_->gl_version_info().IsAtLeastGL(3, 2)) { | 3373 gl_version_info().IsAtLeastGL(3, 2)) { |
3367 glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); | 3374 glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); |
3368 } | 3375 } |
3369 | 3376 |
3370 has_robustness_extension_ = | 3377 has_robustness_extension_ = |
3371 context->HasExtension("GL_ARB_robustness") || | 3378 context->HasExtension("GL_ARB_robustness") || |
3372 context->HasExtension("GL_KHR_robustness") || | 3379 context->HasExtension("GL_KHR_robustness") || |
3373 context->HasExtension("GL_EXT_robustness"); | 3380 context->HasExtension("GL_EXT_robustness"); |
3374 | 3381 |
3375 if (!InitializeShaderTranslator()) { | 3382 if (!InitializeShaderTranslator()) { |
3376 return false; | 3383 return false; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3447 if (LOCAL_PEEK_GL_ERROR("glClearWorkaroundInit") != GL_NO_ERROR) | 3454 if (LOCAL_PEEK_GL_ERROR("glClearWorkaroundInit") != GL_NO_ERROR) |
3448 return false; | 3455 return false; |
3449 } | 3456 } |
3450 | 3457 |
3451 return true; | 3458 return true; |
3452 } | 3459 } |
3453 | 3460 |
3454 Capabilities GLES2DecoderImpl::GetCapabilities() { | 3461 Capabilities GLES2DecoderImpl::GetCapabilities() { |
3455 DCHECK(initialized()); | 3462 DCHECK(initialized()); |
3456 Capabilities caps; | 3463 Capabilities caps; |
3457 caps.VisitPrecisions([](GLenum shader, GLenum type, | 3464 const gl::GLVersionInfo& version_info = gl_version_info(); |
3458 Capabilities::ShaderPrecision* shader_precision) { | 3465 caps.VisitPrecisions([&version_info]( |
| 3466 GLenum shader, GLenum type, |
| 3467 Capabilities::ShaderPrecision* shader_precision) { |
3459 GLint range[2] = {0, 0}; | 3468 GLint range[2] = {0, 0}; |
3460 GLint precision = 0; | 3469 GLint precision = 0; |
3461 GetShaderPrecisionFormatImpl(shader, type, range, &precision); | 3470 GetShaderPrecisionFormatImpl(version_info, shader, type, range, |
| 3471 &precision); |
3462 shader_precision->min_range = range[0]; | 3472 shader_precision->min_range = range[0]; |
3463 shader_precision->max_range = range[1]; | 3473 shader_precision->max_range = range[1]; |
3464 shader_precision->precision = precision; | 3474 shader_precision->precision = precision; |
3465 }); | 3475 }); |
3466 DoGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, | 3476 DoGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, |
3467 &caps.max_combined_texture_image_units); | 3477 &caps.max_combined_texture_image_units); |
3468 DoGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &caps.max_cube_map_texture_size); | 3478 DoGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &caps.max_cube_map_texture_size); |
3469 DoGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, | 3479 DoGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, |
3470 &caps.max_fragment_uniform_vectors); | 3480 &caps.max_fragment_uniform_vectors); |
3471 DoGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &caps.max_renderbuffer_size); | 3481 DoGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &caps.max_renderbuffer_size); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3645 resources.MaxVertexOutputVectors = | 3655 resources.MaxVertexOutputVectors = |
3646 group_->max_vertex_output_components() / 4; | 3656 group_->max_vertex_output_components() / 4; |
3647 resources.MaxFragmentInputVectors = | 3657 resources.MaxFragmentInputVectors = |
3648 group_->max_fragment_input_components() / 4; | 3658 group_->max_fragment_input_components() / 4; |
3649 resources.MaxProgramTexelOffset = group_->max_program_texel_offset(); | 3659 resources.MaxProgramTexelOffset = group_->max_program_texel_offset(); |
3650 resources.MinProgramTexelOffset = group_->min_program_texel_offset(); | 3660 resources.MinProgramTexelOffset = group_->min_program_texel_offset(); |
3651 } | 3661 } |
3652 | 3662 |
3653 GLint range[2] = { 0, 0 }; | 3663 GLint range[2] = { 0, 0 }; |
3654 GLint precision = 0; | 3664 GLint precision = 0; |
3655 GetShaderPrecisionFormatImpl(GL_FRAGMENT_SHADER, GL_HIGH_FLOAT, | 3665 GetShaderPrecisionFormatImpl(gl_version_info(), GL_FRAGMENT_SHADER, |
3656 range, &precision); | 3666 GL_HIGH_FLOAT, range, &precision); |
3657 resources.FragmentPrecisionHigh = | 3667 resources.FragmentPrecisionHigh = |
3658 PrecisionMeetsSpecForHighpFloat(range[0], range[1], precision); | 3668 PrecisionMeetsSpecForHighpFloat(range[0], range[1], precision); |
3659 | 3669 |
3660 ShShaderSpec shader_spec; | 3670 ShShaderSpec shader_spec; |
3661 switch (context_type) { | 3671 switch (context_type) { |
3662 case CONTEXT_TYPE_WEBGL1: | 3672 case CONTEXT_TYPE_WEBGL1: |
3663 shader_spec = SH_WEBGL_SPEC; | 3673 shader_spec = SH_WEBGL_SPEC; |
3664 resources.OES_standard_derivatives = derivatives_explicitly_enabled_; | 3674 resources.OES_standard_derivatives = derivatives_explicitly_enabled_; |
3665 resources.EXT_frag_depth = frag_depth_explicitly_enabled_; | 3675 resources.EXT_frag_depth = frag_depth_explicitly_enabled_; |
3666 resources.EXT_draw_buffers = draw_buffers_explicitly_enabled_; | 3676 resources.EXT_draw_buffers = draw_buffers_explicitly_enabled_; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3731 driver_bug_workarounds |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS; | 3741 driver_bug_workarounds |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS; |
3732 if (workarounds().regenerate_struct_names) | 3742 if (workarounds().regenerate_struct_names) |
3733 driver_bug_workarounds |= SH_REGENERATE_STRUCT_NAMES; | 3743 driver_bug_workarounds |= SH_REGENERATE_STRUCT_NAMES; |
3734 if (workarounds().remove_pow_with_constant_exponent) | 3744 if (workarounds().remove_pow_with_constant_exponent) |
3735 driver_bug_workarounds |= SH_REMOVE_POW_WITH_CONSTANT_EXPONENT; | 3745 driver_bug_workarounds |= SH_REMOVE_POW_WITH_CONSTANT_EXPONENT; |
3736 | 3746 |
3737 resources.WEBGL_debug_shader_precision = | 3747 resources.WEBGL_debug_shader_precision = |
3738 group_->gpu_preferences().emulate_shader_precision; | 3748 group_->gpu_preferences().emulate_shader_precision; |
3739 | 3749 |
3740 ShShaderOutput shader_output_language = | 3750 ShShaderOutput shader_output_language = |
3741 ShaderTranslator::GetShaderOutputLanguageForContext( | 3751 ShaderTranslator::GetShaderOutputLanguageForContext(gl_version_info()); |
3742 feature_info_->gl_version_info()); | |
3743 | 3752 |
3744 vertex_translator_ = shader_translator_cache()->GetTranslator( | 3753 vertex_translator_ = shader_translator_cache()->GetTranslator( |
3745 GL_VERTEX_SHADER, shader_spec, &resources, shader_output_language, | 3754 GL_VERTEX_SHADER, shader_spec, &resources, shader_output_language, |
3746 static_cast<ShCompileOptions>(driver_bug_workarounds)); | 3755 static_cast<ShCompileOptions>(driver_bug_workarounds)); |
3747 if (!vertex_translator_.get()) { | 3756 if (!vertex_translator_.get()) { |
3748 LOG(ERROR) << "Could not initialize vertex shader translator."; | 3757 LOG(ERROR) << "Could not initialize vertex shader translator."; |
3749 Destroy(true); | 3758 Destroy(true); |
3750 return false; | 3759 return false; |
3751 } | 3760 } |
3752 | 3761 |
(...skipping 1785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5538 if (texture->target() != 0 && texture->target() != target) { | 5547 if (texture->target() != 0 && texture->target() != target) { |
5539 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, | 5548 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
5540 "glBindTexture", | 5549 "glBindTexture", |
5541 "texture bound to more than 1 target."); | 5550 "texture bound to more than 1 target."); |
5542 return; | 5551 return; |
5543 } | 5552 } |
5544 LogClientServiceForInfo(texture, client_id, "glBindTexture"); | 5553 LogClientServiceForInfo(texture, client_id, "glBindTexture"); |
5545 glBindTexture(target, texture->service_id()); | 5554 glBindTexture(target, texture->service_id()); |
5546 if (texture->target() == 0) { | 5555 if (texture->target() == 0) { |
5547 texture_manager()->SetTarget(texture_ref, target); | 5556 texture_manager()->SetTarget(texture_ref, target); |
5548 if (!feature_info_->gl_version_info().BehavesLikeGLES() && | 5557 if (!gl_version_info().BehavesLikeGLES() && |
5549 feature_info_->gl_version_info().IsAtLeastGL(3, 2)) { | 5558 gl_version_info().IsAtLeastGL(3, 2)) { |
5550 // In Desktop GL core profile and GL ES, depth textures are always | 5559 // In Desktop GL core profile and GL ES, depth textures are always |
5551 // sampled to the RED channel, whereas on Desktop GL compatibility | 5560 // sampled to the RED channel, whereas on Desktop GL compatibility |
5552 // proifle, they are sampled to RED, LUMINANCE, INTENSITY, or ALPHA | 5561 // proifle, they are sampled to RED, LUMINANCE, INTENSITY, or ALPHA |
5553 // channel, depending on the DEPTH_TEXTURE_MODE value. | 5562 // channel, depending on the DEPTH_TEXTURE_MODE value. |
5554 // In theory we only need to apply this for depth textures, but it is | 5563 // In theory we only need to apply this for depth textures, but it is |
5555 // simpler to apply to all textures. | 5564 // simpler to apply to all textures. |
5556 glTexParameteri(target, GL_DEPTH_TEXTURE_MODE, GL_RED); | 5565 glTexParameteri(target, GL_DEPTH_TEXTURE_MODE, GL_RED); |
5557 } | 5566 } |
5558 } | 5567 } |
5559 } else { | 5568 } else { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5661 !state_.bound_transform_feedback->paused()) { | 5670 !state_.bound_transform_feedback->paused()) { |
5662 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glResumeTransformFeedback", | 5671 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glResumeTransformFeedback", |
5663 "transform feedback is not active or not paused"); | 5672 "transform feedback is not active or not paused"); |
5664 return; | 5673 return; |
5665 } | 5674 } |
5666 state_.bound_transform_feedback->DoResumeTransformFeedback(); | 5675 state_.bound_transform_feedback->DoResumeTransformFeedback(); |
5667 } | 5676 } |
5668 | 5677 |
5669 void GLES2DecoderImpl::DoDisableVertexAttribArray(GLuint index) { | 5678 void GLES2DecoderImpl::DoDisableVertexAttribArray(GLuint index) { |
5670 if (state_.vertex_attrib_manager->Enable(index, false)) { | 5679 if (state_.vertex_attrib_manager->Enable(index, false)) { |
5671 if (index != 0 || feature_info_->gl_version_info().BehavesLikeGLES()) { | 5680 if (index != 0 || gl_version_info().BehavesLikeGLES()) { |
5672 glDisableVertexAttribArray(index); | 5681 glDisableVertexAttribArray(index); |
5673 } | 5682 } |
5674 } else { | 5683 } else { |
5675 LOCAL_SET_GL_ERROR( | 5684 LOCAL_SET_GL_ERROR( |
5676 GL_INVALID_VALUE, | 5685 GL_INVALID_VALUE, |
5677 "glDisableVertexAttribArray", "index out of range"); | 5686 "glDisableVertexAttribArray", "index out of range"); |
5678 } | 5687 } |
5679 } | 5688 } |
5680 | 5689 |
5681 void GLES2DecoderImpl::InvalidateFramebufferImpl( | 5690 void GLES2DecoderImpl::InvalidateFramebufferImpl( |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5753 NOTREACHED(); | 5762 NOTREACHED(); |
5754 return; | 5763 return; |
5755 } | 5764 } |
5756 } | 5765 } |
5757 translated_attachments[i] = attachment; | 5766 translated_attachments[i] = attachment; |
5758 } | 5767 } |
5759 | 5768 |
5760 bool dirty = false; | 5769 bool dirty = false; |
5761 switch (op) { | 5770 switch (op) { |
5762 case kFramebufferDiscard: | 5771 case kFramebufferDiscard: |
5763 if (feature_info_->gl_version_info().is_es3) { | 5772 if (gl_version_info().is_es3) { |
5764 glInvalidateFramebuffer( | 5773 glInvalidateFramebuffer( |
5765 target, validated_count, translated_attachments.get()); | 5774 target, validated_count, translated_attachments.get()); |
5766 } else { | 5775 } else { |
5767 glDiscardFramebufferEXT( | 5776 glDiscardFramebufferEXT( |
5768 target, validated_count, translated_attachments.get()); | 5777 target, validated_count, translated_attachments.get()); |
5769 } | 5778 } |
5770 dirty = true; | 5779 dirty = true; |
5771 break; | 5780 break; |
5772 case kFramebufferInvalidate: | 5781 case kFramebufferInvalidate: |
5773 if (feature_info_->gl_version_info().IsLowerThanGL(4, 3)) { | 5782 if (gl_version_info().IsLowerThanGL(4, 3)) { |
5774 // no-op since the function isn't supported. | 5783 // no-op since the function isn't supported. |
5775 } else { | 5784 } else { |
5776 glInvalidateFramebuffer( | 5785 glInvalidateFramebuffer( |
5777 target, validated_count, translated_attachments.get()); | 5786 target, validated_count, translated_attachments.get()); |
5778 dirty = true; | 5787 dirty = true; |
5779 } | 5788 } |
5780 break; | 5789 break; |
5781 case kFramebufferInvalidateSub: | 5790 case kFramebufferInvalidateSub: |
5782 // Make it an no-op because we don't have a mechanism to mark partial | 5791 // Make it an no-op because we don't have a mechanism to mark partial |
5783 // pixels uncleared yet. | 5792 // pixels uncleared yet. |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5996 } | 6005 } |
5997 if (*params == GL_SRGB_EXT) { | 6006 if (*params == GL_SRGB_EXT) { |
5998 *params = GL_RGB; | 6007 *params = GL_RGB; |
5999 } | 6008 } |
6000 } | 6009 } |
6001 return true; | 6010 return true; |
6002 default: | 6011 default: |
6003 break; | 6012 break; |
6004 } | 6013 } |
6005 | 6014 |
6006 if (gl::GetGLImplementation() != gl::kGLImplementationEGLGLES2) { | 6015 if (!gl_version_info().is_es) { |
6007 switch (pname) { | 6016 switch (pname) { |
6008 case GL_MAX_FRAGMENT_UNIFORM_VECTORS: | 6017 case GL_MAX_FRAGMENT_UNIFORM_VECTORS: |
6009 *num_written = 1; | 6018 *num_written = 1; |
6010 if (params) { | 6019 if (params) { |
6011 *params = group_->max_fragment_uniform_vectors(); | 6020 *params = group_->max_fragment_uniform_vectors(); |
6012 } | 6021 } |
6013 return true; | 6022 return true; |
6014 case GL_MAX_VARYING_VECTORS: | 6023 case GL_MAX_VARYING_VECTORS: |
6015 *num_written = 1; | 6024 *num_written = 1; |
6016 if (params) { | 6025 if (params) { |
6017 *params = group_->max_varying_vectors(); | 6026 *params = group_->max_varying_vectors(); |
6018 } | 6027 } |
6019 return true; | 6028 return true; |
6020 case GL_MAX_VERTEX_UNIFORM_VECTORS: | 6029 case GL_MAX_VERTEX_UNIFORM_VECTORS: |
6021 *num_written = 1; | 6030 *num_written = 1; |
6022 if (params) { | 6031 if (params) { |
6023 *params = group_->max_vertex_uniform_vectors(); | 6032 *params = group_->max_vertex_uniform_vectors(); |
6024 } | 6033 } |
6025 return true; | 6034 return true; |
6026 } | 6035 } |
6027 } | 6036 } |
6028 if (unsafe_es3_apis_enabled()) { | 6037 if (unsafe_es3_apis_enabled()) { |
6029 switch (pname) { | 6038 switch (pname) { |
6030 case GL_MAX_VARYING_COMPONENTS: { | 6039 case GL_MAX_VARYING_COMPONENTS: { |
6031 if (feature_info_->gl_version_info().is_es) { | 6040 if (gl_version_info().is_es) { |
6032 // We can just delegate this query to the driver. | 6041 // We can just delegate this query to the driver. |
6033 return false; | 6042 return false; |
6034 } | 6043 } |
6035 | 6044 |
6036 // GL_MAX_VARYING_COMPONENTS is deprecated in the desktop | 6045 // GL_MAX_VARYING_COMPONENTS is deprecated in the desktop |
6037 // OpenGL core profile, so for simplicity, just compute it | 6046 // OpenGL core profile, so for simplicity, just compute it |
6038 // from GL_MAX_VARYING_VECTORS on non-OpenGL ES | 6047 // from GL_MAX_VARYING_VECTORS on non-OpenGL ES |
6039 // configurations. | 6048 // configurations. |
6040 GLint max_varying_vectors = 0; | 6049 GLint max_varying_vectors = 0; |
6041 glGetIntegerv(GL_MAX_VARYING_VECTORS, &max_varying_vectors); | 6050 glGetIntegerv(GL_MAX_VARYING_VECTORS, &max_varying_vectors); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6124 return true; | 6133 return true; |
6125 case GL_ALPHA_BITS: | 6134 case GL_ALPHA_BITS: |
6126 *num_written = 1; | 6135 *num_written = 1; |
6127 if (params) { | 6136 if (params) { |
6128 GLint v = 0; | 6137 GLint v = 0; |
6129 Framebuffer* framebuffer = | 6138 Framebuffer* framebuffer = |
6130 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); | 6139 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); |
6131 if (framebuffer) { | 6140 if (framebuffer) { |
6132 if (framebuffer->HasAlphaMRT() && | 6141 if (framebuffer->HasAlphaMRT() && |
6133 framebuffer->HasSameInternalFormatsMRT()) { | 6142 framebuffer->HasSameInternalFormatsMRT()) { |
6134 if (feature_info_->gl_version_info().is_desktop_core_profile) { | 6143 if (gl_version_info().is_desktop_core_profile) { |
6135 for (uint32_t i = 0; i < group_->max_draw_buffers(); i++) { | 6144 for (uint32_t i = 0; i < group_->max_draw_buffers(); i++) { |
6136 if (framebuffer->HasColorAttachment(i)) { | 6145 if (framebuffer->HasColorAttachment(i)) { |
6137 glGetFramebufferAttachmentParameterivEXT( | 6146 glGetFramebufferAttachmentParameterivEXT( |
6138 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, | 6147 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, |
6139 GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, &v); | 6148 GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, &v); |
6140 break; | 6149 break; |
6141 } | 6150 } |
6142 } | 6151 } |
6143 } else { | 6152 } else { |
6144 glGetIntegerv(GL_ALPHA_BITS, &v); | 6153 glGetIntegerv(GL_ALPHA_BITS, &v); |
6145 } | 6154 } |
6146 } | 6155 } |
6147 } else { | 6156 } else { |
6148 v = (ClientExposedBackBufferHasAlpha() ? 8 : 0); | 6157 v = (ClientExposedBackBufferHasAlpha() ? 8 : 0); |
6149 } | 6158 } |
6150 params[0] = v; | 6159 params[0] = v; |
6151 } | 6160 } |
6152 return true; | 6161 return true; |
6153 case GL_DEPTH_BITS: | 6162 case GL_DEPTH_BITS: |
6154 *num_written = 1; | 6163 *num_written = 1; |
6155 if (params) { | 6164 if (params) { |
6156 GLint v = 0; | 6165 GLint v = 0; |
6157 if (feature_info_->gl_version_info().is_desktop_core_profile) { | 6166 if (gl_version_info().is_desktop_core_profile) { |
6158 Framebuffer* framebuffer = | 6167 Framebuffer* framebuffer = |
6159 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); | 6168 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); |
6160 if (framebuffer) { | 6169 if (framebuffer) { |
6161 if (framebuffer->HasDepthAttachment()) { | 6170 if (framebuffer->HasDepthAttachment()) { |
6162 glGetFramebufferAttachmentParameterivEXT( | 6171 glGetFramebufferAttachmentParameterivEXT( |
6163 GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, | 6172 GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, |
6164 GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, &v); | 6173 GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, &v); |
6165 } | 6174 } |
6166 } else { | 6175 } else { |
6167 v = (back_buffer_has_depth_ ? 24 : 0); | 6176 v = (back_buffer_has_depth_ ? 24 : 0); |
6168 } | 6177 } |
6169 } else { | 6178 } else { |
6170 glGetIntegerv(GL_DEPTH_BITS, &v); | 6179 glGetIntegerv(GL_DEPTH_BITS, &v); |
6171 } | 6180 } |
6172 params[0] = BoundFramebufferHasDepthAttachment() ? v : 0; | 6181 params[0] = BoundFramebufferHasDepthAttachment() ? v : 0; |
6173 } | 6182 } |
6174 return true; | 6183 return true; |
6175 case GL_RED_BITS: | 6184 case GL_RED_BITS: |
6176 case GL_GREEN_BITS: | 6185 case GL_GREEN_BITS: |
6177 case GL_BLUE_BITS: | 6186 case GL_BLUE_BITS: |
6178 *num_written = 1; | 6187 *num_written = 1; |
6179 if (params) { | 6188 if (params) { |
6180 GLint v = 0; | 6189 GLint v = 0; |
6181 if (feature_info_->gl_version_info().is_desktop_core_profile) { | 6190 if (gl_version_info().is_desktop_core_profile) { |
6182 Framebuffer* framebuffer = | 6191 Framebuffer* framebuffer = |
6183 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); | 6192 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); |
6184 if (framebuffer) { | 6193 if (framebuffer) { |
6185 if (framebuffer->HasSameInternalFormatsMRT()) { | 6194 if (framebuffer->HasSameInternalFormatsMRT()) { |
6186 GLenum framebuffer_enum = 0; | 6195 GLenum framebuffer_enum = 0; |
6187 switch (pname) { | 6196 switch (pname) { |
6188 case GL_RED_BITS: | 6197 case GL_RED_BITS: |
6189 framebuffer_enum = GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE; | 6198 framebuffer_enum = GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE; |
6190 break; | 6199 break; |
6191 case GL_GREEN_BITS: | 6200 case GL_GREEN_BITS: |
(...skipping 18 matching lines...) Expand all Loading... |
6210 } else { | 6219 } else { |
6211 glGetIntegerv(pname, &v); | 6220 glGetIntegerv(pname, &v); |
6212 } | 6221 } |
6213 params[0] = v; | 6222 params[0] = v; |
6214 } | 6223 } |
6215 return true; | 6224 return true; |
6216 case GL_STENCIL_BITS: | 6225 case GL_STENCIL_BITS: |
6217 *num_written = 1; | 6226 *num_written = 1; |
6218 if (params) { | 6227 if (params) { |
6219 GLint v = 0; | 6228 GLint v = 0; |
6220 if (feature_info_->gl_version_info().is_desktop_core_profile) { | 6229 if (gl_version_info().is_desktop_core_profile) { |
6221 Framebuffer* framebuffer = | 6230 Framebuffer* framebuffer = |
6222 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); | 6231 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); |
6223 if (framebuffer) { | 6232 if (framebuffer) { |
6224 if (framebuffer->HasStencilAttachment()) { | 6233 if (framebuffer->HasStencilAttachment()) { |
6225 glGetFramebufferAttachmentParameterivEXT( | 6234 glGetFramebufferAttachmentParameterivEXT( |
6226 GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, | 6235 GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, |
6227 GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, &v); | 6236 GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, &v); |
6228 } | 6237 } |
6229 } else { | 6238 } else { |
6230 v = (back_buffer_has_stencil_ ? 8 : 0); | 6239 v = (back_buffer_has_stencil_ ? 8 : 0); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6461 } | 6470 } |
6462 return GetHelper(pname, NULL, num_values); | 6471 return GetHelper(pname, NULL, num_values); |
6463 } | 6472 } |
6464 | 6473 |
6465 GLenum GLES2DecoderImpl::AdjustGetPname(GLenum pname) { | 6474 GLenum GLES2DecoderImpl::AdjustGetPname(GLenum pname) { |
6466 if (GL_MAX_SAMPLES == pname && | 6475 if (GL_MAX_SAMPLES == pname && |
6467 features().use_img_for_multisampled_render_to_texture) { | 6476 features().use_img_for_multisampled_render_to_texture) { |
6468 return GL_MAX_SAMPLES_IMG; | 6477 return GL_MAX_SAMPLES_IMG; |
6469 } | 6478 } |
6470 if (GL_ALIASED_POINT_SIZE_RANGE == pname && | 6479 if (GL_ALIASED_POINT_SIZE_RANGE == pname && |
6471 feature_info_->gl_version_info().is_desktop_core_profile) { | 6480 gl_version_info().is_desktop_core_profile) { |
6472 return GL_POINT_SIZE_RANGE; | 6481 return GL_POINT_SIZE_RANGE; |
6473 } | 6482 } |
6474 return pname; | 6483 return pname; |
6475 } | 6484 } |
6476 | 6485 |
6477 void GLES2DecoderImpl::DoGetBooleanv(GLenum pname, GLboolean* params) { | 6486 void GLES2DecoderImpl::DoGetBooleanv(GLenum pname, GLboolean* params) { |
6478 DCHECK(params); | 6487 DCHECK(params); |
6479 GLsizei num_written = 0; | 6488 GLsizei num_written = 0; |
6480 if (GetNumValuesReturnedForGLGet(pname, &num_written)) { | 6489 if (GetNumValuesReturnedForGLGet(pname, &num_written)) { |
6481 std::unique_ptr<GLint[]> values(new GLint[num_written]); | 6490 std::unique_ptr<GLint[]> values(new GLint[num_written]); |
(...skipping 24 matching lines...) Expand all Loading... |
6506 glGetFloatv(pname, params); | 6515 glGetFloatv(pname, params); |
6507 } | 6516 } |
6508 } | 6517 } |
6509 } | 6518 } |
6510 | 6519 |
6511 void GLES2DecoderImpl::DoGetInteger64v(GLenum pname, GLint64* params) { | 6520 void GLES2DecoderImpl::DoGetInteger64v(GLenum pname, GLint64* params) { |
6512 DCHECK(params); | 6521 DCHECK(params); |
6513 if (unsafe_es3_apis_enabled()) { | 6522 if (unsafe_es3_apis_enabled()) { |
6514 switch (pname) { | 6523 switch (pname) { |
6515 case GL_MAX_ELEMENT_INDEX: { | 6524 case GL_MAX_ELEMENT_INDEX: { |
6516 if (feature_info_->gl_version_info().IsAtLeastGLES(3, 0) || | 6525 if (gl_version_info().IsAtLeastGLES(3, 0) || |
6517 feature_info_->gl_version_info().IsAtLeastGL(4, 3)) { | 6526 gl_version_info().IsAtLeastGL(4, 3)) { |
6518 glGetInteger64v(GL_MAX_ELEMENT_INDEX, params); | 6527 glGetInteger64v(GL_MAX_ELEMENT_INDEX, params); |
6519 } else { | 6528 } else { |
6520 // Assume that desktop GL implementations can generally support | 6529 // Assume that desktop GL implementations can generally support |
6521 // 32-bit indices. | 6530 // 32-bit indices. |
6522 if (params) { | 6531 if (params) { |
6523 *params = std::numeric_limits<unsigned int>::max(); | 6532 *params = std::numeric_limits<unsigned int>::max(); |
6524 } | 6533 } |
6525 } | 6534 } |
6526 return; | 6535 return; |
6527 } | 6536 } |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7587 GLint dstY0, | 7596 GLint dstY0, |
7588 GLint dstX1, | 7597 GLint dstX1, |
7589 GLint dstY1, | 7598 GLint dstY1, |
7590 GLbitfield mask, | 7599 GLbitfield mask, |
7591 GLenum filter) { | 7600 GLenum filter) { |
7592 // TODO(sievers): This could be resolved at the GL binding level, but the | 7601 // TODO(sievers): This could be resolved at the GL binding level, but the |
7593 // binding process is currently a bit too 'brute force'. | 7602 // binding process is currently a bit too 'brute force'. |
7594 if (feature_info_->feature_flags().use_core_framebuffer_multisample) { | 7603 if (feature_info_->feature_flags().use_core_framebuffer_multisample) { |
7595 glBlitFramebuffer( | 7604 glBlitFramebuffer( |
7596 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); | 7605 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
7597 } else if (feature_info_->gl_version_info().is_angle) { | 7606 } else if (gl_version_info().is_angle) { |
7598 // This is ES2 only. | 7607 // This is ES2 only. |
7599 glBlitFramebufferANGLE( | 7608 glBlitFramebufferANGLE( |
7600 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); | 7609 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
7601 } else { | 7610 } else { |
7602 glBlitFramebufferEXT( | 7611 glBlitFramebufferEXT( |
7603 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); | 7612 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
7604 } | 7613 } |
7605 } | 7614 } |
7606 | 7615 |
7607 bool GLES2DecoderImpl::ValidateRenderbufferStorageMultisample( | 7616 bool GLES2DecoderImpl::ValidateRenderbufferStorageMultisample( |
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8884 max_vertex_accessed, | 8893 max_vertex_accessed, |
8885 instanced, | 8894 instanced, |
8886 primcount); | 8895 primcount); |
8887 } | 8896 } |
8888 | 8897 |
8889 bool GLES2DecoderImpl::SimulateAttrib0( | 8898 bool GLES2DecoderImpl::SimulateAttrib0( |
8890 const char* function_name, GLuint max_vertex_accessed, bool* simulated) { | 8899 const char* function_name, GLuint max_vertex_accessed, bool* simulated) { |
8891 DCHECK(simulated); | 8900 DCHECK(simulated); |
8892 *simulated = false; | 8901 *simulated = false; |
8893 | 8902 |
8894 if (feature_info_->gl_version_info().BehavesLikeGLES()) | 8903 if (gl_version_info().BehavesLikeGLES()) |
8895 return true; | 8904 return true; |
8896 | 8905 |
8897 const VertexAttrib* attrib = | 8906 const VertexAttrib* attrib = |
8898 state_.vertex_attrib_manager->GetVertexAttrib(0); | 8907 state_.vertex_attrib_manager->GetVertexAttrib(0); |
8899 // If it's enabled or it's not used then we don't need to do anything. | 8908 // If it's enabled or it's not used then we don't need to do anything. |
8900 bool attrib_0_used = | 8909 bool attrib_0_used = |
8901 state_.current_program->GetAttribInfoByLocation(0) != NULL; | 8910 state_.current_program->GetAttribInfoByLocation(0) != NULL; |
8902 if (attrib->enabled() && attrib_0_used) { | 8911 if (attrib->enabled() && attrib_0_used) { |
8903 return true; | 8912 return true; |
8904 } | 8913 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8977 | 8986 |
8978 if (feature_info_->feature_flags().angle_instanced_arrays) | 8987 if (feature_info_->feature_flags().angle_instanced_arrays) |
8979 glVertexAttribDivisorANGLE(attrib_index, attrib->divisor()); | 8988 glVertexAttribDivisorANGLE(attrib_index, attrib->divisor()); |
8980 glBindBuffer( | 8989 glBindBuffer( |
8981 GL_ARRAY_BUFFER, state_.bound_array_buffer.get() ? | 8990 GL_ARRAY_BUFFER, state_.bound_array_buffer.get() ? |
8982 state_.bound_array_buffer->service_id() : 0); | 8991 state_.bound_array_buffer->service_id() : 0); |
8983 | 8992 |
8984 // Never touch vertex attribute 0's state (in particular, never disable it) | 8993 // Never touch vertex attribute 0's state (in particular, never disable it) |
8985 // when running on desktop GL with compatibility profile because it will | 8994 // when running on desktop GL with compatibility profile because it will |
8986 // never be re-enabled. | 8995 // never be re-enabled. |
8987 if (attrib_index != 0 || feature_info_->gl_version_info().BehavesLikeGLES()) { | 8996 if (attrib_index != 0 || gl_version_info().BehavesLikeGLES()) { |
8988 if (attrib->enabled()) { | 8997 if (attrib->enabled()) { |
8989 glEnableVertexAttribArray(attrib_index); | 8998 glEnableVertexAttribArray(attrib_index); |
8990 } else { | 8999 } else { |
8991 glDisableVertexAttribArray(attrib_index); | 9000 glDisableVertexAttribArray(attrib_index); |
8992 } | 9001 } |
8993 } | 9002 } |
8994 } | 9003 } |
8995 | 9004 |
8996 bool GLES2DecoderImpl::SimulateFixedAttribs( | 9005 bool GLES2DecoderImpl::SimulateFixedAttribs( |
8997 const char* function_name, | 9006 const char* function_name, |
8998 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount) { | 9007 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount) { |
8999 DCHECK(simulated); | 9008 DCHECK(simulated); |
9000 *simulated = false; | 9009 *simulated = false; |
9001 if (feature_info_->gl_version_info().BehavesLikeGLES()) | 9010 if (gl_version_info().BehavesLikeGLES()) |
9002 return true; | 9011 return true; |
9003 | 9012 |
9004 if (!state_.vertex_attrib_manager->HaveFixedAttribs()) { | 9013 if (!state_.vertex_attrib_manager->HaveFixedAttribs()) { |
9005 return true; | 9014 return true; |
9006 } | 9015 } |
9007 | 9016 |
9008 LOCAL_PERFORMANCE_WARNING( | 9017 LOCAL_PERFORMANCE_WARNING( |
9009 "GL_FIXED attributes have a significant performance penalty"); | 9018 "GL_FIXED attributes have a significant performance penalty"); |
9010 | 9019 |
9011 // NOTE: we could be smart and try to check if a buffer is used | 9020 // NOTE: we could be smart and try to check if a buffer is used |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9771 return; | 9780 return; |
9772 } | 9781 } |
9773 Texture* texture = texture_ref->texture(); | 9782 Texture* texture = texture_ref->texture(); |
9774 switch (pname) { | 9783 switch (pname) { |
9775 case GL_TEXTURE_MAX_ANISOTROPY_EXT: | 9784 case GL_TEXTURE_MAX_ANISOTROPY_EXT: |
9776 if (workarounds().init_texture_max_anisotropy) { | 9785 if (workarounds().init_texture_max_anisotropy) { |
9777 texture->InitTextureMaxAnisotropyIfNeeded(target); | 9786 texture->InitTextureMaxAnisotropyIfNeeded(target); |
9778 } | 9787 } |
9779 break; | 9788 break; |
9780 case GL_TEXTURE_IMMUTABLE_LEVELS: | 9789 case GL_TEXTURE_IMMUTABLE_LEVELS: |
9781 if (feature_info_->gl_version_info().IsLowerThanGL(4, 2)) { | 9790 if (gl_version_info().IsLowerThanGL(4, 2)) { |
9782 GLint levels = texture->GetImmutableLevels(); | 9791 GLint levels = texture->GetImmutableLevels(); |
9783 if (fparams) { | 9792 if (fparams) { |
9784 fparams[0] = static_cast<GLfloat>(levels); | 9793 fparams[0] = static_cast<GLfloat>(levels); |
9785 } else { | 9794 } else { |
9786 iparams[0] = levels; | 9795 iparams[0] = levels; |
9787 } | 9796 } |
9788 return; | 9797 return; |
9789 } | 9798 } |
9790 break; | 9799 break; |
9791 // Get the level information from the texture to avoid a Mac driver | 9800 // Get the level information from the texture to avoid a Mac driver |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10140 ->SetAttribInfo(indx, | 10149 ->SetAttribInfo(indx, |
10141 state_.bound_array_buffer.get(), | 10150 state_.bound_array_buffer.get(), |
10142 size, | 10151 size, |
10143 type, | 10152 type, |
10144 normalized, | 10153 normalized, |
10145 stride, | 10154 stride, |
10146 stride != 0 ? stride : group_size, | 10155 stride != 0 ? stride : group_size, |
10147 offset, | 10156 offset, |
10148 GL_FALSE); | 10157 GL_FALSE); |
10149 // We support GL_FIXED natively on EGL/GLES2 implementations | 10158 // We support GL_FIXED natively on EGL/GLES2 implementations |
10150 if (type != GL_FIXED || feature_info_->gl_version_info().is_es) { | 10159 if (type != GL_FIXED || gl_version_info().is_es) { |
10151 glVertexAttribPointer(indx, size, type, normalized, stride, ptr); | 10160 glVertexAttribPointer(indx, size, type, normalized, stride, ptr); |
10152 } | 10161 } |
10153 return error::kNoError; | 10162 return error::kNoError; |
10154 } | 10163 } |
10155 | 10164 |
10156 void GLES2DecoderImpl::DoViewport(GLint x, GLint y, GLsizei width, | 10165 void GLES2DecoderImpl::DoViewport(GLint x, GLint y, GLsizei width, |
10157 GLsizei height) { | 10166 GLsizei height) { |
10158 state_.viewport_x = x; | 10167 state_.viewport_x = x; |
10159 state_.viewport_y = y; | 10168 state_.viewport_y = y; |
10160 state_.viewport_width = std::min(width, viewport_max_width_); | 10169 state_.viewport_width = std::min(width, viewport_max_width_); |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10516 if (format == static_cast<GLenum>(preferred_format) && | 10525 if (format == static_cast<GLenum>(preferred_format) && |
10517 type == static_cast<GLenum>(preferred_type)) { | 10526 type == static_cast<GLenum>(preferred_type)) { |
10518 format_type_acceptable = true; | 10527 format_type_acceptable = true; |
10519 } | 10528 } |
10520 } | 10529 } |
10521 if (!format_type_acceptable) { | 10530 if (!format_type_acceptable) { |
10522 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glReadPixels", | 10531 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glReadPixels", |
10523 "format and type incompatible with the current read framebuffer"); | 10532 "format and type incompatible with the current read framebuffer"); |
10524 return error::kNoError; | 10533 return error::kNoError; |
10525 } | 10534 } |
10526 if (type == GL_HALF_FLOAT_OES && | 10535 if (type == GL_HALF_FLOAT_OES && !gl_version_info().is_es2) { |
10527 !(feature_info_->gl_version_info().is_es2)) { | |
10528 type = GL_HALF_FLOAT; | 10536 type = GL_HALF_FLOAT; |
10529 } | 10537 } |
10530 if (width == 0 || height == 0) { | 10538 if (width == 0 || height == 0) { |
10531 return error::kNoError; | 10539 return error::kNoError; |
10532 } | 10540 } |
10533 | 10541 |
10534 // Get the size of the current fbo or backbuffer. | 10542 // Get the size of the current fbo or backbuffer. |
10535 gfx::Size max_size = GetBoundReadFrameBufferSize(); | 10543 gfx::Size max_size = GetBoundReadFrameBufferSize(); |
10536 | 10544 |
10537 int32_t max_x; | 10545 int32_t max_x; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10581 if (async && features().use_async_readpixels && | 10589 if (async && features().use_async_readpixels && |
10582 !state_.bound_pixel_pack_buffer.get()) { | 10590 !state_.bound_pixel_pack_buffer.get()) { |
10583 // To simply the state tracking, we don't go down the async path if | 10591 // To simply the state tracking, we don't go down the async path if |
10584 // a PIXEL_PACK_BUFFER is bound (in which case the client can | 10592 // a PIXEL_PACK_BUFFER is bound (in which case the client can |
10585 // implement something similar on their own - all necessary functions | 10593 // implement something similar on their own - all necessary functions |
10586 // should be exposed). | 10594 // should be exposed). |
10587 GLuint buffer = 0; | 10595 GLuint buffer = 0; |
10588 glGenBuffersARB(1, &buffer); | 10596 glGenBuffersARB(1, &buffer); |
10589 glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, buffer); | 10597 glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, buffer); |
10590 // For ANGLE client version 2, GL_STREAM_READ is not available. | 10598 // For ANGLE client version 2, GL_STREAM_READ is not available. |
10591 const GLenum usage_hint = feature_info_->gl_version_info().is_angle ? | 10599 const GLenum usage_hint = |
10592 GL_STATIC_DRAW : GL_STREAM_READ; | 10600 gl_version_info().is_angle ? GL_STATIC_DRAW : GL_STREAM_READ; |
10593 glBufferData(GL_PIXEL_PACK_BUFFER_ARB, pixels_size, NULL, usage_hint); | 10601 glBufferData(GL_PIXEL_PACK_BUFFER_ARB, pixels_size, NULL, usage_hint); |
10594 GLenum error = glGetError(); | 10602 GLenum error = glGetError(); |
10595 if (error == GL_NO_ERROR) { | 10603 if (error == GL_NO_ERROR) { |
10596 // No need to worry about ES3 pixel pack parameters, because no | 10604 // No need to worry about ES3 pixel pack parameters, because no |
10597 // PIXEL_PACK_BUFFER is bound, and all these settings haven't been | 10605 // PIXEL_PACK_BUFFER is bound, and all these settings haven't been |
10598 // sent to GL. | 10606 // sent to GL. |
10599 glReadPixels(x, y, width, height, format, type, 0); | 10607 glReadPixels(x, y, width, height, format, type, 0); |
10600 pending_readpixel_fences_.push(FenceCallback()); | 10608 pending_readpixel_fences_.push(FenceCallback()); |
10601 WaitForReadPixels(base::Bind(&GLES2DecoderImpl::FinishReadPixels, | 10609 WaitForReadPixels(base::Bind(&GLES2DecoderImpl::FinishReadPixels, |
10602 base::AsWeakPtr(this), c, buffer)); | 10610 base::AsWeakPtr(this), c, buffer)); |
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11642 {8, 5}, | 11650 {8, 5}, |
11643 {8, 6}, | 11651 {8, 6}, |
11644 {8, 8}, | 11652 {8, 8}, |
11645 {10, 5}, | 11653 {10, 5}, |
11646 {10, 6}, | 11654 {10, 6}, |
11647 {10, 8}, | 11655 {10, 8}, |
11648 {10, 10}, | 11656 {10, 10}, |
11649 {12, 10}, | 11657 {12, 10}, |
11650 {12, 12}}; | 11658 {12, 12}}; |
11651 | 11659 |
11652 bool CheckETCFormatSupport(const FeatureInfo& featureInfo) { | 11660 bool CheckETCFormatSupport(const FeatureInfo& feature_info) { |
11653 const gl::GLVersionInfo& versionInfo = featureInfo.gl_version_info(); | 11661 const gl::GLVersionInfo& version_info = feature_info.gl_version_info(); |
11654 return versionInfo.IsAtLeastGL(4, 3) || versionInfo.IsAtLeastGLES(3, 0) || | 11662 return version_info.IsAtLeastGL(4, 3) || version_info.IsAtLeastGLES(3, 0) || |
11655 featureInfo.feature_flags().arb_es3_compatibility; | 11663 feature_info.feature_flags().arb_es3_compatibility; |
11656 } | 11664 } |
11657 | 11665 |
11658 using CompressedFormatSupportCheck = bool (*)(const FeatureInfo&); | 11666 using CompressedFormatSupportCheck = bool (*)(const FeatureInfo&); |
11659 using CompressedFormatDecompressionFunction = void (*)(size_t width, | 11667 using CompressedFormatDecompressionFunction = void (*)(size_t width, |
11660 size_t height, | 11668 size_t height, |
11661 size_t depth, | 11669 size_t depth, |
11662 const uint8_t* input, | 11670 const uint8_t* input, |
11663 size_t inputRowPitch, | 11671 size_t inputRowPitch, |
11664 size_t inputDepthPitch, | 11672 size_t inputDepthPitch, |
11665 uint8_t* output, | 11673 uint8_t* output, |
(...skipping 1796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13462 if (!validators_->shader_precision.IsValid(precision_type)) { | 13470 if (!validators_->shader_precision.IsValid(precision_type)) { |
13463 LOCAL_SET_GL_ERROR_INVALID_ENUM( | 13471 LOCAL_SET_GL_ERROR_INVALID_ENUM( |
13464 "glGetShaderPrecisionFormat", precision_type, "precision_type"); | 13472 "glGetShaderPrecisionFormat", precision_type, "precision_type"); |
13465 return error::kNoError; | 13473 return error::kNoError; |
13466 } | 13474 } |
13467 | 13475 |
13468 result->success = 1; // true | 13476 result->success = 1; // true |
13469 | 13477 |
13470 GLint range[2] = { 0, 0 }; | 13478 GLint range[2] = { 0, 0 }; |
13471 GLint precision = 0; | 13479 GLint precision = 0; |
13472 GetShaderPrecisionFormatImpl(shader_type, precision_type, range, &precision); | 13480 GetShaderPrecisionFormatImpl(gl_version_info(), shader_type, precision_type, |
| 13481 range, &precision); |
13473 | 13482 |
13474 result->min_range = range[0]; | 13483 result->min_range = range[0]; |
13475 result->max_range = range[1]; | 13484 result->max_range = range[1]; |
13476 result->precision = precision; | 13485 result->precision = precision; |
13477 | 13486 |
13478 return error::kNoError; | 13487 return error::kNoError; |
13479 } | 13488 } |
13480 | 13489 |
13481 error::Error GLES2DecoderImpl::HandleGetAttachedShaders( | 13490 error::Error GLES2DecoderImpl::HandleGetAttachedShaders( |
13482 uint32_t immediate_data_size, | 13491 uint32_t immediate_data_size, |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13899 offscreen_saved_color_texture_.swap(offscreen_target_color_texture_); | 13908 offscreen_saved_color_texture_.swap(offscreen_target_color_texture_); |
13900 offscreen_target_frame_buffer_->AttachRenderTexture( | 13909 offscreen_target_frame_buffer_->AttachRenderTexture( |
13901 offscreen_target_color_texture_.get()); | 13910 offscreen_target_color_texture_.get()); |
13902 offscreen_saved_frame_buffer_->AttachRenderTexture( | 13911 offscreen_saved_frame_buffer_->AttachRenderTexture( |
13903 offscreen_saved_color_texture_.get()); | 13912 offscreen_saved_color_texture_.get()); |
13904 } | 13913 } |
13905 | 13914 |
13906 // Ensure the side effects of the copy are visible to the parent | 13915 // Ensure the side effects of the copy are visible to the parent |
13907 // context. There is no need to do this for ANGLE because it uses a | 13916 // context. There is no need to do this for ANGLE because it uses a |
13908 // single D3D device for all contexts. | 13917 // single D3D device for all contexts. |
13909 if (!feature_info_->gl_version_info().is_angle) | 13918 if (!gl_version_info().is_angle) |
13910 glFlush(); | 13919 glFlush(); |
13911 } | 13920 } |
13912 } else if (supports_async_swap_) { | 13921 } else if (supports_async_swap_) { |
13913 TRACE_EVENT_ASYNC_BEGIN0("cc", "GLES2DecoderImpl::AsyncSwapBuffers", this); | 13922 TRACE_EVENT_ASYNC_BEGIN0("cc", "GLES2DecoderImpl::AsyncSwapBuffers", this); |
13914 surface_->SwapBuffersAsync(base::Bind(&GLES2DecoderImpl::FinishSwapBuffers, | 13923 surface_->SwapBuffersAsync(base::Bind(&GLES2DecoderImpl::FinishSwapBuffers, |
13915 base::AsWeakPtr(this))); | 13924 base::AsWeakPtr(this))); |
13916 } else { | 13925 } else { |
13917 FinishSwapBuffers(surface_->SwapBuffers()); | 13926 FinishSwapBuffers(surface_->SwapBuffers()); |
13918 } | 13927 } |
13919 | 13928 |
(...skipping 2253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16173 return error::kNoError; | 16182 return error::kNoError; |
16174 } | 16183 } |
16175 if (!validators_->internal_format_parameter.IsValid(pname)) { | 16184 if (!validators_->internal_format_parameter.IsValid(pname)) { |
16176 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetInternalformativ", pname, "pname"); | 16185 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetInternalformativ", pname, "pname"); |
16177 return error::kNoError; | 16186 return error::kNoError; |
16178 } | 16187 } |
16179 | 16188 |
16180 typedef cmds::GetInternalformativ::Result Result; | 16189 typedef cmds::GetInternalformativ::Result Result; |
16181 GLsizei num_values = 0; | 16190 GLsizei num_values = 0; |
16182 std::vector<GLint> samples; | 16191 std::vector<GLint> samples; |
16183 if (feature_info_->gl_version_info().IsLowerThanGL(4, 2)) { | 16192 if (gl_version_info().IsLowerThanGL(4, 2)) { |
16184 if (!GLES2Util::IsIntegerFormat(format) && | 16193 if (!GLES2Util::IsIntegerFormat(format) && |
16185 !GLES2Util::IsFloatFormat(format)) { | 16194 !GLES2Util::IsFloatFormat(format)) { |
16186 // No multisampling for integer formats and float formats. | 16195 // No multisampling for integer formats and float formats. |
16187 GLint max_samples = renderbuffer_manager()->max_samples(); | 16196 GLint max_samples = renderbuffer_manager()->max_samples(); |
16188 while (max_samples > 0) { | 16197 while (max_samples > 0) { |
16189 samples.push_back(max_samples); | 16198 samples.push_back(max_samples); |
16190 max_samples = max_samples >> 1; | 16199 max_samples = max_samples >> 1; |
16191 } | 16200 } |
16192 } | 16201 } |
16193 switch (pname) { | 16202 switch (pname) { |
(...skipping 28 matching lines...) Expand all Loading... |
16222 Result* result = GetSharedMemoryAs<Result*>( | 16231 Result* result = GetSharedMemoryAs<Result*>( |
16223 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); | 16232 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); |
16224 GLint* params = result ? result->GetData() : NULL; | 16233 GLint* params = result ? result->GetData() : NULL; |
16225 if (params == nullptr) { | 16234 if (params == nullptr) { |
16226 return error::kOutOfBounds; | 16235 return error::kOutOfBounds; |
16227 } | 16236 } |
16228 // Check that the client initialized the result. | 16237 // Check that the client initialized the result. |
16229 if (result->size != 0) { | 16238 if (result->size != 0) { |
16230 return error::kInvalidArguments; | 16239 return error::kInvalidArguments; |
16231 } | 16240 } |
16232 if (feature_info_->gl_version_info().IsLowerThanGL(4, 2)) { | 16241 if (gl_version_info().IsLowerThanGL(4, 2)) { |
16233 switch (pname) { | 16242 switch (pname) { |
16234 case GL_NUM_SAMPLE_COUNTS: | 16243 case GL_NUM_SAMPLE_COUNTS: |
16235 params[0] = static_cast<GLint>(samples.size()); | 16244 params[0] = static_cast<GLint>(samples.size()); |
16236 break; | 16245 break; |
16237 case GL_SAMPLES: | 16246 case GL_SAMPLES: |
16238 for (size_t ii = 0; ii < samples.size(); ++ii) { | 16247 for (size_t ii = 0; ii < samples.size(); ++ii) { |
16239 params[ii] = samples[ii]; | 16248 params[ii] = samples[ii]; |
16240 } | 16249 } |
16241 break; | 16250 break; |
16242 default: | 16251 default: |
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17542 } | 17551 } |
17543 | 17552 |
17544 // Include the auto-generated part of this file. We split this because it means | 17553 // Include the auto-generated part of this file. We split this because it means |
17545 // we can easily edit the non-auto generated parts right here in this file | 17554 // we can easily edit the non-auto generated parts right here in this file |
17546 // instead of having to edit some template or the code generator. | 17555 // instead of having to edit some template or the code generator. |
17547 #include "base/macros.h" | 17556 #include "base/macros.h" |
17548 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17557 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
17549 | 17558 |
17550 } // namespace gles2 | 17559 } // namespace gles2 |
17551 } // namespace gpu | 17560 } // namespace gpu |
OLD | NEW |