guest_driver.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2020 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <optional>
  6. #include <vector>
  7. #include "common/common_types.h"
  8. namespace VideoCore {
  9. /**
  10. * The GuestDriverProfile class is used to learn about the GPU drivers behavior and collect
  11. * information necessary for impossible to avoid HLE methods like shader tracks as they are
  12. * Entscheidungsproblems.
  13. */
  14. class GuestDriverProfile {
  15. public:
  16. explicit GuestDriverProfile() = default;
  17. explicit GuestDriverProfile(std::optional<u32> texture_handler_size)
  18. : texture_handler_size{texture_handler_size} {}
  19. void DeduceTextureHandlerSize(std::vector<u32> bound_offsets);
  20. u32 GetTextureHandlerSize() const {
  21. return texture_handler_size.value_or(default_texture_handler_size);
  22. }
  23. bool IsTextureHandlerSizeKnown() const {
  24. return texture_handler_size.has_value();
  25. }
  26. private:
  27. // Minimum size of texture handler any driver can use.
  28. static constexpr u32 min_texture_handler_size = 4;
  29. // This goes with Vulkan and OpenGL standards but Nvidia GPUs can easily use 4 bytes instead.
  30. // Thus, certain drivers may squish the size.
  31. static constexpr u32 default_texture_handler_size = 8;
  32. std::optional<u32> texture_handler_size = default_texture_handler_size;
  33. };
  34. } // namespace VideoCore