Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Lukas Tietze
MASTERARBEIT😆😜
Commits
262bb32a
Commit
262bb32a
authored
Jun 30, 2020
by
Lukas Tietze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixe für shaderc-Implementierung!
parent
3a9c77c9
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
295 additions
and
218 deletions
+295
-218
CMakeLists.txt
CMakeLists.txt
+7
-4
assets/shaders/post-processing/default.vert.glsl
assets/shaders/post-processing/default.vert.glsl
+2
-2
src/App/src/VkrtApp.cpp
src/App/src/VkrtApp.cpp
+1
-1
src/Lib/include/Defs.hpp
src/Lib/include/Defs.hpp
+13
-0
src/Lib/include/Util/Logging.hpp
src/Lib/include/Util/Logging.hpp
+85
-50
src/Lib/src/Core/App.cpp
src/Lib/src/Core/App.cpp
+15
-15
src/Lib/src/Core/AppCreateInfo.cpp
src/Lib/src/Core/AppCreateInfo.cpp
+1
-1
src/Lib/src/Core/CgContext.Basics.cpp
src/Lib/src/Core/CgContext.Basics.cpp
+11
-11
src/Lib/src/Core/CgContext.Rasterization.cpp
src/Lib/src/Core/CgContext.Rasterization.cpp
+16
-5
src/Lib/src/Core/CgContext.Raytracing.cpp
src/Lib/src/Core/CgContext.Raytracing.cpp
+10
-10
src/Lib/src/Core/CgContext.cpp
src/Lib/src/Core/CgContext.cpp
+66
-57
src/Lib/src/Core/DeviceInfo.cpp
src/Lib/src/Core/DeviceInfo.cpp
+7
-7
src/Lib/src/Util/Logging.cpp
src/Lib/src/Util/Logging.cpp
+39
-41
src/Lib/src/VkUtil/CompileShader.cpp
src/Lib/src/VkUtil/CompileShader.cpp
+12
-13
src/Playground/src/main.cpp
src/Playground/src/main.cpp
+9
-0
src/submodules/shaderc
src/submodules/shaderc
+1
-1
No files found.
CMakeLists.txt
View file @
262bb32a
...
...
@@ -18,7 +18,7 @@ add_subdirectory(./src/submodules/glfw)
set
(
SHADERC_SKIP_TESTS on
)
set
(
SHADERC_ENABLE_SHARED_CRT on
)
add_subdirectory
(
./src/submodules/shaderc/
src
)
add_subdirectory
(
./src/submodules/shaderc/
)
# set(ASSIMP_NO_EXPORT on)
set
(
ASSIMP_BUILD_TESTS off
)
...
...
@@ -88,7 +88,8 @@ target_include_directories(Lib
PRIVATE
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/glfw/include
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/glm
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/shaderc/.shaderc/include
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/shaderc/libshaderc/include
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/shaderc/libshaderc_util/include
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/assimp/include
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/dearImGui
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/dearImGui/examples
...
...
@@ -128,7 +129,8 @@ target_include_directories(App
PRIVATE
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/glfw/include
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/glm
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/shaderc/src/libshaderc/include
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/shaderc/libshaderc/include
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/shaderc/libshaderc_util/include
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/assimp/include
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/dearImGui
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/dearImGui/examples
...
...
@@ -161,7 +163,8 @@ target_include_directories(Playground
PRIVATE
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/glfw/include
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/glm
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/shaderc/src/libshaderc/include
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/shaderc/libshaderc/include
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/shaderc/libshaderc_util/include
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/assimp/include
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/dearImGui
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/submodules/dearImGui/examples
...
...
assets/shaders/post-processing/default.vert.glsl
View file @
262bb32a
#version 450
#extension GL_GOOGLE_include_directive : enable
#extension GL_ARB_separate_shader_objects : enable
//
#extension GL_GOOGLE_include_directive : enable
//
#extension GL_ARB_separate_shader_objects : enable
layout
(
location
=
0
)
out
vec2
texCoord
;
...
...
src/App/src/VkrtApp.cpp
View file @
262bb32a
...
...
@@ -276,7 +276,7 @@ lib::AppCreateInfo app::VkrtApp::CreateInitInfo() const
info
.
shaderTable
.
postProcessingFragmentShader
.
path
=
"./assets/shaders/post-processing/default.frag.glsl"
;
info
.
shaderTable
.
postProcessingFragmentShader
.
compileOptions
.
optimizationLevel
=
lib
::
ShaderOptimizationLevel
::
Performance
;
info
.
shaderTable
.
postProcessingVertexShader
.
type
=
lib
::
ShaderType
::
Fragment
;
info
.
shaderTable
.
postProcessingVertexShader
.
type
=
lib
::
ShaderType
::
Vertex
;
info
.
shaderTable
.
postProcessingVertexShader
.
fileType
=
lib
::
ShaderFileType
::
Glsl
;
info
.
shaderTable
.
postProcessingVertexShader
.
path
=
"./assets/shaders/post-processing/default.vert.glsl"
;
info
.
shaderTable
.
postProcessingVertexShader
.
compileOptions
.
optimizationLevel
=
lib
::
ShaderOptimizationLevel
::
Performance
;
...
...
src/Lib/include/Defs.hpp
View file @
262bb32a
...
...
@@ -22,4 +22,17 @@ namespace lib
inline
const
glm
::
vec3
y
=
{
0
,
1
,
0
};
inline
const
glm
::
vec3
z
=
{
0
,
0
,
1
};
}
// namespace axis
namespace
ansiColors
{
constexpr
auto
Black
=
"\u001b[30m"
;
constexpr
auto
Red
=
"\u001b[31m"
;
constexpr
auto
Green
=
"\u001b[32m"
;
constexpr
auto
Yellow
=
"\u001b[33m"
;
constexpr
auto
Blue
=
"\u001b[34m"
;
constexpr
auto
Magenta
=
"\u001b[35m"
;
constexpr
auto
Cyan
=
"\u001b[36m"
;
constexpr
auto
White
=
"\u001b[37m"
;
constexpr
auto
Reset
=
"\u001b[0m"
;
}
// namespace ansiColors
}
// namespace lib
src/Lib/include/Util/Logging.hpp
View file @
262bb32a
...
...
@@ -7,63 +7,98 @@
namespace
lib
{
namespace
log
{
void
SetLoggingStatus
(
bool
debugEnabled
,
bool
infoEnabled
,
bool
warningEnabled
,
bool
errorEnabled
);
bool
IsDebugEnabled
();
bool
IsInfoEnabled
();
bool
IsWarningEnabled
();
bool
IsErrorEnabled
();
void
LogDebug
(
const
std
::
string
&
text
);
void
Log
(
const
std
::
string
&
text
);
void
LogWarning
(
const
std
::
string
&
text
);
void
LogError
(
const
std
::
string
&
text
);
template
<
class
TFirst
,
class
...
TArgs
>
void
LogDebug
(
const
std
::
string
&
format
,
const
TFirst
&
first
,
const
TArgs
&
...
args
)
{
if
constexpr
(
IsDebug
)
namespace
log
{
if
(
!
lib
::
log
::
IsDebugEnabled
())
struct
ChannelState
{
return
;
}
bool
enabled
;
bool
flush
;
std
::
string
prefix
;
std
::
string
suffix
;
lib
::
log
::
LogDebug
(
Format
(
format
,
first
,
args
...));
}
}
inline
ChannelState
(
bool
enabled
,
std
::
string
prefix
,
std
::
string
suffix
,
bool
flush
)
:
enabled
(
enabled
),
flush
(
flush
),
prefix
(
prefix
),
suffix
(
suffix
)
{}
};
template
<
class
TFirst
,
class
...
TArgs
>
void
Log
(
const
std
::
string
&
format
,
const
TFirst
&
first
,
const
TArgs
&
...
args
)
{
if
(
!
lib
::
log
::
IsInfoEnabled
())
{
return
;
}
struct
State
{
ChannelState
debug
;
ChannelState
info
;
ChannelState
warning
;
ChannelState
error
;
lib
::
log
::
Log
(
Format
(
format
,
first
,
args
...));
}
inline
State
(
ChannelState
debug
,
ChannelState
info
,
ChannelState
warning
,
ChannelState
error
)
:
debug
(
debug
),
info
(
info
),
warning
(
warning
),
error
(
error
)
{
}
};
template
<
class
TFirst
,
class
...
TArgs
>
void
LogWarning
(
const
std
::
string
&
format
,
const
TFirst
&
first
,
const
TArgs
&
...
args
)
{
if
(
!
lib
::
log
::
IsWarningEnabled
())
{
return
;
}
State
&
GetState
();
lib
::
log
::
LogWarning
(
Format
(
format
,
first
,
args
...));
}
void
Debug
(
const
std
::
string
&
text
);
void
Info
(
const
std
::
string
&
text
);
void
Warning
(
const
std
::
string
&
text
);
void
Error
(
const
std
::
string
&
text
);
template
<
class
TFirst
,
class
...
TArgs
>
void
LogError
(
const
std
::
string
&
format
,
const
TFirst
&
first
,
const
TArgs
&
...
args
)
{
if
(
!
lib
::
log
::
IsErrorEnabled
())
{
return
;
}
template
<
class
TFirst
,
class
...
TArgs
>
void
Debug
(
const
std
::
string
&
format
,
const
TFirst
&
first
,
const
TArgs
&
...
args
)
{
if
constexpr
(
IsDebug
)
{
if
(
!
lib
::
log
::
GetState
().
debug
.
enabled
)
{
return
;
}
lib
::
log
::
LogError
(
Format
(
format
,
first
,
args
...));
}
}
// namespace log
lib
::
log
::
Debug
(
Format
(
format
,
first
,
args
...));
}
}
template
<
class
TFirst
,
class
...
TArgs
>
void
Info
(
const
std
::
string
&
format
,
const
TFirst
&
first
,
const
TArgs
&
...
args
)
{
if
(
!
lib
::
log
::
GetState
().
info
.
enabled
)
{
return
;
}
lib
::
log
::
Info
(
Format
(
format
,
first
,
args
...));
}
template
<
class
TFirst
,
class
...
TArgs
>
void
Warning
(
const
std
::
string
&
format
,
const
TFirst
&
first
,
const
TArgs
&
...
args
)
{
if
(
!
lib
::
log
::
GetState
().
warning
.
enabled
)
{
return
;
}
lib
::
log
::
Warning
(
Format
(
format
,
first
,
args
...));
}
template
<
class
TFirst
,
class
...
TArgs
>
void
Error
(
const
std
::
string
&
format
,
const
TFirst
&
first
,
const
TArgs
&
...
args
)
{
if
(
!
lib
::
log
::
GetState
().
error
.
enabled
)
{
return
;
}
lib
::
log
::
Error
(
Format
(
format
,
first
,
args
...));
}
}
// namespace log
}
// namespace lib
\ No newline at end of file
src/Lib/src/Core/App.cpp
View file @
262bb32a
...
...
@@ -8,9 +8,9 @@
#include <numeric>
#include <cmath>
using
lib
::
log
::
Log
;
using
lib
::
log
::
Log
Error
;
using
lib
::
log
::
Log
Warning
;
using
lib
::
log
::
Info
;
using
lib
::
log
::
Error
;
using
lib
::
log
::
Warning
;
#undef CreateWindow
...
...
@@ -145,20 +145,20 @@ lib::App::App(const AppCreateInfo &info) : appBaseName(info.appName),
{
if
(
!
info
.
Validate
(
false
))
{
Log
Error
(
"Invalid create info!"
);
Error
(
"Invalid create info!"
);
return
;
}
if
(
!
glfwInit
())
{
Log
Error
(
"Glfw could not be initialized!"
);
Error
(
"Glfw could not be initialized!"
);
return
;
}
if
(
!
glfwVulkanSupported
())
{
Log
Error
(
"Vulkan is not supported!"
);
Error
(
"Vulkan is not supported!"
);
return
;
}
...
...
@@ -172,22 +172,22 @@ lib::App::App(const AppCreateInfo &info) : appBaseName(info.appName),
if
(
this
->
context
->
IsOk
())
{
Log
(
"Successfully initialized App!"
);
Info
(
"Successfully initialized App!"
);
}
else
if
(
this
->
context
->
IsRecoverable
())
{
Log
Warning
(
"Initialized App with recoverable errors!"
);
Warning
(
"Initialized App with recoverable errors!"
);
}
else
{
Log
Error
(
"Failed to initialize App: Failed to initialize Vulkan Context!"
);
Error
(
"Failed to initialize App: Failed to initialize Vulkan Context!"
);
}
this
->
RegisterCallbacks
();
}
catch
(
const
std
::
exception
&
e
)
{
Log
Error
(
"Failed to initialize App: Exception occurred: %"
,
e
.
what
());
Error
(
"Failed to initialize App: Exception occurred: %"
,
e
.
what
());
}
}
...
...
@@ -227,21 +227,21 @@ void lib::App::Run()
{
if
(
!
this
->
IsOk
())
{
Log
Error
(
"The App was not initialized correctly, can't run!"
);
Error
(
"The App was not initialized correctly, can't run!"
);
return
;
}
if
(
!
this
->
adapter
)
{
Log
Error
(
"There must be an IAppAdapter attached to run!"
);
Error
(
"There must be an IAppAdapter attached to run!"
);
return
;
}
this
->
adapter
->
AfterInit
(
*
this
);
Log
(
"Starting main loop!"
);
Info
(
"Starting main loop!"
);
auto
hasException
=
false
;
::
t0
=
::
t1
=
std
::
chrono
::
high_resolution_clock
::
now
();
...
...
@@ -261,12 +261,12 @@ void lib::App::Run()
}
catch
(
const
std
::
exception
&
e
)
{
Log
Error
(
"Exception occurred: %"
,
e
.
what
());
Error
(
"Exception occurred: %"
,
e
.
what
());
hasException
=
true
;
}
catch
(...)
{
Log
Error
(
"Unidentified exception occurred"
);
Error
(
"Unidentified exception occurred"
);
hasException
=
true
;
}
}
...
...
src/Lib/src/Core/AppCreateInfo.cpp
View file @
262bb32a
...
...
@@ -57,7 +57,7 @@ bool lib::AppCreateInfo::Validate(bool silent) const
{
for
(
const
auto
&
error
:
errors
)
{
lib
::
log
::
Log
Error
(
::
errorMessages
[
error
]);
lib
::
log
::
Error
(
::
errorMessages
[
error
]);
}
}
...
...
src/Lib/src/Core/CgContext.Basics.cpp
View file @
262bb32a
...
...
@@ -17,10 +17,10 @@
#include "Util/Utils.hpp"
#include "VkUtil/VkUtil.hpp"
using
lib
::
log
::
Lo
g
;
using
lib
::
log
::
LogDebug
;
using
lib
::
log
::
LogError
;
using
lib
::
log
::
Log
Warning
;
using
lib
::
log
::
Debu
g
;
using
lib
::
log
::
Error
;
using
lib
::
log
::
Info
;
using
lib
::
log
::
Warning
;
#undef min
#undef max
...
...
@@ -29,11 +29,11 @@ void lib::CgContext::QueryExtensions()
{
this
->
availableExtensions
=
vk
::
enumerateInstanceExtensionProperties
();
if
(
lib
::
log
::
IsD
ebug
E
nabled
()
)
if
(
lib
::
log
::
GetState
().
d
ebug
.
e
nabled
)
{
for
(
const
auto
&
availableExtension
:
this
->
availableExtensions
)
{
Log
Debug
(
"Available extension %"
,
availableExtension
.
extensionName
);
Debug
(
"Available extension %"
,
availableExtension
.
extensionName
);
}
}
}
...
...
@@ -52,11 +52,11 @@ bool lib::CgContext::CheckAndAdd(const char *name, NameList &buf, bool required)
if
(
required
)
{
Log
Error
(
"Could not find required extension %"
,
name
);
Error
(
"Could not find required extension %"
,
name
);
}
else
{
Log
Warning
(
"Could not find optional extension %"
,
name
);
Warning
(
"Could not find optional extension %"
,
name
);
}
return
false
;
...
...
@@ -78,11 +78,11 @@ void lib::CgContext::QueryLayers()
{
this
->
availableLayers
=
vk
::
enumerateInstanceLayerProperties
();
if
(
lib
::
log
::
IsD
ebug
E
nabled
()
)
if
(
lib
::
log
::
GetState
().
d
ebug
.
e
nabled
)
{
for
(
const
auto
&
availableLayer
:
this
->
availableLayers
)
{
Log
Debug
(
"Available extension %"
,
availableLayer
.
layerName
);
Debug
(
"Available extension %"
,
availableLayer
.
layerName
);
}
}
}
...
...
@@ -97,7 +97,7 @@ bool lib::CgContext::CheckLayer(const char *name)
}
}
Log
Error
(
"Could not find layer %"
,
name
);
Error
(
"Could not find layer %"
,
name
);
return
false
;
}
...
...
src/Lib/src/Core/CgContext.Rasterization.cpp
View file @
262bb32a
...
...
@@ -26,10 +26,10 @@
#include "imgui_impl_vulkan.h"
#include "imgui_impl_glfw.h"
using
lib
::
log
::
Lo
g
;
using
lib
::
log
::
LogDebug
;
using
lib
::
log
::
LogError
;
using
lib
::
log
::
Log
Warning
;
using
lib
::
log
::
Debu
g
;
using
lib
::
log
::
Error
;
using
lib
::
log
::
Info
;
using
lib
::
log
::
Warning
;
bool
lib
::
CgContext
::
TryCreateRasterizerPipeline
()
{
...
...
@@ -73,6 +73,7 @@ bool lib::CgContext::TryCreateRasterizerPipeline()
viewport
.
maxDepth
=
1.
f
;
vk
::
Rect2D
scissor
;
scissor
.
offset
=
{
0
,
0
};
scissor
.
extent
=
this
->
swapChainExtent
;
vk
::
PipelineViewportStateCreateInfo
viewportStateCreateInfo
;
...
...
@@ -122,7 +123,17 @@ bool lib::CgContext::TryCreateRasterizerPipeline()
createInfo
.
layout
=
this
->
rasterizationStep
.
pipelineLayout
;
const
auto
result
=
this
->
logicalDevice
.
createGraphicsPipeline
(
nullptr
,
createInfo
);
this
->
rasterizationStep
.
pipeline
=
result
.
value
;
if
(
result
.
result
==
vk
::
Result
::
eSuccess
)
{
this
->
rasterizationStep
.
pipeline
=
result
.
value
;
}
else
{
Error
(
"Failed to create Graphicspipeline!"
);
success
=
false
;
}
}
if
(
vertexModule
)
...
...
src/Lib/src/Core/CgContext.Raytracing.cpp
View file @
262bb32a
...
...
@@ -26,10 +26,10 @@
#include "imgui_impl_vulkan.h"
#include "imgui_impl_glfw.h"
using
lib
::
log
::
Log
;
using
lib
::
log
::
Log
Debug
;
using
lib
::
log
::
Log
Error
;
using
lib
::
log
::
Log
Warning
;
using
lib
::
log
::
Info
;
using
lib
::
log
::
Debug
;
using
lib
::
log
::
Error
;
using
lib
::
log
::
Warning
;
void
lib
::
CgContext
::
CreateAccelerationStructures
()
{
...
...
@@ -51,7 +51,7 @@ void lib::CgContext::CreateAccelerationStructures()
commandBuffer
.
Run
();
Log
(
"Successfully created acceleration structures!"
);
Info
(
"Successfully created acceleration structures!"
);
}
void
lib
::
CgContext
::
CreateRaytracingDescriptorSetLayout
()
...
...
@@ -131,7 +131,7 @@ void lib::CgContext::CreateRaytracingDescriptorSetLayout()
this
->
raytracingStep
.
descriptorSetLayout
=
this
->
logicalDevice
.
createDescriptorSetLayout
(
createInfo
);
Log
(
"Successfully created descriptor set layout!"
);
Info
(
"Successfully created descriptor set layout!"
);
}
void
lib
::
CgContext
::
CreateRaytracingDescriptorPool
()
...
...
@@ -298,7 +298,7 @@ void lib::CgContext::CreateRaytracingDescriptorSets()
{});
}
Log
(
"Successfully created raytracing descriptor set!"
);
Info
(
"Successfully created raytracing descriptor set!"
);
}
bool
lib
::
CgContext
::
TryCreateRayTracingPipeline
()
...
...
@@ -414,13 +414,13 @@ bool lib::CgContext::TryCreateRayTracingPipeline()
const
auto
result
=
this
->
logicalDevice
.
createRayTracingPipelinesNV
(
vk
::
PipelineCache
(),
pipelineCreateInfo
);
this
->
raytracingStep
.
pipeline
=
result
.
value
[
0
];
Log
(
"Successfully created raytracing pipeline!"
);
Info
(
"Successfully created raytracing pipeline!"
);
success
=
true
;
}
else
{
Log
Error
(
"Failed to load shaders required for raytracing!"
);
Error
(
"Failed to load shaders required for raytracing!"
);
}
if
(
raygenModule
)
...
...
@@ -463,5 +463,5 @@ void lib::CgContext::CreateShaderBindingTable()
this
->
shaderBindingTableBuffer
.
reset
(
new
lib
::
Buffer
(
std
::
move
(
finalBuffer
)));
Log
(
"Successfully created shader binding table!"
);
Info
(
"Successfully created shader binding table!"
);
}
src/Lib/src/Core/CgContext.cpp
View file @
262bb32a
...
...
@@ -26,39 +26,38 @@
#include "imgui_impl_vulkan.h"
#include "imgui_impl_glfw.h"
using
lib
::
log
::
Lo
g
;
using
lib
::
log
::
LogDebug
;
using
lib
::
log
::
LogError
;
using
lib
::
log
::
Log
Warning
;
using
lib
::
log
::
Debu
g
;
using
lib
::
log
::
Error
;
using
lib
::
log
::
Info
;
using
lib
::
log
::
Warning
;
#undef min
#undef max
namespace
{
VKAPI_ATTR
vk
::
Bool32
VKAPI_CALL
debugCallback
(
vk
::
DebugUtilsMessageSeverityFlagBitsEXT
messageSeverity
,
vk
::
DebugUtilsMessageTypeFlagsEXT
messageType
,
const
vk
::
DebugUtilsMessengerCallbackDataEXT
&
pCallbackData
,
void
*
pUserData
)
bool
debugCallback
(
vk
::
DebugUtilsMessageSeverityFlagBitsEXT
messageSeverity
,
vk
::
DebugUtilsMessageTypeFlagsEXT
messageType
,
const
vk
::
DebugUtilsMessengerCallbackDataEXT
&
pCallbackData
,
void
*
pUserData
)
{
switch
(
messageSeverity
)
{
case
vk
::
DebugUtilsMessageSeverityFlagBitsEXT
::
eVerbose
:
lib
::
log
::
Log
Debug
(
"[ValidationLayer] %"
,
pCallbackData
.
pMessage
);
lib
::
log
::
Debug
(
"[ValidationLayer] %"
,
pCallbackData
.
pMessage
);
break
;
case
vk
::
DebugUtilsMessageSeverityFlagBitsEXT
::
eInfo
:
lib
::
log
::
Log
(
"[ValidationLayer] %"
,
pCallbackData
.
pMessage
);
lib
::
log
::
Info
(
"[ValidationLayer] %"
,
pCallbackData
.
pMessage
);
break
;
case
vk
::
DebugUtilsMessageSeverityFlagBitsEXT
::
eWarning
:
lib
::
log
::
Log
Warning
(
"[ValidationLayer] %"
,
pCallbackData
.
pMessage
);
lib
::
log
::
Warning
(
"[ValidationLayer] %"
,
pCallbackData
.
pMessage
);
break
;
case
vk
::
DebugUtilsMessageSeverityFlagBitsEXT
::
eError
:
lib
::
log
::
LogError
(
"[ValidationLayer] %"
,
pCallbackData
.
pMessage
);
lib
::
log
::
Error
(
"[ValidationLayer] %"
,
pCallbackData
.
pMessage
);
break
;
}
return
VK_FALSE
;
return
false
;
}
/**
...
...
@@ -88,11 +87,11 @@ lib::CgContext::CgContext(const AppCreateInfo &info, GLFWwindow *window) : windo
PFN_vkGetInstanceProcAddr
vkGetInstanceProcAddr
=
dl
.
getProcAddress
<
PFN_vkGetInstanceProcAddr
>
(
"vkGetInstanceProcAddr"
);
VULKAN_HPP_DEFAULT_DISPATCHER
.
init
(
vkGetInstanceProcAddr
);
Log
(
"Starting %
\n
Version: %.%.%
\n
TimeStamp: %
\n
BuildType: %"
,
this
->
appInfo
.
appName
,
version
::
Major
,
version
::
Minor
,
version
::
Patch
,
version
::
TimeStamp
,
version
::
Type
);
Info
(
"Starting %
\n
Version: %.%.%
\n
TimeStamp: %
\n
BuildType: %"
,
this
->
appInfo
.
appName
,
version
::
Major
,
version
::
Minor
,
version
::
Patch
,
version
::
TimeStamp
,
version
::
Type
);
try
{
...
...
@@ -127,15 +126,15 @@ lib::CgContext::CgContext(const AppCreateInfo &info, GLFWwindow *window) : windo
this
->
CreateSyncObjects
();
this
->
InitializeImGui
();
this
->
frameIndex
=
0
;
Log
(
"Successfully initialized Vulkan!"
);
Info
(
"Successfully initialized Vulkan!"
);
}
catch
(
CoreInitException
&
e
)
{
Log
Error
(
"Failed to initialize Vulkan!
\n
Reason: %"
,
e
.
what
());
Error
(
"Failed to initialize Vulkan!
\n
Reason: %"
,
e
.
what
());
}
catch
(
std
::
exception
&
e
)
{
Log
Error
(
"Failed to initialize Vulkan after unhandled exception!
\n
What: %!"
,
e
.
what
());
Error
(
"Failed to initialize Vulkan after unhandled exception!
\n
What: %!"
,
e
.
what
());
}
}
...
...
@@ -415,7 +414,7 @@ void lib::CgContext::CreateInstance()
}
else
{
Log
Warning
(
"Not all required Layers are available!"
);
Warning
(
"Not all required Layers are available!"
);
}
}
...
...
@@ -429,7 +428,7 @@ void lib::CgContext::CreateInstance()
this
->
instance
=
vk
::
createInstance
(
createInfo
);
Log
(
"Successfully created vulkan instance!"
);
Info
(
"Successfully created vulkan instance!"
);
VULKAN_HPP_DEFAULT_DISPATCHER
.
init
(
this
->
instance
);
...
...
@@ -443,10 +442,20 @@ void lib::CgContext::SetupDebugCallbacks()
{