Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Unified Diff: gpu/tools/compositor_model_bench/render_tree.h

Issue 7718020: Initial checkin of the compositor_model_bench tool, which simulates the GPU demands of Chromium's... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/tools/compositor_model_bench/render_tree.h
===================================================================
--- gpu/tools/compositor_model_bench/render_tree.h (revision 0)
+++ gpu/tools/compositor_model_bench/render_tree.h (revision 0)
@@ -0,0 +1,101 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Data structures for representing parts of Chromium's composited layer tree
+// and a function to load it from the JSON configuration file
+
+#ifndef GPU_TOOLS_COMPOSITOR_MODEL_BENCH_RENDER_TREE_H_
+#define GPU_TOOLS_COMPOSITOR_MODEL_BENCH_RENDER_TREE_H_
+
+#include <string>
+#include <vector>
+
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_vector.h"
+#include "gpu/tools/compositor_model_bench/shaders.h"
+#include "ui/gfx/gl/gl_bindings.h"
+#include "ui/gfx/gl/gl_implementation.h"
+
+// These are fairly arbitrary values based on how big my actual browser
+// window was.
+const int WINDOW_WIDTH = 1609;
+const int WINDOW_HEIGHT = 993;
+
+struct Tile {
+ int x;
+ int y;
+ int texID;
+};
+
+struct Texture {
+ int texID;
+ int height;
+ int width;
+ GLenum format;
+};
+
+GLenum TextureFormatFromString(std::string format);
+const char* TextureFormatName(GLenum format);
+int FormatBytesPerPixel(GLenum format);
+
+struct RenderNodeVisitor;
+
+class RenderNode {
+ public:
+ virtual ~RenderNode() {}
+ int layerID;
piman 2011/08/26 02:24:16 according to our style, classes are not supposed t
+ int width;
+ int height;
+ bool drawsContent;
+ int targetSurface;
+ float transform[16];
+ std::vector<Tile> tiles;
+ int tile_width;
+ int tile_height;
+
+ virtual void Accept(RenderNodeVisitor* v);
+};
+
+class ContentLayerNode : public RenderNode {
+ public:
+ ScopedVector<RenderNode> children;
+ bool skipsDraw;
+
+ virtual void Accept(RenderNodeVisitor* v) OVERRIDE;
+};
+
+class CCNode : public RenderNode {
+ public:
+ ShaderID vertex_shader;
+ ShaderID fragment_shader;
+ std::vector<Texture> textures;
+
+ virtual void Accept(RenderNodeVisitor* v) OVERRIDE;
+};
+
+class RenderNodeVisitor {
+ public:
+ virtual ~RenderNodeVisitor() {}
+
+ virtual void BeginVisitRenderNode(RenderNode* v) = 0;
+ virtual void BeginVisitContentLayerNode(ContentLayerNode* v) {
+ this->BeginVisitRenderNode(v);
+ }
+ virtual void BeginVisitCCNode(CCNode* v) {
+ this->BeginVisitRenderNode(v);
+ }
+
+ virtual void EndVisitRenderNode(RenderNode* v) {}
+ virtual void EndVisitContentLayerNode(ContentLayerNode* v) {
+ this->EndVisitRenderNode(v);
+ }
+ virtual void EndVisitCCNode(CCNode* v) {
+ this->EndVisitRenderNode(v);
+ }
+};
+
+RenderNode* BuildRenderTreeFromFile(const FilePath& path);
+
+#endif // GPU_TOOLS_COMPOSITOR_MODEL_BENCH_RENDER_TREE_H_
+

Powered by Google App Engine
This is Rietveld 408576698