mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-09 15:26:00 +01:00
opengl: remove unused alpha matte from shadow
This commit is contained in:
parent
da6fa9cbd2
commit
11432f69b9
2 changed files with 12 additions and 22 deletions
|
@ -348,21 +348,18 @@ void CHyprOpenGLImpl::initShaders() {
|
||||||
m_RenderData.pCurrentMonData->m_shBLURFINISH.brightness = glGetUniformLocation(prog, "brightness");
|
m_RenderData.pCurrentMonData->m_shBLURFINISH.brightness = glGetUniformLocation(prog, "brightness");
|
||||||
m_RenderData.pCurrentMonData->m_shBLURFINISH.noise = glGetUniformLocation(prog, "noise");
|
m_RenderData.pCurrentMonData->m_shBLURFINISH.noise = glGetUniformLocation(prog, "noise");
|
||||||
|
|
||||||
prog = createProgram(QUADVERTSRC, FRAGSHADOW);
|
prog = createProgram(QUADVERTSRC, FRAGSHADOW);
|
||||||
m_RenderData.pCurrentMonData->m_shSHADOW.program = prog;
|
m_RenderData.pCurrentMonData->m_shSHADOW.program = prog;
|
||||||
m_RenderData.pCurrentMonData->m_shSHADOW.proj = glGetUniformLocation(prog, "proj");
|
m_RenderData.pCurrentMonData->m_shSHADOW.proj = glGetUniformLocation(prog, "proj");
|
||||||
m_RenderData.pCurrentMonData->m_shSHADOW.posAttrib = glGetAttribLocation(prog, "pos");
|
m_RenderData.pCurrentMonData->m_shSHADOW.posAttrib = glGetAttribLocation(prog, "pos");
|
||||||
m_RenderData.pCurrentMonData->m_shSHADOW.texAttrib = glGetAttribLocation(prog, "texcoord");
|
m_RenderData.pCurrentMonData->m_shSHADOW.texAttrib = glGetAttribLocation(prog, "texcoord");
|
||||||
m_RenderData.pCurrentMonData->m_shSHADOW.matteTexAttrib = glGetAttribLocation(prog, "texcoordMatte");
|
m_RenderData.pCurrentMonData->m_shSHADOW.topLeft = glGetUniformLocation(prog, "topLeft");
|
||||||
m_RenderData.pCurrentMonData->m_shSHADOW.alphaMatte = glGetUniformLocation(prog, "alphaMatte");
|
m_RenderData.pCurrentMonData->m_shSHADOW.bottomRight = glGetUniformLocation(prog, "bottomRight");
|
||||||
m_RenderData.pCurrentMonData->m_shSHADOW.topLeft = glGetUniformLocation(prog, "topLeft");
|
m_RenderData.pCurrentMonData->m_shSHADOW.fullSize = glGetUniformLocation(prog, "fullSize");
|
||||||
m_RenderData.pCurrentMonData->m_shSHADOW.bottomRight = glGetUniformLocation(prog, "bottomRight");
|
m_RenderData.pCurrentMonData->m_shSHADOW.radius = glGetUniformLocation(prog, "radius");
|
||||||
m_RenderData.pCurrentMonData->m_shSHADOW.fullSize = glGetUniformLocation(prog, "fullSize");
|
m_RenderData.pCurrentMonData->m_shSHADOW.range = glGetUniformLocation(prog, "range");
|
||||||
m_RenderData.pCurrentMonData->m_shSHADOW.radius = glGetUniformLocation(prog, "radius");
|
m_RenderData.pCurrentMonData->m_shSHADOW.shadowPower = glGetUniformLocation(prog, "shadowPower");
|
||||||
m_RenderData.pCurrentMonData->m_shSHADOW.range = glGetUniformLocation(prog, "range");
|
m_RenderData.pCurrentMonData->m_shSHADOW.color = glGetUniformLocation(prog, "color");
|
||||||
m_RenderData.pCurrentMonData->m_shSHADOW.shadowPower = glGetUniformLocation(prog, "shadowPower");
|
|
||||||
m_RenderData.pCurrentMonData->m_shSHADOW.color = glGetUniformLocation(prog, "color");
|
|
||||||
m_RenderData.pCurrentMonData->m_shSHADOW.useAlphaMatte = glGetUniformLocation(prog, "useAlphaMatte");
|
|
||||||
|
|
||||||
prog = createProgram(QUADVERTSRC, FRAGBORDER1);
|
prog = createProgram(QUADVERTSRC, FRAGBORDER1);
|
||||||
m_RenderData.pCurrentMonData->m_shBORDER1.program = prog;
|
m_RenderData.pCurrentMonData->m_shBORDER1.program = prog;
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
inline const std::string FRAGSHADOW = R"#(
|
inline const std::string FRAGSHADOW = R"#(
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
varying vec4 v_color;
|
varying vec4 v_color;
|
||||||
uniform sampler2D alphaMatte;
|
|
||||||
varying vec2 v_texcoord;
|
varying vec2 v_texcoord;
|
||||||
varying vec2 v_texcoordMatte;
|
|
||||||
|
|
||||||
uniform vec2 topLeft;
|
uniform vec2 topLeft;
|
||||||
uniform vec2 bottomRight;
|
uniform vec2 bottomRight;
|
||||||
|
@ -15,7 +13,6 @@ uniform vec2 fullSize;
|
||||||
uniform float radius;
|
uniform float radius;
|
||||||
uniform float range;
|
uniform float range;
|
||||||
uniform float shadowPower;
|
uniform float shadowPower;
|
||||||
uniform int useAlphaMatte;
|
|
||||||
|
|
||||||
float pixAlphaRoundedDistance(float distanceToCorner) {
|
float pixAlphaRoundedDistance(float distanceToCorner) {
|
||||||
if (distanceToCorner > radius) {
|
if (distanceToCorner > radius) {
|
||||||
|
@ -77,10 +74,6 @@ void main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useAlphaMatte == 1) {
|
|
||||||
pixColor[3] *= 1.0 - texture2D(alphaMatte, v_texcoordMatte)[3];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pixColor[3] == 0.0) {
|
if (pixColor[3] == 0.0) {
|
||||||
discard; return;
|
discard; return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue