Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VkCV Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vulkan2021
VkCV Framework
Commits
dc50aab2
Commit
dc50aab2
authored
3 years ago
by
Sebastian Gaida
Browse files
Options
Downloads
Patches
Plain Diff
[
#16
] [Docu] add comments for functions
parent
5d385670
No related branches found
No related tags found
4 merge requests
!12
Resolve "Swapchain Class"
,
!7
Resolve "Shader Program Class"
,
!5
Resolve "Pipeline State Object"
,
!4
Resolve "Renderpass Class"
Pipeline
#24731
passed
3 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/vkcv/SwapChain.cpp
+46
-1
46 additions, 1 deletion
src/vkcv/SwapChain.cpp
with
46 additions
and
1 deletion
src/vkcv/SwapChain.cpp
+
46
−
1
View file @
dc50aab2
...
@@ -11,14 +11,29 @@ namespace vkcv {
...
@@ -11,14 +11,29 @@ namespace vkcv {
return
m_swapchain
;
return
m_swapchain
;
}
}
/**
* gets surface of the swapchain
* @return current surface
*/
vk
::
SurfaceKHR
SwapChain
::
getSurface
()
{
vk
::
SurfaceKHR
SwapChain
::
getSurface
()
{
return
m_surface
;
return
m_surface
;
}
}
/**
* gets the surface of the swapchain
* @return chosen format
*/
vk
::
SurfaceFormatKHR
SwapChain
::
getSurfaceFormat
(){
vk
::
SurfaceFormatKHR
SwapChain
::
getSurfaceFormat
(){
return
m_format
;
return
m_format
;
}
}
/**
* creates surface and checks availability
* @param window current window for the surface
* @param instance Vulkan-Instance
* @param physicalDevice Vulkan-PhysicalDevice
* @return created surface
*/
vk
::
SurfaceKHR
createSurface
(
GLFWwindow
*
window
,
const
vk
::
Instance
&
instance
,
const
vk
::
PhysicalDevice
&
physicalDevice
)
{
vk
::
SurfaceKHR
createSurface
(
GLFWwindow
*
window
,
const
vk
::
Instance
&
instance
,
const
vk
::
PhysicalDevice
&
physicalDevice
)
{
//create surface
//create surface
VkSurfaceKHR
surface
;
VkSurfaceKHR
surface
;
...
@@ -33,6 +48,13 @@ namespace vkcv {
...
@@ -33,6 +48,13 @@ namespace vkcv {
return
vk
::
SurfaceKHR
(
surface
);
return
vk
::
SurfaceKHR
(
surface
);
}
}
/**
* chooses Extent and clapms values to the available
* @param physicalDevice Vulkan-PhysicalDevice
* @param surface of the swapchain
* @param window of the current application
* @return chosen Extent for the surface
*/
vk
::
Extent2D
chooseSwapExtent
(
vk
::
PhysicalDevice
physicalDevice
,
vk
::
SurfaceKHR
surface
,
const
Window
&
window
){
vk
::
Extent2D
chooseSwapExtent
(
vk
::
PhysicalDevice
physicalDevice
,
vk
::
SurfaceKHR
surface
,
const
Window
&
window
){
vk
::
SurfaceCapabilitiesKHR
surfaceCapabilities
;
vk
::
SurfaceCapabilitiesKHR
surfaceCapabilities
;
if
(
physicalDevice
.
getSurfaceCapabilitiesKHR
(
surface
,
&
surfaceCapabilities
)
!=
vk
::
Result
::
eSuccess
){
if
(
physicalDevice
.
getSurfaceCapabilitiesKHR
(
surface
,
&
surfaceCapabilities
)
!=
vk
::
Result
::
eSuccess
){
...
@@ -55,6 +77,12 @@ namespace vkcv {
...
@@ -55,6 +77,12 @@ namespace vkcv {
return
extent2D
;
return
extent2D
;
}
}
/**
* chooses Surface Format for the current surface
* @param physicalDevice Vulkan-PhysicalDevice
* @param surface of the swapchain
* @return available Format
*/
vk
::
SurfaceFormatKHR
chooseSwapSurfaceFormat
(
vk
::
PhysicalDevice
physicalDevice
,
vk
::
SurfaceKHR
surface
)
{
vk
::
SurfaceFormatKHR
chooseSwapSurfaceFormat
(
vk
::
PhysicalDevice
physicalDevice
,
vk
::
SurfaceKHR
surface
)
{
uint32_t
formatCount
;
uint32_t
formatCount
;
physicalDevice
.
getSurfaceFormatsKHR
(
surface
,
&
formatCount
,
nullptr
);
physicalDevice
.
getSurfaceFormatsKHR
(
surface
,
&
formatCount
,
nullptr
);
...
@@ -71,6 +99,12 @@ namespace vkcv {
...
@@ -71,6 +99,12 @@ namespace vkcv {
return
availableFormats
[
0
];
return
availableFormats
[
0
];
}
}
/**
* returns vk::PresentModeKHR::eMailbox if available or vk::PresentModeKHR::eFifo otherwise
* @param physicalDevice Vulkan-PhysicalDevice
* @param surface of the swapchain
* @return available PresentationMode
*/
vk
::
PresentModeKHR
choosePresentMode
(
vk
::
PhysicalDevice
physicalDevice
,
vk
::
SurfaceKHR
surface
)
{
vk
::
PresentModeKHR
choosePresentMode
(
vk
::
PhysicalDevice
physicalDevice
,
vk
::
SurfaceKHR
surface
)
{
uint32_t
modeCount
;
uint32_t
modeCount
;
physicalDevice
.
getSurfacePresentModesKHR
(
surface
,
&
modeCount
,
nullptr
);
physicalDevice
.
getSurfacePresentModesKHR
(
surface
,
&
modeCount
,
nullptr
);
...
@@ -88,6 +122,12 @@ namespace vkcv {
...
@@ -88,6 +122,12 @@ namespace vkcv {
return
vk
::
PresentModeKHR
::
eFifo
;
return
vk
::
PresentModeKHR
::
eFifo
;
}
}
/**
* returns the minImageCount +1 for at least doublebuffering, if it's greater than maxImageCount return maxImageCount
* @param physicalDevice Vulkan-PhysicalDevice
* @param surface of the swapchain
* @return available ImageCount
*/
uint32_t
chooseImageCount
(
vk
::
PhysicalDevice
physicalDevice
,
vk
::
SurfaceKHR
surface
)
{
uint32_t
chooseImageCount
(
vk
::
PhysicalDevice
physicalDevice
,
vk
::
SurfaceKHR
surface
)
{
vk
::
SurfaceCapabilitiesKHR
surfaceCapabilities
;
vk
::
SurfaceCapabilitiesKHR
surfaceCapabilities
;
if
(
physicalDevice
.
getSurfaceCapabilitiesKHR
(
surface
,
&
surfaceCapabilities
)
!=
vk
::
Result
::
eSuccess
){
if
(
physicalDevice
.
getSurfaceCapabilitiesKHR
(
surface
,
&
surfaceCapabilities
)
!=
vk
::
Result
::
eSuccess
){
...
@@ -102,7 +142,12 @@ namespace vkcv {
...
@@ -102,7 +142,12 @@ namespace vkcv {
return
imageCount
;
return
imageCount
;
}
}
/**
* creates and returns a swapchain with default specs
* @param window of the current application
* @param context that keeps instance, physicalDevice and a device.
* @return swapchain
*/
SwapChain
SwapChain
::
create
(
const
Window
&
window
,
const
Context
&
context
)
{
SwapChain
SwapChain
::
create
(
const
Window
&
window
,
const
Context
&
context
)
{
const
vk
::
Instance
&
instance
=
context
.
getInstance
();
const
vk
::
Instance
&
instance
=
context
.
getInstance
();
const
vk
::
PhysicalDevice
&
physicalDevice
=
context
.
getPhysicalDevice
();
const
vk
::
PhysicalDevice
&
physicalDevice
=
context
.
getPhysicalDevice
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment