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

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

Issue 1998723002: Move code in ui/gl/* from gfx:: to gl:: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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
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_copy_texture_chromium.h" 5 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 precision mediump float;\n\ 94 precision mediump float;\n\
95 #define TexCoordPrecision mediump\n\ 95 #define TexCoordPrecision mediump\n\
96 #else\n\ 96 #else\n\
97 #define TexCoordPrecision\n\ 97 #define TexCoordPrecision\n\
98 #endif\n"; 98 #endif\n";
99 99
100 std::string GetVertexShaderSource() { 100 std::string GetVertexShaderSource() {
101 std::string source; 101 std::string source;
102 102
103 // Preamble for core and compatibility mode. 103 // Preamble for core and compatibility mode.
104 if (gfx::GetGLImplementation() == 104 if (gl::GetGLImplementation() == gl::kGLImplementationDesktopGLCoreProfile) {
105 gfx::kGLImplementationDesktopGLCoreProfile) {
106 source += std::string("\ 105 source += std::string("\
107 #version 150\n\ 106 #version 150\n\
108 #define ATTRIBUTE in\n\ 107 #define ATTRIBUTE in\n\
109 #define VARYING out\n"); 108 #define VARYING out\n");
110 } else { 109 } else {
111 source += std::string("\ 110 source += std::string("\
112 #define ATTRIBUTE attribute\n\ 111 #define ATTRIBUTE attribute\n\
113 #define VARYING varying\n"); 112 #define VARYING varying\n");
114 } 113 }
115 114
(...skipping 20 matching lines...) Expand all
136 135
137 std::string GetFragmentShaderSource(bool premultiply_alpha, 136 std::string GetFragmentShaderSource(bool premultiply_alpha,
138 bool unpremultiply_alpha, 137 bool unpremultiply_alpha,
139 GLenum target) { 138 GLenum target) {
140 // Only one alpha mode at a time makes sense. 139 // Only one alpha mode at a time makes sense.
141 DCHECK(!premultiply_alpha || !unpremultiply_alpha); 140 DCHECK(!premultiply_alpha || !unpremultiply_alpha);
142 141
143 std::string source; 142 std::string source;
144 143
145 // Preamble for core and compatibility mode. 144 // Preamble for core and compatibility mode.
146 if (gfx::GetGLImplementation() == 145 if (gl::GetGLImplementation() == gl::kGLImplementationDesktopGLCoreProfile) {
147 gfx::kGLImplementationDesktopGLCoreProfile) {
148 source += std::string("\ 146 source += std::string("\
149 #version 150\n\ 147 #version 150\n\
150 out vec4 frag_color;\n\ 148 out vec4 frag_color;\n\
151 #define VARYING in\n\ 149 #define VARYING in\n\
152 #define FRAGCOLOR frag_color\n\ 150 #define FRAGCOLOR frag_color\n\
153 #define TextureLookup texture\n"); 151 #define TextureLookup texture\n");
154 } else { 152 } else {
155 switch (target) { 153 switch (target) {
156 case GL_TEXTURE_2D: 154 case GL_TEXTURE_2D:
157 source += std::string("#define TextureLookup texture2D\n"); 155 source += std::string("#define TextureLookup texture2D\n");
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 } 577 }
580 578
581 if (!initialized_) { 579 if (!initialized_) {
582 DLOG(ERROR) << "CopyTextureCHROMIUM: Uninitialized manager."; 580 DLOG(ERROR) << "CopyTextureCHROMIUM: Uninitialized manager.";
583 return; 581 return;
584 } 582 }
585 583
586 if (vertex_array_object_id_) { 584 if (vertex_array_object_id_) {
587 glBindVertexArrayOES(vertex_array_object_id_); 585 glBindVertexArrayOES(vertex_array_object_id_);
588 } else { 586 } else {
589 if (gfx::GetGLImplementation() != 587 if (gl::GetGLImplementation() !=
590 gfx::kGLImplementationDesktopGLCoreProfile) { 588 gl::kGLImplementationDesktopGLCoreProfile) {
591 decoder->ClearAllAttributes(); 589 decoder->ClearAllAttributes();
592 } 590 }
593 glEnableVertexAttribArray(kVertexPositionAttrib); 591 glEnableVertexAttribArray(kVertexPositionAttrib);
594 glBindBuffer(GL_ARRAY_BUFFER, buffer_id_); 592 glBindBuffer(GL_ARRAY_BUFFER, buffer_id_);
595 glVertexAttribPointer(kVertexPositionAttrib, 2, GL_FLOAT, GL_FALSE, 0, 0); 593 glVertexAttribPointer(kVertexPositionAttrib, 2, GL_FLOAT, GL_FALSE, 0, 0);
596 } 594 }
597 595
598 FragmentShaderId fragment_shader_id = GetFragmentShaderId( 596 FragmentShaderId fragment_shader_id = GetFragmentShaderId(
599 premultiply_alpha, unpremultiply_alpha, source_target); 597 premultiply_alpha, unpremultiply_alpha, source_target);
600 DCHECK_LT(static_cast<size_t>(fragment_shader_id), fragment_shaders_.size()); 598 DCHECK_LT(static_cast<size_t>(fragment_shader_id), fragment_shaders_.size());
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 decoder->RestoreTextureState(dest_id); 755 decoder->RestoreTextureState(dest_id);
758 decoder->RestoreTextureUnitBindings(0); 756 decoder->RestoreTextureUnitBindings(0);
759 decoder->RestoreActiveTexture(); 757 decoder->RestoreActiveTexture();
760 decoder->RestoreProgramBindings(); 758 decoder->RestoreProgramBindings();
761 decoder->RestoreBufferBindings(); 759 decoder->RestoreBufferBindings();
762 decoder->RestoreFramebufferBindings(); 760 decoder->RestoreFramebufferBindings();
763 decoder->RestoreGlobalState(); 761 decoder->RestoreGlobalState();
764 } 762 }
765 763
766 } // namespace gpu 764 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gl_surface_mock.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698