renderer: optimize border drawcalls (#11891)
calculates the specific border region to avoid sampling on regions where the border cannot be at
This commit is contained in:
parent
378438ffe7
commit
e0c96276df
1 changed files with 18 additions and 22 deletions
|
|
@ -2402,18 +2402,16 @@ void CHyprOpenGLImpl::renderBorder(const CBox& box, const CGradientValueData& gr
|
||||||
|
|
||||||
glBindVertexArray(m_shaders->m_shBORDER1.uniformLocations[SHADER_SHADER_VAO]);
|
glBindVertexArray(m_shaders->m_shBORDER1.uniformLocations[SHADER_SHADER_VAO]);
|
||||||
|
|
||||||
if (m_renderData.clipBox.width != 0 && m_renderData.clipBox.height != 0) {
|
// calculate the border's region, which we need to render over. No need to run the shader on
|
||||||
CRegion damageClip{m_renderData.clipBox.x, m_renderData.clipBox.y, m_renderData.clipBox.width, m_renderData.clipBox.height};
|
// things outside there
|
||||||
damageClip.intersect(m_renderData.damage);
|
CRegion borderRegion = m_renderData.damage.copy().intersect(newBox);
|
||||||
|
borderRegion.subtract(box.copy().expand(-scaledBorderSize - round));
|
||||||
|
|
||||||
if (!damageClip.empty()) {
|
if (m_renderData.clipBox.width != 0 && m_renderData.clipBox.height != 0)
|
||||||
damageClip.forEachRect([this](const auto& RECT) {
|
borderRegion.intersect(m_renderData.clipBox);
|
||||||
scissor(&RECT);
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
if (!borderRegion.empty()) {
|
||||||
});
|
borderRegion.forEachRect([this](const auto& RECT) {
|
||||||
}
|
|
||||||
} else {
|
|
||||||
m_renderData.damage.forEachRect([this](const auto& RECT) {
|
|
||||||
scissor(&RECT);
|
scissor(&RECT);
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
});
|
});
|
||||||
|
|
@ -2492,18 +2490,16 @@ void CHyprOpenGLImpl::renderBorder(const CBox& box, const CGradientValueData& gr
|
||||||
|
|
||||||
glBindVertexArray(m_shaders->m_shBORDER1.uniformLocations[SHADER_SHADER_VAO]);
|
glBindVertexArray(m_shaders->m_shBORDER1.uniformLocations[SHADER_SHADER_VAO]);
|
||||||
|
|
||||||
if (m_renderData.clipBox.width != 0 && m_renderData.clipBox.height != 0) {
|
// calculate the border's region, which we need to render over. No need to run the shader on
|
||||||
CRegion damageClip{m_renderData.clipBox.x, m_renderData.clipBox.y, m_renderData.clipBox.width, m_renderData.clipBox.height};
|
// things outside there
|
||||||
damageClip.intersect(m_renderData.damage);
|
CRegion borderRegion = m_renderData.damage.copy().intersect(newBox);
|
||||||
|
borderRegion.subtract(box.copy().expand(-scaledBorderSize - round));
|
||||||
|
|
||||||
if (!damageClip.empty()) {
|
if (m_renderData.clipBox.width != 0 && m_renderData.clipBox.height != 0)
|
||||||
damageClip.forEachRect([this](const auto& RECT) {
|
borderRegion.intersect(m_renderData.clipBox);
|
||||||
scissor(&RECT);
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
if (!borderRegion.empty()) {
|
||||||
});
|
borderRegion.forEachRect([this](const auto& RECT) {
|
||||||
}
|
|
||||||
} else {
|
|
||||||
m_renderData.damage.forEachRect([this](const auto& RECT) {
|
|
||||||
scissor(&RECT);
|
scissor(&RECT);
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue