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