mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-07 01:26:20 +00:00
shader_recompiler: Emulate unnormalized sampler coordinates in shader. (#1762)
* shader_recompiler: Emulate unnormalized sampler coordinates in shader. * Address review comments.
This commit is contained in:
parent
306279901f
commit
028be3ba5d
10 changed files with 78 additions and 12 deletions
|
@ -49,6 +49,12 @@ struct FMaskSpecialization {
|
|||
auto operator<=>(const FMaskSpecialization&) const = default;
|
||||
};
|
||||
|
||||
struct SamplerSpecialization {
|
||||
bool force_unnormalized = false;
|
||||
|
||||
auto operator<=>(const SamplerSpecialization&) const = default;
|
||||
};
|
||||
|
||||
/**
|
||||
* Alongside runtime information, this structure also checks bound resources
|
||||
* for compatibility. Can be used as a key for storing shader permutations.
|
||||
|
@ -67,6 +73,7 @@ struct StageSpecialization {
|
|||
boost::container::small_vector<TextureBufferSpecialization, 8> tex_buffers;
|
||||
boost::container::small_vector<ImageSpecialization, 16> images;
|
||||
boost::container::small_vector<FMaskSpecialization, 8> fmasks;
|
||||
boost::container::small_vector<SamplerSpecialization, 16> samplers;
|
||||
Backend::Bindings start{};
|
||||
|
||||
explicit StageSpecialization(const Info& info_, RuntimeInfo runtime_info_,
|
||||
|
@ -107,6 +114,10 @@ struct StageSpecialization {
|
|||
spec.width = sharp.width;
|
||||
spec.height = sharp.height;
|
||||
});
|
||||
ForEachSharp(samplers, info->samplers,
|
||||
[](auto& spec, const auto& desc, AmdGpu::Sampler sharp) {
|
||||
spec.force_unnormalized = sharp.force_unnormalized;
|
||||
});
|
||||
}
|
||||
|
||||
void ForEachSharp(auto& spec_list, auto& desc_list, auto&& func) {
|
||||
|
@ -175,6 +186,11 @@ struct StageSpecialization {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
for (u32 i = 0; i < samplers.size(); i++) {
|
||||
if (samplers[i] != other.samplers[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue