Revert "gl_engine: --unused code"

This reverts commit d8c06add22.

drop shadow has been broken...
This commit is contained in:
Hermet Park 2025-07-07 12:50:30 +09:00 committed by Hermet Park
parent c216805a87
commit 53680eae2f
3 changed files with 9 additions and 2 deletions

View file

@ -161,7 +161,9 @@ struct GlCompositor : RenderCompositor
GlCompositor(const RenderRegion& box) : bbox(box) {}
};
#define GL_GAUSSIAN_MAX_LEVEL 3
struct GlGaussianBlur {
int level{};
float sigma{};
float scale{};
float extend{};

View file

@ -953,6 +953,7 @@ void GlRenderer::effectGaussianBlurUpdate(RenderEffectGaussianBlur* effect, cons
blur->sigma = effect->sigma;
blur->scale = std::sqrt(transform.e11 * transform.e11 + transform.e12 * transform.e12);
blur->extend = 2 * blur->sigma * blur->scale;
blur->level = int(GL_GAUSSIAN_MAX_LEVEL * ((effect->quality - 1) * 0.01f)) + 1;
effect->rd = blur;
effect->valid = (blur->extend > 0);
}
@ -971,6 +972,7 @@ void GlRenderer::effectDropShadowUpdate(RenderEffectDropShadow* effect, const Ma
};
dropShadow->sigma = sigma;
dropShadow->scale = scale;
dropShadow->level = int(GL_GAUSSIAN_MAX_LEVEL * ((effect->quality - 1) * 0.01f)) + 1;
dropShadow->color[3] = effect->color[3] / 255.0f;
//Drop shadow effect applies blending in the shader (GL_BLEND disabled), so the color should be premultiplied:
dropShadow->color[0] = effect->color[0] / 255.0f * dropShadow->color[3];
@ -1186,8 +1188,8 @@ bool GlRenderer::render(TVG_UNUSED RenderCompositor* cmp, const RenderEffect* ef
task->setDrawRange(ioffset, 6);
// add task to render pipeline
pass->addRenderTask(task);
} else return false;
return true;
}
return false;
}

View file

@ -740,6 +740,7 @@ void main()
const char* GAUSSIAN_VERTICAL = R"(
uniform sampler2D uSrcTexture;
layout(std140) uniform Gaussian {
int level;
float sigma;
float scale;
float extend;
@ -775,6 +776,7 @@ void main()
const char* GAUSSIAN_HORIZONTAL = R"(
uniform sampler2D uSrcTexture;
layout(std140) uniform Gaussian {
int level;
float sigma;
float scale;
float extend;
@ -811,6 +813,7 @@ const char* EFFECT_DROPSHADOW = R"(
uniform sampler2D uSrcTexture;
uniform sampler2D uBlrTexture;
layout(std140) uniform DropShadow {
int level;
float sigma;
float scale;
float extend;