Loading...
Searching...
No Matches
CaptureAdjustGLSL.hpp
Go to the documentation of this file.
1#pragma once
2
25namespace score::gfx
26{
27
30#define SCORE_GFX_CAPTURE_UNIFORMS \
31 "layout(std140, binding = 0) uniform renderer_t {\n" \
32 " mat4 clipSpaceCorrMatrix;\n" \
33 " vec2 renderSize;\n" \
34 "} renderer;\n" \
35 "\n" \
36 "layout(std140, binding = 2) uniform material_t {\n" \
37 " vec2 scale;\n" \
38 " vec2 texSz;\n" \
39 " vec4 blackLevel;\n" \
40 " vec4 whiteBalance;\n" \
41 " vec4 params;\n" \
42 "} mat;\n"
43
48#define SCORE_GFX_CAPTURE_ADJUST_FN \
49 "vec3 adjustCapture(vec3 c)\n" \
50 "{\n" \
51 " vec3 bl = mat.blackLevel.rgb;\n" \
52 " c = (c - bl) / max(vec3(1.0 / 65535.0), vec3(1.0) - bl);\n" \
53 " c *= mat.whiteBalance.rgb;\n" \
54 " c *= mat.params.x;\n" \
55 " c = max(c, vec3(0.0));\n" \
56 " float l = dot(c, vec3(0.2126, 0.7152, 0.0722));\n" \
57 " c = mix(vec3(l), c, mat.params.z);\n" \
58 " c = max(c, vec3(0.0));\n" \
59 " c = pow(c, vec3(1.0 / max(mat.params.y, 1.0 / 65535.0)));\n" \
60 " return clamp(c, 0.0, 1.0);\n" \
61 "}\n"
62
72static const constexpr auto captureVertexShader = R"_(#version 450
73layout(location = 0) in vec2 position;
74layout(location = 1) in vec2 texcoord;
75
76layout(location = 0) out vec2 v_texcoord;
77
79
80out gl_PerVertex { vec4 gl_Position; };
81
82void main()
83{
84 v_texcoord = texcoord;
85 gl_Position = renderer.clipSpaceCorrMatrix * vec4(position.x * mat.scale.x, position.y * mat.scale.y, 0.0, 1.);
86#if defined(QSHADER_HLSL) || defined(QSHADER_MSL)
87 gl_Position.y = - gl_Position.y;
88#endif
89}
90)_";
91
92
93} // namespace score::gfx
#define SCORE_GFX_CAPTURE_UNIFORMS
Definition CaptureAdjustGLSL.hpp:30
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11