diff options
Diffstat (limited to 'src/video_core/shader/decode')
| -rw-r--r-- | src/video_core/shader/decode/texture.cpp | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/src/video_core/shader/decode/texture.cpp b/src/video_core/shader/decode/texture.cpp index c369e23ad..f33e9c67c 100644 --- a/src/video_core/shader/decode/texture.cpp +++ b/src/video_core/shader/decode/texture.cpp | |||
| @@ -284,7 +284,7 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) { | |||
| 284 | 284 | ||
| 285 | const Sampler& ShaderIR::GetSampler(const Tegra::Shader::Sampler& sampler, | 285 | const Sampler& ShaderIR::GetSampler(const Tegra::Shader::Sampler& sampler, |
| 286 | std::optional<SamplerInfo> sampler_info) { | 286 | std::optional<SamplerInfo> sampler_info) { |
| 287 | const auto offset = static_cast<std::size_t>(sampler.index.Value()); | 287 | const auto offset = static_cast<u32>(sampler.index.Value()); |
| 288 | 288 | ||
| 289 | Tegra::Shader::TextureType type; | 289 | Tegra::Shader::TextureType type; |
| 290 | bool is_array; | 290 | bool is_array; |
| @@ -293,17 +293,14 @@ const Sampler& ShaderIR::GetSampler(const Tegra::Shader::Sampler& sampler, | |||
| 293 | type = sampler_info->type; | 293 | type = sampler_info->type; |
| 294 | is_array = sampler_info->is_array; | 294 | is_array = sampler_info->is_array; |
| 295 | is_shadow = sampler_info->is_shadow; | 295 | is_shadow = sampler_info->is_shadow; |
| 296 | } else if (auto sampler = locker.ObtainBoundSampler(offset); sampler) { | ||
| 297 | type = sampler->texture_type.Value(); | ||
| 298 | is_array = sampler->is_array.Value() != 0; | ||
| 299 | is_shadow = sampler->is_shadow.Value() != 0; | ||
| 296 | } else { | 300 | } else { |
| 297 | auto sampler = locker.ObtainBoundSampler(offset); | 301 | type = Tegra::Shader::TextureType::Texture2D; |
| 298 | if (sampler) { | 302 | is_array = false; |
| 299 | type = sampler->texture_type.Value(); | 303 | is_shadow = false; |
| 300 | is_array = sampler->is_array.Value() != 0; | ||
| 301 | is_shadow = sampler->is_shadow.Value() != 0; | ||
| 302 | } else { | ||
| 303 | type = Tegra::Shader::TextureType::Texture2D; | ||
| 304 | is_array = false; | ||
| 305 | is_shadow = false; | ||
| 306 | } | ||
| 307 | } | 304 | } |
| 308 | 305 | ||
| 309 | // If this sampler has already been used, return the existing mapping. | 306 | // If this sampler has already been used, return the existing mapping. |
| @@ -320,7 +317,7 @@ const Sampler& ShaderIR::GetSampler(const Tegra::Shader::Sampler& sampler, | |||
| 320 | const std::size_t next_index = used_samplers.size(); | 317 | const std::size_t next_index = used_samplers.size(); |
| 321 | const Sampler entry{offset, next_index, type, is_array, is_shadow}; | 318 | const Sampler entry{offset, next_index, type, is_array, is_shadow}; |
| 322 | return *used_samplers.emplace(entry).first; | 319 | return *used_samplers.emplace(entry).first; |
| 323 | } | 320 | } // namespace VideoCommon::Shader |
| 324 | 321 | ||
| 325 | const Sampler& ShaderIR::GetBindlessSampler(const Tegra::Shader::Register& reg, | 322 | const Sampler& ShaderIR::GetBindlessSampler(const Tegra::Shader::Register& reg, |
| 326 | std::optional<SamplerInfo> sampler_info) { | 323 | std::optional<SamplerInfo> sampler_info) { |
| @@ -336,17 +333,14 @@ const Sampler& ShaderIR::GetBindlessSampler(const Tegra::Shader::Register& reg, | |||
| 336 | type = sampler_info->type; | 333 | type = sampler_info->type; |
| 337 | is_array = sampler_info->is_array; | 334 | is_array = sampler_info->is_array; |
| 338 | is_shadow = sampler_info->is_shadow; | 335 | is_shadow = sampler_info->is_shadow; |
| 336 | } else if (auto sampler = locker.ObtainBindlessSampler(cbuf_index, cbuf_offset); sampler) { | ||
| 337 | type = sampler->texture_type.Value(); | ||
| 338 | is_array = sampler->is_array.Value() != 0; | ||
| 339 | is_shadow = sampler->is_shadow.Value() != 0; | ||
| 339 | } else { | 340 | } else { |
| 340 | auto sampler = locker.ObtainBindlessSampler(cbuf_index, cbuf_offset); | 341 | type = Tegra::Shader::TextureType::Texture2D; |
| 341 | if (sampler) { | 342 | is_array = false; |
| 342 | type = sampler->texture_type.Value(); | 343 | is_shadow = false; |
| 343 | is_array = sampler->is_array.Value() != 0; | ||
| 344 | is_shadow = sampler->is_shadow.Value() != 0; | ||
| 345 | } else { | ||
| 346 | type = Tegra::Shader::TextureType::Texture2D; | ||
| 347 | is_array = false; | ||
| 348 | is_shadow = false; | ||
| 349 | } | ||
| 350 | } | 344 | } |
| 351 | 345 | ||
| 352 | // If this sampler has already been used, return the existing mapping. | 346 | // If this sampler has already been used, return the existing mapping. |