mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 11:36:13 +00:00
rsx: framebuffer textures do not have mipmaps!
- Force mipmap count to 1 if sampling from an RTV/DSV - TODO: Better wcb flush detection, it should be better to re-upload the texture after it has been dwnloaded if expected mipmaps are > 1
This commit is contained in:
parent
71c8885678
commit
6891323c18
6 changed files with 29 additions and 24 deletions
|
@ -5,6 +5,27 @@
|
|||
#include <vector>
|
||||
#include "Utilities/GSL.h"
|
||||
|
||||
namespace rsx
|
||||
{
|
||||
enum texture_upload_context
|
||||
{
|
||||
shader_read = 0,
|
||||
blit_engine_src = 1,
|
||||
blit_engine_dst = 2,
|
||||
framebuffer_storage = 3
|
||||
};
|
||||
|
||||
//Sampled image descriptor
|
||||
struct sampled_image_descriptor_base
|
||||
{
|
||||
texture_upload_context upload_context = texture_upload_context::shader_read;
|
||||
rsx::texture_dimension_extended image_type = texture_dimension_extended::texture_dimension_2d;
|
||||
bool is_depth_texture = false;
|
||||
f32 scale_x = 1.f;
|
||||
f32 scale_y = 1.f;
|
||||
};
|
||||
}
|
||||
|
||||
struct rsx_subresource_layout
|
||||
{
|
||||
gsl::span<const gsl::byte> data;
|
||||
|
@ -39,4 +60,4 @@ u8 get_format_block_size_in_bytes(rsx::surface_color_format format);
|
|||
* Get number of bytes occupied by texture in RSX mem
|
||||
*/
|
||||
size_t get_texture_size(const rsx::fragment_texture &texture);
|
||||
size_t get_texture_size(const rsx::vertex_texture &texture);
|
||||
size_t get_texture_size(const rsx::vertex_texture &texture);
|
|
@ -17,30 +17,12 @@ namespace rsx
|
|||
swapped_native_component_order = 2,
|
||||
};
|
||||
|
||||
enum texture_upload_context
|
||||
{
|
||||
shader_read = 0,
|
||||
blit_engine_src = 1,
|
||||
blit_engine_dst = 2,
|
||||
framebuffer_storage = 3
|
||||
};
|
||||
|
||||
enum texture_sampler_status
|
||||
{
|
||||
status_uninitialized = 0,
|
||||
status_ready = 1
|
||||
};
|
||||
|
||||
//Sampled image descriptor
|
||||
struct sampled_image_descriptor_base
|
||||
{
|
||||
texture_upload_context upload_context = texture_upload_context::shader_read;
|
||||
rsx::texture_dimension_extended image_type = texture_dimension_extended::texture_dimension_2d;
|
||||
bool is_depth_texture = false;
|
||||
f32 scale_x = 1.f;
|
||||
f32 scale_y = 1.f;
|
||||
};
|
||||
|
||||
struct cached_texture_section : public rsx::buffered_section
|
||||
{
|
||||
u16 width;
|
||||
|
|
|
@ -252,7 +252,7 @@ void GLGSRender::end()
|
|||
*sampler_state = m_gl_texture_cache.upload_texture(unused, rsx::method_registers.fragment_textures[i], m_rtts);
|
||||
|
||||
if (m_textures_dirty[i])
|
||||
m_gl_sampler_states[i].apply(rsx::method_registers.fragment_textures[i]);
|
||||
m_gl_sampler_states[i].apply(rsx::method_registers.fragment_textures[i], fs_sampler_state[i].get());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace gl
|
|||
}
|
||||
|
||||
//Apply sampler state settings
|
||||
void sampler_state::apply(rsx::fragment_texture& tex)
|
||||
void sampler_state::apply(rsx::fragment_texture& tex, const rsx::sampled_image_descriptor_base* sampled_image)
|
||||
{
|
||||
const f32 border_color = (f32)tex.border_color() / 255;
|
||||
const f32 border_color_array[] = { border_color, border_color, border_color, border_color };
|
||||
|
@ -143,7 +143,8 @@ namespace gl
|
|||
glSamplerParameteri(samplerHandle, GL_TEXTURE_WRAP_R, wrap_mode(tex.wrap_r()));
|
||||
glSamplerParameterfv(samplerHandle, GL_TEXTURE_BORDER_COLOR, border_color_array);
|
||||
|
||||
if (tex.get_exact_mipmap_count() <= 1)
|
||||
if (sampled_image->upload_context != rsx::texture_upload_context::shader_read ||
|
||||
tex.get_exact_mipmap_count() <= 1)
|
||||
{
|
||||
GLint min_filter = tex_min_filter(tex.min_filter());
|
||||
|
||||
|
|
|
@ -52,6 +52,6 @@ namespace gl
|
|||
glBindSampler(index, samplerHandle);
|
||||
}
|
||||
|
||||
void apply(rsx::fragment_texture& tex);
|
||||
void apply(rsx::fragment_texture& tex, const rsx::sampled_image_descriptor_base* sampled_image);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1149,7 +1149,8 @@ void VKGSRender::end()
|
|||
|
||||
std::tie(min_filter, mip_mode) = vk::get_min_filter_and_mip(rsx::method_registers.fragment_textures[i].min_filter());
|
||||
|
||||
if (rsx::method_registers.fragment_textures[i].get_exact_mipmap_count() > 1)
|
||||
if (sampler_state->upload_context == rsx::texture_upload_context::shader_read &&
|
||||
rsx::method_registers.fragment_textures[i].get_exact_mipmap_count() > 1)
|
||||
{
|
||||
min_lod = (float)(rsx::method_registers.fragment_textures[i].min_lod() >> 8);
|
||||
max_lod = (float)(rsx::method_registers.fragment_textures[i].max_lod() >> 8);
|
||||
|
|
Loading…
Add table
Reference in a new issue