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

Side by Side Diff: ui/gl/gl_gl_api_implementation.cc

Issue 2164723003: Fix gpu mipmap support on ChromeOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: restrict fix to ES3 Created 4 years, 5 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 | « gpu/gpu.gyp ('k') | ui/gl/gl_version_info.h » ('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 "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 18 matching lines...) Expand all
29 // A GL Api that calls TRACE and then calls another GL api. 29 // A GL Api that calls TRACE and then calls another GL api.
30 static TraceGLApi* g_trace_gl = NULL; 30 static TraceGLApi* g_trace_gl = NULL;
31 // The GL Api being used for stub contexts. If null, g_gl is used instead. 31 // The GL Api being used for stub contexts. If null, g_gl is used instead.
32 static GLApi* g_stub_gl = NULL; 32 static GLApi* g_stub_gl = NULL;
33 // GL version used when initializing dynamic bindings. 33 // GL version used when initializing dynamic bindings.
34 static GLVersionInfo* g_version_info = NULL; 34 static GLVersionInfo* g_version_info = NULL;
35 35
36 namespace { 36 namespace {
37 37
38 static inline GLenum GetInternalFormat(GLenum internal_format) { 38 static inline GLenum GetInternalFormat(GLenum internal_format) {
39 if (GetGLImplementation() != kGLImplementationEGLGLES2) { 39 if (!g_version_info->is_es) {
40 if (internal_format == GL_BGRA_EXT || internal_format == GL_BGRA8_EXT) 40 if (internal_format == GL_BGRA_EXT || internal_format == GL_BGRA8_EXT)
41 return GL_RGBA8; 41 return GL_RGBA8;
42 } 42 }
43 if (g_version_info->is_es3 && g_version_info->is_mesa) {
44 // Mesa bug workaround: Mipmapping does not work when using GL_BGRA_EXT
45 if (internal_format == GL_BGRA_EXT)
46 return GL_RGBA;
47 }
43 return internal_format; 48 return internal_format;
44 } 49 }
45 50
46 // TODO(epenner): Could the above function be merged into this and removed? 51 // TODO(epenner): Could the above function be merged into this and removed?
47 static inline GLenum GetTexInternalFormat(GLenum internal_format, 52 static inline GLenum GetTexInternalFormat(GLenum internal_format,
48 GLenum format, 53 GLenum format,
49 GLenum type) { 54 GLenum type) {
55 DCHECK(g_version_info);
50 GLenum gl_internal_format = GetInternalFormat(internal_format); 56 GLenum gl_internal_format = GetInternalFormat(internal_format);
51 57
52 // g_version_info must be initialized when this function is bound. 58 // g_version_info must be initialized when this function is bound.
53 DCHECK(g_version_info);
54 if (g_version_info->is_es3) { 59 if (g_version_info->is_es3) {
55 if (internal_format == GL_RED_EXT) { 60 if (internal_format == GL_RED_EXT) {
56 // GL_EXT_texture_rg case in ES2. 61 // GL_EXT_texture_rg case in ES2.
57 switch (type) { 62 switch (type) {
58 case GL_UNSIGNED_BYTE: 63 case GL_UNSIGNED_BYTE:
59 gl_internal_format = GL_R8_EXT; 64 gl_internal_format = GL_R8_EXT;
60 break; 65 break;
61 case GL_HALF_FLOAT_OES: 66 case GL_HALF_FLOAT_OES:
62 gl_internal_format = GL_R16F_EXT; 67 gl_internal_format = GL_R16F_EXT;
63 break; 68 break;
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 TraceGLApi::~TraceGLApi() { 568 TraceGLApi::~TraceGLApi() {
564 } 569 }
565 570
566 NoContextGLApi::NoContextGLApi() { 571 NoContextGLApi::NoContextGLApi() {
567 } 572 }
568 573
569 NoContextGLApi::~NoContextGLApi() { 574 NoContextGLApi::~NoContextGLApi() {
570 } 575 }
571 576
572 } // namespace gl 577 } // namespace gl
OLDNEW
« no previous file with comments | « gpu/gpu.gyp ('k') | ui/gl/gl_version_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698