refactor(effects): drop the unused composite acrylic shader

The acrylic material carried a full composite shader — vertex and
fragment source, compile and link helpers, the program handle and seven
uniform locations — that nothing ever invoked. The acrylic is composited
on the ImGui draw list, not through this program.

- Remove the dead shader source, its compile/link helpers, the program
  and uniform fields, and the compile/link/cleanup steps in init and
  shutdown. No behaviour change; init no longer builds a program that is
  never bound.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-10-13 13:30:20 -05:00
co-authored by Claude Opus 4.8
parent 75e0c5048e
commit fdd95aa457
2 changed files with 0 additions and 170 deletions
-154
View File
@@ -33,109 +33,6 @@ namespace dragonx {
namespace ui {
namespace effects {
// ============================================================================
// Composite Shader Source (GLEW Available)
// ============================================================================
namespace {
const char* COMPOSITE_VERTEX = R"glsl(
#version 330 core
layout (location = 0) in vec2 aPos;
layout (location = 1) in vec2 aTexCoord;
out vec2 vTexCoord;
out vec2 vNoiseCoord;
uniform vec2 uTexScale; // For noise tiling
void main()
{
gl_Position = vec4(aPos, 0.0, 1.0);
vTexCoord = aTexCoord;
vNoiseCoord = aTexCoord * uTexScale; // Tile noise
}
)glsl";
const char* COMPOSITE_FRAGMENT = R"glsl(
#version 330 core
in vec2 vTexCoord;
in vec2 vNoiseCoord;
out vec4 FragColor;
uniform sampler2D uBlurTex;
uniform sampler2D uNoiseTex;
uniform vec4 uTintColor;
uniform float uTintOpacity;
uniform float uLuminosity;
uniform float uNoiseOpacity;
void main()
{
// Sample blurred background
vec3 blur = texture(uBlurTex, vTexCoord).rgb;
// Apply luminosity (desaturation effect)
float lum = dot(blur, vec3(0.299, 0.587, 0.114));
blur = mix(vec3(lum), blur, uLuminosity);
// Apply tint color
vec3 tinted = mix(blur, uTintColor.rgb, uTintOpacity);
// Sample and apply noise
float noise = texture(uNoiseTex, vNoiseCoord).r;
// Noise is centered at 0.5, so we subtract 0.5 and scale
float noiseOffset = (noise - 0.5) * 2.0 * uNoiseOpacity;
tinted += vec3(noiseOffset);
// Output with slight transparency
FragColor = vec4(tinted, uTintColor.a);
}
)glsl";
bool compileShader(GLuint shader, const char* source)
{
glShaderSource(shader, 1, &source, nullptr);
glCompileShader(shader);
GLint success;
glGetShaderiv(shader, GL_COMPILE_STATUS, &success);
if (!success) {
GLint logLength;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &logLength);
std::vector<char> log(logLength + 1);
glGetShaderInfoLog(shader, logLength, nullptr, log.data());
DEBUG_LOGF("Shader compile error:\n%s\n", log.data());
return false;
}
return true;
}
bool linkProgram(GLuint program)
{
glLinkProgram(program);
GLint success;
glGetProgramiv(program, GL_LINK_STATUS, &success);
if (!success) {
GLint logLength;
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &logLength);
std::vector<char> log(logLength + 1);
glGetProgramInfoLog(program, logLength, nullptr, log.data());
DEBUG_LOGF("Program link error:\n%s\n", log.data());
return false;
}
return true;
}
} // anonymous namespace
// ============================================================================
// AcrylicMaterial Implementation (GLEW Available)
// ============================================================================
@@ -172,52 +69,6 @@ bool AcrylicMaterial::init()
return false;
}
// Create composite shader
GLuint vs = glCreateShader(GL_VERTEX_SHADER);
GLuint fs = glCreateShader(GL_FRAGMENT_SHADER);
if (!compileShader(vs, COMPOSITE_VERTEX)) {
glDeleteShader(vs);
glDeleteShader(fs);
return false;
}
if (!compileShader(fs, COMPOSITE_FRAGMENT)) {
glDeleteShader(vs);
glDeleteShader(fs);
return false;
}
compositeShader_ = glCreateProgram();
glAttachShader(compositeShader_, vs);
glAttachShader(compositeShader_, fs);
if (!linkProgram(compositeShader_)) {
glDeleteProgram(compositeShader_);
glDeleteShader(vs);
glDeleteShader(fs);
compositeShader_ = 0;
return false;
}
glDeleteShader(vs);
glDeleteShader(fs);
// Get uniform locations
uCompositeTintColor_ = glGetUniformLocation(compositeShader_, "uTintColor");
uCompositeTintOpacity_ = glGetUniformLocation(compositeShader_, "uTintOpacity");
uCompositeLuminosity_ = glGetUniformLocation(compositeShader_, "uLuminosity");
uCompositeNoiseOpacity_ = glGetUniformLocation(compositeShader_, "uNoiseOpacity");
uCompositeBlurTex_ = glGetUniformLocation(compositeShader_, "uBlurTex");
uCompositeNoiseTex_ = glGetUniformLocation(compositeShader_, "uNoiseTex");
uCompositeTexScale_ = glGetUniformLocation(compositeShader_, "uTexScale");
DEBUG_LOGF("AcrylicMaterial: Composite shader uniforms:\n");
DEBUG_LOGF(" uTintColor=%d, uTintOpacity=%d, uLuminosity=%d\n",
uCompositeTintColor_, uCompositeTintOpacity_, uCompositeLuminosity_);
DEBUG_LOGF(" uNoiseOpacity=%d, uBlurTex=%d, uNoiseTex=%d, uTexScale=%d\n",
uCompositeNoiseOpacity_, uCompositeBlurTex_, uCompositeNoiseTex_, uCompositeTexScale_);
// Detect system capabilities
refreshCapabilities();
currentFallback_ = detectFallback();
@@ -239,11 +90,6 @@ void AcrylicMaterial::shutdown()
quad_.destroy();
noiseTexture_.destroy();
if (compositeShader_) {
glDeleteProgram(compositeShader_);
compositeShader_ = 0;
}
initialized_ = false;
viewportWidth_ = 0;
viewportHeight_ = 0;
-16
View File
@@ -352,12 +352,6 @@ private:
*/
void applyBlur(float radius, bool ignoreMultiplier = false);
/**
* @brief Composite final acrylic appearance
*/
void compositeAcrylic(const ImVec2& pMin, const ImVec2& pMax,
const AcrylicParams& params);
/**
* @brief Check if effect should be skipped (settings/quality)
*/
@@ -406,16 +400,6 @@ private:
// Noise texture
NoiseTexture noiseTexture_;
// Composite shader (tint + noise overlay)
GLuint compositeShader_ = 0;
GLint uCompositeTintColor_ = -1;
GLint uCompositeTintOpacity_ = -1;
GLint uCompositeLuminosity_ = -1;
GLint uCompositeNoiseOpacity_ = -1;
GLint uCompositeBlurTex_ = -1;
GLint uCompositeNoiseTex_ = -1;
GLint uCompositeTexScale_ = -1;
#ifdef DRAGONX_USE_DX11
// ---- DX11 acrylic resources (used instead of GL objects above) ----
ID3D11Device* dx_device_ = nullptr;