shaders.h 1.5 KB

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