mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-01-28 17:28:26 +00:00
support for Video Out gamma setting
This commit is contained in:
parent
7ff8124ce2
commit
e347e3249c
|
@ -11,9 +11,12 @@
|
||||||
#include "imgui_internal.h"
|
#include "imgui_internal.h"
|
||||||
#include "layer.h"
|
#include "layer.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
#include "video_core/renderer_vulkan/vk_presenter.h"
|
||||||
#include "widget/frame_dump.h"
|
#include "widget/frame_dump.h"
|
||||||
#include "widget/frame_graph.h"
|
#include "widget/frame_graph.h"
|
||||||
|
|
||||||
|
extern std::unique_ptr<Vulkan::Presenter> presenter;
|
||||||
|
|
||||||
using namespace ImGui;
|
using namespace ImGui;
|
||||||
using namespace Core::Devtools;
|
using namespace Core::Devtools;
|
||||||
using L = Core::Devtools::Layer;
|
using L = Core::Devtools::Layer;
|
||||||
|
@ -71,6 +74,13 @@ void L::DrawMenuBar() {
|
||||||
open_popup_help = MenuItem("Help & Tips");
|
open_popup_help = MenuItem("Help & Tips");
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
if (BeginMenu("Display")) {
|
||||||
|
if (BeginMenu("Brightness")) {
|
||||||
|
SliderFloat("Gamma", &presenter->GetGammaRef(), 0.1f, 2.0f);
|
||||||
|
ImGui::EndMenu();
|
||||||
|
}
|
||||||
|
ImGui::EndMenu();
|
||||||
|
}
|
||||||
EndMainMenuBar();
|
EndMainMenuBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ struct ServiceThreadParams {
|
||||||
|
|
||||||
class VideoOutDriver {
|
class VideoOutDriver {
|
||||||
public:
|
public:
|
||||||
explicit VideoOutDriver(u32 width, u32 height);
|
VideoOutDriver(u32 width, u32 height);
|
||||||
~VideoOutDriver();
|
~VideoOutDriver();
|
||||||
|
|
||||||
int Open(const ServiceThreadParams* params);
|
int Open(const ServiceThreadParams* params);
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
#include "core/libraries/videoout/video_out.h"
|
#include "core/libraries/videoout/video_out.h"
|
||||||
#include "core/loader/symbols_resolver.h"
|
#include "core/loader/symbols_resolver.h"
|
||||||
#include "core/platform.h"
|
#include "core/platform.h"
|
||||||
|
#include "video_core/renderer_vulkan/vk_presenter.h"
|
||||||
|
|
||||||
|
extern std::unique_ptr<Vulkan::Presenter> presenter;
|
||||||
|
|
||||||
namespace Libraries::VideoOut {
|
namespace Libraries::VideoOut {
|
||||||
|
|
||||||
|
@ -297,6 +300,28 @@ s32 PS4_SYSV_ABI sceVideoOutWaitVblank(s32 handle) {
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s32 PS4_SYSV_ABI sceVideoOutColorSettingsSetGamma(SceVideoOutColorSettings* settings, float gamma) {
|
||||||
|
if (gamma < 0.1f || gamma > 2.0f) {
|
||||||
|
return ORBIS_VIDEO_OUT_ERROR_INVALID_VALUE;
|
||||||
|
}
|
||||||
|
settings->gamma = gamma;
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 PS4_SYSV_ABI sceVideoOutAdjustColor(s32 handle, const SceVideoOutColorSettings* settings) {
|
||||||
|
if (settings == nullptr) {
|
||||||
|
return ORBIS_VIDEO_OUT_ERROR_INVALID_ADDRESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto* port = driver->GetPort(handle);
|
||||||
|
if (!port) {
|
||||||
|
return ORBIS_VIDEO_OUT_ERROR_INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
presenter->GetGammaRef() = settings->gamma;
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
void RegisterLib(Core::Loader::SymbolsResolver* sym) {
|
void RegisterLib(Core::Loader::SymbolsResolver* sym) {
|
||||||
driver = std::make_unique<VideoOutDriver>(Config::getScreenWidth(), Config::getScreenHeight());
|
driver = std::make_unique<VideoOutDriver>(Config::getScreenWidth(), Config::getScreenHeight());
|
||||||
|
|
||||||
|
@ -329,6 +354,10 @@ void RegisterLib(Core::Loader::SymbolsResolver* sym) {
|
||||||
LIB_FUNCTION("U2JJtSqNKZI", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutGetEventId);
|
LIB_FUNCTION("U2JJtSqNKZI", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutGetEventId);
|
||||||
LIB_FUNCTION("rWUTcKdkUzQ", "libSceVideoOut", 1, "libSceVideoOut", 0, 0,
|
LIB_FUNCTION("rWUTcKdkUzQ", "libSceVideoOut", 1, "libSceVideoOut", 0, 0,
|
||||||
sceVideoOutGetEventData);
|
sceVideoOutGetEventData);
|
||||||
|
LIB_FUNCTION("DYhhWbJSeRg", "libSceVideoOut", 1, "libSceVideoOut", 0, 0,
|
||||||
|
sceVideoOutColorSettingsSetGamma);
|
||||||
|
LIB_FUNCTION("pv9CI5VC+R0", "libSceVideoOut", 1, "libSceVideoOut", 0, 0,
|
||||||
|
sceVideoOutAdjustColor);
|
||||||
|
|
||||||
// openOrbis appears to have libSceVideoOut_v1 module libSceVideoOut_v1.1
|
// openOrbis appears to have libSceVideoOut_v1 module libSceVideoOut_v1.1
|
||||||
LIB_FUNCTION("Up36PTk687E", "libSceVideoOut", 1, "libSceVideoOut", 1, 1, sceVideoOutOpen);
|
LIB_FUNCTION("Up36PTk687E", "libSceVideoOut", 1, "libSceVideoOut", 1, 1, sceVideoOutOpen);
|
||||||
|
|
|
@ -88,6 +88,11 @@ struct SceVideoOutDeviceCapabilityInfo {
|
||||||
u64 capability;
|
u64 capability;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct SceVideoOutColorSettings {
|
||||||
|
float gamma;
|
||||||
|
u32 reserved[3];
|
||||||
|
};
|
||||||
|
|
||||||
void PS4_SYSV_ABI sceVideoOutSetBufferAttribute(BufferAttribute* attribute, PixelFormat pixelFormat,
|
void PS4_SYSV_ABI sceVideoOutSetBufferAttribute(BufferAttribute* attribute, PixelFormat pixelFormat,
|
||||||
u32 tilingMode, u32 aspectRatio, u32 width,
|
u32 tilingMode, u32 aspectRatio, u32 width,
|
||||||
u32 height, u32 pitchInPixel);
|
u32 height, u32 pitchInPixel);
|
||||||
|
@ -106,6 +111,8 @@ s32 PS4_SYSV_ABI sceVideoOutOpen(SceUserServiceUserId userId, s32 busType, s32 i
|
||||||
s32 PS4_SYSV_ABI sceVideoOutClose(s32 handle);
|
s32 PS4_SYSV_ABI sceVideoOutClose(s32 handle);
|
||||||
int PS4_SYSV_ABI sceVideoOutGetEventId(const Kernel::SceKernelEvent* ev);
|
int PS4_SYSV_ABI sceVideoOutGetEventId(const Kernel::SceKernelEvent* ev);
|
||||||
int PS4_SYSV_ABI sceVideoOutGetEventData(const Kernel::SceKernelEvent* ev, int64_t* data);
|
int PS4_SYSV_ABI sceVideoOutGetEventData(const Kernel::SceKernelEvent* ev, int64_t* data);
|
||||||
|
s32 PS4_SYSV_ABI sceVideoOutColorSettingsSetGamma(SceVideoOutColorSettings* settings, float gamma);
|
||||||
|
s32 PS4_SYSV_ABI sceVideoOutAdjustColor(s32 handle, const SceVideoOutColorSettings* settings);
|
||||||
|
|
||||||
// Internal system functions
|
// Internal system functions
|
||||||
void sceVideoOutGetBufferLabelAddress(s32 handle, uintptr_t* label_addr);
|
void sceVideoOutGetBufferLabelAddress(s32 handle, uintptr_t* label_addr);
|
||||||
|
|
|
@ -41,10 +41,18 @@ enum SchedulerType {
|
||||||
class Rasterizer;
|
class Rasterizer;
|
||||||
|
|
||||||
class Presenter {
|
class Presenter {
|
||||||
|
struct PostProcessSettings {
|
||||||
|
float gamma = 1.0f;
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Presenter(Frontend::WindowSDL& window, AmdGpu::Liverpool* liverpool);
|
Presenter(Frontend::WindowSDL& window, AmdGpu::Liverpool* liverpool);
|
||||||
~Presenter();
|
~Presenter();
|
||||||
|
|
||||||
|
float& GetGammaRef() {
|
||||||
|
return pp_settings.gamma;
|
||||||
|
}
|
||||||
|
|
||||||
Frame* PrepareFrame(const Libraries::VideoOut::BufferAttributeGroup& attribute,
|
Frame* PrepareFrame(const Libraries::VideoOut::BufferAttributeGroup& attribute,
|
||||||
VAddr cpu_address, bool is_eop) {
|
VAddr cpu_address, bool is_eop) {
|
||||||
const auto info = VideoCore::ImageInfo{attribute, cpu_address};
|
const auto info = VideoCore::ImageInfo{attribute, cpu_address};
|
||||||
|
@ -87,6 +95,7 @@ private:
|
||||||
Frame* GetRenderFrame();
|
Frame* GetRenderFrame();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
PostProcessSettings pp_settings{};
|
||||||
Frontend::WindowSDL& window;
|
Frontend::WindowSDL& window;
|
||||||
AmdGpu::Liverpool* liverpool;
|
AmdGpu::Liverpool* liverpool;
|
||||||
Instance instance;
|
Instance instance;
|
||||||
|
|
Loading…
Reference in a new issue