Skip to content

Commit 6a32f8c

Browse files
committed
Stop clamping radial gradient t values to [0.0, 1.0].
Closes #393.
1 parent c24fdf3 commit 6a32f8c

File tree

6 files changed

+71
-71
lines changed

6 files changed

+71
-71
lines changed

resources/shaders/gl3/d3d9/tile.fs.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ vec4 filterRadialGradient(vec2 colorTexCoord,
319319
if(ts . x > ts . y)
320320
ts = ts . yx;
321321
float t = ts . x >= 0.0 ? ts . x : ts . y;
322-
color = texture(colorTexture, uvOrigin + vec2(clamp(t, 0.0, 1.0), 0.0));
322+
color = texture(colorTexture, uvOrigin + vec2(t, 0.0));
323323
}
324324

325325
return color;

resources/shaders/gl4/d3d11/tile.cs.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ vec4 filterRadialGradient(vec2 colorTexCoord,
321321
if(ts . x > ts . y)
322322
ts = ts . yx;
323323
float t = ts . x >= 0.0 ? ts . x : ts . y;
324-
color = texture(colorTexture, uvOrigin + vec2(clamp(t, 0.0, 1.0), 0.0));
324+
color = texture(colorTexture, uvOrigin + vec2(t, 0.0));
325325
}
326326

327327
return color;

resources/shaders/gl4/d3d9/tile.fs.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ vec4 filterRadialGradient(vec2 colorTexCoord,
319319
if(ts . x > ts . y)
320320
ts = ts . yx;
321321
float t = ts . x >= 0.0 ? ts . x : ts . y;
322-
color = texture(colorTexture, uvOrigin + vec2(clamp(t, 0.0, 1.0), 0.0));
322+
color = texture(colorTexture, uvOrigin + vec2(t, 0.0));
323323
}
324324

325325
return color;

resources/shaders/metal/d3d11/tile.cs.metal

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct bTiles
1818

1919
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(16u, 4u, 1u);
2020

21-
constant float3 _1082 = {};
21+
constant float3 _1081 = {};
2222

2323
// Implementation of the GLSL mod() function, which is slightly different than Metal fmod()
2424
template<typename Tx, typename Ty>
@@ -133,7 +133,7 @@ float4 filterRadialGradient(thread const float2& colorTexCoord, thread const tex
133133
_595 = ts.y;
134134
}
135135
float t = _595;
136-
color = colorTexture.sample(colorTextureSmplr, (uvOrigin + float2(fast::clamp(t, 0.0, 1.0), 0.0)), level(0.0));
136+
color = colorTexture.sample(colorTextureSmplr, (uvOrigin + float2(t, 0.0)), level(0.0));
137137
}
138138
return color;
139139
}
@@ -146,19 +146,19 @@ float4 filterBlur(thread const float2& colorTexCoord, thread const texture2d<flo
146146
float3 gaussCoeff = filterParams1.xyz;
147147
float gaussSum = gaussCoeff.x;
148148
float4 color = colorTexture.sample(colorTextureSmplr, colorTexCoord, level(0.0)) * gaussCoeff.x;
149-
float2 _640 = gaussCoeff.xy * gaussCoeff.yz;
150-
gaussCoeff = float3(_640.x, _640.y, gaussCoeff.z);
149+
float2 _639 = gaussCoeff.xy * gaussCoeff.yz;
150+
gaussCoeff = float3(_639.x, _639.y, gaussCoeff.z);
151151
for (int i = 1; i <= support; i += 2)
152152
{
153153
float gaussPartialSum = gaussCoeff.x;
154-
float2 _660 = gaussCoeff.xy * gaussCoeff.yz;
155-
gaussCoeff = float3(_660.x, _660.y, gaussCoeff.z);
154+
float2 _659 = gaussCoeff.xy * gaussCoeff.yz;
155+
gaussCoeff = float3(_659.x, _659.y, gaussCoeff.z);
156156
gaussPartialSum += gaussCoeff.x;
157157
float2 srcOffset = srcOffsetScale * (float(i) + (gaussCoeff.x / gaussPartialSum));
158158
color += ((colorTexture.sample(colorTextureSmplr, (colorTexCoord - srcOffset), level(0.0)) + colorTexture.sample(colorTextureSmplr, (colorTexCoord + srcOffset), level(0.0))) * gaussPartialSum);
159159
gaussSum += (2.0 * gaussPartialSum);
160-
float2 _700 = gaussCoeff.xy * gaussCoeff.yz;
161-
gaussCoeff = float3(_700.x, _700.y, gaussCoeff.z);
160+
float2 _699 = gaussCoeff.xy * gaussCoeff.yz;
161+
gaussCoeff = float3(_699.x, _699.y, gaussCoeff.z);
162162
}
163163
return color / float4(gaussSum);
164164
}
@@ -361,34 +361,34 @@ float3 compositeScreen(thread const float3& destColor, thread const float3& srcC
361361
static inline __attribute__((always_inline))
362362
float3 compositeSelect(thread const bool3& cond, thread const float3& ifTrue, thread const float3& ifFalse)
363363
{
364-
float _766;
364+
float _765;
365365
if (cond.x)
366366
{
367-
_766 = ifTrue.x;
367+
_765 = ifTrue.x;
368368
}
369369
else
370370
{
371-
_766 = ifFalse.x;
371+
_765 = ifFalse.x;
372372
}
373-
float _777;
373+
float _776;
374374
if (cond.y)
375375
{
376-
_777 = ifTrue.y;
376+
_776 = ifTrue.y;
377377
}
378378
else
379379
{
380-
_777 = ifFalse.y;
380+
_776 = ifFalse.y;
381381
}
382-
float _788;
382+
float _787;
383383
if (cond.z)
384384
{
385-
_788 = ifTrue.z;
385+
_787 = ifTrue.z;
386386
}
387387
else
388388
{
389-
_788 = ifFalse.z;
389+
_787 = ifFalse.z;
390390
}
391-
return float3(_766, _777, _788);
391+
return float3(_765, _776, _787);
392392
}
393393

394394
static inline __attribute__((always_inline))
@@ -433,16 +433,16 @@ float3 compositeSoftLight(thread const float3& destColor, thread const float3& s
433433
static inline __attribute__((always_inline))
434434
float compositeDivide(thread const float& num, thread const float& denom)
435435
{
436-
float _802;
436+
float _801;
437437
if (denom != 0.0)
438438
{
439-
_802 = num / denom;
439+
_801 = num / denom;
440440
}
441441
else
442442
{
443-
_802 = 0.0;
443+
_801 = 0.0;
444444
}
445-
return _802;
445+
return _801;
446446
}
447447

448448
static inline __attribute__((always_inline))
@@ -452,25 +452,25 @@ float3 compositeRGBToHSL(thread const float3& rgb)
452452
float xMin = fast::min(fast::min(rgb.x, rgb.y), rgb.z);
453453
float c = v - xMin;
454454
float l = mix(xMin, v, 0.5);
455-
float3 _908;
455+
float3 _907;
456456
if (rgb.x == v)
457457
{
458-
_908 = float3(0.0, rgb.yz);
458+
_907 = float3(0.0, rgb.yz);
459459
}
460460
else
461461
{
462-
float3 _921;
462+
float3 _920;
463463
if (rgb.y == v)
464464
{
465-
_921 = float3(2.0, rgb.zx);
465+
_920 = float3(2.0, rgb.zx);
466466
}
467467
else
468468
{
469-
_921 = float3(4.0, rgb.xy);
469+
_920 = float3(4.0, rgb.xy);
470470
}
471-
_908 = _921;
471+
_907 = _920;
472472
}
473-
float3 terms = _908;
473+
float3 terms = _907;
474474
float param = ((terms.x * c) + terms.y) - terms.z;
475475
float param_1 = c;
476476
float h = 1.0471975803375244140625 * compositeDivide(param, param_1);
@@ -642,17 +642,17 @@ float4 calculateColor(thread const float2& fragCoord, thread const texture2d<flo
642642
float2 param_17 = fragCoord;
643643
int param_18 = compositeOp;
644644
color = composite(param_15, destTexture, destTextureSmplr, param_16, param_17, param_18);
645-
float3 _1364 = color.xyz * color.w;
646-
color = float4(_1364.x, _1364.y, _1364.z, color.w);
645+
float3 _1363 = color.xyz * color.w;
646+
color = float4(_1363.x, _1363.y, _1363.z, color.w);
647647
return color;
648648
}
649649

650-
kernel void main0(constant int2& uFramebufferTileSize [[buffer(3)]], constant int& uLoadAction [[buffer(4)]], constant int2& uTextureMetadataSize [[buffer(7)]], constant float2& uFramebufferSize [[buffer(0)]], constant float2& uTileSize [[buffer(1)]], constant float4& uClearColor [[buffer(5)]], constant float2& uColorTextureSize0 [[buffer(8)]], constant float2& uMaskTextureSize0 [[buffer(9)]], const device bFirstTileMap& _1510 [[buffer(2)]], const device bTiles& _1603 [[buffer(6)]], texture2d<float, access::read_write> uDestImage [[texture(0)]], texture2d<float> uTextureMetadata [[texture(1)]], texture2d<float> uColorTexture0 [[texture(2)]], texture2d<float> uMaskTexture0 [[texture(3)]], texture2d<float> uGammaLUT [[texture(4)]], sampler uTextureMetadataSmplr [[sampler(0)]], sampler uColorTexture0Smplr [[sampler(1)]], sampler uMaskTexture0Smplr [[sampler(2)]], sampler uGammaLUTSmplr [[sampler(3)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]])
650+
kernel void main0(constant int2& uFramebufferTileSize [[buffer(3)]], constant int& uLoadAction [[buffer(4)]], constant int2& uTextureMetadataSize [[buffer(7)]], constant float2& uFramebufferSize [[buffer(0)]], constant float2& uTileSize [[buffer(1)]], constant float4& uClearColor [[buffer(5)]], constant float2& uColorTextureSize0 [[buffer(8)]], constant float2& uMaskTextureSize0 [[buffer(9)]], const device bFirstTileMap& _1509 [[buffer(2)]], const device bTiles& _1602 [[buffer(6)]], texture2d<float, access::read_write> uDestImage [[texture(0)]], texture2d<float> uTextureMetadata [[texture(1)]], texture2d<float> uColorTexture0 [[texture(2)]], texture2d<float> uMaskTexture0 [[texture(3)]], texture2d<float> uGammaLUT [[texture(4)]], sampler uTextureMetadataSmplr [[sampler(0)]], sampler uColorTexture0Smplr [[sampler(1)]], sampler uMaskTexture0Smplr [[sampler(2)]], sampler uGammaLUTSmplr [[sampler(3)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]])
651651
{
652652
int2 tileCoord = int2(gl_WorkGroupID.xy);
653653
int2 firstTileSubCoord = int2(gl_LocalInvocationID.xy) * int2(1, 4);
654654
int2 firstFragCoord = (tileCoord * int2(uTileSize)) + firstTileSubCoord;
655-
int tileIndex = _1510.iFirstTileMap[tileCoord.x + (uFramebufferTileSize.x * tileCoord.y)];
655+
int tileIndex = _1509.iFirstTileMap[tileCoord.x + (uFramebufferTileSize.x * tileCoord.y)];
656656
if ((tileIndex < 0) && (uLoadAction != 0))
657657
{
658658
return;
@@ -685,8 +685,8 @@ kernel void main0(constant int2& uFramebufferTileSize [[buffer(3)]], constant in
685685
{
686686
int2 tileSubCoord = firstTileSubCoord + int2(0, subY_1);
687687
float2 fragCoord = float2(firstFragCoord + int2(0, subY_1)) + float2(0.5);
688-
int alphaTileIndex = int(_1603.iTiles[(tileIndex * 4) + 2] << uint(8)) >> 8;
689-
uint tileControlWord = _1603.iTiles[(tileIndex * 4) + 3];
688+
int alphaTileIndex = int(_1602.iTiles[(tileIndex * 4) + 2] << uint(8)) >> 8;
689+
uint tileControlWord = _1602.iTiles[(tileIndex * 4) + 3];
690690
uint colorEntry = tileControlWord & 65535u;
691691
int tileCtrl = int((tileControlWord >> uint(16)) & 255u);
692692
if (alphaTileIndex >= 0)
@@ -726,7 +726,7 @@ kernel void main0(constant int2& uFramebufferTileSize [[buffer(3)]], constant in
726726
float4 srcColor = calculateColor(param_10, uColorTexture0, uColorTexture0Smplr, uMaskTexture0, uMaskTexture0Smplr, uColorTexture0, uColorTexture0Smplr, uGammaLUT, uGammaLUTSmplr, param_11, param_12, param_13, param_14, param_15, param_16, param_17, param_18, param_19, param_20, param_21);
727727
destColors[subY_1] = (destColors[subY_1] * (1.0 - srcColor.w)) + srcColor;
728728
}
729-
tileIndex = int(_1603.iTiles[(tileIndex * 4) + 0]);
729+
tileIndex = int(_1602.iTiles[(tileIndex * 4) + 0]);
730730
}
731731
for (int subY_2 = 0; subY_2 < 4; subY_2++)
732732
{

resources/shaders/metal/d3d9/tile.fs.metal

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
using namespace metal;
88

9-
constant float3 _1056 = {};
9+
constant float3 _1055 = {};
1010

1111
struct main0_out
1212
{
@@ -85,7 +85,7 @@ float4 filterRadialGradient(thread const float2& colorTexCoord, thread const tex
8585
_569 = ts.y;
8686
}
8787
float t = _569;
88-
color = colorTexture.sample(colorTextureSmplr, (uvOrigin + float2(fast::clamp(t, 0.0, 1.0), 0.0)));
88+
color = colorTexture.sample(colorTextureSmplr, (uvOrigin + float2(t, 0.0)));
8989
}
9090
return color;
9191
}
@@ -98,19 +98,19 @@ float4 filterBlur(thread const float2& colorTexCoord, thread const texture2d<flo
9898
float3 gaussCoeff = filterParams1.xyz;
9999
float gaussSum = gaussCoeff.x;
100100
float4 color = colorTexture.sample(colorTextureSmplr, colorTexCoord) * gaussCoeff.x;
101-
float2 _614 = gaussCoeff.xy * gaussCoeff.yz;
102-
gaussCoeff = float3(_614.x, _614.y, gaussCoeff.z);
101+
float2 _613 = gaussCoeff.xy * gaussCoeff.yz;
102+
gaussCoeff = float3(_613.x, _613.y, gaussCoeff.z);
103103
for (int i = 1; i <= support; i += 2)
104104
{
105105
float gaussPartialSum = gaussCoeff.x;
106-
float2 _634 = gaussCoeff.xy * gaussCoeff.yz;
107-
gaussCoeff = float3(_634.x, _634.y, gaussCoeff.z);
106+
float2 _633 = gaussCoeff.xy * gaussCoeff.yz;
107+
gaussCoeff = float3(_633.x, _633.y, gaussCoeff.z);
108108
gaussPartialSum += gaussCoeff.x;
109109
float2 srcOffset = srcOffsetScale * (float(i) + (gaussCoeff.x / gaussPartialSum));
110110
color += ((colorTexture.sample(colorTextureSmplr, (colorTexCoord - srcOffset)) + colorTexture.sample(colorTextureSmplr, (colorTexCoord + srcOffset))) * gaussPartialSum);
111111
gaussSum += (2.0 * gaussPartialSum);
112-
float2 _674 = gaussCoeff.xy * gaussCoeff.yz;
113-
gaussCoeff = float3(_674.x, _674.y, gaussCoeff.z);
112+
float2 _673 = gaussCoeff.xy * gaussCoeff.yz;
113+
gaussCoeff = float3(_673.x, _673.y, gaussCoeff.z);
114114
}
115115
return color / float4(gaussSum);
116116
}
@@ -313,34 +313,34 @@ float3 compositeScreen(thread const float3& destColor, thread const float3& srcC
313313
static inline __attribute__((always_inline))
314314
float3 compositeSelect(thread const bool3& cond, thread const float3& ifTrue, thread const float3& ifFalse)
315315
{
316-
float _740;
316+
float _739;
317317
if (cond.x)
318318
{
319-
_740 = ifTrue.x;
319+
_739 = ifTrue.x;
320320
}
321321
else
322322
{
323-
_740 = ifFalse.x;
323+
_739 = ifFalse.x;
324324
}
325-
float _751;
325+
float _750;
326326
if (cond.y)
327327
{
328-
_751 = ifTrue.y;
328+
_750 = ifTrue.y;
329329
}
330330
else
331331
{
332-
_751 = ifFalse.y;
332+
_750 = ifFalse.y;
333333
}
334-
float _762;
334+
float _761;
335335
if (cond.z)
336336
{
337-
_762 = ifTrue.z;
337+
_761 = ifTrue.z;
338338
}
339339
else
340340
{
341-
_762 = ifFalse.z;
341+
_761 = ifFalse.z;
342342
}
343-
return float3(_740, _751, _762);
343+
return float3(_739, _750, _761);
344344
}
345345

346346
static inline __attribute__((always_inline))
@@ -385,16 +385,16 @@ float3 compositeSoftLight(thread const float3& destColor, thread const float3& s
385385
static inline __attribute__((always_inline))
386386
float compositeDivide(thread const float& num, thread const float& denom)
387387
{
388-
float _776;
388+
float _775;
389389
if (denom != 0.0)
390390
{
391-
_776 = num / denom;
391+
_775 = num / denom;
392392
}
393393
else
394394
{
395-
_776 = 0.0;
395+
_775 = 0.0;
396396
}
397-
return _776;
397+
return _775;
398398
}
399399

400400
static inline __attribute__((always_inline))
@@ -404,25 +404,25 @@ float3 compositeRGBToHSL(thread const float3& rgb)
404404
float xMin = fast::min(fast::min(rgb.x, rgb.y), rgb.z);
405405
float c = v - xMin;
406406
float l = mix(xMin, v, 0.5);
407-
float3 _882;
407+
float3 _881;
408408
if (rgb.x == v)
409409
{
410-
_882 = float3(0.0, rgb.yz);
410+
_881 = float3(0.0, rgb.yz);
411411
}
412412
else
413413
{
414-
float3 _895;
414+
float3 _894;
415415
if (rgb.y == v)
416416
{
417-
_895 = float3(2.0, rgb.zx);
417+
_894 = float3(2.0, rgb.zx);
418418
}
419419
else
420420
{
421-
_895 = float3(4.0, rgb.xy);
421+
_894 = float3(4.0, rgb.xy);
422422
}
423-
_882 = _895;
423+
_881 = _894;
424424
}
425-
float3 terms = _882;
425+
float3 terms = _881;
426426
float param = ((terms.x * c) + terms.y) - terms.z;
427427
float param_1 = c;
428428
float h = 1.0471975803375244140625 * compositeDivide(param, param_1);
@@ -594,8 +594,8 @@ float4 calculateColor(thread const float2& fragCoord, thread const texture2d<flo
594594
float2 param_17 = fragCoord;
595595
int param_18 = compositeOp;
596596
color = composite(param_15, destTexture, destTextureSmplr, param_16, param_17, param_18);
597-
float3 _1340 = color.xyz * color.w;
598-
color = float4(_1340.x, _1340.y, _1340.z, color.w);
597+
float3 _1339 = color.xyz * color.w;
598+
color = float4(_1339.x, _1339.y, _1339.z, color.w);
599599
return color;
600600
}
601601

shaders/tile_fragment.inc.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ vec4 filterRadialGradient(vec2 colorTexCoord,
296296
if (ts.x > ts.y)
297297
ts = ts.yx;
298298
float t = ts.x >= 0.0 ? ts.x : ts.y;
299-
color = texture(colorTexture, uvOrigin + vec2(clamp(t, 0.0, 1.0), 0.0));
299+
color = texture(colorTexture, uvOrigin + vec2(t, 0.0));
300300
}
301301

302302
return color;

0 commit comments

Comments
 (0)