| 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 5088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5099 } | 5099 } |
| 5100 } | 5100 } |
| 5101 | 5101 |
| 5102 bool GLES2DecoderImpl::GetHelper( | 5102 bool GLES2DecoderImpl::GetHelper( |
| 5103 GLenum pname, GLint* params, GLsizei* num_written) { | 5103 GLenum pname, GLint* params, GLsizei* num_written) { |
| 5104 DCHECK(num_written); | 5104 DCHECK(num_written); |
| 5105 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { | 5105 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { |
| 5106 switch (pname) { | 5106 switch (pname) { |
| 5107 case GL_IMPLEMENTATION_COLOR_READ_FORMAT: | 5107 case GL_IMPLEMENTATION_COLOR_READ_FORMAT: |
| 5108 *num_written = 1; | 5108 *num_written = 1; |
| 5109 // Return the GL implementation's preferred format and (see below type) | 5109 // Return an additional (other than GL_RGBA) read format which the GL |
| 5110 // if we have the GL extension that exposes this. This allows the GPU | 5110 // implementation supports. If no additional format is available, this |
| 5111 // client to use the implementation's preferred format for glReadPixels | 5111 // function will return GL_RGBA. |
| 5112 // for optimisation. | |
| 5113 // | 5112 // |
| 5114 // A conflicting extension (GL_ARB_ES2_compatibility) specifies an error | 5113 // If the GL_OES_read_format extension is available, we query GL |
| 5115 // case when requested on integer/floating point buffers but which is | 5114 // directly. Otherwise we use our internal implementation. |
| 5116 // acceptable on GLES2 and with the GL_OES_read_format extension. | 5115 // |
| 5116 // A conflicting extension (GL_ARB_ES2_compatibility) specifies an |
| 5117 // error case when requested on integer/floating point buffers but |
| 5118 // which is acceptable on GLES2 and with the GL_OES_read_format |
| 5119 // extension. |
| 5117 // | 5120 // |
| 5118 // Therefore if an error occurs we swallow the error and use the | 5121 // Therefore if an error occurs we swallow the error and use the |
| 5119 // internal implementation. | 5122 // internal implementation. |
| 5120 if (params) { | 5123 if (params) { |
| 5121 if (context_->HasExtension("GL_OES_read_format")) { | 5124 if (context_->HasExtension("GL_OES_read_format")) { |
| 5122 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper", | 5125 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper", |
| 5123 GetErrorState()); | 5126 GetErrorState()); |
| 5124 glGetIntegerv(pname, params); | 5127 glGetIntegerv(pname, params); |
| 5125 if (glGetError() == GL_NO_ERROR) | 5128 if (glGetError() == GL_NO_ERROR) |
| 5126 return true; | 5129 return true; |
| 5127 } | 5130 } |
| 5128 *params = GLES2Util::GetGLReadPixelsImplementationFormat( | 5131 *params = GLES2Util::GetGLReadPixelsAdditionalFormat( |
| 5129 GetBoundReadFrameBufferInternalFormat()); | 5132 GetBoundReadFrameBufferInternalFormat(), |
| 5133 GetBoundReadFrameBufferTextureType()); |
| 5130 } | 5134 } |
| 5131 return true; | 5135 return true; |
| 5132 case GL_IMPLEMENTATION_COLOR_READ_TYPE: | 5136 case GL_IMPLEMENTATION_COLOR_READ_TYPE: |
| 5133 *num_written = 1; | 5137 *num_written = 1; |
| 5134 if (params) { | 5138 if (params) { |
| 5135 if (context_->HasExtension("GL_OES_read_format")) { | 5139 if (context_->HasExtension("GL_OES_read_format")) { |
| 5136 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper", | 5140 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper", |
| 5137 GetErrorState()); | 5141 GetErrorState()); |
| 5138 glGetIntegerv(pname, params); | 5142 glGetIntegerv(pname, params); |
| 5139 if (glGetError() == GL_NO_ERROR) | 5143 if (glGetError() == GL_NO_ERROR) |
| 5140 return true; | 5144 return true; |
| 5141 } | 5145 } |
| 5142 *params = GLES2Util::GetGLReadPixelsImplementationType( | 5146 *params = GLES2Util::GetGLReadPixelsTypeForAdditionalFormat( |
| 5143 GetBoundReadFrameBufferInternalFormat(), | 5147 GetBoundReadFrameBufferInternalFormat(), |
| 5144 GetBoundReadFrameBufferTextureType()); | 5148 GetBoundReadFrameBufferTextureType()); |
| 5145 } | 5149 } |
| 5146 return true; | 5150 return true; |
| 5147 case GL_MAX_FRAGMENT_UNIFORM_VECTORS: | 5151 case GL_MAX_FRAGMENT_UNIFORM_VECTORS: |
| 5148 *num_written = 1; | 5152 *num_written = 1; |
| 5149 if (params) { | 5153 if (params) { |
| 5150 *params = group_->max_fragment_uniform_vectors(); | 5154 *params = group_->max_fragment_uniform_vectors(); |
| 5151 } | 5155 } |
| 5152 return true; | 5156 return true; |
| (...skipping 10793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15946 } | 15950 } |
| 15947 | 15951 |
| 15948 // Include the auto-generated part of this file. We split this because it means | 15952 // Include the auto-generated part of this file. We split this because it means |
| 15949 // we can easily edit the non-auto generated parts right here in this file | 15953 // we can easily edit the non-auto generated parts right here in this file |
| 15950 // instead of having to edit some template or the code generator. | 15954 // instead of having to edit some template or the code generator. |
| 15951 #include "base/macros.h" | 15955 #include "base/macros.h" |
| 15952 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15956 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 15953 | 15957 |
| 15954 } // namespace gles2 | 15958 } // namespace gles2 |
| 15955 } // namespace gpu | 15959 } // namespace gpu |
| OLD | NEW |