mirror of
https://github.com/thinkonmay/sunshine-sdk.git
synced 2026-08-06 20:54:52 +00:00
remove global task pool
This commit is contained in:
parent
85b9079db6
commit
6781fd8da3
@ -9,11 +9,6 @@
|
||||
*/
|
||||
safe::mail_t mail::man;
|
||||
|
||||
/**
|
||||
* @brief A thread pool for processing tasks.
|
||||
*/
|
||||
thread_pool_util::ThreadPool task_pool;
|
||||
|
||||
/**
|
||||
* @brief A boolean flag to indicate whether the cursor should be displayed.
|
||||
*/
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
#include "thread_pool.h"
|
||||
#include "thread_safe.h"
|
||||
|
||||
extern thread_pool_util::ThreadPool task_pool;
|
||||
extern bool display_cursor;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@ -126,7 +126,6 @@ main(int argc, char *argv[]) {
|
||||
BOOST_LOG(error) << "Logging failed to initialize"sv;
|
||||
}
|
||||
|
||||
task_pool.start(1);
|
||||
|
||||
// Create signal handler after logging has been initialized
|
||||
auto process_shutdown_event = mail::man->event<bool>(mail::shutdown);
|
||||
@ -413,8 +412,6 @@ main(int argc, char *argv[]) {
|
||||
BOOST_LOG(info) << "Closed";
|
||||
// let other threads to close
|
||||
timer->sleep_for(1s);
|
||||
task_pool.stop();
|
||||
task_pool.join();
|
||||
|
||||
#ifdef _WIN32
|
||||
// Restore global NVIDIA control panel settings
|
||||
|
||||
@ -1,45 +1,45 @@
|
||||
#include "include/base_vs_types.hlsl"
|
||||
|
||||
#if defined(LEFT_SUBSAMPLING)
|
||||
vertex_t generate_fullscreen_triangle_vertex(uint vertex_id, float subsample_offset, int rotate_texture_steps)
|
||||
#elif defined(TOPLEFT_SUBSAMPLING)
|
||||
vertex_t generate_fullscreen_triangle_vertex(uint vertex_id, float2 subsample_offset, int rotate_texture_steps)
|
||||
#else
|
||||
vertex_t generate_fullscreen_triangle_vertex(uint vertex_id, int rotate_texture_steps)
|
||||
#endif
|
||||
{
|
||||
vertex_t output;
|
||||
float2 tex_coord;
|
||||
|
||||
if (vertex_id == 0) {
|
||||
output.viewpoint_pos = float4(-1, -1, 0, 1);
|
||||
tex_coord = float2(0, 1);
|
||||
}
|
||||
else if (vertex_id == 1) {
|
||||
output.viewpoint_pos = float4(-1, 3, 0, 1);
|
||||
tex_coord = float2(0, -1);
|
||||
}
|
||||
else if (vertex_id == 2) {
|
||||
output.viewpoint_pos = float4(3, -1, 0, 1);
|
||||
tex_coord = float2(2, 1);
|
||||
}
|
||||
|
||||
if (rotate_texture_steps != 0) {
|
||||
float rotation_radians = radians(90 * rotate_texture_steps);
|
||||
float2x2 rotation_matrix = { cos(rotation_radians), -sin(rotation_radians),
|
||||
sin(rotation_radians), cos(rotation_radians) };
|
||||
float2 rotation_center = { 0.5, 0.5 };
|
||||
tex_coord = round(rotation_center + mul(rotation_matrix, tex_coord - rotation_center));
|
||||
}
|
||||
|
||||
#if defined(LEFT_SUBSAMPLING)
|
||||
output.tex_right_left_center = float3(tex_coord.x, tex_coord.x - subsample_offset, tex_coord.y);
|
||||
#elif defined (TOPLEFT_SUBSAMPLING)
|
||||
output.tex_right_left_top = float3(tex_coord.x, tex_coord.x - subsample_offset.x, tex_coord.y - subsample_offset.y);
|
||||
output.tex_right_left_bottom = float3(tex_coord.x, tex_coord.x - subsample_offset.x, tex_coord.y);
|
||||
#else
|
||||
output.tex_coord = tex_coord;
|
||||
#endif
|
||||
|
||||
return output;
|
||||
}
|
||||
#include "include/base_vs_types.hlsl"
|
||||
|
||||
#if defined(LEFT_SUBSAMPLING)
|
||||
vertex_t generate_fullscreen_triangle_vertex(uint vertex_id, float subsample_offset, int rotate_texture_steps)
|
||||
#elif defined(TOPLEFT_SUBSAMPLING)
|
||||
vertex_t generate_fullscreen_triangle_vertex(uint vertex_id, float2 subsample_offset, int rotate_texture_steps)
|
||||
#else
|
||||
vertex_t generate_fullscreen_triangle_vertex(uint vertex_id, int rotate_texture_steps)
|
||||
#endif
|
||||
{
|
||||
vertex_t output;
|
||||
float2 tex_coord;
|
||||
|
||||
if (vertex_id == 0) {
|
||||
output.viewpoint_pos = float4(-1, -1, 0, 1);
|
||||
tex_coord = float2(0, 1);
|
||||
}
|
||||
else if (vertex_id == 1) {
|
||||
output.viewpoint_pos = float4(-1, 3, 0, 1);
|
||||
tex_coord = float2(0, -1);
|
||||
}
|
||||
else if (vertex_id == 2) {
|
||||
output.viewpoint_pos = float4(3, -1, 0, 1);
|
||||
tex_coord = float2(2, 1);
|
||||
}
|
||||
|
||||
if (rotate_texture_steps != 0) {
|
||||
float rotation_radians = radians(90 * rotate_texture_steps);
|
||||
float2x2 rotation_matrix = { cos(rotation_radians), -sin(rotation_radians),
|
||||
sin(rotation_radians), cos(rotation_radians) };
|
||||
float2 rotation_center = { 0.5, 0.5 };
|
||||
tex_coord = round(rotation_center + mul(rotation_matrix, tex_coord - rotation_center));
|
||||
}
|
||||
|
||||
#if defined(LEFT_SUBSAMPLING)
|
||||
output.tex_right_left_center = float3(tex_coord.x, tex_coord.x - subsample_offset, tex_coord.y);
|
||||
#elif defined (TOPLEFT_SUBSAMPLING)
|
||||
output.tex_right_left_top = float3(tex_coord.x, tex_coord.x - subsample_offset.x, tex_coord.y - subsample_offset.y);
|
||||
output.tex_right_left_bottom = float3(tex_coord.x, tex_coord.x - subsample_offset.x, tex_coord.y);
|
||||
#else
|
||||
output.tex_coord = tex_coord;
|
||||
#endif
|
||||
|
||||
return output;
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
struct vertex_t
|
||||
{
|
||||
float4 viewpoint_pos : SV_Position;
|
||||
#if defined(LEFT_SUBSAMPLING)
|
||||
float3 tex_right_left_center : TEXCOORD;
|
||||
#elif defined (TOPLEFT_SUBSAMPLING)
|
||||
float3 tex_right_left_top : TEXCOORD;
|
||||
float3 tex_right_left_bottom : TEXCOORD;
|
||||
#else
|
||||
float2 tex_coord : TEXCOORD;
|
||||
#endif
|
||||
};
|
||||
struct vertex_t
|
||||
{
|
||||
float4 viewpoint_pos : SV_Position;
|
||||
#if defined(LEFT_SUBSAMPLING)
|
||||
float3 tex_right_left_center : TEXCOORD;
|
||||
#elif defined (TOPLEFT_SUBSAMPLING)
|
||||
float3 tex_right_left_top : TEXCOORD;
|
||||
float3 tex_right_left_bottom : TEXCOORD;
|
||||
#else
|
||||
float2 tex_coord : TEXCOORD;
|
||||
#endif
|
||||
};
|
||||
@ -1,41 +1,41 @@
|
||||
// This is a fast sRGB approximation from Microsoft's ColorSpaceUtility.hlsli
|
||||
float3 ApplySRGBCurve(float3 x)
|
||||
{
|
||||
return x < 0.0031308 ? 12.92 * x : 1.13005 * sqrt(x - 0.00228) - 0.13448 * x + 0.005719;
|
||||
}
|
||||
|
||||
float3 NitsToPQ(float3 L)
|
||||
{
|
||||
// Constants from SMPTE 2084 PQ
|
||||
static const float m1 = 2610.0 / 4096.0 / 4;
|
||||
static const float m2 = 2523.0 / 4096.0 * 128;
|
||||
static const float c1 = 3424.0 / 4096.0;
|
||||
static const float c2 = 2413.0 / 4096.0 * 32;
|
||||
static const float c3 = 2392.0 / 4096.0 * 32;
|
||||
|
||||
float3 Lp = pow(saturate(L / 10000.0), m1);
|
||||
return pow((c1 + c2 * Lp) / (1 + c3 * Lp), m2);
|
||||
}
|
||||
|
||||
float3 Rec709toRec2020(float3 rec709)
|
||||
{
|
||||
static const float3x3 ConvMat =
|
||||
{
|
||||
0.627402, 0.329292, 0.043306,
|
||||
0.069095, 0.919544, 0.011360,
|
||||
0.016394, 0.088028, 0.895578
|
||||
};
|
||||
return mul(ConvMat, rec709);
|
||||
}
|
||||
|
||||
float3 scRGBTo2100PQ(float3 rgb)
|
||||
{
|
||||
// Convert from Rec 709 primaries (used by scRGB) to Rec 2020 primaries (used by Rec 2100)
|
||||
rgb = Rec709toRec2020(rgb);
|
||||
|
||||
// 1.0f is defined as 80 nits in the scRGB colorspace
|
||||
rgb *= 80;
|
||||
|
||||
// Apply the PQ transfer function on the raw color values in nits
|
||||
return NitsToPQ(rgb);
|
||||
}
|
||||
// This is a fast sRGB approximation from Microsoft's ColorSpaceUtility.hlsli
|
||||
float3 ApplySRGBCurve(float3 x)
|
||||
{
|
||||
return x < 0.0031308 ? 12.92 * x : 1.13005 * sqrt(x - 0.00228) - 0.13448 * x + 0.005719;
|
||||
}
|
||||
|
||||
float3 NitsToPQ(float3 L)
|
||||
{
|
||||
// Constants from SMPTE 2084 PQ
|
||||
static const float m1 = 2610.0 / 4096.0 / 4;
|
||||
static const float m2 = 2523.0 / 4096.0 * 128;
|
||||
static const float c1 = 3424.0 / 4096.0;
|
||||
static const float c2 = 2413.0 / 4096.0 * 32;
|
||||
static const float c3 = 2392.0 / 4096.0 * 32;
|
||||
|
||||
float3 Lp = pow(saturate(L / 10000.0), m1);
|
||||
return pow((c1 + c2 * Lp) / (1 + c3 * Lp), m2);
|
||||
}
|
||||
|
||||
float3 Rec709toRec2020(float3 rec709)
|
||||
{
|
||||
static const float3x3 ConvMat =
|
||||
{
|
||||
0.627402, 0.329292, 0.043306,
|
||||
0.069095, 0.919544, 0.011360,
|
||||
0.016394, 0.088028, 0.895578
|
||||
};
|
||||
return mul(ConvMat, rec709);
|
||||
}
|
||||
|
||||
float3 scRGBTo2100PQ(float3 rgb)
|
||||
{
|
||||
// Convert from Rec 709 primaries (used by scRGB) to Rec 2020 primaries (used by Rec 2100)
|
||||
rgb = Rec709toRec2020(rgb);
|
||||
|
||||
// 1.0f is defined as 80 nits in the scRGB colorspace
|
||||
rgb *= 80;
|
||||
|
||||
// Apply the PQ transfer function on the raw color values in nits
|
||||
return NitsToPQ(rgb);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user