mirror of
https://github.com/korenkonder/ReDIVA.git
synced 2026-10-06 13:48:01 +03:00
NVENC: Handle color conversion by ourself on GPU
This commit is contained in:
@@ -11,12 +11,39 @@
|
||||
|
||||
enum shader_dev_sub_enum {
|
||||
SHADER_DEV_SUB_SHADER_FFP = 0,
|
||||
SHADER_DEV_SUB_CONVERT_YCBCR_BT709,
|
||||
SHADER_DEV_SUB_CONVERT_RGB,
|
||||
SHADER_DEV_SUB_CONVERT_ALPHA,
|
||||
#if DISPLAY_IBL
|
||||
SHADER_DEV_SUB_CUBEMAP_DISPLAY,
|
||||
#endif
|
||||
SHADER_DEV_SUB_SHADER_END,
|
||||
};
|
||||
|
||||
static const int32_t convert_ycbcr_bt709_vpt_unival_max[] = {
|
||||
-1,
|
||||
};
|
||||
|
||||
static const int32_t convert_ycbcr_bt709_fpt_unival_max[] = {
|
||||
-1,
|
||||
};
|
||||
|
||||
static const int32_t convert_alpha_vpt_unival_max[] = {
|
||||
-1,
|
||||
};
|
||||
|
||||
static const int32_t convert_alpha_fpt_unival_max[] = {
|
||||
-1,
|
||||
};
|
||||
|
||||
static const int32_t convert_rgb_vpt_unival_max[] = {
|
||||
-1,
|
||||
};
|
||||
|
||||
static const int32_t convert_rgb_fpt_unival_max[] = {
|
||||
-1,
|
||||
};
|
||||
|
||||
#if DISPLAY_IBL
|
||||
static const int32_t cubemap_display_vpt_unival_max[] = {
|
||||
-1,
|
||||
@@ -44,6 +71,39 @@ static const int32_t cubemap_display_fpt_unival_max[] = {
|
||||
#define SHADER_DESCRIPTION_COMMON_QUAD \
|
||||
{ SHADER_DESCRIPTION_UNIFORM, 0, sizeof(quad_shader_data), U_INVALID, }
|
||||
|
||||
static const shader_description convert_ycbcr_bt709_vpt_desc[] = {
|
||||
SHADER_DESCRIPTION_COMMON_QUAD,
|
||||
{ SHADER_DESCRIPTION_END, -1, -1, U_INVALID, },
|
||||
};
|
||||
|
||||
static const shader_description convert_ycbcr_bt709_fpt_desc[] = {
|
||||
{ SHADER_DESCRIPTION_SAMPLER, 0, 0, U_INVALID, },
|
||||
{ SHADER_DESCRIPTION_FRAGMENT_OUTPUT, 0, 4, U_INVALID, },
|
||||
{ SHADER_DESCRIPTION_END, -1, -1, U_INVALID, },
|
||||
};
|
||||
|
||||
static const shader_description convert_alpha_vpt_desc[] = {
|
||||
SHADER_DESCRIPTION_COMMON_QUAD,
|
||||
{ SHADER_DESCRIPTION_END, -1, -1, U_INVALID, },
|
||||
};
|
||||
|
||||
static const shader_description convert_alpha_fpt_desc[] = {
|
||||
{ SHADER_DESCRIPTION_SAMPLER, 0, 0, U_INVALID, },
|
||||
{ SHADER_DESCRIPTION_FRAGMENT_OUTPUT, 0, 4, U_INVALID, },
|
||||
{ SHADER_DESCRIPTION_END, -1, -1, U_INVALID, },
|
||||
};
|
||||
|
||||
static const shader_description convert_rgb_vpt_desc[] = {
|
||||
SHADER_DESCRIPTION_COMMON_QUAD,
|
||||
{ SHADER_DESCRIPTION_END, -1, -1, U_INVALID, },
|
||||
};
|
||||
|
||||
static const shader_description convert_rgb_fpt_desc[] = {
|
||||
{ SHADER_DESCRIPTION_SAMPLER, 0, 0, U_INVALID, },
|
||||
{ SHADER_DESCRIPTION_FRAGMENT_OUTPUT, 0, 4, U_INVALID, },
|
||||
{ SHADER_DESCRIPTION_END, -1, -1, U_INVALID, },
|
||||
};
|
||||
|
||||
#if DISPLAY_IBL
|
||||
static const shader_description cubemap_display_vpt_desc[] = {
|
||||
{ SHADER_DESCRIPTION_VERTEX_INPUT, 0, 3, U_INVALID, },
|
||||
@@ -65,6 +125,18 @@ static const shader_description cubemap_display_fpt_desc[] = {
|
||||
#undef SHADER_DESCRIPTION_EFFECT_TEXTURE_SAMPLER
|
||||
#pragma endregion
|
||||
|
||||
static const uniform_name CONVERT_YCBCR_BT709_uniform[] = {
|
||||
U_INVALID,
|
||||
};
|
||||
|
||||
static const uniform_name CONVERT_ALPHA_uniform[] = {
|
||||
U_INVALID,
|
||||
};
|
||||
|
||||
static const uniform_name CONVERT_RGB_uniform[] = {
|
||||
U_INVALID,
|
||||
};
|
||||
|
||||
#if DISPLAY_IBL
|
||||
static const uniform_name CUBEMAP_DISPLAY_uniform[] = {
|
||||
U_INVALID,
|
||||
@@ -82,6 +154,21 @@ static const uniform_name CUBEMAP_DISPLAY_uniform[] = {
|
||||
fp##_fpt_desc, \
|
||||
}
|
||||
|
||||
static const shader_sub_table CONVERT_YCBCR_BT709_table[] = {
|
||||
shader_sub_table_struct(CONVERT_YCBCR_BT709,
|
||||
convert_ycbcr_bt709, convert_ycbcr_bt709),
|
||||
};
|
||||
|
||||
static const shader_sub_table CONVERT_ALPHA_table[] = {
|
||||
shader_sub_table_struct(CONVERT_ALPHA,
|
||||
convert_alpha, convert_alpha),
|
||||
};
|
||||
|
||||
static const shader_sub_table CONVERT_RGB_table[] = {
|
||||
shader_sub_table_struct(CONVERT_RGB,
|
||||
convert_rgb, convert_rgb),
|
||||
};
|
||||
|
||||
#if DISPLAY_IBL
|
||||
static const shader_sub_table CUBEMAP_DISPLAY_table[] = {
|
||||
shader_sub_table_struct(CUBEMAP_DISPLAY,
|
||||
@@ -110,6 +197,9 @@ const shader_table shader_dev_table[] = {
|
||||
0,
|
||||
0,
|
||||
},
|
||||
shader_table_struct(CONVERT_YCBCR_BT709),
|
||||
shader_table_struct(CONVERT_ALPHA),
|
||||
shader_table_struct(CONVERT_RGB),
|
||||
#if DISPLAY_IBL
|
||||
shader_table_struct(CUBEMAP_DISPLAY),
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user