libobs: Remove need for DrawMatrix technique in effects
(Note: This commit also modifies obs-filters and text-freetype2) This simplifies writing of effects. DrawMatrix is no longer necessary because there are no sources that require drawing with a color matrix other than async sources, and async sources are automatically processed and don't defer their initial render stage to filters.
This commit is contained in:
parent
e9a814740b
commit
9e15e3d8fd
@ -1,7 +1,4 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform float4x4 color_matrix;
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
uniform texture_rect image;
|
||||
|
||||
sampler_state def_sampler {
|
||||
@ -28,13 +25,6 @@ float4 PSDrawBare(VertInOut vert_in) : TARGET
|
||||
return image.Sample(def_sampler, vert_in.uv);
|
||||
}
|
||||
|
||||
float4 PSDrawMatrix(VertInOut vert_in) : TARGET
|
||||
{
|
||||
float4 yuv = image.Sample(def_sampler, vert_in.uv);
|
||||
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
|
||||
return saturate(mul(float4(yuv.xyz, 1.0), color_matrix));
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@ -43,13 +33,3 @@ technique Draw
|
||||
pixel_shader = PSDrawBare(vert_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(vert_in);
|
||||
pixel_shader = PSDrawMatrix(vert_in);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1606,11 +1606,10 @@ static inline void obs_source_render_filters(obs_source_t *source)
|
||||
source->rendering_filter = false;
|
||||
}
|
||||
|
||||
static void obs_source_default_render(obs_source_t *source, bool color_matrix)
|
||||
static void obs_source_default_render(obs_source_t *source)
|
||||
{
|
||||
gs_effect_t *effect = obs->video.default_effect;
|
||||
const char *tech_name = color_matrix ? "DrawMatrix" : "Draw";
|
||||
gs_technique_t *tech = gs_effect_get_technique(effect, tech_name);
|
||||
gs_technique_t *tech = gs_effect_get_technique(effect, "Draw");
|
||||
size_t passes, i;
|
||||
|
||||
passes = gs_technique_begin(tech);
|
||||
@ -1626,14 +1625,13 @@ static void obs_source_default_render(obs_source_t *source, bool color_matrix)
|
||||
static inline void obs_source_main_render(obs_source_t *source)
|
||||
{
|
||||
uint32_t flags = source->info.output_flags;
|
||||
bool color_matrix = (flags & OBS_SOURCE_COLOR_MATRIX) != 0;
|
||||
bool custom_draw = (flags & OBS_SOURCE_CUSTOM_DRAW) != 0;
|
||||
bool default_effect = !source->filter_parent &&
|
||||
source->filters.num == 0 &&
|
||||
!custom_draw;
|
||||
|
||||
if (default_effect)
|
||||
obs_source_default_render(source, color_matrix);
|
||||
obs_source_default_render(source);
|
||||
else if (source->context.data)
|
||||
source->info.video_render(source->context.data,
|
||||
custom_draw ? NULL : gs_get_effect());
|
||||
@ -2594,10 +2592,9 @@ const char *obs_source_get_id(const obs_source_t *source)
|
||||
}
|
||||
|
||||
static inline void render_filter_bypass(obs_source_t *target,
|
||||
gs_effect_t *effect, bool use_matrix)
|
||||
gs_effect_t *effect)
|
||||
{
|
||||
const char *tech_name = use_matrix ? "DrawMatrix" : "Draw";
|
||||
gs_technique_t *tech = gs_effect_get_technique(effect, tech_name);
|
||||
gs_technique_t *tech = gs_effect_get_technique(effect, "Draw");
|
||||
size_t passes, i;
|
||||
|
||||
passes = gs_technique_begin(tech);
|
||||
@ -2610,10 +2607,9 @@ static inline void render_filter_bypass(obs_source_t *target,
|
||||
}
|
||||
|
||||
static inline void render_filter_tex(gs_texture_t *tex, gs_effect_t *effect,
|
||||
uint32_t width, uint32_t height, bool use_matrix)
|
||||
uint32_t width, uint32_t height)
|
||||
{
|
||||
const char *tech_name = use_matrix ? "DrawMatrix" : "Draw";
|
||||
gs_technique_t *tech = gs_effect_get_technique(effect, tech_name);
|
||||
gs_technique_t *tech = gs_effect_get_technique(effect, "Draw");
|
||||
gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image");
|
||||
size_t passes, i;
|
||||
|
||||
@ -2645,7 +2641,6 @@ void obs_source_process_filter_begin(obs_source_t *filter,
|
||||
obs_source_t *target, *parent;
|
||||
uint32_t target_flags, parent_flags;
|
||||
int cx, cy;
|
||||
bool use_matrix;
|
||||
|
||||
if (!obs_ptr_valid(filter, "obs_source_process_filter_begin"))
|
||||
return;
|
||||
@ -2656,7 +2651,6 @@ void obs_source_process_filter_begin(obs_source_t *filter,
|
||||
parent_flags = parent->info.output_flags;
|
||||
cx = get_base_width(target);
|
||||
cy = get_base_height(target);
|
||||
use_matrix = !!(target_flags & OBS_SOURCE_COLOR_MATRIX);
|
||||
|
||||
filter->allow_direct = allow_direct;
|
||||
|
||||
@ -2690,7 +2684,7 @@ void obs_source_process_filter_begin(obs_source_t *filter,
|
||||
gs_ortho(0.0f, (float)cx, 0.0f, (float)cy, -100.0f, 100.0f);
|
||||
|
||||
if (target == parent && !custom_draw && !async)
|
||||
obs_source_default_render(target, use_matrix);
|
||||
obs_source_default_render(target);
|
||||
else
|
||||
obs_source_video_render(target);
|
||||
|
||||
@ -2706,7 +2700,6 @@ void obs_source_process_filter_end(obs_source_t *filter, gs_effect_t *effect,
|
||||
obs_source_t *target, *parent;
|
||||
gs_texture_t *texture;
|
||||
uint32_t target_flags, parent_flags;
|
||||
bool use_matrix;
|
||||
|
||||
if (!obs_ptr_valid(filter, "obs_source_process_filter_end"))
|
||||
return;
|
||||
@ -2715,15 +2708,13 @@ void obs_source_process_filter_end(obs_source_t *filter, gs_effect_t *effect,
|
||||
parent = obs_filter_get_parent(filter);
|
||||
target_flags = target->info.output_flags;
|
||||
parent_flags = parent->info.output_flags;
|
||||
use_matrix = !!(target_flags & OBS_SOURCE_COLOR_MATRIX);
|
||||
|
||||
if (can_bypass(target, parent, parent_flags, filter->allow_direct)) {
|
||||
render_filter_bypass(target, effect, use_matrix);
|
||||
render_filter_bypass(target, effect);
|
||||
} else {
|
||||
texture = gs_texrender_get_texture(filter->filter_texrender);
|
||||
if (texture)
|
||||
render_filter_tex(texture, effect, width, height,
|
||||
use_matrix);
|
||||
render_filter_tex(texture, effect, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2732,7 +2723,6 @@ void obs_source_skip_video_filter(obs_source_t *filter)
|
||||
obs_source_t *target, *parent;
|
||||
bool custom_draw, async;
|
||||
uint32_t parent_flags;
|
||||
bool use_matrix;
|
||||
|
||||
if (!obs_ptr_valid(filter, "obs_source_skip_video_filter"))
|
||||
return;
|
||||
@ -2742,11 +2732,10 @@ void obs_source_skip_video_filter(obs_source_t *filter)
|
||||
parent_flags = parent->info.output_flags;
|
||||
custom_draw = (parent_flags & OBS_SOURCE_CUSTOM_DRAW) != 0;
|
||||
async = (parent_flags & OBS_SOURCE_ASYNC) != 0;
|
||||
use_matrix = !!(parent_flags & OBS_SOURCE_COLOR_MATRIX);
|
||||
|
||||
if (target == parent) {
|
||||
if (!custom_draw && !async)
|
||||
obs_source_default_render(target, use_matrix);
|
||||
obs_source_default_render(target);
|
||||
else if (target->info.video_render)
|
||||
obs_source_main_render(target);
|
||||
else
|
||||
|
@ -87,15 +87,6 @@ enum obs_source_type {
|
||||
*/
|
||||
#define OBS_SOURCE_CUSTOM_DRAW (1<<3)
|
||||
|
||||
/**
|
||||
* Source uses a color matrix (usually YUV sources).
|
||||
*
|
||||
* When this is used, the video_render callback will automatically assign a
|
||||
* 4x4 YUV->RGB matrix to the "color_matrix" parameter of the effect, or it can
|
||||
* be changed to a custom value.
|
||||
*/
|
||||
#define OBS_SOURCE_COLOR_MATRIX (1<<4)
|
||||
|
||||
/**
|
||||
* Source supports interaction.
|
||||
*
|
||||
|
@ -1,8 +1,5 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix;
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform texture2d target;
|
||||
uniform float4 color;
|
||||
@ -44,19 +41,6 @@ float4 PSAddImageRGBA(VertDataOut v_in) : TARGET
|
||||
return rgba;
|
||||
}
|
||||
|
||||
float4 PSAddImageMatrix(VertDataOut v_in) : TARGET
|
||||
{
|
||||
float4 yuv = image.Sample(textureSampler, v_in.uv);
|
||||
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
|
||||
|
||||
float4 rgba = saturate(mul(float4(yuv.xyz, 1.0), color_matrix)) *
|
||||
color;
|
||||
|
||||
float4 targetRGB = target.Sample(textureSampler, v_in.uv2);
|
||||
rgba.rgb = saturate(rgba.rgb + targetRGB.rgb);
|
||||
return rgba;
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@ -65,12 +49,3 @@ technique Draw
|
||||
pixel_shader = PSAddImageRGBA(v_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PSAddImageMatrix(v_in);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix;
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform texture2d target;
|
||||
uniform float4 color;
|
||||
@ -44,19 +41,6 @@ float4 PSMuliplyImageRGBA(VertDataOut v_in) : TARGET
|
||||
return rgba;
|
||||
}
|
||||
|
||||
float4 PSMuliplyImageMatrix(VertDataOut v_in) : TARGET
|
||||
{
|
||||
float4 yuv = image.Sample(textureSampler, v_in.uv);
|
||||
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
|
||||
|
||||
float4 rgba = saturate(mul(float4(yuv.xyz, 1.0), color_matrix)) *
|
||||
color;
|
||||
|
||||
float4 targetRGB = target.Sample(textureSampler, v_in.uv2);
|
||||
rgba.rgb = saturate(rgba.rgb * targetRGB.rgb);
|
||||
return rgba;
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@ -65,12 +49,3 @@ technique Draw
|
||||
pixel_shader = PSMuliplyImageRGBA(v_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PSMuliplyImageMatrix(v_in);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix;
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform texture2d target;
|
||||
uniform float4 color;
|
||||
@ -44,19 +41,6 @@ float4 PSSubtractImageRGBA(VertDataOut v_in) : TARGET
|
||||
return rgba;
|
||||
}
|
||||
|
||||
float4 PSSubtractImageMatrix(VertDataOut v_in) : TARGET
|
||||
{
|
||||
float4 yuv = image.Sample(textureSampler, v_in.uv);
|
||||
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
|
||||
|
||||
float4 rgba = saturate(mul(float4(yuv.xyz, 1.0), color_matrix)) *
|
||||
color;
|
||||
|
||||
float4 targetRGB = target.Sample(textureSampler, v_in.uv2);
|
||||
rgba.rgb = saturate(rgba.rgb - targetRGB.rgb);
|
||||
return rgba;
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@ -65,12 +49,3 @@ technique Draw
|
||||
pixel_shader = PSSubtractImageRGBA(v_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PSSubtractImageMatrix(v_in);
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,5 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix = {1.0, 0.0, 0.0, 0.0,
|
||||
0.0, 1.0, 0.0, 0.0,
|
||||
0.0, 0.0, 1.0, 0.0,
|
||||
0.0, 0.0, 0.0, 1.0};
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform float4x4 yuv_mat = { 0.182586, 0.614231, 0.062007, 0.062745,
|
||||
-0.100644, -0.338572, 0.439216, 0.501961,
|
||||
@ -107,12 +101,6 @@ float4 PSChromaKeyRGBA(VertData v_in) : TARGET
|
||||
return ProcessChromaKey(rgba, v_in, false);
|
||||
}
|
||||
|
||||
float4 PSChromaKeyMatrix(VertData v_in) : TARGET
|
||||
{
|
||||
float4 rgba = SampleYUVToRGB(v_in.uv) * color;
|
||||
return ProcessChromaKey(rgba, v_in, true);
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@ -121,12 +109,3 @@ technique Draw
|
||||
pixel_shader = PSChromaKeyRGBA(v_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PSChromaKeyMatrix(v_in);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix;
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform float4 color;
|
||||
uniform float contrast;
|
||||
@ -39,15 +36,6 @@ float4 PSColorFilterRGBA(VertData v_in) : TARGET
|
||||
return CalcColor(rgba);
|
||||
}
|
||||
|
||||
float4 PSColorFilterMatrix(VertData v_in) : TARGET
|
||||
{
|
||||
float4 yuv = image.Sample(textureSampler, v_in.uv);
|
||||
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
|
||||
float4 rgba = saturate(mul(float4(yuv.xyz, 1.0), color_matrix)) * color;
|
||||
|
||||
return CalcColor(rgba);
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@ -56,12 +44,3 @@ technique Draw
|
||||
pixel_shader = PSColorFilterRGBA(v_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PSColorFilterMatrix(v_in);
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,5 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix = {1.0, 0.0, 0.0, 0.0,
|
||||
0.0, 1.0, 0.0, 0.0,
|
||||
0.0, 0.0, 1.0, 0.0,
|
||||
0.0, 0.0, 0.0, 1.0};
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform float4 color;
|
||||
uniform float contrast;
|
||||
@ -67,12 +61,6 @@ float4 PSColorKeyRGBA(VertData v_in) : TARGET
|
||||
return ProcessColorKey(rgba, v_in);
|
||||
}
|
||||
|
||||
float4 PSColorKeyMatrix(VertData v_in) : TARGET
|
||||
{
|
||||
float4 rgba = SampleYUVToRGB(v_in.uv) * color;
|
||||
return ProcessColorKey(rgba, v_in);
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@ -81,12 +69,3 @@ technique Draw
|
||||
pixel_shader = PSColorKeyRGBA(v_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PSColorKeyMatrix(v_in);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix;
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform texture2d target;
|
||||
uniform float4 color;
|
||||
@ -44,19 +41,6 @@ float4 PSAlphaMaskRGBA(VertDataOut v_in) : TARGET
|
||||
return rgba;
|
||||
}
|
||||
|
||||
float4 PSAlphaMaskMatrix(VertDataOut v_in) : TARGET
|
||||
{
|
||||
float4 yuv = image.Sample(textureSampler, v_in.uv);
|
||||
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
|
||||
|
||||
float4 rgba = saturate(mul(float4(yuv.xyz, 1.0), color_matrix)) *
|
||||
color;
|
||||
|
||||
float4 targetRGB = target.Sample(textureSampler, v_in.uv2);
|
||||
rgba.a = targetRGB.a;
|
||||
return rgba;
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@ -65,12 +49,3 @@ technique Draw
|
||||
pixel_shader = PSAlphaMaskRGBA(v_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PSAlphaMaskMatrix(v_in);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix;
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform texture2d target;
|
||||
uniform float4 color;
|
||||
@ -44,19 +41,6 @@ float4 PSColorMaskRGBA(VertDataOut v_in) : TARGET
|
||||
return rgba;
|
||||
}
|
||||
|
||||
float4 PSColorMaskMatrix(VertDataOut v_in) : TARGET
|
||||
{
|
||||
float4 yuv = image.Sample(textureSampler, v_in.uv);
|
||||
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
|
||||
|
||||
float4 rgba = saturate(mul(float4(yuv.xyz, 1.0), color_matrix)) *
|
||||
color;
|
||||
|
||||
float4 targetRGB = target.Sample(textureSampler, v_in.uv2);
|
||||
rgba.a = (targetRGB.r + targetRGB.g + targetRGB.b) / 3.0;
|
||||
return rgba;
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@ -66,11 +50,3 @@ technique Draw
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(v_in);
|
||||
pixel_shader = PSColorMaskMatrix(v_in);
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,6 @@
|
||||
|
||||
uniform float4x4 ViewProj;
|
||||
uniform texture2d image;
|
||||
uniform float4x4 color_matrix;
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
|
||||
uniform texture2d target;
|
||||
uniform float4 color = {1.0, 1.0, 1.0, 1.0};
|
||||
@ -74,31 +71,6 @@ float4 PSDrawBare(VertOut vert_in) : TARGET
|
||||
return colorx;
|
||||
}
|
||||
|
||||
float4 PSDrawMatrix(VertOut vert_in) : TARGET
|
||||
{
|
||||
float4 E = image.Sample(def_sampler, vert_in.uv);
|
||||
|
||||
float4 colorx = 8*E;
|
||||
float4 B = image.Sample(def_sampler, vert_in.t1.yw);
|
||||
float4 D = image.Sample(def_sampler, vert_in.t2.xw);
|
||||
float4 F = image.Sample(def_sampler, vert_in.t2.zw);
|
||||
float4 H = image.Sample(def_sampler, vert_in.t3.yw);
|
||||
colorx -= image.Sample(def_sampler, vert_in.t1.xw);
|
||||
colorx -= B;
|
||||
colorx -= image.Sample(def_sampler, vert_in.t1.zw);
|
||||
colorx -= D;
|
||||
colorx -= F;
|
||||
colorx -= image.Sample(def_sampler, vert_in.t3.xw);
|
||||
colorx -= H;
|
||||
colorx -= image.Sample(def_sampler, vert_in.t3.zw);
|
||||
|
||||
colorx = ((E!=F && E!=D) || (E!=B && E!=H)) ? saturate(E + colorx*sharpness) : E;
|
||||
|
||||
float4 yuv = colorx;
|
||||
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
|
||||
return saturate(mul(float4(yuv.xyz, 1.0), color_matrix));
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@ -107,12 +79,3 @@ technique Draw
|
||||
pixel_shader = PSDrawBare(vert_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(vert_in);
|
||||
pixel_shader = PSDrawMatrix(vert_in);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,4 @@
|
||||
uniform float4x4 ViewProj;
|
||||
uniform float4x4 color_matrix;
|
||||
uniform float3 color_range_min = {0.0, 0.0, 0.0};
|
||||
uniform float3 color_range_max = {1.0, 1.0, 1.0};
|
||||
uniform texture2d image;
|
||||
|
||||
sampler_state def_sampler {
|
||||
@ -30,13 +27,6 @@ float4 PSDrawBare(VertInOut vert_in) : TARGET
|
||||
return image.Sample(def_sampler, vert_in.uv) * vert_in.col;
|
||||
}
|
||||
|
||||
float4 PSDrawMatrix(VertInOut vert_in) : TARGET
|
||||
{
|
||||
float4 yuv = image.Sample(def_sampler, vert_in.uv);
|
||||
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
|
||||
return saturate(mul(float4(yuv.xyz, 1.0), color_matrix));
|
||||
}
|
||||
|
||||
technique Draw
|
||||
{
|
||||
pass
|
||||
@ -45,12 +35,3 @@ technique Draw
|
||||
pixel_shader = PSDrawBare(vert_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique DrawMatrix
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSDefault(vert_in);
|
||||
pixel_shader = PSDrawMatrix(vert_in);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user