mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-19 12:40:29 +00:00
rsx: Minor fixups
- Optimize framebuffer memory invalidate conditions - Fix texture sampling of AA textures (wider by 2x surfaces)
This commit is contained in:
parent
af1d3c2aa6
commit
b95630d84a
rpcs3/Emu/RSX
@ -894,9 +894,10 @@ namespace rsx
|
||||
if (extended_dimension != rsx::texture_dimension_extended::texture_dimension_2d)
|
||||
LOG_ERROR(RSX, "Texture resides in render target memory, but requested type is not 2D (%d)", (u32)extended_dimension);
|
||||
|
||||
f32 internal_scale = (f32)texptr->get_native_pitch() / tex.pitch();
|
||||
bool requires_processing = texptr->get_surface_width() != tex_width || texptr->get_surface_height() != tex_height;
|
||||
const f32 internal_scale = (f32)texptr->get_native_pitch() / tex.pitch();
|
||||
const u32 internal_width = tex_width * texptr->get_native_pitch() / tex.pitch();
|
||||
|
||||
bool requires_processing = texptr->get_surface_width() != internal_width || texptr->get_surface_height() != tex_height;
|
||||
if (!requires_processing)
|
||||
{
|
||||
for (const auto& tex : m_rtts.m_bound_render_targets)
|
||||
@ -921,7 +922,7 @@ namespace rsx
|
||||
|
||||
if (requires_processing)
|
||||
{
|
||||
const auto w = rsx::apply_resolution_scale(tex_width, true);
|
||||
const auto w = rsx::apply_resolution_scale(internal_width, true);
|
||||
const auto h = rsx::apply_resolution_scale(tex_height, true);
|
||||
return{ create_temporary_subresource_view(cmd, texptr, format, 0, 0, w, h), texture_upload_context::framebuffer_storage, false, internal_scale };
|
||||
}
|
||||
@ -942,9 +943,10 @@ namespace rsx
|
||||
if (extended_dimension != rsx::texture_dimension_extended::texture_dimension_2d)
|
||||
LOG_ERROR(RSX, "Texture resides in depth buffer memory, but requested type is not 2D (%d)", (u32)extended_dimension);
|
||||
|
||||
f32 internal_scale = (f32)texptr->get_native_pitch() / tex.pitch();
|
||||
bool requires_processing = texptr->get_surface_width() != tex_width || texptr->get_surface_height() != tex_height;
|
||||
const f32 internal_scale = (f32)texptr->get_native_pitch() / tex.pitch();
|
||||
const u32 internal_width = tex_width * texptr->get_native_pitch() / tex.pitch();
|
||||
|
||||
bool requires_processing = texptr->get_surface_width() != internal_width || texptr->get_surface_height() != tex_height;
|
||||
if (!requires_processing && texaddr == std::get<0>(m_rtts.m_bound_depth_stencil))
|
||||
{
|
||||
if (g_cfg.video.strict_rendering_mode)
|
||||
@ -961,7 +963,7 @@ namespace rsx
|
||||
|
||||
if (requires_processing)
|
||||
{
|
||||
const auto w = rsx::apply_resolution_scale(tex_width, true);
|
||||
const auto w = rsx::apply_resolution_scale(internal_width, true);
|
||||
const auto h = rsx::apply_resolution_scale(tex_height, true);
|
||||
return{ create_temporary_subresource_view(cmd, texptr, format, 0, 0, w, h), texture_upload_context::framebuffer_storage, true, internal_scale };
|
||||
}
|
||||
|
@ -357,20 +357,22 @@ void GLGSRender::end()
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_sampler_mutex);
|
||||
void* unused = nullptr;
|
||||
bool update_framebuffer_sourced = false;
|
||||
|
||||
if (surface_store_tag != m_rtts.cache_tag)
|
||||
{
|
||||
m_samplers_dirty.store(true);
|
||||
update_framebuffer_sourced = true;
|
||||
surface_store_tag = m_rtts.cache_tag;
|
||||
}
|
||||
|
||||
for (int i = 0; i < rsx::limits::fragment_textures_count; ++i)
|
||||
{
|
||||
if (m_samplers_dirty || m_textures_dirty[i])
|
||||
{
|
||||
if (!fs_sampler_state[i])
|
||||
fs_sampler_state[i] = std::make_unique<gl::texture_cache::sampled_image_descriptor>();
|
||||
if (!fs_sampler_state[i])
|
||||
fs_sampler_state[i] = std::make_unique<gl::texture_cache::sampled_image_descriptor>();
|
||||
|
||||
if (m_samplers_dirty || m_textures_dirty[i] ||
|
||||
(update_framebuffer_sourced && fs_sampler_state[i]->upload_context == rsx::texture_upload_context::framebuffer_storage))
|
||||
{
|
||||
auto sampler_state = static_cast<gl::texture_cache::sampled_image_descriptor*>(fs_sampler_state[i].get());
|
||||
|
||||
if (rsx::method_registers.fragment_textures[i].enabled())
|
||||
@ -394,17 +396,17 @@ void GLGSRender::end()
|
||||
|
||||
for (int i = 0; i < rsx::limits::vertex_textures_count; ++i)
|
||||
{
|
||||
int texture_index = i + rsx::limits::fragment_textures_count;
|
||||
if (!vs_sampler_state[i])
|
||||
vs_sampler_state[i] = std::make_unique<gl::texture_cache::sampled_image_descriptor>();
|
||||
|
||||
if (m_samplers_dirty || m_vertex_textures_dirty[i])
|
||||
if (m_samplers_dirty || m_vertex_textures_dirty[i] ||
|
||||
(update_framebuffer_sourced && vs_sampler_state[i]->upload_context == rsx::texture_upload_context::framebuffer_storage))
|
||||
{
|
||||
if (!vs_sampler_state[i])
|
||||
vs_sampler_state[i] = std::make_unique<gl::texture_cache::sampled_image_descriptor>();
|
||||
|
||||
auto sampler_state = static_cast<gl::texture_cache::sampled_image_descriptor*>(vs_sampler_state[i].get());
|
||||
|
||||
if (rsx::method_registers.vertex_textures[i].enabled())
|
||||
{
|
||||
const int texture_index = i + rsx::limits::fragment_textures_count;
|
||||
glActiveTexture(GL_TEXTURE0 + texture_index);
|
||||
|
||||
*sampler_state = m_gl_texture_cache.upload_texture(unused, rsx::method_registers.vertex_textures[i], m_rtts);
|
||||
|
@ -1050,20 +1050,22 @@ void VKGSRender::end()
|
||||
//Load textures
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_sampler_mutex);
|
||||
bool update_framebuffer_sourced = false;
|
||||
|
||||
if (surface_store_tag != m_rtts.cache_tag)
|
||||
{
|
||||
m_samplers_dirty.store(true);
|
||||
update_framebuffer_sourced = true;
|
||||
surface_store_tag = m_rtts.cache_tag;
|
||||
}
|
||||
|
||||
for (int i = 0; i < rsx::limits::fragment_textures_count; ++i)
|
||||
{
|
||||
if (m_samplers_dirty || m_textures_dirty[i])
|
||||
{
|
||||
if (!fs_sampler_state[i])
|
||||
fs_sampler_state[i] = std::make_unique<vk::texture_cache::sampled_image_descriptor>();
|
||||
if (!fs_sampler_state[i])
|
||||
fs_sampler_state[i] = std::make_unique<vk::texture_cache::sampled_image_descriptor>();
|
||||
|
||||
if (m_samplers_dirty || m_textures_dirty[i] ||
|
||||
(update_framebuffer_sourced && fs_sampler_state[i]->upload_context == rsx::texture_upload_context::framebuffer_storage))
|
||||
{
|
||||
auto sampler_state = static_cast<vk::texture_cache::sampled_image_descriptor*>(fs_sampler_state[i].get());
|
||||
|
||||
if (rsx::method_registers.fragment_textures[i].enabled())
|
||||
@ -1127,13 +1129,12 @@ void VKGSRender::end()
|
||||
|
||||
for (int i = 0; i < rsx::limits::vertex_textures_count; ++i)
|
||||
{
|
||||
int texture_index = i + rsx::limits::fragment_textures_count;
|
||||
if (!vs_sampler_state[i])
|
||||
vs_sampler_state[i] = std::make_unique<vk::texture_cache::sampled_image_descriptor>();
|
||||
|
||||
if (m_samplers_dirty || m_vertex_textures_dirty[i])
|
||||
if (m_samplers_dirty || m_vertex_textures_dirty[i] ||
|
||||
(update_framebuffer_sourced && vs_sampler_state[i]->upload_context == rsx::texture_upload_context::framebuffer_storage))
|
||||
{
|
||||
if (!vs_sampler_state[i])
|
||||
vs_sampler_state[i] = std::make_unique<vk::texture_cache::sampled_image_descriptor>();
|
||||
|
||||
auto sampler_state = static_cast<vk::texture_cache::sampled_image_descriptor*>(vs_sampler_state[i].get());
|
||||
|
||||
if (rsx::method_registers.vertex_textures[i].enabled())
|
||||
|
Loading…
x
Reference in New Issue
Block a user