mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-07 18:25:59 +01:00
opengl: use a passthru shader for final wlr copy
This commit is contained in:
parent
f678789dfd
commit
b69f40815f
3 changed files with 27 additions and 5 deletions
|
@ -195,6 +195,13 @@ void CHyprOpenGLImpl::initShaders() {
|
||||||
m_RenderData.pCurrentMonData->m_shRGBA.applyTint = glGetUniformLocation(prog, "applyTint");
|
m_RenderData.pCurrentMonData->m_shRGBA.applyTint = glGetUniformLocation(prog, "applyTint");
|
||||||
m_RenderData.pCurrentMonData->m_shRGBA.tint = glGetUniformLocation(prog, "tint");
|
m_RenderData.pCurrentMonData->m_shRGBA.tint = glGetUniformLocation(prog, "tint");
|
||||||
|
|
||||||
|
prog = createProgram(TEXVERTSRC, TEXFRAGSRCRGBAPASSTHRU);
|
||||||
|
m_RenderData.pCurrentMonData->m_shPASSTHRURGBA.program = prog;
|
||||||
|
m_RenderData.pCurrentMonData->m_shPASSTHRURGBA.proj = glGetUniformLocation(prog, "proj");
|
||||||
|
m_RenderData.pCurrentMonData->m_shPASSTHRURGBA.tex = glGetUniformLocation(prog, "tex");
|
||||||
|
m_RenderData.pCurrentMonData->m_shPASSTHRURGBA.texAttrib = glGetAttribLocation(prog, "texcoord");
|
||||||
|
m_RenderData.pCurrentMonData->m_shPASSTHRURGBA.posAttrib = glGetAttribLocation(prog, "pos");
|
||||||
|
|
||||||
prog = createProgram(TEXVERTSRC, TEXFRAGSRCRGBX);
|
prog = createProgram(TEXVERTSRC, TEXFRAGSRCRGBX);
|
||||||
m_RenderData.pCurrentMonData->m_shRGBX.program = prog;
|
m_RenderData.pCurrentMonData->m_shRGBX.program = prog;
|
||||||
m_RenderData.pCurrentMonData->m_shRGBX.tex = glGetUniformLocation(prog, "tex");
|
m_RenderData.pCurrentMonData->m_shRGBX.tex = glGetUniformLocation(prog, "tex");
|
||||||
|
@ -489,11 +496,16 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
|
||||||
shader = &m_sFinalScreenShader;
|
shader = &m_sFinalScreenShader;
|
||||||
usingFinalShader = true;
|
usingFinalShader = true;
|
||||||
} else {
|
} else {
|
||||||
switch (tex.m_iType) {
|
if (m_bApplyFinalShader) {
|
||||||
case TEXTURE_RGBA: shader = &m_RenderData.pCurrentMonData->m_shRGBA; break;
|
shader = &m_RenderData.pCurrentMonData->m_shPASSTHRURGBA;
|
||||||
case TEXTURE_RGBX: shader = &m_RenderData.pCurrentMonData->m_shRGBX; break;
|
usingFinalShader = true;
|
||||||
case TEXTURE_EXTERNAL: shader = &m_RenderData.pCurrentMonData->m_shEXT; break;
|
} else {
|
||||||
default: RASSERT(false, "tex.m_iTarget unsupported!");
|
switch (tex.m_iType) {
|
||||||
|
case TEXTURE_RGBA: shader = &m_RenderData.pCurrentMonData->m_shRGBA; break;
|
||||||
|
case TEXTURE_RGBX: shader = &m_RenderData.pCurrentMonData->m_shRGBX; break;
|
||||||
|
case TEXTURE_EXTERNAL: shader = &m_RenderData.pCurrentMonData->m_shEXT; break;
|
||||||
|
default: RASSERT(false, "tex.m_iTarget unsupported!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ struct SMonitorRenderData {
|
||||||
bool m_bShadersInitialized = false;
|
bool m_bShadersInitialized = false;
|
||||||
CShader m_shQUAD;
|
CShader m_shQUAD;
|
||||||
CShader m_shRGBA;
|
CShader m_shRGBA;
|
||||||
|
CShader m_shPASSTHRURGBA;
|
||||||
CShader m_shRGBX;
|
CShader m_shRGBX;
|
||||||
CShader m_shEXT;
|
CShader m_shEXT;
|
||||||
CShader m_shBLUR1;
|
CShader m_shBLUR1;
|
||||||
|
|
|
@ -122,6 +122,15 @@ void main() {
|
||||||
gl_FragColor = pixColor * alpha;
|
gl_FragColor = pixColor * alpha;
|
||||||
})#";
|
})#";
|
||||||
|
|
||||||
|
inline const std::string TEXFRAGSRCRGBAPASSTHRU = R"#(
|
||||||
|
precision mediump float;
|
||||||
|
varying vec2 v_texcoord; // is in 0-1
|
||||||
|
uniform sampler2D tex;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
gl_FragColor = texture2D(tex, v_texcoord);
|
||||||
|
})#";
|
||||||
|
|
||||||
inline const std::string TEXFRAGSRCRGBX = R"#(
|
inline const std::string TEXFRAGSRCRGBX = R"#(
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
varying vec2 v_texcoord;
|
varying vec2 v_texcoord;
|
||||||
|
|
Loading…
Reference in a new issue