Use g_fxo for rsx::avconf

This commit is contained in:
Nekotekina 2019-08-25 15:04:20 +03:00
parent 7a00b5f809
commit 928719b658
5 changed files with 26 additions and 20 deletions

View File

@ -175,7 +175,7 @@ s32 cellVideoOutGetGamma(u32 videoOut, vm::ptr<f32> gamma)
return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT;
}
auto conf = fxm::get_always<rsx::avconf>();
auto conf = g_fxo->get<rsx::avconf>();
*gamma = conf->gamma;
return CELL_OK;
@ -222,7 +222,7 @@ s32 cellVideoOutSetGamma(u32 videoOut, f32 gamma)
return CELL_VIDEO_OUT_ERROR_ILLEGAL_PARAMETER;
}
auto conf = fxm::get_always<rsx::avconf>();
auto conf = g_fxo->get<rsx::avconf>();
conf->gamma = gamma;
return CELL_OK;

View File

@ -121,7 +121,7 @@ error_code cellVideoOutGetResolution(u32 resolutionId, vm::ptr<CellVideoOutResol
case 0x99: *resolution = { 0x3c0, 0x5be }; break;
case 0x98: *resolution = { 0x400, 0x5be }; break;
case 0xa1: *resolution = { 0x780, 0x438 }; break;
default: return CELL_VIDEO_OUT_ERROR_ILLEGAL_PARAMETER;
}
@ -168,12 +168,13 @@ error_code cellVideoOutConfigure(u32 videoOut, vm::ptr<CellVideoOutConfiguration
auto& res_info = g_video_out_resolution_map.at(res);
auto conf = fxm::get_always<rsx::avconf>();
auto conf = g_fxo->get<rsx::avconf>();
conf->aspect = config->aspect;
conf->format = config->format;
conf->scanline_pitch = config->pitch;
conf->resolution_x = u32(res_info.first);
conf->resolution_y = u32(res_info.second);
conf->state = 1;
return CELL_OK;
}

View File

@ -492,7 +492,7 @@ void GLGSRender::end()
{
if (rsx::method_registers.current_draw_clause.execute_pipeline_dependencies() & rsx::vertex_base_changed)
{
// Rebase vertex bases instead of
// Rebase vertex bases instead of
for (auto &info : m_vertex_layout.interleaved_blocks)
{
const auto vertex_base_offset = rsx::method_registers.vertex_data_base_offset();
@ -1314,7 +1314,7 @@ void GLGSRender::load_program_env()
if (update_fragment_env) m_fragment_env_buffer->reserve_storage_on_heap(128);
if (update_vertex_env) m_vertex_env_buffer->reserve_storage_on_heap(256);
if (update_fragment_texture_env) m_texture_parameters_buffer->reserve_storage_on_heap(256);
if (update_fragment_constants) m_fragment_constants_buffer->reserve_storage_on_heap(align(fragment_constants_size, 256));
if (update_fragment_constants) m_fragment_constants_buffer->reserve_storage_on_heap(align(fragment_constants_size, 256));
if (update_transform_constants) m_transform_constants_buffer->reserve_storage_on_heap(8192);
}
@ -1564,12 +1564,13 @@ void GLGSRender::flip(int buffer, bool emu_flip)
u32 buffer_pitch = display_buffers[buffer].pitch;
u32 av_format;
const auto avconfig = fxm::get<rsx::avconf>();
const auto avconfig = g_fxo->get<rsx::avconf>();
if (avconfig)
if (avconfig->state)
{
av_format = avconfig->get_compatible_gcm_format();
if (!buffer_pitch) buffer_pitch = buffer_width * avconfig->get_bpp();
if (!buffer_pitch)
buffer_pitch = buffer_width * avconfig->get_bpp();
buffer_width = std::min(buffer_width, avconfig->resolution_x);
buffer_height = std::min(buffer_height, avconfig->resolution_y);
@ -1577,7 +1578,8 @@ void GLGSRender::flip(int buffer, bool emu_flip)
else
{
av_format = CELL_GCM_TEXTURE_A8R8G8B8;
if (!buffer_pitch) buffer_pitch = buffer_width * 4;
if (!buffer_pitch)
buffer_pitch = buffer_width * 4;
}
// Disable scissor test (affects blit, clear, etc)
@ -1648,7 +1650,7 @@ void GLGSRender::flip(int buffer, bool emu_flip)
// TODO: Should emit only once to avoid flooding the log file
// TODO: Take AA scaling into account
LOG_WARNING(RSX, "Selected output image does not satisfy the video configuration. Display buffer resolution=%dx%d, avconf resolution=%dx%d, surface=%dx%d",
display_buffers[buffer].width, display_buffers[buffer].height, avconfig ? avconfig->resolution_x : 0, avconfig ? avconfig->resolution_y : 0,
display_buffers[buffer].width, display_buffers[buffer].height, avconfig->state * avconfig->resolution_x, avconfig->state * avconfig->resolution_y,
render_target_texture->get_surface_width(rsx::surface_metrics::pixels), render_target_texture->get_surface_height(rsx::surface_metrics::pixels));
buffer_width = render_target_texture->width();
@ -1705,7 +1707,7 @@ void GLGSRender::flip(int buffer, bool emu_flip)
areai screen_area = coordi({}, { (int)buffer_width, (int)buffer_height });
if (g_cfg.video.full_rgb_range_output && (!avconfig || avconfig->gamma == 1.f))
if (g_cfg.video.full_rgb_range_output && avconfig->gamma == 1.f)
{
// Blit source image to the screen
m_flip_fbo.recreate();
@ -1717,7 +1719,7 @@ void GLGSRender::flip(int buffer, bool emu_flip)
}
else
{
const f32 gamma = avconfig ? avconfig->gamma : 1.f;
const f32 gamma = avconfig->gamma;
const bool limited_range = !g_cfg.video.full_rgb_range_output;
gl::screen.bind();

View File

@ -3173,12 +3173,13 @@ void VKGSRender::flip(int buffer, bool emu_flip)
u32 buffer_pitch = display_buffers[buffer].pitch;
u32 av_format;
const auto avconfig = fxm::get<rsx::avconf>();
const auto avconfig = g_fxo->get<rsx::avconf>();
if (avconfig)
if (avconfig->state)
{
av_format = avconfig->get_compatible_gcm_format();
if (!buffer_pitch) buffer_pitch = buffer_width * avconfig->get_bpp();
if (!buffer_pitch)
buffer_pitch = buffer_width * avconfig->get_bpp();
buffer_width = std::min(buffer_width, avconfig->resolution_x);
buffer_height = std::min(buffer_height, avconfig->resolution_y);
@ -3186,7 +3187,8 @@ void VKGSRender::flip(int buffer, bool emu_flip)
else
{
av_format = CELL_GCM_TEXTURE_A8R8G8B8;
if (!buffer_pitch) buffer_pitch = buffer_width * 4;
if (!buffer_pitch)
buffer_pitch = buffer_width * 4;
}
coordi aspect_ratio;
@ -3288,7 +3290,7 @@ void VKGSRender::flip(int buffer, bool emu_flip)
// TODO: Should emit only once to avoid flooding the log file
// TODO: Take AA scaling into account
LOG_WARNING(RSX, "Selected output image does not satisfy the video configuration. Display buffer resolution=%dx%d, avconf resolution=%dx%d, surface=%dx%d",
display_buffers[buffer].width, display_buffers[buffer].height, avconfig? avconfig->resolution_x : 0, avconfig? avconfig->resolution_y : 0,
display_buffers[buffer].width, display_buffers[buffer].height, avconfig->state * avconfig->resolution_x, avconfig->state * avconfig->resolution_y,
render_target_texture->get_surface_width(rsx::surface_metrics::pixels), render_target_texture->get_surface_height(rsx::surface_metrics::pixels));
buffer_width = render_target_texture->width();

View File

@ -148,9 +148,10 @@ namespace rsx
u8 format = 0; // XRGB
u8 aspect = 0; // AUTO
u32 scanline_pitch = 0; // PACKED
f32 gamma = 1.f; // NO GAMMA CORRECTION
atomic_t<f32> gamma = 1.f; // NO GAMMA CORRECTION
u32 resolution_x = 1280; // X RES
u32 resolution_y = 720; // Y RES
atomic_t<u32> state = 0; // 1 after cellVideoOutConfigure was called
u32 get_compatible_gcm_format()
{
@ -407,7 +408,7 @@ namespace rsx
const u32 log2_w = ceil_log2(width);
const u32 log2_h = ceil_log2(height);
const u32 log2_d = ceil_log2(depth);
for (u32 z = 0; z < depth; ++z)
{
for (u32 y = 0; y < height; ++y)