yuzu-emu
/
yuzu
Archived
1
0
Fork 0

configure_graphics: Use u8 for bg_color values

This commit is contained in:
ameerj 2021-07-08 21:45:01 -04:00
parent 386cd45f07
commit 8284658bac
5 changed files with 20 additions and 19 deletions

View File

@ -333,9 +333,9 @@ struct Values {
Setting<bool> use_fast_gpu_time{true, "use_fast_gpu_time"}; Setting<bool> use_fast_gpu_time{true, "use_fast_gpu_time"};
Setting<bool> use_caches_gc{false, "use_caches_gc"}; Setting<bool> use_caches_gc{false, "use_caches_gc"};
Setting<float> bg_red{0.0f, "bg_red"}; Setting<u8> bg_red{0, "bg_red"};
Setting<float> bg_green{0.0f, "bg_green"}; Setting<u8> bg_green{0, "bg_green"};
Setting<float> bg_blue{0.0f, "bg_blue"}; Setting<u8> bg_blue{0, "bg_blue"};
// System // System
Setting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"}; Setting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"};

View File

@ -229,9 +229,6 @@ void RendererOpenGL::LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color
} }
void RendererOpenGL::InitOpenGLObjects() { void RendererOpenGL::InitOpenGLObjects() {
glClearColor(Settings::values.bg_red.GetValue(), Settings::values.bg_green.GetValue(),
Settings::values.bg_blue.GetValue(), 0.0f);
// Create shader programs // Create shader programs
OGLShader vertex_shader; OGLShader vertex_shader;
vertex_shader.Create(HostShaders::OPENGL_PRESENT_VERT, GL_VERTEX_SHADER); vertex_shader.Create(HostShaders::OPENGL_PRESENT_VERT, GL_VERTEX_SHADER);
@ -337,8 +334,9 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture,
void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) { void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
if (renderer_settings.set_background_color) { if (renderer_settings.set_background_color) {
// Update background color before drawing // Update background color before drawing
glClearColor(Settings::values.bg_red.GetValue(), Settings::values.bg_green.GetValue(), glClearColor(Settings::values.bg_red.GetValue() / 255.0f,
Settings::values.bg_blue.GetValue(), 0.0f); Settings::values.bg_green.GetValue() / 255.0f,
Settings::values.bg_blue.GetValue() / 255.0f, 1.0f);
} }
// Set projection matrix // Set projection matrix

View File

@ -225,8 +225,11 @@ VkSemaphore VKBlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer, bool
descriptor_set = descriptor_sets[image_index], buffer = *buffer, descriptor_set = descriptor_sets[image_index], buffer = *buffer,
size = swapchain.GetSize(), pipeline = *pipeline, size = swapchain.GetSize(), pipeline = *pipeline,
layout = *pipeline_layout](vk::CommandBuffer cmdbuf) { layout = *pipeline_layout](vk::CommandBuffer cmdbuf) {
const f32 bg_red = Settings::values.bg_red.GetValue() / 255.0f;
const f32 bg_green = Settings::values.bg_green.GetValue() / 255.0f;
const f32 bg_blue = Settings::values.bg_blue.GetValue() / 255.0f;
const VkClearValue clear_color{ const VkClearValue clear_color{
.color = {.float32 = {0.0f, 0.0f, 0.0f, 0.0f}}, .color = {.float32 = {bg_red, bg_green, bg_blue, 1.0f}},
}; };
const VkRenderPassBeginInfo renderpass_bi{ const VkRenderPassBeginInfo renderpass_bi{
.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, .sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO,

View File

@ -101,7 +101,7 @@ void ConfigureGraphics::SetConfiguration() {
ConfigurationShared::SetHighlight(ui->bg_layout, !Settings::values.bg_red.UsingGlobal()); ConfigurationShared::SetHighlight(ui->bg_layout, !Settings::values.bg_red.UsingGlobal());
} }
UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red.GetValue(), UpdateBackgroundColorButton(QColor::fromRgb(Settings::values.bg_red.GetValue(),
Settings::values.bg_green.GetValue(), Settings::values.bg_green.GetValue(),
Settings::values.bg_blue.GetValue())); Settings::values.bg_blue.GetValue()));
UpdateDeviceComboBox(); UpdateDeviceComboBox();
@ -132,9 +132,9 @@ void ConfigureGraphics::ApplyConfiguration() {
Settings::values.vulkan_device.SetValue(vulkan_device); Settings::values.vulkan_device.SetValue(vulkan_device);
} }
if (Settings::values.bg_red.UsingGlobal()) { if (Settings::values.bg_red.UsingGlobal()) {
Settings::values.bg_red.SetValue(static_cast<float>(bg_color.redF())); Settings::values.bg_red.SetValue(static_cast<u8>(bg_color.red()));
Settings::values.bg_green.SetValue(static_cast<float>(bg_color.greenF())); Settings::values.bg_green.SetValue(static_cast<u8>(bg_color.green()));
Settings::values.bg_blue.SetValue(static_cast<float>(bg_color.blueF())); Settings::values.bg_blue.SetValue(static_cast<u8>(bg_color.blue()));
} }
} else { } else {
if (ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { if (ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
@ -159,9 +159,9 @@ void ConfigureGraphics::ApplyConfiguration() {
Settings::values.bg_red.SetGlobal(false); Settings::values.bg_red.SetGlobal(false);
Settings::values.bg_green.SetGlobal(false); Settings::values.bg_green.SetGlobal(false);
Settings::values.bg_blue.SetGlobal(false); Settings::values.bg_blue.SetGlobal(false);
Settings::values.bg_red.SetValue(static_cast<float>(bg_color.redF())); Settings::values.bg_red.SetValue(static_cast<u8>(bg_color.red()));
Settings::values.bg_green.SetValue(static_cast<float>(bg_color.greenF())); Settings::values.bg_green.SetValue(static_cast<u8>(bg_color.green()));
Settings::values.bg_blue.SetValue(static_cast<float>(bg_color.blueF())); Settings::values.bg_blue.SetValue(static_cast<u8>(bg_color.blue()));
} }
} }
} }

View File

@ -232,7 +232,7 @@ use_vsync =
use_caches_gc = use_caches_gc =
# The clear color for the renderer. What shows up on the sides of the bottom screen. # The clear color for the renderer. What shows up on the sides of the bottom screen.
# Must be in range of 0.0-1.0. Defaults to 1.0 for all. # Must be in range of 0-255. Defaults to 0 for all.
bg_red = bg_red =
bg_blue = bg_blue =
bg_green = bg_green =