Saving some GPU memory by using one channel textures where possible.

This commit is contained in:
Filippo Scognamiglio 2014-06-07 15:32:21 +02:00
parent 8fd7161ec8
commit 6c461acf28
3 changed files with 8 additions and 7 deletions

View File

@ -159,7 +159,7 @@ ShaderEffect {
noise += horizontal_distortion;" : "")
: "") +
"float color = texture2D(source, coords).r;" +
"float color = texture2D(source, coords).a;" +
(noise_strength !== 0 ? "
color += stepNoise(coords) * noise * (1.0 - distance * distance * 2.0);" : "") +
@ -172,7 +172,7 @@ ShaderEffect {
"vec3 finalColor = mix(background_color, font_color, color).rgb;" +
"finalColor = mix(finalColor * 1.1, vec3(0.0), 1.2 * distance * distance);" +
"finalColor *= texture2D(rasterizationSource, coords).r;" +
"finalColor *= texture2D(rasterizationSource, coords).a;" +
(brightness_flickering !== 0 ? "
finalColor *= brightness;" : "") +

View File

@ -73,7 +73,6 @@ Item{
kterminal.copyClipboard();
}
KTerminal {
id: kterminal
anchors.fill: parent
@ -218,6 +217,7 @@ Item{
id: finalSource
sourceItem: blurredterminal
sourceRect: frame.sourceRect
format: ShaderEffectSource.Alpha
}
ShaderEffect {
id: blurredterminal
@ -252,13 +252,13 @@ Item{
"float color = texture2D(source, coords + delta).r * 256.0;" +
(mBlur !== 0 ?
"float blurredSourceColor = texture2D(blurredSource, qt_TexCoord0).r * 256.0;" +
"float blurredSourceColor = texture2D(blurredSource, qt_TexCoord0).a * 256.0;" +
"blurredSourceColor = blurredSourceColor - blurredSourceColor * " + (1.0 - motionBlurCoefficient) * fpsAttenuation+ ";" +
"color = step(1.0, color) * color + step(color, 1.0) * blurredSourceColor;"
: "") +
"gl_FragColor = vec4(vec3(floor(color) / 256.0), 1.0);" +
"gl_FragColor.a = vec4(floor(color) / 256.0);" +
"}"
}
//////////////////////////////////////////////////////////////////////
@ -308,7 +308,7 @@ Item{
}" +
"void main() {" +
"gl_FragColor = vec4(getScanlineIntensity(qt_TexCoord0));" +
"gl_FragColor.a = getScanlineIntensity(qt_TexCoord0);" +
"}"
}
ShaderEffectSource{
@ -317,5 +317,6 @@ Item{
sourceRect: frame.sourceRect
hideSource: true
smooth: true
format: ShaderEffectSource.Alpha
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.0.1, 2014-06-07T10:59:29. -->
<!-- Written by QtCreator 3.0.1, 2014-06-07T14:58:56. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>