fix(win/video): don't offload chroma subsampling math to texture sampler when downscaling (#3014)
* Don't use sampler math for chroma if downscaling * Correct portrait rotation offsets
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
#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;
|
||||
@@ -30,11 +24,24 @@ vertex_t generate_fullscreen_triangle_vertex(uint vertex_id, int rotate_texture_
|
||||
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 (rotate_texture_steps % 2) {
|
||||
subsample_offset.xy = subsample_offset.yx;
|
||||
}
|
||||
}
|
||||
|
||||
#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_center = float3(tex_coord.x, tex_coord.x - subsample_offset.x, tex_coord.y);
|
||||
#elif defined(LEFT_SUBSAMPLING_SCALE)
|
||||
float2 halfsample_offset = subsample_offset / 2;
|
||||
float3 right_center_left = float3(tex_coord.x + halfsample_offset.x,
|
||||
tex_coord.x - halfsample_offset.x,
|
||||
tex_coord.x - 3 * halfsample_offset.x);
|
||||
float2 top_bottom = float2(tex_coord.y - halfsample_offset.y,
|
||||
tex_coord.y + halfsample_offset.y);
|
||||
output.tex_right_center_left_top = float4(right_center_left, top_bottom.x);
|
||||
output.tex_right_center_left_bottom = float4(right_center_left, top_bottom.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
|
||||
|
||||
Reference in New Issue
Block a user