diff options
| author | 2020-01-24 10:44:34 -0400 | |
|---|---|---|
| committer | 2020-01-25 09:04:59 -0400 | |
| commit | bb8eb15d392d69693f8cda0427669d011e23db97 (patch) | |
| tree | cebd080530de75e7b5400f46c25c307a80e3c222 /src/video_core/shader/decode.cpp | |
| parent | Shader_IR: Change name of TrackSampler function so it does not confuse with t... (diff) | |
| download | yuzu-bb8eb15d392d69693f8cda0427669d011e23db97.tar.gz yuzu-bb8eb15d392d69693f8cda0427669d011e23db97.tar.xz yuzu-bb8eb15d392d69693f8cda0427669d011e23db97.zip | |
Shader_IR: Address feedback.
Diffstat (limited to 'src/video_core/shader/decode.cpp')
| -rw-r--r-- | src/video_core/shader/decode.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/video_core/shader/decode.cpp b/src/video_core/shader/decode.cpp index d4a10eee5..6b697ed5d 100644 --- a/src/video_core/shader/decode.cpp +++ b/src/video_core/shader/decode.cpp | |||
| @@ -35,9 +35,9 @@ constexpr bool IsSchedInstruction(u32 offset, u32 main_offset) { | |||
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | void DeduceTextureHandlerSize(VideoCore::GuestDriverProfile* gpu_driver, | 37 | void DeduceTextureHandlerSize(VideoCore::GuestDriverProfile* gpu_driver, |
| 38 | std::list<Sampler>& used_samplers) { | 38 | const std::list<Sampler>& used_samplers) { |
| 39 | if (gpu_driver == nullptr) { | 39 | if (gpu_driver == nullptr) { |
| 40 | LOG_CRITICAL(HW_GPU, "GPU Driver profile has not been created yet"); | 40 | LOG_CRITICAL(HW_GPU, "GPU driver profile has not been created yet"); |
| 41 | return; | 41 | return; |
| 42 | } | 42 | } |
| 43 | if (gpu_driver->TextureHandlerSizeKnown() || used_samplers.size() <= 1) { | 43 | if (gpu_driver->TextureHandlerSizeKnown() || used_samplers.size() <= 1) { |
| @@ -57,9 +57,9 @@ void DeduceTextureHandlerSize(VideoCore::GuestDriverProfile* gpu_driver, | |||
| 57 | } | 57 | } |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | std::optional<u32> TryDeduceSamplerSize(Sampler& sampler_to_deduce, | 60 | std::optional<u32> TryDeduceSamplerSize(const Sampler& sampler_to_deduce, |
| 61 | VideoCore::GuestDriverProfile* gpu_driver, | 61 | VideoCore::GuestDriverProfile* gpu_driver, |
| 62 | std::list<Sampler>& used_samplers) { | 62 | const std::list<Sampler>& used_samplers) { |
| 63 | if (gpu_driver == nullptr) { | 63 | if (gpu_driver == nullptr) { |
| 64 | LOG_CRITICAL(HW_GPU, "GPU Driver profile has not been created yet"); | 64 | LOG_CRITICAL(HW_GPU, "GPU Driver profile has not been created yet"); |
| 65 | return std::nullopt; | 65 | return std::nullopt; |
| @@ -367,17 +367,18 @@ void ShaderIR::PostDecode() { | |||
| 367 | auto gpu_driver = locker.AccessGuestDriverProfile(); | 367 | auto gpu_driver = locker.AccessGuestDriverProfile(); |
| 368 | DeduceTextureHandlerSize(gpu_driver, used_samplers); | 368 | DeduceTextureHandlerSize(gpu_driver, used_samplers); |
| 369 | // Deduce Indexed Samplers | 369 | // Deduce Indexed Samplers |
| 370 | if (uses_indexed_samplers) { | 370 | if (!uses_indexed_samplers) { |
| 371 | for (auto& sampler : used_samplers) { | 371 | return; |
| 372 | if (sampler.IsIndexed()) { | 372 | } |
| 373 | auto size = TryDeduceSamplerSize(sampler, gpu_driver, used_samplers); | 373 | for (auto& sampler : used_samplers) { |
| 374 | if (size) { | 374 | if (!sampler.IsIndexed()) { |
| 375 | sampler.SetSize(*size); | 375 | continue; |
| 376 | } else { | 376 | } |
| 377 | LOG_CRITICAL(HW_GPU, "Failed to deduce size of indexed sampler"); | 377 | if (const auto size = TryDeduceSamplerSize(sampler, gpu_driver, used_samplers)) { |
| 378 | sampler.SetSize(1); | 378 | sampler.SetSize(*size); |
| 379 | } | 379 | } else { |
| 380 | } | 380 | LOG_CRITICAL(HW_GPU, "Failed to deduce size of indexed sampler"); |
| 381 | sampler.SetSize(1); | ||
| 381 | } | 382 | } |
| 382 | } | 383 | } |
| 383 | } | 384 | } |