| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef CC_OUTPUT_GL_RENDERER_DRAW_CACHE_H_ | 5 #ifndef CC_OUTPUT_GL_RENDERER_DRAW_CACHE_H_ |
| 6 #define CC_OUTPUT_GL_RENDERER_DRAW_CACHE_H_ | 6 #define CC_OUTPUT_GL_RENDERER_DRAW_CACHE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "cc/output/program_binding.h" |
| 11 #include "third_party/skia/include/core/SkColor.h" | 12 #include "third_party/skia/include/core/SkColor.h" |
| 12 | 13 |
| 13 namespace cc { | 14 namespace cc { |
| 14 | 15 |
| 15 class Program; | |
| 16 | |
| 17 // Collects 4 floats at a time for easy upload to GL. | 16 // Collects 4 floats at a time for easy upload to GL. |
| 18 struct Float4 { | 17 struct Float4 { |
| 19 float data[4]; | 18 float data[4]; |
| 20 }; | 19 }; |
| 21 | 20 |
| 22 // Collects 16 floats at a time for easy upload to GL. | 21 // Collects 16 floats at a time for easy upload to GL. |
| 23 struct Float16 { | 22 struct Float16 { |
| 24 float data[16]; | 23 float data[16]; |
| 25 }; | 24 }; |
| 26 | 25 |
| 27 // A cache for storing textured quads to be drawn. Stores the minimum required | 26 // A cache for storing textured quads to be drawn. Stores the minimum required |
| 28 // data to tell if two back to back draws only differ in their transform. Quads | 27 // data to tell if two back to back draws only differ in their transform. Quads |
| 29 // that only differ by transform may be coalesced into a single draw call. | 28 // that only differ by transform may be coalesced into a single draw call. |
| 30 struct TexturedQuadDrawCache { | 29 struct TexturedQuadDrawCache { |
| 31 TexturedQuadDrawCache(); | 30 TexturedQuadDrawCache(); |
| 32 ~TexturedQuadDrawCache(); | 31 ~TexturedQuadDrawCache(); |
| 33 | 32 |
| 33 bool is_empty = true; |
| 34 |
| 34 // Values tracked to determine if textured quads may be coalesced. | 35 // Values tracked to determine if textured quads may be coalesced. |
| 35 const Program* program = nullptr; | 36 ProgramKey program_key; |
| 36 int resource_id = -1; | 37 int resource_id = -1; |
| 37 bool needs_blending = false; | 38 bool needs_blending = false; |
| 38 bool nearest_neighbor = false; | 39 bool nearest_neighbor = false; |
| 39 SkColor background_color = 0; | 40 SkColor background_color = 0; |
| 40 | 41 |
| 41 // A cache for the coalesced quad data. | 42 // A cache for the coalesced quad data. |
| 42 std::vector<Float4> uv_xform_data; | 43 std::vector<Float4> uv_xform_data; |
| 43 std::vector<float> vertex_opacity_data; | 44 std::vector<float> vertex_opacity_data; |
| 44 std::vector<Float16> matrix_data; | 45 std::vector<Float16> matrix_data; |
| 45 | 46 |
| 46 private: | 47 private: |
| 47 DISALLOW_COPY_AND_ASSIGN(TexturedQuadDrawCache); | 48 DISALLOW_COPY_AND_ASSIGN(TexturedQuadDrawCache); |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 } // namespace cc | 51 } // namespace cc |
| 51 | 52 |
| 52 #endif // CC_OUTPUT_GL_RENDERER_DRAW_CACHE_H_ | 53 #endif // CC_OUTPUT_GL_RENDERER_DRAW_CACHE_H_ |
| OLD | NEW |