mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-12-26 06:40:05 +00:00
set sampler max lod, min lod, lod bias and max anisotropy
This commit is contained in:
parent
eaee73f95d
commit
e9610ec0dd
@ -740,9 +740,9 @@ void RasterizerOpenGL::SamplerInfo::Create() {
|
|||||||
glSamplerParameteri(sampler.handle, GL_TEXTURE_COMPARE_FUNC, GL_NEVER);
|
glSamplerParameteri(sampler.handle, GL_TEXTURE_COMPARE_FUNC, GL_NEVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerOpenGL::SamplerInfo::SyncWithConfig(const Tegra::Texture::TSCEntry& config) {
|
void RasterizerOpenGL::SamplerInfo::SyncWithConfig(const Tegra::Texture::FullTextureInfo& info) {
|
||||||
const GLuint s = sampler.handle;
|
const GLuint s = sampler.handle;
|
||||||
|
const Tegra::Texture::TSCEntry& config = info.tsc;
|
||||||
if (mag_filter != config.mag_filter) {
|
if (mag_filter != config.mag_filter) {
|
||||||
mag_filter = config.mag_filter;
|
mag_filter = config.mag_filter;
|
||||||
glSamplerParameteri(
|
glSamplerParameteri(
|
||||||
@ -793,6 +793,17 @@ void RasterizerOpenGL::SamplerInfo::SyncWithConfig(const Tegra::Texture::TSCEntr
|
|||||||
glSamplerParameterfv(s, GL_TEXTURE_BORDER_COLOR, border_color.data());
|
glSamplerParameterfv(s, GL_TEXTURE_BORDER_COLOR, border_color.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (info.tic.use_header_opt_control == 0) {
|
||||||
|
glSamplerParameterf(s, GL_TEXTURE_MAX_ANISOTROPY_EXT,
|
||||||
|
static_cast<float>(1 << info.tic.max_anisotropy.Value()));
|
||||||
|
glSamplerParameterf(s, GL_TEXTURE_MIN_LOD,
|
||||||
|
static_cast<float>(info.tic.res_min_mip_level.Value()));
|
||||||
|
glSamplerParameterf(s, GL_TEXTURE_MAX_LOD,
|
||||||
|
static_cast<float>(info.tic.res_max_mip_level.Value() == 0
|
||||||
|
? 16
|
||||||
|
: info.tic.res_max_mip_level.Value()));
|
||||||
|
glSamplerParameterf(s, GL_TEXTURE_LOD_BIAS, info.tic.mip_lod_bias.Value() / 256.f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, Shader& shader,
|
u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, Shader& shader,
|
||||||
@ -890,7 +901,7 @@ u32 RasterizerOpenGL::SetupTextures(Maxwell::ShaderStage stage, Shader& shader,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
texture_samplers[current_bindpoint].SyncWithConfig(texture.tsc);
|
texture_samplers[current_bindpoint].SyncWithConfig(texture);
|
||||||
Surface surface = res_cache.GetTextureSurface(texture, entry);
|
Surface surface = res_cache.GetTextureSurface(texture, entry);
|
||||||
if (surface != nullptr) {
|
if (surface != nullptr) {
|
||||||
state.texture_units[current_bindpoint].texture = surface->Texture().handle;
|
state.texture_units[current_bindpoint].texture = surface->Texture().handle;
|
||||||
|
@ -88,7 +88,7 @@ private:
|
|||||||
/// SamplerInfo struct.
|
/// SamplerInfo struct.
|
||||||
void Create();
|
void Create();
|
||||||
/// Syncs the sampler object with the config, updating any necessary state.
|
/// Syncs the sampler object with the config, updating any necessary state.
|
||||||
void SyncWithConfig(const Tegra::Texture::TSCEntry& config);
|
void SyncWithConfig(const Tegra::Texture::FullTextureInfo& info);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Tegra::Texture::TextureFilter mag_filter;
|
Tegra::Texture::TextureFilter mag_filter;
|
||||||
|
@ -168,20 +168,29 @@ struct TICEntry {
|
|||||||
|
|
||||||
// High 16 bits of the pitch value
|
// High 16 bits of the pitch value
|
||||||
BitField<0, 16, u32> pitch_high;
|
BitField<0, 16, u32> pitch_high;
|
||||||
|
BitField<26, 1, u32> use_header_opt_control;
|
||||||
|
BitField<27, 1, u32> depth_texture;
|
||||||
BitField<28, 4, u32> max_mip_level;
|
BitField<28, 4, u32> max_mip_level;
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
BitField<0, 16, u32> width_minus_1;
|
BitField<0, 16, u32> width_minus_1;
|
||||||
BitField<22, 1, u32> srgb_conversion;
|
BitField<22, 1, u32> srgb_conversion;
|
||||||
BitField<23, 4, TextureType> texture_type;
|
BitField<23, 4, TextureType> texture_type;
|
||||||
|
BitField<29, 3, u32> border_size;
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
BitField<0, 16, u32> height_minus_1;
|
BitField<0, 16, u32> height_minus_1;
|
||||||
BitField<16, 15, u32> depth_minus_1;
|
BitField<16, 15, u32> depth_minus_1;
|
||||||
};
|
};
|
||||||
|
union {
|
||||||
|
BitField<6, 13, u32> mip_lod_bias;
|
||||||
|
BitField<27, 3, u32> max_anisotropy;
|
||||||
|
};
|
||||||
|
|
||||||
INSERT_PADDING_BYTES(8);
|
union {
|
||||||
|
BitField<0, 4, u32> res_min_mip_level;
|
||||||
|
BitField<4, 4, u32> res_max_mip_level;
|
||||||
|
};
|
||||||
|
|
||||||
GPUVAddr Address() const {
|
GPUVAddr Address() const {
|
||||||
return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | address_low);
|
return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | address_low);
|
||||||
|
Loading…
Reference in New Issue
Block a user