diff options
Diffstat (limited to 'src/video_core/shader/decode.cpp')
| -rw-r--r-- | src/video_core/shader/decode.cpp | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/src/video_core/shader/decode.cpp b/src/video_core/shader/decode.cpp index aed35a9b8..c702c7629 100644 --- a/src/video_core/shader/decode.cpp +++ b/src/video_core/shader/decode.cpp | |||
| @@ -315,25 +315,33 @@ u32 ShaderIR::DecodeInstr(NodeBlock& bb, u32 pc) { | |||
| 315 | return pc + 1; | 315 | return pc + 1; |
| 316 | } | 316 | } |
| 317 | 317 | ||
| 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 | |||
| 318 | void ShaderIR::PostDecode() { | 341 | void ShaderIR::PostDecode() { |
| 319 | // Deduce texture handler size if needed | 342 | // Deduce texture handler size if needed |
| 320 | auto* gpu_driver = locker.AccessGuestDriverProfile(); | 343 | auto* gpu_driver = locker.AccessGuestDriverProfile(); |
| 321 | if (gpu_driver) { | 344 | DeduceTextureHandlerSize(gpu_driver, used_samplers); |
| 322 | if (!gpu_driver->TextureHandlerSizeKnown() && used_samplers.size() > 1) { | ||
| 323 | u32 count{}; | ||
| 324 | std::vector<u32> bound_offsets; | ||
| 325 | for (const auto& sampler : used_samplers) { | ||
| 326 | if (sampler.IsBindless()) { | ||
| 327 | continue; | ||
| 328 | } | ||
| 329 | count++; | ||
| 330 | bound_offsets.emplace_back(sampler.GetOffset()); | ||
| 331 | } | ||
| 332 | if (count > 1) { | ||
| 333 | gpu_driver->DeduceTextureHandlerSize(std::move(bound_offsets)); | ||
| 334 | } | ||
| 335 | } | ||
| 336 | } | ||
| 337 | } | 345 | } |
| 338 | 346 | ||
| 339 | } // namespace VideoCommon::Shader | 347 | } // namespace VideoCommon::Shader |