| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Shaders from Chromium and an interface for setting them up | 5 // Shaders from Chromium and an interface for setting them up |
| 6 | 6 |
| 7 #ifndef GPU_TOOLS_COMPOSITOR_MODEL_BENCH_SHADERS_H_ | 7 #ifndef GPU_TOOLS_COMPOSITOR_MODEL_BENCH_SHADERS_H_ |
| 8 #define GPU_TOOLS_COMPOSITOR_MODEL_BENCH_SHADERS_H_ | 8 #define GPU_TOOLS_COMPOSITOR_MODEL_BENCH_SHADERS_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 // Forward declarations. | 12 // Forward declarations. |
| 13 class CCNode; | 13 class CCNode; |
| 14 class ContentLayerNode; | 14 class ContentLayerNode; |
| 15 | 15 |
| 16 typedef unsigned int GLuint; | 16 typedef unsigned int GLuint; |
| 17 | 17 |
| 18 enum ShaderID { | 18 enum ShaderID { |
| 19 SHADER_UNRECOGNIZED = 0, | 19 SHADER_UNRECOGNIZED = 0, |
| 20 VERTEX_SHADER_POS_TEX_YUV_STRETCH, | 20 VERTEX_SHADER_POS_TEX_YUV_STRETCH, |
| 21 VERTEX_SHADER_POS_TEX, | 21 VERTEX_SHADER_POS_TEX, |
| 22 VERTEX_SHADER_POS_TEX_TRANSFORM, | 22 VERTEX_SHADER_POS_TEX_TRANSFORM, |
| 23 FRAGMENT_SHADER_YUV_VIDEO, | 23 FRAGMENT_SHADER_YUV_VIDEO, |
| 24 FRAGMENT_SHADER_RGBA_TEX_FLIP_ALPHA, | 24 FRAGMENT_SHADER_RGBA_TEX_FLIP_ALPHA, |
| 25 FRAGMENT_SHADER_RGBA_TEX_ALPHA, | 25 FRAGMENT_SHADER_RGBA_TEX_ALPHA, |
| 26 SHADER_ID_MAX | 26 SHADER_ID_MAX |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 ShaderID ShaderIDFromString(std::string name); | 29 ShaderID ShaderIDFromString(const std::string& name); |
| 30 std::string ShaderNameFromID(ShaderID id); | 30 std::string ShaderNameFromID(ShaderID id); |
| 31 | 31 |
| 32 void ConfigAndActivateShaderForNode(CCNode* n); | 32 void ConfigAndActivateShaderForNode(CCNode* n); |
| 33 | 33 |
| 34 // Call once to set up the parameters for an entire tiled layer, then use | 34 // Call once to set up the parameters for an entire tiled layer, then use |
| 35 // DrawTileQuad for each tile to be drawn. | 35 // DrawTileQuad for each tile to be drawn. |
| 36 void ConfigAndActivateShaderForTiling(ContentLayerNode* n); | 36 void ConfigAndActivateShaderForTiling(ContentLayerNode* n); |
| 37 | 37 |
| 38 // One-off function to set up global VBO's that will be used every time | 38 // One-off function to set up global VBO's that will be used every time |
| 39 // we want to draw a quad. | 39 // we want to draw a quad. |
| 40 void InitBuffers(); | 40 void InitBuffers(); |
| 41 | 41 |
| 42 // Per-frame initialization of the VBO's (to replicate behavior in Chrome.) | 42 // Per-frame initialization of the VBO's (to replicate behavior in Chrome.) |
| 43 void BeginFrame(); | 43 void BeginFrame(); |
| 44 | 44 |
| 45 // Draw the quad in those VBO's. | 45 // Draw the quad in those VBO's. |
| 46 void DrawQuad(float width, float height); | 46 void DrawQuad(float width, float height); |
| 47 | 47 |
| 48 // Draw the quad in those VBO's for an individual tile within a tiled layer. | 48 // Draw the quad in those VBO's for an individual tile within a tiled layer. |
| 49 // x and y give the 2D index of the tile. | 49 // x and y give the 2D index of the tile. |
| 50 void DrawTileQuad(GLuint texID, int x, int y); | 50 void DrawTileQuad(GLuint texID, int x, int y); |
| 51 | 51 |
| 52 #endif // GPU_TOOLS_COMPOSITOR_MODEL_BENCH_SHADERS_H_ | 52 #endif // GPU_TOOLS_COMPOSITOR_MODEL_BENCH_SHADERS_H_ |
| OLD | NEW |