diff options
Diffstat (limited to 'src/video_core/shader/decode.cpp')
| -rw-r--r-- | src/video_core/shader/decode.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
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) { | |||
| 33 | return (absolute_offset % SchedPeriod) == 0; | 33 | return (absolute_offset % SchedPeriod) == 0; |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | void DeduceTextureHandlerSize(VideoCore::GuestDriverProfile* gpu_driver, | ||
| 37 | std::list<Sampler>& used_samplers) { | ||
| 38 | if (gpu_driver == nullptr) { | ||
| 39 | LOG_CRITICAL(HW_GPU, "GPU Driver profile has not been created yet"); | ||
| 40 | return; | ||
| 41 | } | ||
| 42 | if (gpu_driver->TextureHandlerSizeKnown() || used_samplers.size() <= 1) { | ||
| 43 | return; | ||
| 44 | } | ||
| 45 | u32 count{}; | ||
| 46 | std::vector<u32> bound_offsets; | ||
| 47 | for (const auto& sampler : used_samplers) { | ||
| 48 | if (sampler.IsBindless()) { | ||
| 49 | continue; | ||
| 50 | } | ||
| 51 | ++count; | ||
| 52 | bound_offsets.emplace_back(sampler.GetOffset()); | ||
| 53 | } | ||
| 54 | if (count > 1) { | ||
| 55 | gpu_driver->DeduceTextureHandlerSize(std::move(bound_offsets)); | ||
| 56 | } | ||
| 57 | } | ||
| 58 | |||
| 36 | } // Anonymous namespace | 59 | } // Anonymous namespace |
| 37 | 60 | ||
| 38 | class ASTDecoder { | 61 | class ASTDecoder { |
| @@ -315,32 +338,9 @@ u32 ShaderIR::DecodeInstr(NodeBlock& bb, u32 pc) { | |||
| 315 | return pc + 1; | 338 | return pc + 1; |
| 316 | } | 339 | } |
| 317 | 340 | ||
| 318 | void DeduceTextureHandlerSize(VideoCore::GuestDriverProfile* gpu_driver, | ||
| 319 | std::list<Sampler>& used_samplers) { | ||
| 320 | if (gpu_driver == nullptr) { | ||
| 321 | LOG_CRITICAL(HW_GPU, "GPU Driver profile has not been created yet"); | ||
| 322 | return; | ||
| 323 | } | ||
| 324 | if (gpu_driver->TextureHandlerSizeKnown() || used_samplers.size() <= 1) { | ||
| 325 | return; | ||
| 326 | } | ||
| 327 | u32 count{}; | ||
| 328 | std::vector<u32> bound_offsets; | ||
| 329 | for (const auto& sampler : used_samplers) { | ||
| 330 | if (sampler.IsBindless()) { | ||
| 331 | continue; | ||
| 332 | } | ||
| 333 | count++; | ||
| 334 | bound_offsets.emplace_back(sampler.GetOffset()); | ||
| 335 | } | ||
| 336 | if (count > 1) { | ||
| 337 | gpu_driver->DeduceTextureHandlerSize(std::move(bound_offsets)); | ||
| 338 | } | ||
| 339 | } | ||
| 340 | |||
| 341 | void ShaderIR::PostDecode() { | 341 | void ShaderIR::PostDecode() { |
| 342 | // Deduce texture handler size if needed | 342 | // Deduce texture handler size if needed |
| 343 | auto* gpu_driver = locker.AccessGuestDriverProfile(); | 343 | auto gpu_driver = locker.AccessGuestDriverProfile(); |
| 344 | DeduceTextureHandlerSize(gpu_driver, used_samplers); | 344 | DeduceTextureHandlerSize(gpu_driver, used_samplers); |
| 345 | } | 345 | } |
| 346 | 346 | ||