mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 16:31:28 +12:00
rsx: Remove texture mipmap hack
This commit is contained in:
parent
6586090307
commit
a92ae827c1
3 changed files with 12 additions and 10 deletions
|
@ -214,7 +214,7 @@ namespace gl
|
||||||
glSamplerParameterfv(samplerHandle, GL_TEXTURE_BORDER_COLOR, border_color.rgba);
|
glSamplerParameterfv(samplerHandle, GL_TEXTURE_BORDER_COLOR, border_color.rgba);
|
||||||
|
|
||||||
if (sampled_image->upload_context != rsx::texture_upload_context::shader_read ||
|
if (sampled_image->upload_context != rsx::texture_upload_context::shader_read ||
|
||||||
tex.get_exact_mipmap_count() <= 1)
|
tex.get_exact_mipmap_count() == 1)
|
||||||
{
|
{
|
||||||
GLint min_filter = tex_min_filter(tex.min_filter());
|
GLint min_filter = tex_min_filter(tex.min_filter());
|
||||||
|
|
||||||
|
|
|
@ -65,18 +65,17 @@ namespace rsx
|
||||||
|
|
||||||
u16 fragment_texture::get_exact_mipmap_count() const
|
u16 fragment_texture::get_exact_mipmap_count() const
|
||||||
{
|
{
|
||||||
u16 max_mipmap_count = 1;
|
u16 max_mipmap_count;
|
||||||
if (is_compressed_format())
|
if (is_compressed_format())
|
||||||
{
|
{
|
||||||
// OpenGL considers that highest mipmap level for DXTC format is when either width or height is 1
|
// OpenGL considers that highest mipmap level for DXTC format is when either width or height is 1
|
||||||
// not both. Assume it's the same for others backend.
|
// not both. Assume it's the same for others backend.
|
||||||
max_mipmap_count = static_cast<u16>(floor(log2(std::min(width() / 4, height() / 4))) + 1);
|
max_mipmap_count = floor_log2(static_cast<u32>(std::min(width() / 4, height() / 4))) + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
max_mipmap_count = static_cast<u16>(floor(log2(std::max(width(), height()))) + 1);
|
max_mipmap_count = floor_log2(static_cast<u32>(std::max(width(), height()))) + 1;
|
||||||
|
|
||||||
max_mipmap_count = std::min(mipmap(), max_mipmap_count);
|
return std::min(verify(HERE, mipmap()), max_mipmap_count);
|
||||||
return (max_mipmap_count > 0) ? max_mipmap_count : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rsx::texture_wrap_mode fragment_texture::wrap_s() const
|
rsx::texture_wrap_mode fragment_texture::wrap_s() const
|
||||||
|
@ -326,10 +325,8 @@ namespace rsx
|
||||||
|
|
||||||
u16 vertex_texture::get_exact_mipmap_count() const
|
u16 vertex_texture::get_exact_mipmap_count() const
|
||||||
{
|
{
|
||||||
u16 max_mipmap_count = static_cast<u16>(floor(log2(std::max(width(), height()))) + 1);
|
const u16 max_mipmap_count = floor_log2(static_cast<u32>(std::max(width(), height()))) + 1;
|
||||||
max_mipmap_count = std::min(mipmap(), max_mipmap_count);
|
return std::min(verify(HERE, mipmap()), max_mipmap_count);
|
||||||
|
|
||||||
return (max_mipmap_count > 0) ? max_mipmap_count : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<std::array<u8, 4>, std::array<u8, 4>> vertex_texture::decoded_remap() const
|
std::pair<std::array<u8, 4>, std::array<u8, 4>> vertex_texture::decoded_remap() const
|
||||||
|
|
|
@ -144,6 +144,11 @@ namespace rsx
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
static inline u32 floor_log2(u32 value)
|
||||||
|
{
|
||||||
|
return value <= 1 ? 0 : utils::cntlz32(value, true) ^ 31;
|
||||||
|
}
|
||||||
|
|
||||||
static inline u32 ceil_log2(u32 value)
|
static inline u32 ceil_log2(u32 value)
|
||||||
{
|
{
|
||||||
return value <= 1 ? 0 : utils::cntlz32((value - 1) << 1, true) ^ 31;
|
return value <= 1 ? 0 : utils::cntlz32((value - 1) << 1, true) ^ 31;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue