-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
118 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src_assets/windows/assets/shaders/directx/convert_yuv444in420_nv12_uv_ps.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#include "include/convert_base.hlsl" | ||
|
||
#define PROTOTYPE_UV_SAMPLING | ||
#include "include/convert_yuv444in420_ps_base.hlsl" |
1 change: 1 addition & 0 deletions
1
src_assets/windows/assets/shaders/directx/convert_yuv444in420_nv12_uv_ps_linear.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#include "include/convert_linear_base.hlsl" | ||
|
||
#define PROTOTYPE_UV_SAMPLING | ||
#include "include/convert_yuv444in420_ps_base.hlsl" |
1 change: 0 additions & 1 deletion
1
src_assets/windows/assets/shaders/directx/convert_yuv444in420_nv12_y_ps.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#include "include/convert_base.hlsl" | ||
|
||
#define PLANAR_VIEWPORTS | ||
#include "include/convert_yuv444in420_ps_base.hlsl" |
1 change: 0 additions & 1 deletion
1
src_assets/windows/assets/shaders/directx/convert_yuv444in420_nv12_y_ps_linear.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#include "include/convert_linear_base.hlsl" | ||
|
||
#define PLANAR_VIEWPORTS | ||
#include "include/convert_yuv444in420_ps_base.hlsl" |
1 change: 1 addition & 0 deletions
1
src_assets/windows/assets/shaders/directx/convert_yuv444in420_p010_uv_ps.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#include "include/convert_base.hlsl" | ||
|
||
#define P010 | ||
#define PROTOTYPE_UV_SAMPLING | ||
#include "include/convert_yuv444in420_ps_base.hlsl" |
1 change: 1 addition & 0 deletions
1
src_assets/windows/assets/shaders/directx/convert_yuv444in420_p010_uv_ps_linear.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#include "include/convert_linear_base.hlsl" | ||
|
||
#define P010 | ||
#define PROTOTYPE_UV_SAMPLING | ||
#include "include/convert_yuv444in420_ps_base.hlsl" |
1 change: 1 addition & 0 deletions
1
...s/windows/assets/shaders/directx/convert_yuv444in420_p010_uv_ps_perceptual_quantizer.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#include "include/convert_perceptual_quantizer_base.hlsl" | ||
|
||
#define P010 | ||
#define PROTOTYPE_UV_SAMPLING | ||
#include "include/convert_yuv444in420_ps_base.hlsl" |
1 change: 0 additions & 1 deletion
1
src_assets/windows/assets/shaders/directx/convert_yuv444in420_p010_y_ps.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#include "include/convert_base.hlsl" | ||
|
||
#define PLANAR_VIEWPORTS | ||
#define P010 | ||
#include "include/convert_yuv444in420_ps_base.hlsl" |
1 change: 0 additions & 1 deletion
1
src_assets/windows/assets/shaders/directx/convert_yuv444in420_p010_y_ps_linear.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#include "include/convert_linear_base.hlsl" | ||
|
||
#define PLANAR_VIEWPORTS | ||
#define P010 | ||
#include "include/convert_yuv444in420_ps_base.hlsl" |
1 change: 0 additions & 1 deletion
1
...ts/windows/assets/shaders/directx/convert_yuv444in420_p010_y_ps_perceptual_quantizer.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#include "include/convert_perceptual_quantizer_base.hlsl" | ||
|
||
#define PLANAR_VIEWPORTS | ||
#define P010 | ||
#include "include/convert_yuv444in420_ps_base.hlsl" |
30 changes: 29 additions & 1 deletion
30
src_assets/windows/assets/shaders/directx/convert_yuv444in420_uv_vs.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,29 @@ | ||
#include "include/convert_yuv444in420_vs_base.hlsl" | ||
cbuffer subsample_offset_cbuffer : register(b0) { | ||
float2 subsample_offset; | ||
}; | ||
|
||
cbuffer rotate_texture_steps_cbuffer : register(b1) { | ||
int rotate_texture_steps; | ||
}; | ||
|
||
cbuffer color_matrix_cbuffer : register(b3) { | ||
float4 color_vec_y; | ||
float4 color_vec_u; | ||
float4 color_vec_v; | ||
float2 range_y; | ||
float2 range_uv; | ||
}; | ||
|
||
#define PLANAR_VIEWPORTS | ||
#define PROTOTYPE_UV_SAMPLING | ||
#include "include/base_vs.hlsl" | ||
|
||
vertex_t main_vs(uint vertex_id : SV_VertexID) | ||
{ | ||
vertex_t output = generate_fullscreen_triangle_vertex(vertex_id % 3, subsample_offset, vertex_id / 3, rotate_texture_steps); | ||
|
||
output.viewport = vertex_id / 3; | ||
output.color_vec = color_vec_v; | ||
|
||
return output; | ||
} |
30 changes: 29 additions & 1 deletion
30
src_assets/windows/assets/shaders/directx/convert_yuv444in420_y_vs.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,30 @@ | ||
cbuffer rotate_texture_steps_cbuffer : register(b1) { | ||
int rotate_texture_steps; | ||
}; | ||
|
||
cbuffer color_matrix_cbuffer : register(b3) { | ||
float4 color_vec_y; | ||
float4 color_vec_u; | ||
float4 color_vec_v; | ||
float2 range_y; | ||
float2 range_uv; | ||
}; | ||
|
||
#define PLANAR_VIEWPORTS | ||
#include "include/convert_yuv444in420_vs_base.hlsl" | ||
#include "include/base_vs.hlsl" | ||
|
||
vertex_t main_vs(uint vertex_id : SV_VertexID) | ||
{ | ||
vertex_t output = generate_fullscreen_triangle_vertex(vertex_id % 3, rotate_texture_steps); | ||
|
||
output.viewport = vertex_id / 3; | ||
|
||
if (output.viewport == 0) { | ||
output.color_vec = color_vec_y; | ||
} | ||
else { | ||
output.color_vec = color_vec_u; | ||
} | ||
|
||
return output; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src_assets/windows/assets/shaders/directx/include/base_vs_types.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 25 additions & 34 deletions
59
src_assets/windows/assets/shaders/directx/include/convert_yuv444in420_ps_base.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,42 @@ | ||
Texture2D image : register(t0); | ||
SamplerState def_sampler : register(s0); | ||
|
||
#ifndef PLANAR_VIEWPORTS | ||
cbuffer color_matrix_cbuffer : register(b0) { | ||
float4 color_vec_y; | ||
float4 color_vec_u; | ||
float4 color_vec_v; | ||
float2 range_y; | ||
float2 range_uv; | ||
}; | ||
#endif | ||
|
||
#define PLANAR_VIEWPORTS | ||
#include "include/base_vs_types.hlsl" | ||
|
||
#ifdef PLANAR_VIEWPORTS | ||
uint main_ps(vertex_t input) : SV_Target | ||
#else | ||
#ifdef PROTOTYPE_UV_SAMPLING | ||
uint2 main_ps(vertex_t input) : SV_Target | ||
#else | ||
uint main_ps(vertex_t input) : SV_Target | ||
#endif | ||
{ | ||
// Y U V | ||
// +-------+ +---+ +---+ | ||
// | | | | | | | ||
// VP0-> | Y | |UR | |VR | | ||
// | | | | | | | ||
// +---+---+ +---+ +---+ | ||
// | | | | ||
// VP1-> |UL |VL | <-VP2 | ||
// | | | | ||
// +---+---+ | ||
|
||
float3 rgb = CONVERT_FUNCTION(image.Sample(def_sampler, input.tex_coord, 0).rgb); | ||
|
||
#ifdef PLANAR_VIEWPORTS | ||
float y = dot(input.color_vec.xyz, rgb) + input.color_vec.w; | ||
// Y U V | ||
// +-------+ +---+ +---+ | ||
// | | |V0 | |V1 | | ||
// | Y | +---+ +---+ | ||
// | | |V2 | |V3 | | ||
// +-------+ +---+ +---+ | ||
// | | | ||
// | U | | ||
// | | | ||
// +-------+ | ||
#ifdef PROTOTYPE_UV_SAMPLING | ||
float3 rgb_left = CONVERT_FUNCTION(image.Sample(def_sampler, input.tex_right_left_center.yz).rgb); | ||
float3 rgb_right = CONVERT_FUNCTION(image.Sample(def_sampler, input.tex_right_left_center.xz).rgb); | ||
uint2 vv = uint2(dot(input.color_vec.xyz, rgb_left) + input.color_vec.w, | ||
dot(input.color_vec.xyz, rgb_right) + input.color_vec.w); | ||
#ifdef P010 | ||
return uint(y) << 6; | ||
return vv << 6; | ||
#else | ||
return uint(y); | ||
return vv; | ||
#endif | ||
#else | ||
float u = dot(color_vec_u.xyz, rgb) + color_vec_u.w; | ||
float v = dot(color_vec_v.xyz, rgb) + color_vec_v.w; | ||
float3 rgb = CONVERT_FUNCTION(image.Sample(def_sampler, input.tex_coord, 0).rgb); | ||
uint yu = dot(input.color_vec.xyz, rgb) + input.color_vec.w; | ||
#ifdef P010 | ||
return uint2(u, v) << 6; | ||
return yu << 6; | ||
#else | ||
return uint2(u, v); | ||
return yu; | ||
#endif | ||
#endif | ||
} |
Oops, something went wrong.