Loading...
Searching...
No Matches
score-plugin-gfx/Gfx/Settings/Model.hpp
1#pragma once
2#include <Gfx/Graph/RenderState.hpp>
3
4#include <score/plugins/ProjectSettings/ProjectSettingsModel.hpp>
5#include <score/plugins/settingsdelegate/SettingsDelegateModel.hpp>
6
7#include <score_plugin_gfx_export.h>
8
9#include <verdigris>
10namespace Gfx::Settings
11{
12
14{
15 const QString OpenGL{"OpenGL"};
16 const QString Vulkan{"Vulkan"};
17 const QString Metal{"Metal"};
18 const QString D3D11{"Direct3D 11"};
19 const QString D3D12{"Direct3D 12"};
20 operator QStringList() const noexcept;
21};
22
24{
25 const QString Auto{"Auto"};
26 const QString None{"None"};
27 const QString CUDA{"CUDA"};
28 const QString QSV{"Intel QuickSync"};
29 const QString VDPAU{"VDPAU"};
30 const QString VAAPI{"VA-API"};
31 const QString D3D{"Direct3D 11"};
32 const QString D3D12{"Direct3D 12"};
33 const QString DXVA{"DXVA2"};
34 const QString VideoToolbox{"Video Toolbox"};
35 const QString V4L2{"V4L2-M2M"};
36 const QString VulkanVideo{"Vulkan Video"};
37 operator QStringList() const noexcept;
38};
39
40class SCORE_PLUGIN_GFX_EXPORT Model : public score::SettingsDelegateModel
41{
42 W_OBJECT(Model)
43
44 QString m_GraphicsApi{};
45 QString m_HardwareDecode{};
46 int m_DecodingThreads{1};
47 double m_Rate{};
48 int m_Samples{1};
49 bool m_VSync{};
50 int m_Buffers{3};
51
52public:
53 Model(
54 const UuidKey<score::SettingsDelegateFactory>& k, QSettings& set,
55 const score::ApplicationContext& ctx);
56
57 SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_GFX_EXPORT, QString, HardwareDecode)
58 SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_GFX_EXPORT, int, DecodingThreads)
59 SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_GFX_EXPORT, double, Rate)
60 SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_GFX_EXPORT, int, Samples)
61 SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_GFX_EXPORT, bool, VSync)
62 SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_GFX_EXPORT, int, Buffers)
63
64public:
65 score::gfx::GraphicsApi graphicsApiEnum() const noexcept;
66 QString getGraphicsApi() const;
67 void initGraphicsApi(QString);
68 void setGraphicsApi(QString);
69 void GraphicsApiChanged(QString arg)
70 E_SIGNAL(SCORE_PLUGIN_GFX_EXPORT, GraphicsApiChanged, arg)
71 SCORE_SETTINGS_PROPERTY(QString, GraphicsApi)
72
73 // Required as D3D12 requires a minimum of 2 samples
74 int resolveSamples(score::gfx::GraphicsApi) const noexcept;
75};
76
77SCORE_SETTINGS_PARAMETER(Model, GraphicsApi)
78SCORE_SETTINGS_PARAMETER(Model, HardwareDecode)
79SCORE_SETTINGS_PARAMETER(Model, DecodingThreads)
80SCORE_SETTINGS_PARAMETER(Model, Rate)
81SCORE_SETTINGS_PARAMETER(Model, Samples)
82SCORE_SETTINGS_PARAMETER(Model, VSync)
83SCORE_SETTINGS_PARAMETER(Model, Buffers)
84
85SCORE_PLUGIN_GFX_EXPORT
86QShaderVersion shaderVersionForAPI(score::gfx::GraphicsApi) noexcept;
87}
Definition score-plugin-gfx/Gfx/Settings/Model.hpp:41
Definition UuidKey.hpp:345
Definition SettingsDelegateModel.hpp:18
GraphicsApi
Available graphics APIs to use.
Definition RenderState.hpp:22
Definition score-plugin-gfx/Gfx/Settings/Model.hpp:14
Definition score-plugin-gfx/Gfx/Settings/Model.hpp:24
Used to access all the application-wide state and structures.
Definition ApplicationContext.hpp:25