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