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_copy_texture_chromium.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "gpu/command_buffer/service/gl_utils.h" | 10 #include "gpu/command_buffer/service/gl_utils.h" |
11 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 11 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
12 | 12 |
13 #define SHADER(src) \ | 13 #define SHADER(src) \ |
14 "#ifdef GL_ES\n" \ | 14 "#ifdef GL_ES\n" \ |
15 "precision mediump float;\n" \ | 15 "precision mediump float;\n" \ |
16 "#define TexCoordPrecision mediump\n" \ | 16 "#define TexCoordPrecision mediump\n" \ |
17 "#else\n" \ | 17 "#else\n" \ |
18 "#define TexCoordPrecision\n" \ | 18 "#define TexCoordPrecision\n" \ |
19 "#endif\n" #src | 19 "#endif\n" #src |
20 #define SHADER_2D(src) \ | 20 #define SHADER_2D(src) \ |
21 "#define SamplerType sampler2D\n" \ | 21 "#define SamplerType sampler2D\n" \ |
22 "#define TextureLookup texture2D\n" SHADER(src) | 22 "#define TextureLookup texture2D\n" SHADER(src) |
23 #define SHADER_RECTANGLE_ARB(src) \ | 23 #define SHADER_RECTANGLE_ARB(src) \ |
24 "#define SamplerType samplerRect\n" \ | 24 "#define SamplerType sampler2DRect\n" \ |
25 "#define TextureLookup textureRect\n" SHADER(src) | 25 "#define TextureLookup texture2DRect\n" SHADER(src) |
26 #define SHADER_EXTERNAL_OES(src) \ | 26 #define SHADER_EXTERNAL_OES(src) \ |
27 "#extension GL_OES_EGL_image_external : require\n" \ | 27 "#extension GL_OES_EGL_image_external : require\n" \ |
28 "#define SamplerType samplerExternalOES\n" \ | 28 "#define SamplerType samplerExternalOES\n" \ |
29 "#define TextureLookup texture2D\n" SHADER(src) | 29 "#define TextureLookup texture2D\n" SHADER(src) |
30 #define FRAGMENT_SHADERS(src) \ | 30 #define FRAGMENT_SHADERS(src) \ |
31 SHADER_2D(src), SHADER_RECTANGLE_ARB(src), SHADER_EXTERNAL_OES(src) | 31 SHADER_2D(src), SHADER_RECTANGLE_ARB(src), SHADER_EXTERNAL_OES(src) |
32 | 32 |
33 namespace { | 33 namespace { |
34 | 34 |
35 enum VertexShaderId { | 35 enum VertexShaderId { |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 decoder->RestoreTextureState(dest_id); | 473 decoder->RestoreTextureState(dest_id); |
474 decoder->RestoreTextureUnitBindings(0); | 474 decoder->RestoreTextureUnitBindings(0); |
475 decoder->RestoreActiveTexture(); | 475 decoder->RestoreActiveTexture(); |
476 decoder->RestoreProgramBindings(); | 476 decoder->RestoreProgramBindings(); |
477 decoder->RestoreBufferBindings(); | 477 decoder->RestoreBufferBindings(); |
478 decoder->RestoreFramebufferBindings(); | 478 decoder->RestoreFramebufferBindings(); |
479 decoder->RestoreGlobalState(); | 479 decoder->RestoreGlobalState(); |
480 } | 480 } |
481 | 481 |
482 } // namespace gpu | 482 } // namespace gpu |
OLD | NEW |