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.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);
|
||||
m_RenderData.pCurrentMonData->m_shRGBX.program = prog;
|
||||
m_RenderData.pCurrentMonData->m_shRGBX.tex = glGetUniformLocation(prog, "tex");
|
||||
|
@ -488,6 +495,10 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
|
|||
if (m_bApplyFinalShader && m_sFinalScreenShader.program) {
|
||||
shader = &m_sFinalScreenShader;
|
||||
usingFinalShader = true;
|
||||
} else {
|
||||
if (m_bApplyFinalShader) {
|
||||
shader = &m_RenderData.pCurrentMonData->m_shPASSTHRURGBA;
|
||||
usingFinalShader = true;
|
||||
} else {
|
||||
switch (tex.m_iType) {
|
||||
case TEXTURE_RGBA: shader = &m_RenderData.pCurrentMonData->m_shRGBA; break;
|
||||
|
@ -496,6 +507,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
|
|||
default: RASSERT(false, "tex.m_iTarget unsupported!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(tex.m_iTarget, tex.m_iTexID);
|
||||
|
|
|
@ -41,6 +41,7 @@ struct SMonitorRenderData {
|
|||
bool m_bShadersInitialized = false;
|
||||
CShader m_shQUAD;
|
||||
CShader m_shRGBA;
|
||||
CShader m_shPASSTHRURGBA;
|
||||
CShader m_shRGBX;
|
||||
CShader m_shEXT;
|
||||
CShader m_shBLUR1;
|
||||
|
|
|
@ -122,6 +122,15 @@ void main() {
|
|||
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"#(
|
||||
precision mediump float;
|
||||
varying vec2 v_texcoord;
|
||||
|
|
Loading…
Reference in a new issue