Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MASTERARBEIT😆😜
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lukas Tietze
MASTERARBEIT😆😜
Commits
0d411eb0
Commit
0d411eb0
authored
Jul 06, 2020
by
Lukas Tietze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Makros beim Kompilieren
parent
a437e104
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
4 deletions
+39
-4
src/Lib/include/VkUtil/Shader.hpp
src/Lib/include/VkUtil/Shader.hpp
+32
-0
src/Lib/src/Core/CgContext.Rasterization.cpp
src/Lib/src/Core/CgContext.Rasterization.cpp
+1
-2
src/Lib/src/VkUtil/CompileShader.cpp
src/Lib/src/VkUtil/CompileShader.cpp
+6
-2
No files found.
src/Lib/include/VkUtil/Shader.hpp
View file @
0d411eb0
...
...
@@ -80,6 +80,33 @@ namespace lib
None
,
};
/**
* @brief Makrodefinition für den Compiler. Es können Name und Wert angegeben werden.
*/
struct
CompilerMacro
{
/**
* @brief Initialisiert eine neue Instanz der Compiler Macro Klasse.
*
* @param name Der Name.
* @param value Der Wert (optional)
*/
inline
CompilerMacro
(
std
::
string
name
,
std
::
string
value
=
""
)
:
name
(
name
),
value
(
value
)
{}
/**
* @brief Der Name des Makros, also der zu ersetzende Text.
*/
std
::
string
name
;
/**
* @brief Der Wert des Makros.
*/
std
::
string
value
;
};
/**
* @brief Enthält Optionen für die Kompilierung eines Shaders.
*/
...
...
@@ -89,6 +116,11 @@ namespace lib
* @brief Optimierungslevel.
*/
ShaderOptimizationLevel
optimizationLevel
=
lib
::
IsDebug
?
ShaderOptimizationLevel
::
Debug
:
ShaderOptimizationLevel
::
Performance
;
/**
* @brief Eine Auflistung von Makros, die beim Kompilieren definiert sein sollen.
*/
std
::
vector
<
CompilerMacro
>
macros
;
};
/**
...
...
src/Lib/src/Core/CgContext.Rasterization.cpp
View file @
0d411eb0
...
...
@@ -289,8 +289,7 @@ void lib::CgContext::CreateRasterizationFrameBuffers()
},
this
->
swapChainImageFormat
,
vk
::
ImageUsageFlagBits
::
eSampled
|
vk
::
ImageUsageFlagBits
::
eStorage
|
vk
::
ImageUsageFlagBits
::
eColorAttachment
,
vk
::
ImageUsageFlagBits
::
eStorage
,
vk
::
ImageLayout
::
eGeneral
};
auto
newTexture
=
new
lib
::
Texture
{
this
,
...
...
src/Lib/src/VkUtil/CompileShader.cpp
View file @
0d411eb0
...
...
@@ -11,9 +11,8 @@
#include "Util/Logging.hpp"
#include "Util/Io.hpp"
using
lib
::
log
::
Info
;
using
lib
::
log
::
Error
;
using
lib
::
log
::
Info
;
using
lib
::
log
::
Warning
;
namespace
...
...
@@ -134,6 +133,11 @@ bool lib::CompileShader(const std::string &glsl, const lib::ShaderInfo &info, li
options
.
SetTargetEnvironment
(
shaderc_target_env_vulkan
,
shaderc_env_version_vulkan_1_1
);
options
.
SetSourceLanguage
(
shaderc_source_language_glsl
);
for
(
const
auto
&
macro
:
info
.
compileOptions
.
macros
)
{
options
.
AddMacroDefinition
(
macro
.
name
,
macro
.
value
);
}
switch
(
info
.
compileOptions
.
optimizationLevel
)
{
case
lib
::
ShaderOptimizationLevel
::
Debug
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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