Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWin
Commits
35e0abb0
Commit
35e0abb0
authored
Jan 13, 2022
by
Vlad Zahorodnii
Browse files
kwineffects: Rename generateShaderFromResources() to generateShaderFromFile()
It works both with resource files and normal files.
parent
754e0d8f
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/effects/invert/invert.cpp
View file @
35e0abb0
...
...
@@ -71,7 +71,7 @@ bool InvertEffect::loadData()
ensureResources
();
m_inited
=
true
;
m_shader
=
ShaderManager
::
instance
()
->
generateShaderFrom
Resources
(
ShaderTrait
::
MapTexture
,
QString
(),
QStringLiteral
(
":/effects/invert/shaders/invert.frag"
));
m_shader
=
ShaderManager
::
instance
()
->
generateShaderFrom
File
(
ShaderTrait
::
MapTexture
,
QString
(),
QStringLiteral
(
":/effects/invert/shaders/invert.frag"
));
if
(
!
m_shader
->
isValid
())
{
qCCritical
(
KWIN_INVERT
)
<<
"The shader failed to load!"
;
return
false
;
...
...
src/effects/lookingglass/lookingglass.cpp
View file @
35e0abb0
...
...
@@ -114,7 +114,7 @@ bool LookingGlassEffect::loadData()
return
false
;
}
m_shader
=
ShaderManager
::
instance
()
->
generateShaderFrom
Resources
(
ShaderTrait
::
MapTexture
,
QString
(),
QStringLiteral
(
":/effects/lookingglass/shaders/lookingglass.frag"
));
m_shader
=
ShaderManager
::
instance
()
->
generateShaderFrom
File
(
ShaderTrait
::
MapTexture
,
QString
(),
QStringLiteral
(
":/effects/lookingglass/shaders/lookingglass.frag"
));
if
(
m_shader
->
isValid
())
{
ShaderBinder
binder
(
m_shader
);
m_shader
->
setUniform
(
"u_textureSize"
,
QVector2D
(
screenSize
.
width
(),
screenSize
.
height
()));
...
...
src/effects/startupfeedback/startupfeedback.cpp
View file @
35e0abb0
...
...
@@ -152,7 +152,7 @@ void StartupFeedbackEffect::reconfigure(Effect::ReconfigureFlags flags)
m_type
=
BlinkingFeedback
;
if
(
effects
->
compositingType
()
==
OpenGLCompositing
)
{
ensureResources
();
m_blinkingShader
.
reset
(
ShaderManager
::
instance
()
->
generateShaderFrom
Resources
(
ShaderTrait
::
MapTexture
,
QString
(),
QStringLiteral
(
":/effects/startupfeedback/shaders/blinking-startup.frag"
)));
m_blinkingShader
.
reset
(
ShaderManager
::
instance
()
->
generateShaderFrom
File
(
ShaderTrait
::
MapTexture
,
QString
(),
QStringLiteral
(
":/effects/startupfeedback/shaders/blinking-startup.frag"
)));
if
(
m_blinkingShader
->
isValid
())
{
qCDebug
(
KWIN_STARTUPFEEDBACK
)
<<
"Blinking Shader is valid"
;
}
else
{
...
...
src/libkwineffects/kwinglutils.cpp
View file @
35e0abb0
...
...
@@ -800,7 +800,7 @@ static QString resolveShaderFilePath(const QString &filePath)
return
prefix
+
suffix
+
extension
;
}
GLShader
*
ShaderManager
::
generateShaderFrom
Resources
(
ShaderTraits
traits
,
const
QString
&
vertexFile
,
const
QString
&
fragmentFile
)
GLShader
*
ShaderManager
::
generateShaderFrom
File
(
ShaderTraits
traits
,
const
QString
&
vertexFile
,
const
QString
&
fragmentFile
)
{
auto
loadShaderFile
=
[](
const
QString
&
filePath
)
{
QFile
file
(
filePath
);
...
...
src/libkwineffects/kwinglutils.h
View file @
35e0abb0
...
...
@@ -262,9 +262,6 @@ public:
/**
* Creates a custom shader with the given @p traits and custom @p vertexFile and or @p fragmentFile.
* The file names specified in @p vertexFile and @p fragmentFile are relative paths to the shaders
* resource file shipped together with KWin. This means this method can only be used for built-in
* effects, for 3rd party effects generateCustomShader should be used.
*
* If the @p vertexFile is empty a vertex shader with the given @p traits is generated.
* If it is not empty the @p vertexFile is used as the source for the vertex shader.
...
...
@@ -274,14 +271,16 @@ public:
* So if both @p vertexFile and @p fragmentFile are provided the @p traits are ignored.
* If neither are provided a new shader following the @p traits is generated.
*
* If a custom shader stage is provided and core profile is used, the final file path will
* be resolved by appending "_core" to the basename.
*
* @param traits The shader traits for generating the shader
* @param vertexFile optional vertex shader source code to be used instead of shader traits
* @param fragmentFile optional fragment shader source code to be used instead of shader traits
* @return new generated shader
* @see generateCustomShader
* @since 5.6
*/
GLShader
*
generateShaderFrom
Resources
(
ShaderTraits
traits
,
const
QString
&
vertexFile
=
QString
(),
const
QString
&
fragmentFile
=
QString
());
GLShader
*
generateShaderFrom
File
(
ShaderTraits
traits
,
const
QString
&
vertexFile
=
QString
(),
const
QString
&
fragmentFile
=
QString
());
/**
* @return a pointer to the ShaderManager instance
...
...
Vlad Zahorodnii
@vladz
mentioned in commit
32e70460
·
Jan 13, 2022
mentioned in commit
32e70460
mentioned in commit 32e70460d07459f56feaabba629c50eeb1e04be0
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment