Chromium Code Reviews| 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 "ui/gl/gl_gl_api_implementation.h" | 5 #include "ui/gl/gl_gl_api_implementation.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 gl_internal_format = GL_RGBA; | 99 gl_internal_format = GL_RGBA; |
| 100 break; | 100 break; |
| 101 case GL_RGB: | 101 case GL_RGB: |
| 102 gl_internal_format = GL_RGB; | 102 gl_internal_format = GL_RGB; |
| 103 break; | 103 break; |
| 104 default: | 104 default: |
| 105 break; | 105 break; |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 if (gfx::g_version_info->IsAtLeastGL(2, 1) || | |
| 110 gfx::g_version_info->IsAtLeastGLES(3, 0)) { | |
| 111 switch (internal_format) { | |
| 112 case GL_SRGB_EXT: | |
| 113 gl_internal_format = GL_SRGB8; | |
| 114 break; | |
| 115 case GL_SRGB_ALPHA_EXT: | |
| 116 gl_internal_format = GL_SRGB8_ALPHA8; | |
| 117 break; | |
| 118 default: | |
| 119 break; | |
| 120 } | |
| 121 } | |
| 122 | |
| 109 if (gfx::g_version_info->is_es) | 123 if (gfx::g_version_info->is_es) |
|
xinghua.cao
2016/05/10 11:02:30
If driver context is es, it will return directly.
| |
| 110 return gl_internal_format; | 124 return gl_internal_format; |
| 111 | 125 |
| 112 if (type == GL_FLOAT) { | 126 if (type == GL_FLOAT) { |
| 113 switch (internal_format) { | 127 switch (internal_format) { |
| 114 // We need to map all the unsized internal formats from ES2 clients. | 128 // We need to map all the unsized internal formats from ES2 clients. |
| 115 case GL_RGBA: | 129 case GL_RGBA: |
| 116 gl_internal_format = GL_RGBA32F_ARB; | 130 gl_internal_format = GL_RGBA32F_ARB; |
| 117 break; | 131 break; |
| 118 case GL_RGB: | 132 case GL_RGB: |
| 119 gl_internal_format = GL_RGB32F_ARB; | 133 gl_internal_format = GL_RGB32F_ARB; |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 148 break; | 162 break; |
| 149 case GL_ALPHA: | 163 case GL_ALPHA: |
| 150 gl_internal_format = GL_ALPHA16F_ARB; | 164 gl_internal_format = GL_ALPHA16F_ARB; |
| 151 break; | 165 break; |
| 152 default: | 166 default: |
| 153 NOTREACHED(); | 167 NOTREACHED(); |
| 154 break; | 168 break; |
| 155 } | 169 } |
| 156 } | 170 } |
| 157 | 171 |
| 158 if (gfx::g_version_info->IsAtLeastGL(2, 1) || | |
| 159 gfx::g_version_info->IsAtLeastGLES(3, 0)) { | |
| 160 switch (internal_format) { | |
| 161 case GL_SRGB_EXT: | |
| 162 gl_internal_format = GL_SRGB8; | |
| 163 break; | |
| 164 case GL_SRGB_ALPHA_EXT: | |
| 165 gl_internal_format = GL_SRGB8_ALPHA8; | |
| 166 break; | |
| 167 default: | |
| 168 break; | |
| 169 } | |
| 170 } | |
| 171 | |
| 172 return gl_internal_format; | 172 return gl_internal_format; |
| 173 } | 173 } |
| 174 | 174 |
| 175 static inline GLenum GetTexFormat(GLenum format) { | 175 static inline GLenum GetTexFormat(GLenum format) { |
| 176 GLenum gl_format = format; | 176 GLenum gl_format = format; |
| 177 | 177 |
| 178 DCHECK(gfx::g_version_info); | 178 DCHECK(gfx::g_version_info); |
| 179 if (gfx::g_version_info->IsAtLeastGL(2, 1) || | 179 if (gfx::g_version_info->IsAtLeastGL(2, 1) || |
| 180 gfx::g_version_info->IsAtLeastGLES(3, 0)) { | 180 gfx::g_version_info->IsAtLeastGLES(3, 0)) { |
| 181 switch (format) { | 181 switch (format) { |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 666 | 666 |
| 667 void VirtualGLApi::glFlushFn() { | 667 void VirtualGLApi::glFlushFn() { |
| 668 GLApiBase::glFlushFn(); | 668 GLApiBase::glFlushFn(); |
| 669 } | 669 } |
| 670 | 670 |
| 671 void VirtualGLApi::glFinishFn() { | 671 void VirtualGLApi::glFinishFn() { |
| 672 GLApiBase::glFinishFn(); | 672 GLApiBase::glFinishFn(); |
| 673 } | 673 } |
| 674 | 674 |
| 675 } // namespace gfx | 675 } // namespace gfx |
| OLD | NEW |