Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lava-extras
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
lava
lava-extras
Commits
12801718
Commit
12801718
authored
6 years ago
by
Kaspar Scharf
Browse files
Options
Downloads
Patches
Plain Diff
Implemented proper view/proj matrix handling for ForwardPipeline
parent
170ae9c1
No related branches found
No related tags found
1 merge request
!7
Simple forward rendering pipeline
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pipeline/lava-extras/pipeline/ForwardRenderingPipeline.cc
+51
-6
51 additions, 6 deletions
pipeline/lava-extras/pipeline/ForwardRenderingPipeline.cc
pipeline/lava-extras/pipeline/ForwardRenderingPipeline.hh
+27
-2
27 additions, 2 deletions
pipeline/lava-extras/pipeline/ForwardRenderingPipeline.hh
with
78 additions
and
8 deletions
pipeline/lava-extras/pipeline/ForwardRenderingPipeline.cc
+
51
−
6
View file @
12801718
#include
"ForwardRenderingPipeline.hh"
#include
<glm/glm.hpp>
#include
<glm/ext.hpp>
#include
<lava/objects/RenderPass.hh>
#include
<lava/objects/Buffer.hh>
#include
<lava/objects/Framebuffer.hh>
#include
<lava/objects/GraphicsPipeline.hh>
#include
<lava/objects/Image.hh>
...
...
@@ -12,19 +16,16 @@
#include
<lava/objects/DescriptorSet.hh>
#include
<lava/raii/ActiveRenderPass.hh>
#include
<lava/createinfos/Buffers.hh>
#include
<lava/createinfos/Images.hh>
#include
<lava/createinfos/RenderPassCreateInfo.hh>
#include
<lava/createinfos/PipelineShaderStageCreateInfo.hh>
#include
<lava/createinfos/Sampler.hh>
#include
<lava-extras/camera/FixedCamera.hh>
#include
<lava-extras/camera/GenericCamera.hh>
#include
<glm/ext.hpp>
#include
<lava/createinfos/DescriptorSetLayoutCreateInfo.hh>
#include
<lava-extras/pack/pack.hh>
using
namespace
lava
;
using
namespace
lava
::
pipeline
;
...
...
@@ -87,6 +88,26 @@ ForwardRenderingPipeline::ForwardRenderingPipeline (
info
.
stage
(
1
).
specialize
(
0
,
true
);
// Enable FXAA
mPipelineOutputFXAA
=
mPassOutput
->
createPipeline
(
0
,
info
);
}
{
mViewProjBuffer
=
mDevice
->
createBuffer
(
lava
::
uniformBuffer
(
sizeof
(
ViewProjMatrixData
)
)
);
mViewProjBuffer
->
keepStagingBuffer
();
mViewProjBuffer
->
realizeVRAM
();
auto
dslinfo
=
DescriptorSetLayoutCreateInfo
{};
dslinfo
.
addUniformBuffer
(
vk
::
ShaderStageFlagBits
::
eAllGraphics
);
mViewProjDescriptorSetLayout
=
mDevice
->
createDescriptorSetLayout
(
dslinfo
);
mViewProjDescriptor
=
mViewProjDescriptorSetLayout
->
createDescriptorSet
();
mViewProjDescriptor
->
writeUniformBuffer
(
mViewProjBuffer
,
0
);
}
}
void
ForwardRenderingPipeline
::
resize
(
int
w
,
int
h
)
{
...
...
@@ -118,7 +139,7 @@ void ForwardRenderingPipeline::resize(int w, int h) {
}
void
ForwardRenderingPipeline
::
updateMatrices
(
ForwardRenderingPipeline
::
update
ViewProj
Matrices
(
RecordingCommandBuffer
&
cmd
,
glm
::
mat4
view
,
glm
::
mat4
proj
...
...
@@ -126,6 +147,15 @@ ForwardRenderingPipeline::updateMatrices (
{
mView
=
view
;
mProj
=
proj
;
ViewProjMatrixData
matrixData
{
view
,
proj
};
mViewProjBuffer
->
setDataVRAM
(
&
matrixData
,
sizeof
(
matrixData
),
cmd
);
}
...
...
@@ -169,3 +199,18 @@ ForwardRenderingPipeline::render (
sub
.
draw
(
3
);
}
}
const
SharedDescriptorSet
&
ForwardRenderingPipeline
::
getViewProjDescriptor
()
const
{
return
mViewProjDescriptor
;
}
const
SharedDescriptorSetLayout
&
ForwardRenderingPipeline
::
getViewProjDescriptorSetLayout
()
const
{
return
mViewProjDescriptorSetLayout
;
}
This diff is collapsed.
Click to expand it.
pipeline/lava-extras/pipeline/ForwardRenderingPipeline.hh
+
27
−
2
View file @
12801718
...
...
@@ -10,6 +10,11 @@
namespace
lava
{
struct
ViewProjMatrixData
{
glm
::
mat4x4
view
;
glm
::
mat4x4
proj
;
};
namespace
pipeline
{
/**
* A minimal Forward Rendering Pipeline with support for FXAA.
...
...
@@ -63,10 +68,15 @@ class ForwardRenderingPipeline {
SharedGraphicsPipeline
mPipelineOutputFXAA
;
SharedGraphicsPipeline
mPipelineOutputNoFXAA
;
// === Descriptor Sets
// === Descriptor Sets
===
SharedDescriptorSetLayout
mOutputDescriptorLayout
;
SharedDescriptorSet
mOutputDescriptor
;
// === View./Proj. Matrices ===
SharedBuffer
mViewProjBuffer
;
SharedDescriptorSetLayout
mViewProjDescriptorSetLayout
;
SharedDescriptorSet
mViewProjDescriptor
;
// === SETTINGS ===
bool
mFXAA
=
true
;
...
...
@@ -99,7 +109,7 @@ class ForwardRenderingPipeline {
void
updateMatrices
(
update
ViewProj
Matrices
(
RecordingCommandBuffer
&
cmd
,
glm
::
mat4
view
,
glm
::
mat4
proj
...
...
@@ -141,6 +151,21 @@ class ForwardRenderingPipeline {
return
{
mPassForward
,
0
};
}
SharedBuffer
const
&
getViewProjBuffer
()
const
{
return
mViewProjBuffer
;
}
SharedDescriptorSet
const
&
getViewProjDescriptor
()
const
;
SharedDescriptorSetLayout
const
&
getViewProjDescriptorSetLayout
()
const
;
};
}
}
This diff is collapsed.
Click to expand it.
Kaspar Scharf
@kscharf
mentioned in commit
2213a64a
·
6 years ago
mentioned in commit
2213a64a
mentioned in commit 2213a64ad4a669f1b74e51aa9297bbc2e15576da
Toggle commit list
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