mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
rsx: Remove framebuffer_status_valid flag and move to state
This commit is contained in:
parent
6adcabda29
commit
5f0467b084
7 changed files with 58 additions and 48 deletions
|
@ -671,7 +671,7 @@ void GLGSRender::end()
|
|||
{
|
||||
m_profiler.start();
|
||||
|
||||
if (skip_current_frame || !framebuffer_status_valid || cond_render_ctrl.disable_rendering())
|
||||
if (skip_current_frame || !m_graphics_state.test(rsx::rtt_config_valid) || cond_render_ctrl.disable_rendering())
|
||||
{
|
||||
execute_nop_draw();
|
||||
rsx::thread::end();
|
||||
|
|
|
@ -544,7 +544,7 @@ void GLGSRender::clear_surface(u32 arg)
|
|||
|
||||
init_buffers(static_cast<rsx::framebuffer_creation_context>(ctx), true);
|
||||
|
||||
if (!framebuffer_status_valid) return;
|
||||
if (!m_graphics_state.test(rsx::rtt_config_valid)) return;
|
||||
|
||||
GLbitfield mask = 0;
|
||||
|
||||
|
|
|
@ -111,11 +111,14 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool /*
|
|||
return;
|
||||
}
|
||||
|
||||
m_graphics_state.clear(rsx::rtt_config_dirty | rsx::rtt_config_contested);
|
||||
framebuffer_status_valid = false;
|
||||
m_graphics_state.clear(
|
||||
rsx::rtt_config_dirty |
|
||||
rsx::rtt_config_contested |
|
||||
rsx::rtt_config_valid |
|
||||
rsx::rtt_cache_state_dirty);
|
||||
|
||||
get_framebuffer_layout(context, m_framebuffer_layout);
|
||||
if (!framebuffer_status_valid)
|
||||
if (!m_graphics_state.test(rsx::rtt_config_valid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -206,7 +209,7 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool /*
|
|||
m_depth_surface_info = {};
|
||||
}
|
||||
|
||||
framebuffer_status_valid = false;
|
||||
m_graphics_state.clear(rsx::rtt_config_valid);
|
||||
|
||||
if (m_draw_fbo)
|
||||
{
|
||||
|
@ -224,12 +227,12 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool /*
|
|||
m_draw_fbo->bind();
|
||||
m_draw_fbo->set_extents({ m_framebuffer_layout.width, m_framebuffer_layout.height });
|
||||
|
||||
framebuffer_status_valid = true;
|
||||
m_graphics_state.set(rsx::rtt_config_valid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!framebuffer_status_valid)
|
||||
if (!m_graphics_state.test(rsx::rtt_config_valid))
|
||||
{
|
||||
m_framebuffer_cache.emplace_back();
|
||||
m_framebuffer_cache.back().add_ref();
|
||||
|
@ -290,8 +293,13 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool /*
|
|||
break;
|
||||
}
|
||||
|
||||
framebuffer_status_valid = m_draw_fbo->check();
|
||||
if (!framebuffer_status_valid) return;
|
||||
if (!m_draw_fbo->check())
|
||||
{
|
||||
m_graphics_state.clear(rsx::rtt_config_valid);
|
||||
return;
|
||||
}
|
||||
|
||||
m_graphics_state.set(rsx::rtt_config_valid);
|
||||
|
||||
check_zcull_status(true);
|
||||
set_viewport();
|
||||
|
|
|
@ -1358,8 +1358,7 @@ namespace rsx
|
|||
layout.width = rsx::method_registers.surface_clip_width();
|
||||
layout.height = rsx::method_registers.surface_clip_height();
|
||||
|
||||
m_graphics_state.clear(rsx::rtt_config_contested);
|
||||
framebuffer_status_valid = false;
|
||||
m_graphics_state.clear(rsx::rtt_config_contested | rsx::rtt_config_valid);
|
||||
m_current_framebuffer_context = context;
|
||||
|
||||
if (layout.width == 0 || layout.height == 0)
|
||||
|
@ -1563,7 +1562,7 @@ namespace rsx
|
|||
rsx_log.warning("Framebuffer at 0x%X has aliasing color/depth targets, color_index=%d, zeta_pitch = %d, color_pitch=%d, context=%d",
|
||||
layout.zeta_address, index, layout.zeta_pitch, layout.color_pitch[index], static_cast<u32>(context));
|
||||
|
||||
m_framebuffer_state_contested = true;
|
||||
m_graphics_state.set(rsx::rtt_config_contested);
|
||||
|
||||
// TODO: Research clearing both depth AND color
|
||||
// TODO: If context is creation_draw, deal with possibility of a lost buffer clear
|
||||
|
@ -1597,17 +1596,17 @@ namespace rsx
|
|||
layout.actual_color_pitch[index] = layout.color_pitch[index];
|
||||
}
|
||||
|
||||
framebuffer_status_valid = true;
|
||||
m_graphics_state.set(rsx::rtt_config_valid);
|
||||
}
|
||||
|
||||
if (!framebuffer_status_valid && !layout.zeta_address)
|
||||
if (!m_graphics_state.test(rsx::rtt_config_valid) && !layout.zeta_address)
|
||||
{
|
||||
rsx_log.warning("Framebuffer setup failed. Draw calls may have been lost");
|
||||
return;
|
||||
}
|
||||
|
||||
// At least one attachment exists
|
||||
framebuffer_status_valid = true;
|
||||
m_graphics_state.set(rsx::rtt_config_valid);
|
||||
|
||||
// Window (raster) offsets
|
||||
const auto window_offset_x = rsx::method_registers.window_offset_x();
|
||||
|
@ -1885,14 +1884,14 @@ namespace rsx
|
|||
y1 >= rsx::method_registers.window_clip_vertical())
|
||||
{
|
||||
m_graphics_state |= rsx::pipeline_state::scissor_setup_invalid;
|
||||
framebuffer_status_valid = false;
|
||||
m_graphics_state.clear(rsx::rtt_config_valid);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_graphics_state & rsx::pipeline_state::scissor_setup_invalid)
|
||||
{
|
||||
m_graphics_state.clear(rsx::pipeline_state::scissor_setup_invalid);
|
||||
framebuffer_status_valid = true;
|
||||
m_graphics_state.set(rsx::rtt_config_valid);
|
||||
}
|
||||
|
||||
std::tie(region.x1, region.y1) = rsx::apply_resolution_scale<false>(x1, y1, m_framebuffer_layout.width, m_framebuffer_layout.height);
|
||||
|
|
|
@ -55,36 +55,37 @@ namespace rsx
|
|||
|
||||
enum pipeline_state : u32
|
||||
{
|
||||
fragment_program_ucode_dirty = 0x1, // Fragment program ucode changed
|
||||
vertex_program_ucode_dirty = 0x2, // Vertex program ucode changed
|
||||
fragment_program_state_dirty = 0x4, // Fragment program state changed
|
||||
vertex_program_state_dirty = 0x8, // Vertex program state changed
|
||||
fragment_state_dirty = 0x10, // Fragment state changed (alpha test, etc)
|
||||
vertex_state_dirty = 0x20, // Vertex state changed (scale_offset, clip planes, etc)
|
||||
transform_constants_dirty = 0x40, // Transform constants changed
|
||||
fragment_constants_dirty = 0x80, // Fragment constants changed
|
||||
framebuffer_reads_dirty = 0x100, // Framebuffer contents changed
|
||||
fragment_texture_state_dirty = 0x200, // Fragment texture parameters changed
|
||||
vertex_texture_state_dirty = 0x400, // Fragment texture parameters changed
|
||||
scissor_config_state_dirty = 0x800, // Scissor region changed
|
||||
zclip_config_state_dirty = 0x1000, // Viewport Z clip changed
|
||||
fragment_program_ucode_dirty = (1 << 0), // Fragment program ucode changed
|
||||
vertex_program_ucode_dirty = (1 << 1), // Vertex program ucode changed
|
||||
fragment_program_state_dirty = (1 << 2), // Fragment program state changed
|
||||
vertex_program_state_dirty = (1 << 3), // Vertex program state changed
|
||||
fragment_state_dirty = (1 << 4), // Fragment state changed (alpha test, etc)
|
||||
vertex_state_dirty = (1 << 5), // Vertex state changed (scale_offset, clip planes, etc)
|
||||
transform_constants_dirty = (1 << 6), // Transform constants changed
|
||||
fragment_constants_dirty = (1 << 7), // Fragment constants changed
|
||||
framebuffer_reads_dirty = (1 << 8), // Framebuffer contents changed
|
||||
fragment_texture_state_dirty = (1 << 9), // Fragment texture parameters changed
|
||||
vertex_texture_state_dirty = (1 << 10), // Fragment texture parameters changed
|
||||
scissor_config_state_dirty = (1 << 11), // Scissor region changed
|
||||
zclip_config_state_dirty = (1 << 12), // Viewport Z clip changed
|
||||
|
||||
scissor_setup_invalid = 0x2000, // Scissor configuration is broken
|
||||
scissor_setup_clipped = 0x4000, // Scissor region is cropped by viewport constraint
|
||||
scissor_setup_invalid = (1 << 13), // Scissor configuration is broken
|
||||
scissor_setup_clipped = (1 << 14), // Scissor region is cropped by viewport constraint
|
||||
|
||||
polygon_stipple_pattern_dirty = 0x8000, // Rasterizer stippling pattern changed
|
||||
line_stipple_pattern_dirty = 0x10000, // Line stippling pattern changed
|
||||
polygon_stipple_pattern_dirty = (1 << 15), // Rasterizer stippling pattern changed
|
||||
line_stipple_pattern_dirty = (1 << 16), // Line stippling pattern changed
|
||||
|
||||
push_buffer_arrays_dirty = 0x20000, // Push buffers have data written to them (immediate mode vertex buffers)
|
||||
push_buffer_arrays_dirty = (1 << 17), // Push buffers have data written to them (immediate mode vertex buffers)
|
||||
|
||||
polygon_offset_state_dirty = 0x40000, // Polygon offset config was changed
|
||||
depth_bounds_state_dirty = 0x80000, // Depth bounds configuration changed
|
||||
polygon_offset_state_dirty = (1 << 18), // Polygon offset config was changed
|
||||
depth_bounds_state_dirty = (1 << 19), // Depth bounds configuration changed
|
||||
|
||||
pipeline_config_dirty = 0x100000, // Generic pipeline configuration changes. Shader peek hint.
|
||||
pipeline_config_dirty = (1 << 20), // Generic pipeline configuration changes. Shader peek hint.
|
||||
|
||||
rtt_config_dirty = 0x200000, // Render target configuration changed
|
||||
rtt_config_contested = 0x400000, // Render target configuration is indeterminate
|
||||
texture_cache_state_dirty = 0x800000, // Texture cache state is indeterminate
|
||||
rtt_config_dirty = (1 << 21), // Render target configuration changed
|
||||
rtt_config_contested = (1 << 22), // Render target configuration is indeterminate
|
||||
rtt_config_valid = (1 << 23), // Render target configuration is valid
|
||||
rtt_cache_state_dirty = (1 << 24), // Texture cache state is indeterminate
|
||||
|
||||
fragment_program_dirty = fragment_program_ucode_dirty | fragment_program_state_dirty,
|
||||
vertex_program_dirty = vertex_program_ucode_dirty | vertex_program_state_dirty,
|
||||
|
@ -189,7 +190,6 @@ namespace rsx
|
|||
rsx::gcm_framebuffer_info m_surface_info[rsx::limits::color_buffers_count];
|
||||
rsx::gcm_framebuffer_info m_depth_surface_info;
|
||||
framebuffer_layout m_framebuffer_layout{};
|
||||
bool framebuffer_status_valid = false;
|
||||
|
||||
// Overlays
|
||||
rsx::overlays::display_manager* m_overlay_manager = nullptr;
|
||||
|
|
|
@ -946,7 +946,7 @@ void VKGSRender::begin()
|
|||
|
||||
void VKGSRender::end()
|
||||
{
|
||||
if (skip_current_frame || !framebuffer_status_valid || swapchain_unavailable || cond_render_ctrl.disable_rendering())
|
||||
if (skip_current_frame || !m_graphics_state.test(rsx::rtt_config_valid) || swapchain_unavailable || cond_render_ctrl.disable_rendering())
|
||||
{
|
||||
execute_nop_draw();
|
||||
rsx::thread::end();
|
||||
|
|
|
@ -1435,7 +1435,7 @@ void VKGSRender::clear_surface(u32 mask)
|
|||
if (mask & RSX_GCM_CLEAR_DEPTH_STENCIL_MASK) ctx |= rsx::framebuffer_creation_context::context_clear_depth;
|
||||
init_buffers(rsx::framebuffer_creation_context{ctx});
|
||||
|
||||
if (!framebuffer_status_valid) return;
|
||||
if (!m_graphics_state.test(rsx::rtt_config_valid)) return;
|
||||
|
||||
//float depth_clear = 1.f;
|
||||
u32 stencil_clear = 0;
|
||||
|
@ -2406,11 +2406,14 @@ void VKGSRender::prepare_rtts(rsx::framebuffer_creation_context context)
|
|||
return;
|
||||
}
|
||||
|
||||
m_graphics_state.clear(rsx::rtt_config_dirty | rsx::rtt_config_contested);
|
||||
framebuffer_status_valid = false;
|
||||
m_graphics_state.clear(
|
||||
rsx::rtt_config_dirty |
|
||||
rsx::rtt_config_contested |
|
||||
rsx::rtt_config_valid |
|
||||
rsx::rtt_cache_state_dirty);
|
||||
|
||||
get_framebuffer_layout(context, m_framebuffer_layout);
|
||||
if (!framebuffer_status_valid)
|
||||
if (!m_graphics_state.test(rsx::rtt_config_valid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue