diff options
Diffstat (limited to '')
-rw-r--r-- | src/video_core/guest_driver.cpp | 9 | ||||
-rw-r--r-- | src/video_core/guest_driver.h | 11 | ||||
-rw-r--r-- | src/video_core/rasterizer_interface.h | 2 | ||||
-rw-r--r-- | src/video_core/shader/const_buffer_locker.h | 2 | ||||
-rw-r--r-- | src/video_core/shader/decode.cpp | 48 |
5 files changed, 37 insertions, 35 deletions
diff --git a/src/video_core/guest_driver.cpp b/src/video_core/guest_driver.cpp index 1ded52905..6adef459e 100644 --- a/src/video_core/guest_driver.cpp +++ b/src/video_core/guest_driver.cpp @@ -3,7 +3,7 @@ // Refer to the license.txt file included. #include <algorithm> -#include <climits> +#include <limits> #include "video_core/guest_driver.h" @@ -17,10 +17,9 @@ void GuestDriverProfile::DeduceTextureHandlerSize(std::vector<u32>&& bound_offse if (size < 2) { return; } - std::sort(bound_offsets.begin(), bound_offsets.end(), - [](const u32& a, const u32& b) { return a < b; }); - u32 min_val = UINT_MAX; - for (std::size_t i = 1; i < size; i++) { + std::sort(bound_offsets.begin(), bound_offsets.end(), std::less{}); + u32 min_val = std::numeric_limits<u32>::max(); + for (std::size_t i = 1; i < size; ++i) { if (bound_offsets[i] == bound_offsets[i - 1]) { continue; } diff --git a/src/video_core/guest_driver.h b/src/video_core/guest_driver.h index e08588ee9..0a9a826b6 100644 --- a/src/video_core/guest_driver.h +++ b/src/video_core/guest_driver.h @@ -12,10 +12,13 @@ namespace VideoCore { /** * The GuestDriverProfile class is used to learn about the GPU drivers behavior and collect - * information necessary for impossible to avoid HLE methods like shader tracks. + * information necessary for impossible to avoid HLE methods like shader tracks as they are + * Entscheidungsproblems. */ class GuestDriverProfile { public: + void DeduceTextureHandlerSize(std::vector<u32>&& bound_offsets); + u32 GetTextureHandlerSize() const { return texture_handler_size; } @@ -24,16 +27,14 @@ public: return texture_handler_size_deduced; } - void DeduceTextureHandlerSize(std::vector<u32>&& bound_offsets); - private: // Minimum size of texture handler any driver can use. static constexpr u32 min_texture_handler_size = 4; // This goes with Vulkan and OpenGL standards but Nvidia GPUs can easily // use 4 bytes instead. Thus, certain drivers may squish the size. static constexpr u32 default_texture_handler_size = 8; - u32 texture_handler_size{default_texture_handler_size}; - bool texture_handler_size_deduced{}; + u32 texture_handler_size = default_texture_handler_size; + bool texture_handler_size_deduced = false; }; } // namespace VideoCore diff --git a/src/video_core/rasterizer_interface.h b/src/video_core/rasterizer_interface.h index 1b0cc56f1..c586cd6fe 100644 --- a/src/video_core/rasterizer_interface.h +++ b/src/video_core/rasterizer_interface.h @@ -80,10 +80,12 @@ public: virtual void LoadDiskResources(const std::atomic_bool& stop_loading = false, const DiskResourceLoadCallback& callback = {}) {} + /// Grant access to the Guest Driver Profile for recording/obtaining info on the guest driver. GuestDriverProfile& AccessGuestDriverProfile() { return guest_driver_profile; } + /// Grant access to the Guest Driver Profile for recording/obtaining info on the guest driver. const GuestDriverProfile& AccessGuestDriverProfile() const { return guest_driver_profile; } diff --git a/src/video_core/shader/const_buffer_locker.h b/src/video_core/shader/const_buffer_locker.h index f5655ac64..fd1bb476a 100644 --- a/src/video_core/shader/const_buffer_locker.h +++ b/src/video_core/shader/const_buffer_locker.h @@ -83,7 +83,7 @@ public: VideoCore::GuestDriverProfile* AccessGuestDriverProfile() const { if (engine) { - return &(engine->AccessGuestDriverProfile()); + return &engine->AccessGuestDriverProfile(); } return nullptr; } diff --git a/src/video_core/shader/decode.cpp b/src/video_core/shader/decode.cpp index c702c7629..507614d59 100644 --- a/src/video_core/shader/decode.cpp +++ b/src/video_core/shader/decode.cpp @@ -33,6 +33,29 @@ constexpr bool IsSchedInstruction(u32 offset, u32 main_offset) { return (absolute_offset % SchedPeriod) == 0; } +void DeduceTextureHandlerSize(VideoCore::GuestDriverProfile* gpu_driver, + std::list<Sampler>& used_samplers) { + if (gpu_driver == nullptr) { + LOG_CRITICAL(HW_GPU, "GPU Driver profile has not been created yet"); + return; + } + if (gpu_driver->TextureHandlerSizeKnown() || used_samplers.size() <= 1) { + return; + } + u32 count{}; + std::vector<u32> bound_offsets; + for (const auto& sampler : used_samplers) { + if (sampler.IsBindless()) { + continue; + } + ++count; + bound_offsets.emplace_back(sampler.GetOffset()); + } + if (count > 1) { + gpu_driver->DeduceTextureHandlerSize(std::move(bound_offsets)); + } +} + } // Anonymous namespace class ASTDecoder { @@ -315,32 +338,9 @@ u32 ShaderIR::DecodeInstr(NodeBlock& bb, u32 pc) { return pc + 1; } -void DeduceTextureHandlerSize(VideoCore::GuestDriverProfile* gpu_driver, - std::list<Sampler>& used_samplers) { - if (gpu_driver == nullptr) { - LOG_CRITICAL(HW_GPU, "GPU Driver profile has not been created yet"); - return; - } - if (gpu_driver->TextureHandlerSizeKnown() || used_samplers.size() <= 1) { - return; - } - u32 count{}; - std::vector<u32> bound_offsets; - for (const auto& sampler : used_samplers) { - if (sampler.IsBindless()) { - continue; - } - count++; - bound_offsets.emplace_back(sampler.GetOffset()); - } - if (count > 1) { - gpu_driver->DeduceTextureHandlerSize(std::move(bound_offsets)); - } -} - void ShaderIR::PostDecode() { // Deduce texture handler size if needed - auto* gpu_driver = locker.AccessGuestDriverProfile(); + auto gpu_driver = locker.AccessGuestDriverProfile(); DeduceTextureHandlerSize(gpu_driver, used_samplers); } |