mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-13 08:40:46 -05:00
shader/texture: Support multiple unknown sampler properties
This allows deducing some properties from the texture instruction before asking the runtime. By doing this we can handle type mismatches in some instructions from the renderer instead of the shader decoder. Fixes texelFetch issues with games using 2D texture instructions on a 1D sampler.
This commit is contained in:
@ -191,10 +191,14 @@ private:
|
||||
friend class ASTDecoder;
|
||||
|
||||
struct SamplerInfo {
|
||||
Tegra::Shader::TextureType type;
|
||||
bool is_array;
|
||||
bool is_shadow;
|
||||
bool is_buffer;
|
||||
std::optional<Tegra::Shader::TextureType> type;
|
||||
std::optional<bool> is_array;
|
||||
std::optional<bool> is_shadow;
|
||||
std::optional<bool> is_buffer;
|
||||
|
||||
constexpr bool IsComplete() const noexcept {
|
||||
return type && is_array && is_shadow && is_buffer;
|
||||
}
|
||||
};
|
||||
|
||||
void Decode();
|
||||
@ -327,17 +331,15 @@ private:
|
||||
OperationCode GetPredicateCombiner(Tegra::Shader::PredOperation operation);
|
||||
|
||||
/// Queries the missing sampler info from the execution context.
|
||||
SamplerInfo GetSamplerInfo(std::optional<SamplerInfo> sampler_info, u32 offset,
|
||||
SamplerInfo GetSamplerInfo(SamplerInfo info, u32 offset,
|
||||
std::optional<u32> buffer = std::nullopt);
|
||||
|
||||
/// Accesses a texture sampler
|
||||
std::optional<Sampler> GetSampler(const Tegra::Shader::Sampler& sampler,
|
||||
std::optional<SamplerInfo> sampler_info = std::nullopt);
|
||||
/// Accesses a texture sampler.
|
||||
std::optional<Sampler> GetSampler(Tegra::Shader::Sampler sampler, SamplerInfo info);
|
||||
|
||||
/// Accesses a texture sampler for a bindless texture.
|
||||
std::optional<Sampler> GetBindlessSampler(
|
||||
Tegra::Shader::Register reg, Node& index_var,
|
||||
std::optional<SamplerInfo> sampler_info = std::nullopt);
|
||||
std::optional<Sampler> GetBindlessSampler(Tegra::Shader::Register reg, SamplerInfo info,
|
||||
Node& index_var);
|
||||
|
||||
/// Accesses an image.
|
||||
Image& GetImage(Tegra::Shader::Image image, Tegra::Shader::ImageType type);
|
||||
|
Reference in New Issue
Block a user