summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/decode
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-10-17 16:35:16 +0200
committerFernandoS27 <fsahmkow27@gmail.com>2019-10-26 21:38:30 +0200
commitbe856a38d6b0c7c90c861baf3204ac48a108f3d2 (patch)
treefeef5da87a406bc2e83326adbbf59a54772a34d2 /src/video_core/shader/decode
parentShader_IR: Clang format (diff)
downloadyuzu-be856a38d6b0c7c90c861baf3204ac48a108f3d2.tar
yuzu-be856a38d6b0c7c90c861baf3204ac48a108f3d2.tar.gz
yuzu-be856a38d6b0c7c90c861baf3204ac48a108f3d2.tar.bz2
yuzu-be856a38d6b0c7c90c861baf3204ac48a108f3d2.tar.lz
yuzu-be856a38d6b0c7c90c861baf3204ac48a108f3d2.tar.xz
yuzu-be856a38d6b0c7c90c861baf3204ac48a108f3d2.tar.zst
yuzu-be856a38d6b0c7c90c861baf3204ac48a108f3d2.zip
Diffstat (limited to 'src/video_core/shader/decode')
-rw-r--r--src/video_core/shader/decode/texture.cpp38
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) {
const Sampler& ShaderIR::GetSampler(const Tegra::Shader::Sampler& sampler,
std::optional<SamplerInfo> sampler_info) {
- const auto offset = static_cast<std::size_t>(sampler.index.Value());
+ const auto offset = static_cast<u32>(sampler.index.Value());
Tegra::Shader::TextureType type;
bool is_array;
@@ -293,17 +293,14 @@ const Sampler& ShaderIR::GetSampler(const Tegra::Shader::Sampler& sampler,
type = sampler_info->type;
is_array = sampler_info->is_array;
is_shadow = sampler_info->is_shadow;
+ } else if (auto sampler = locker.ObtainBoundSampler(offset); sampler) {
+ type = sampler->texture_type.Value();
+ is_array = sampler->is_array.Value() != 0;
+ is_shadow = sampler->is_shadow.Value() != 0;
} else {
- auto sampler = locker.ObtainBoundSampler(offset);
- if (sampler) {
- type = sampler->texture_type.Value();
- is_array = sampler->is_array.Value() != 0;
- is_shadow = sampler->is_shadow.Value() != 0;
- } else {
- type = Tegra::Shader::TextureType::Texture2D;
- is_array = false;
- is_shadow = false;
- }
+ type = Tegra::Shader::TextureType::Texture2D;
+ is_array = false;
+ is_shadow = false;
}
// If this sampler has already been used, return the existing mapping.
@@ -320,7 +317,7 @@ const Sampler& ShaderIR::GetSampler(const Tegra::Shader::Sampler& sampler,
const std::size_t next_index = used_samplers.size();
const Sampler entry{offset, next_index, type, is_array, is_shadow};
return *used_samplers.emplace(entry).first;
-}
+} // namespace VideoCommon::Shader
const Sampler& ShaderIR::GetBindlessSampler(const Tegra::Shader::Register& reg,
std::optional<SamplerInfo> sampler_info) {
@@ -336,17 +333,14 @@ const Sampler& ShaderIR::GetBindlessSampler(const Tegra::Shader::Register& reg,
type = sampler_info->type;
is_array = sampler_info->is_array;
is_shadow = sampler_info->is_shadow;
+ } else if (auto sampler = locker.ObtainBindlessSampler(cbuf_index, cbuf_offset); sampler) {
+ type = sampler->texture_type.Value();
+ is_array = sampler->is_array.Value() != 0;
+ is_shadow = sampler->is_shadow.Value() != 0;
} else {
- auto sampler = locker.ObtainBindlessSampler(cbuf_index, cbuf_offset);
- if (sampler) {
- type = sampler->texture_type.Value();
- is_array = sampler->is_array.Value() != 0;
- is_shadow = sampler->is_shadow.Value() != 0;
- } else {
- type = Tegra::Shader::TextureType::Texture2D;
- is_array = false;
- is_shadow = false;
- }
+ type = Tegra::Shader::TextureType::Texture2D;
+ is_array = false;
+ is_shadow = false;
}
// If this sampler has already been used, return the existing mapping.