From de606eb9b73afb30c7870ede39cffad185be1a32 Mon Sep 17 00:00:00 2001 From: UjinT34 Date: Sat, 21 Mar 2026 14:11:06 +0300 Subject: [PATCH] fix highlighting --- src/render/shaders/glsl/border.frag | 30 +++++++------- src/render/shaders/glsl/border.glsl | 53 +++++++++++++------------ src/render/shaders/glsl/cm_helpers.glsl | 11 ++--- src/render/shaders/glsl/shadow.frag | 27 +++++++------ src/render/shaders/glsl/shadow.glsl | 50 ++++++++++++----------- src/render/shaders/glsl/surface.frag | 23 ++++++----- 6 files changed, 100 insertions(+), 94 deletions(-) diff --git a/src/render/shaders/glsl/border.frag b/src/render/shaders/glsl/border.frag index bd09b50ee..9f97348b6 100644 --- a/src/render/shaders/glsl/border.frag +++ b/src/render/shaders/glsl/border.frag @@ -37,34 +37,34 @@ layout(location = 1) out vec4 mirrorColor; #endif void main() { #if USE_MIRROR - vec4[2] pixColors = getBorder( + vec4[2] pixColors = #else - fragColor = getBorder( + fragColor = #endif - v_texcoord, alpha, fullSizeUntransformed, radiusOuter, thick, radius, roundingPower, topLeft, fullSize, gradientLength, gradient, angle, gradient2Length, gradient2, angle2, - gradientLerp + getBorder(v_texcoord, alpha, fullSizeUntransformed, radiusOuter, thick, radius, roundingPower, topLeft, fullSize, gradientLength, gradient, angle, gradient2Length, + gradient2, angle2, gradientLerp #if USE_CM - , - sourceTF, targetTF, convertMatrix, srcTFRange, dstTFRange + , + sourceTF, targetTF, convertMatrix, srcTFRange, dstTFRange #if USE_ICC - , - iccLut3D, iccLutSize + , + iccLut3D, iccLutSize #else #if USE_TONEMAP || USE_SDR_MOD - , - targetPrimariesXYZ + , + targetPrimariesXYZ #endif #if USE_TONEMAP - , - maxLuminance, dstMaxLuminance, dstRefLuminance, srcRefLuminance + , + maxLuminance, dstMaxLuminance, dstRefLuminance, srcRefLuminance #endif #if USE_SDR_MOD - , - sdrSaturation, sdrBrightnessMultiplier + , + sdrSaturation, sdrBrightnessMultiplier #endif #endif #endif - ); + ); #if USE_MIRROR fragColor = pixColors[0]; mirrorColor = pixColors[1]; diff --git a/src/render/shaders/glsl/border.glsl b/src/render/shaders/glsl/border.glsl index 1d9f77876..9028ad0d1 100644 --- a/src/render/shaders/glsl/border.glsl +++ b/src/render/shaders/glsl/border.glsl @@ -88,34 +88,34 @@ vec4 getColorForCoord(vec2 normalizedCoord, int gradientLength, vec4 gradient[10 } #if USE_MIRROR -vec4[2] getBorder(vec2 v_texcoord, float alpha, vec2 fullSizeUntransformed, float radiusOuter, float thick, float radius, float roundingPower, vec2 topLeft, vec2 fullSize, - int gradientLength, vec4 gradient[10], float angle, int gradient2Length, vec4 gradient2[10], float angle2, float gradientLerp +vec4[2] #else -vec4 getBorder(vec2 v_texcoord, float alpha, vec2 fullSizeUntransformed, float radiusOuter, float thick, float radius, float roundingPower, vec2 topLeft, vec2 fullSize, - int gradientLength, vec4 gradient[10], float angle, int gradient2Length, vec4 gradient2[10], float angle2, float gradientLerp +vec4 #endif + getBorder(vec2 v_texcoord, float alpha, vec2 fullSizeUntransformed, float radiusOuter, float thick, float radius, float roundingPower, vec2 topLeft, vec2 fullSize, + int gradientLength, vec4 gradient[10], float angle, int gradient2Length, vec4 gradient2[10], float angle2, float gradientLerp #if USE_CM - , - int sourceTF, int targetTF, mat3 convertMatrix, vec2 srcTFRange, vec2 dstTFRange + , + int sourceTF, int targetTF, mat3 convertMatrix, vec2 srcTFRange, vec2 dstTFRange #if USE_ICC - , - highp sampler3D iccLut3D, float iccLutSize + , + highp sampler3D iccLut3D, float iccLutSize #else #if USE_TONEMAP || USE_SDR_MOD - , - mat3 targetPrimariesXYZ + , + mat3 targetPrimariesXYZ #endif #if USE_TONEMAP - , - float maxLuminance, float dstMaxLuminance, float dstRefLuminance, float srcRefLuminance + , + float maxLuminance, float dstMaxLuminance, float dstRefLuminance, float srcRefLuminance #endif #if USE_SDR_MOD - , - float sdrSaturation, float sdrBrightnessMultiplier + , + float sdrSaturation, float sdrBrightnessMultiplier #endif #endif #endif -) { + ) { vec2 pixCoord = vec2(gl_FragCoord); vec2 pixCoordOuter = pixCoord; vec2 originalPixCoord = v_texcoord; @@ -182,28 +182,29 @@ vec4 getBorder(vec2 v_texcoord, float alpha, vec2 fullSizeUntransformed, float r #if USE_CM #if USE_MIRROR - vec4[2] pixColors = doColorManagement(pixColor, sourceTF, targetTF, convertMatrix, srcTFRange, dstTFRange + vec4[2] pixColors = #else - pixColor = doColorManagement(pixColor, sourceTF, targetTF, convertMatrix, srcTFRange, dstTFRange + pixColor = #endif + doColorManagement(pixColor, sourceTF, targetTF, convertMatrix, srcTFRange, dstTFRange #if USE_ICC - , - iccLut3D, iccLutSize + , + iccLut3D, iccLutSize #else #if USE_TONEMAP || USE_SDR_MOD - , - targetPrimariesXYZ + , + targetPrimariesXYZ #endif #if USE_TONEMAP - , - maxLuminance, dstMaxLuminance, dstRefLuminance, srcRefLuminance + , + maxLuminance, dstMaxLuminance, dstRefLuminance, srcRefLuminance #endif #if USE_SDR_MOD - , - sdrSaturation, sdrBrightnessMultiplier + , + sdrSaturation, sdrBrightnessMultiplier #endif #endif - ); + ); #endif #if USE_MIRROR diff --git a/src/render/shaders/glsl/cm_helpers.glsl b/src/render/shaders/glsl/cm_helpers.glsl index 3c26dc7e2..472c6ea51 100644 --- a/src/render/shaders/glsl/cm_helpers.glsl +++ b/src/render/shaders/glsl/cm_helpers.glsl @@ -205,13 +205,14 @@ vec4 fromLinearNit(vec4 color, int tf, vec2 range) { #endif #if USE_MIRROR -vec4[2] doColorManagement(vec4 pixColor, int srcTF, int dstTF, mat3 convertMatrix, vec2 srcTFRange, vec2 dstTFRange +vec4[2] #else -vec4 doColorManagement(vec4 pixColor, int srcTF, int dstTF, mat3 convertMatrix, vec2 srcTFRange, vec2 dstTFRange +vec4 #endif + doColorManagement(vec4 pixColor, int srcTF, int dstTF, mat3 convertMatrix, vec2 srcTFRange, vec2 dstTFRange #if USE_ICC - , - highp sampler3D iccLut3D, float iccLutSize + , + highp sampler3D iccLut3D, float iccLutSize #else #if USE_TONEMAP || USE_SDR_MOD , @@ -226,7 +227,7 @@ vec4 doColorManagement(vec4 pixColor, int srcTF, int dstTF, mat3 convertMatrix, float sdrSaturation, float sdrBrightnessMultiplier #endif #endif -) { + ) { pixColor.rgb /= max(pixColor.a, 0.001); pixColor.rgb = toLinearRGB(pixColor.rgb, srcTF); #if USE_ICC diff --git a/src/render/shaders/glsl/shadow.frag b/src/render/shaders/glsl/shadow.frag index 7c5a50d47..5ba3d8797 100644 --- a/src/render/shaders/glsl/shadow.frag +++ b/src/render/shaders/glsl/shadow.frag @@ -34,32 +34,33 @@ layout(location = 1) out vec4 mirrorColor; void main() { vec4 pixColor = v_color; #if USE_MIRROR - vec4[2] pixColors = getShadow(pixColor, v_texcoord, radius, roundingPower, topLeft, fullSize, range, shadowPower, bottomRight + vec4[2] pixColors = #else - fragColor = getShadow(pixColor, v_texcoord, radius, roundingPower, topLeft, fullSize, range, shadowPower, bottomRight + fragColor = #endif + getShadow(pixColor, v_texcoord, radius, roundingPower, topLeft, fullSize, range, shadowPower, bottomRight #if USE_CM - , - sourceTF, targetTF, convertMatrix, srcTFRange, dstTFRange + , + sourceTF, targetTF, convertMatrix, srcTFRange, dstTFRange #if USE_ICC - , - iccLut3D, iccLutSize + , + iccLut3D, iccLutSize #else #if USE_TONEMAP || USE_SDR_MOD - , - targetPrimariesXYZ + , + targetPrimariesXYZ #endif #if USE_TONEMAP - , - maxLuminance, dstMaxLuminance, dstRefLuminance, srcRefLuminance + , + maxLuminance, dstMaxLuminance, dstRefLuminance, srcRefLuminance #endif #if USE_SDR_MOD - , - sdrSaturation, sdrBrightnessMultiplier + , + sdrSaturation, sdrBrightnessMultiplier #endif #endif #endif - ); + ); #if USE_MIRROR fragColor = pixColors[0]; mirrorColor = pixColors[1]; diff --git a/src/render/shaders/glsl/shadow.glsl b/src/render/shaders/glsl/shadow.glsl index 7957f90c9..265dba00e 100644 --- a/src/render/shaders/glsl/shadow.glsl +++ b/src/render/shaders/glsl/shadow.glsl @@ -24,32 +24,33 @@ float modifiedLength(vec2 a, float roundingPower) { } #if USE_MIRROR -vec4[2] getShadow(vec4 pixColor, vec2 v_texcoord, float radius, float roundingPower, vec2 topLeft, vec2 fullSize, float range, float shadowPower, vec2 bottomRight +vec4[2] #else -vec4 getShadow(vec4 pixColor, vec2 v_texcoord, float radius, float roundingPower, vec2 topLeft, vec2 fullSize, float range, float shadowPower, vec2 bottomRight +vec4 #endif + getShadow(vec4 pixColor, vec2 v_texcoord, float radius, float roundingPower, vec2 topLeft, vec2 fullSize, float range, float shadowPower, vec2 bottomRight #if USE_CM - , - int sourceTF, int targetTF, mat3 convertMatrix, vec2 srcTFRange, vec2 dstTFRange + , + int sourceTF, int targetTF, mat3 convertMatrix, vec2 srcTFRange, vec2 dstTFRange #if USE_ICC - , - highp sampler3D iccLut3D, float iccLutSize + , + highp sampler3D iccLut3D, float iccLutSize #else #if USE_TONEMAP || USE_SDR_MOD - , - mat3 targetPrimariesXYZ + , + mat3 targetPrimariesXYZ #endif #if USE_TONEMAP - , - float maxLuminance, float dstMaxLuminance, float dstRefLuminance, float srcRefLuminance + , + float maxLuminance, float dstMaxLuminance, float dstRefLuminance, float srcRefLuminance #endif #if USE_SDR_MOD - , - float sdrSaturation, float sdrBrightnessMultiplier + , + float sdrSaturation, float sdrBrightnessMultiplier #endif #endif #endif -) { + ) { float originalAlpha = pixColor[3]; bool done = false; @@ -105,28 +106,29 @@ vec4 getShadow(vec4 pixColor, vec2 v_texcoord, float radius, float roundingPower #if USE_CM #if USE_MIRROR - vec4[2] pixColors = doColorManagement(pixColor, sourceTF, targetTF, convertMatrix, srcTFRange, dstTFRange + vec4[2] pixColors = #else - pixColor = doColorManagement(pixColor, sourceTF, targetTF, convertMatrix, srcTFRange, dstTFRange + pixColor = #endif + doColorManagement(pixColor, sourceTF, targetTF, convertMatrix, srcTFRange, dstTFRange #if USE_ICC - , - iccLut3D, iccLutSize + , + iccLut3D, iccLutSize #else #if USE_TONEMAP || USE_SDR_MOD - , - targetPrimariesXYZ + , + targetPrimariesXYZ #endif #if USE_TONEMAP - , - maxLuminance, dstMaxLuminance, dstRefLuminance, srcRefLuminance + , + maxLuminance, dstMaxLuminance, dstRefLuminance, srcRefLuminance #endif #if USE_SDR_MOD - , - sdrSaturation, sdrBrightnessMultiplier + , + sdrSaturation, sdrBrightnessMultiplier #endif #endif - ); + ); #endif #if USE_MIRROR return pixColors; diff --git a/src/render/shaders/glsl/surface.frag b/src/render/shaders/glsl/surface.frag index 9383da99f..076ca62c2 100644 --- a/src/render/shaders/glsl/surface.frag +++ b/src/render/shaders/glsl/surface.frag @@ -67,28 +67,29 @@ void main() { #if USE_CM #if USE_MIRROR - vec4[2] pixColors = doColorManagement(pixColor, sourceTF, targetTF, convertMatrix, srcTFRange, dstTFRange + vec4[2] pixColors = #else - pixColor = doColorManagement(pixColor, sourceTF, targetTF, convertMatrix, srcTFRange, dstTFRange + pixColor = #endif + doColorManagement(pixColor, sourceTF, targetTF, convertMatrix, srcTFRange, dstTFRange #if USE_ICC - , - iccLut3D, iccLutSize + , + iccLut3D, iccLutSize #else #if USE_TONEMAP || USE_SDR_MOD - , - targetPrimariesXYZ + , + targetPrimariesXYZ #endif #if USE_TONEMAP - , - maxLuminance, dstMaxLuminance, dstRefLuminance, srcRefLuminance + , + maxLuminance, dstMaxLuminance, dstRefLuminance, srcRefLuminance #endif #if USE_SDR_MOD - , - sdrSaturation, sdrBrightnessMultiplier + , + sdrSaturation, sdrBrightnessMultiplier #endif #endif - ); + ); #endif #if USE_MIRROR pixColor = pixColors[0];