render_models.cc 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #include "gpu/tools/compositor_model_bench/render_models.h"
  5. #include <string>
  6. #include <utility>
  7. #include "gpu/tools/compositor_model_bench/forward_render_model.h"
  8. const char* ModelToString(RenderModel m) {
  9. switch (m) {
  10. case ForwardRenderModel:
  11. return "Forward Rendering";
  12. default:
  13. return "(unknown render model name)";
  14. }
  15. }
  16. RenderModelSimulator::RenderModelSimulator(std::unique_ptr<RenderNode> root)
  17. : root_(std::move(root)) {}
  18. RenderModelSimulator::~RenderModelSimulator() {
  19. }
  20. std::unique_ptr<RenderModelSimulator> ConstructSimulationModel(
  21. RenderModel model,
  22. std::unique_ptr<RenderNode> render_tree_root,
  23. int window_width,
  24. int window_height) {
  25. switch (model) {
  26. case ForwardRenderModel:
  27. return std::make_unique<ForwardRenderSimulator>(
  28. std::move(render_tree_root), window_width, window_height);
  29. default:
  30. LOG(ERROR) << "Unrecognized render model. "
  31. "If we know its name, then it's..." << ModelToString(model);
  32. return nullptr;
  33. }
  34. }