dirty_flags.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <algorithm>
  5. #include <cstddef>
  6. #include <iterator>
  7. #include "common/common_types.h"
  8. #include "video_core/engines/maxwell_3d.h"
  9. namespace VideoCommon::Dirty {
  10. enum : u8 {
  11. NullEntry = 0,
  12. Descriptors,
  13. RenderTargets,
  14. RenderTargetControl,
  15. ColorBuffer0,
  16. ColorBuffer1,
  17. ColorBuffer2,
  18. ColorBuffer3,
  19. ColorBuffer4,
  20. ColorBuffer5,
  21. ColorBuffer6,
  22. ColorBuffer7,
  23. ZetaBuffer,
  24. RescaleViewports,
  25. RescaleScissors,
  26. VertexBuffers,
  27. VertexBuffer0,
  28. VertexBuffer31 = VertexBuffer0 + 31,
  29. IndexBuffer,
  30. Shaders,
  31. // Special entries
  32. DepthBiasGlobal,
  33. LastCommonEntry,
  34. };
  35. template <typename Integer>
  36. void FillBlock(Tegra::Engines::Maxwell3D::DirtyState::Table& table, std::size_t begin,
  37. std::size_t num, Integer dirty_index) {
  38. const auto it = std::begin(table) + begin;
  39. std::fill(it, it + num, static_cast<u8>(dirty_index));
  40. }
  41. template <typename Integer1, typename Integer2>
  42. void FillBlock(Tegra::Engines::Maxwell3D::DirtyState::Tables& tables, std::size_t begin,
  43. std::size_t num, Integer1 index_a, Integer2 index_b) {
  44. FillBlock(tables[0], begin, num, index_a);
  45. FillBlock(tables[1], begin, num, index_b);
  46. }
  47. void SetupDirtyFlags(Tegra::Engines::Maxwell3D::DirtyState::Tables& tables);
  48. } // namespace VideoCommon::Dirty