mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-04 21:08:40 +00:00
fix flipped y transform application in upgraded shader
This commit is contained in:
@@ -62,12 +62,12 @@ struct CPU2Vertex
|
||||
|
||||
struct Vertex2Pixel
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
float4 position : SV_POSITION;
|
||||
nointerpolation float2 rect_half_size_px : PSIZE;
|
||||
float2 texcoord_pct : TEX;
|
||||
float2 sdf_sample_pos : SDF;
|
||||
float4 tint : TINT;
|
||||
float corner_radius_px : CRAD;
|
||||
float2 texcoord_pct : TEX;
|
||||
float2 sdf_sample_pos : SDF;
|
||||
float4 tint : TINT;
|
||||
float corner_radius_px : CRAD;
|
||||
nointerpolation float border_thickness_px : BTHC;
|
||||
nointerpolation float softness_px : SFT;
|
||||
nointerpolation float omit_texture : OTX;
|
||||
@@ -101,10 +101,10 @@ vs_main(CPU2Vertex cpu2vertex)
|
||||
//- rjf: prep per-vertex arrays to sample from (p: position, t: texcoord, c: colorcoord, r: cornerradius)
|
||||
float2 dst_p_verts_px[] =
|
||||
{
|
||||
float2(dst_p0_px.x, viewport_size_px.y - dst_p1_px.y),
|
||||
float2(dst_p0_px.x, viewport_size_px.y - dst_p0_px.y),
|
||||
float2(dst_p1_px.x, viewport_size_px.y - dst_p1_px.y),
|
||||
float2(dst_p1_px.x, viewport_size_px.y - dst_p0_px.y),
|
||||
float2(dst_p0_px.x, dst_p1_px.y),
|
||||
float2(dst_p0_px.x, dst_p0_px.y),
|
||||
float2(dst_p1_px.x, dst_p1_px.y),
|
||||
float2(dst_p1_px.x, dst_p0_px.y),
|
||||
};
|
||||
float2 src_p_verts_px[] =
|
||||
{
|
||||
@@ -126,14 +126,15 @@ vs_main(CPU2Vertex cpu2vertex)
|
||||
cpu2vertex.color11,
|
||||
cpu2vertex.color10,
|
||||
};
|
||||
float2 dst_verts_pct = float2(
|
||||
(cpu2vertex.vertex_id >> 1) ? 1.f : 0.f,
|
||||
(cpu2vertex.vertex_id & 1) ? 0.f : 1.f);
|
||||
float2 dst_verts_pct = float2((cpu2vertex.vertex_id >> 1) ? 1.f : 0.f,
|
||||
(cpu2vertex.vertex_id & 1) ? 0.f : 1.f);
|
||||
|
||||
// rjf: fill vertex -> pixel data
|
||||
Vertex2Pixel vertex2pixel;
|
||||
{
|
||||
vertex2pixel.position.xy = 2.f * mul(xform, float3(dst_p_verts_px[cpu2vertex.vertex_id], 1.f)).xy / viewport_size_px - 1.f;
|
||||
float2 xformed_pos = mul(xform, float3(dst_p_verts_px[cpu2vertex.vertex_id], 1.f)).xy;
|
||||
xformed_pos.y = viewport_size_px.y - xformed_pos.y;
|
||||
vertex2pixel.position.xy = 2.f * xformed_pos/viewport_size_px - 1.f;
|
||||
vertex2pixel.position.z = 0.f;
|
||||
vertex2pixel.position.w = 1.f;
|
||||
vertex2pixel.rect_half_size_px = dst_size_px / 2.f * xform_scale;
|
||||
@@ -256,14 +257,14 @@ vs_main(CPU2Vertex c2v)
|
||||
corner_radii_px.z,
|
||||
};
|
||||
float2 cornercoords__pct = float2(
|
||||
(c2v.vertex_id >> 1) ? 1.f : 0.f,
|
||||
(c2v.vertex_id & 1) ? 0.f : 1.f);
|
||||
|
||||
(c2v.vertex_id >> 1) ? 1.f : 0.f,
|
||||
(c2v.vertex_id & 1) ? 0.f : 1.f);
|
||||
|
||||
float2 vertex_position__pct = vertex_positions__scrn[c2v.vertex_id] / viewport_size;
|
||||
float2 vertex_position__scr = 2.f * vertex_position__pct - 1.f;
|
||||
|
||||
|
||||
float2 rect_half_size = float2((rect.z-rect.x)/2, (rect.w-rect.y)/2);
|
||||
|
||||
|
||||
Vertex2Pixel v2p;
|
||||
{
|
||||
v2p.position = float4(vertex_position__scr.x, -vertex_position__scr.y, 0.f, 1.f);
|
||||
@@ -282,7 +283,7 @@ ps_main(Vertex2Pixel v2p) : SV_TARGET
|
||||
// rjf: blend weighted texture samples into color
|
||||
float4 color = kernel[0].x * stage_t2d.Sample(stage_sampler, v2p.texcoord);
|
||||
color.a = kernel[0].x;
|
||||
|
||||
|
||||
for(uint i = 1; i < blur_count; i += 1)
|
||||
{
|
||||
float weight = kernel[i].x;
|
||||
|
||||
Reference in New Issue
Block a user