markv_model_factory.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright (c) 2017 Google Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #include "tools/comp/markv_model_factory.h"
  15. #include "source/util/make_unique.h"
  16. #include "tools/comp/markv_model_shader.h"
  17. namespace spvtools {
  18. namespace comp {
  19. std::unique_ptr<MarkvModel> CreateMarkvModel(MarkvModelType type) {
  20. std::unique_ptr<MarkvModel> model;
  21. switch (type) {
  22. case kMarkvModelShaderLite: {
  23. model = MakeUnique<MarkvModelShaderLite>();
  24. break;
  25. }
  26. case kMarkvModelShaderMid: {
  27. model = MakeUnique<MarkvModelShaderMid>();
  28. break;
  29. }
  30. case kMarkvModelShaderMax: {
  31. model = MakeUnique<MarkvModelShaderMax>();
  32. break;
  33. }
  34. case kMarkvModelUnknown: {
  35. assert(0 && "kMarkvModelUnknown supplied to CreateMarkvModel");
  36. return model;
  37. }
  38. }
  39. model->SetModelType(static_cast<uint32_t>(type));
  40. return model;
  41. }
  42. } // namespace comp
  43. } // namespace spvtools