⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Emulator
All Projects
Emulator
Overview
Activity
Issues
Issue templates
Download (1.41 KB)
Emulator Issues #12725
» integerYbilinearX.glsl
taolas
, 06/05/2022 10:16 PM
void
main
()
{
float4
c0
=
Sample
();
float2
rat
=
GetWindowResolution
()
/
GetResolution
();
float
x
=
GetWindowResolution
().
x
-
GetResolution
().
x
;
float
y
=
GetWindowResolution
().
y
-
GetResolution
().
y
;
float
x1
=
(
x
/
2
.
0
)
*
GetInvWindowResolution
().
x
;
float
x2
=
(
GetWindowResolution
().
x
-
x
/
2
.
0
)
*
GetInvWindowResolution
().
x
;
float
y1
=
(
y
/
2
.
0
)
*
GetInvWindowResolution
().
y
;
float
y2
=
(
GetWindowResolution
().
y
-
y
/
2
.
0
)
*
GetInvWindowResolution
().
y
;
float
source_size
=
GetResolution
().
x
;
float
texel
=
GetCoordinates
().
x
*
source_size
.
x
;
float
texel_floored
=
floor
(
texel
);
float
s
=
fract
(
texel
);
//float config_scale = 0.0; // GetOption(PRESCALE_FACTOR);
float
scale
=
ceil
(
GetWindowResolution
().
x
/
source_size
.
x
);
float
region_range
=
0
.
5
-
0
.
5
/
scale
;
// Figure out where in the texel to sample to get correct pre-scaled bilinear.
// Uses the hardware bilinear interpolator to avoid having to sample 4 times manually.
float
center_dist
=
s
-
0
.
5
;
float
f
=
(
center_dist
-
clamp
(
center_dist
,
-
region_range
,
region_range
))
*
scale
+
0
.
5
;
float
mod_texel
=
texel_floored
+
f
;
float
xloc
=
mod_texel
/
source_size
;
if
(
GetCoordinates
().
y
<
y1
||
y2
<
GetCoordinates
().
y
)
{
c0
.
r
=
0
.
0
;
c0
.
b
=
0
.
0
;
c0
.
g
=
0
.
0
;
}
else
{
float2
offset
=
float2
(
xloc
,
(
GetCoordinates
().
y
*
rat
.
y
-
y1
*
rat
.
y
));
c0
=
SampleLocation
(
offset
);
}
SetOutput
(
c0
);
}
« Previous
1
2
3
4
5
Next »
(2-2/5)
Loading...