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
ccb204b1
Commit
ccb204b1
authored
3 years ago
by
Alexander Gauggel
Browse files
Options
Downloads
Patches
Plain Diff
[
#70
] Render into offscreen float buffer for main passes
parent
e8018ca0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!57
Resolve "Basic voxelization"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
projects/voxelization/resources/shaders/gammaCorrection.comp
+6
-4
6 additions, 4 deletions
projects/voxelization/resources/shaders/gammaCorrection.comp
projects/voxelization/src/main.cpp
+13
-7
13 additions, 7 deletions
projects/voxelization/src/main.cpp
with
19 additions
and
11 deletions
projects/voxelization/resources/shaders/gammaCorrection.comp
+
6
−
4
View file @
ccb204b1
#version 440
layout(set=0, binding=0, rgba8) uniform image2D sceneImage;
layout(set=0, binding=0, r11f_g11f_b10f) uniform image2D inImage;
layout(set=0, binding=1, rgba8) uniform image2D outImage;
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
void main(){
if(any(greaterThanEqual(gl_GlobalInvocationID.xy, imageSize(
scene
Image)))){
if(any(greaterThanEqual(gl_GlobalInvocationID.xy, imageSize(
in
Image)))){
return;
}
ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
vec3 linearColor = imageLoad(
scene
Image, uv).rgb;
vec3 linearColor = imageLoad(
in
Image, uv).rgb;
vec3 gammaCorrected = pow(linearColor, vec3(1.f / 2.2f));
imageStore(
scene
Image, uv, vec4(gammaCorrected, 0.f));
imageStore(
out
Image, uv, vec4(gammaCorrected, 0.f));
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
projects/voxelization/src/main.cpp
+
13
−
7
View file @
ccb204b1
...
...
@@ -103,10 +103,11 @@ int main(int argc, const char** argv) {
vertexBufferIndex
++
;
}
const
vkcv
::
AttachmentDescription
present_color_attachment
(
const
vk
::
Format
colorBufferFormat
=
vk
::
Format
::
eB10G11R11UfloatPack32
;
const
vkcv
::
AttachmentDescription
color_attachment
(
vkcv
::
AttachmentOperation
::
STORE
,
vkcv
::
AttachmentOperation
::
CLEAR
,
co
re
.
getSwapchainImage
Format
()
co
lorBuffer
Format
);
const
vk
::
Format
depthBufferFormat
=
vk
::
Format
::
eD32Sfloat
;
...
...
@@ -116,7 +117,7 @@ int main(int argc, const char** argv) {
depthBufferFormat
);
vkcv
::
PassConfig
forwardPassDefinition
({
present_
color_attachment
,
depth_attachment
});
vkcv
::
PassConfig
forwardPassDefinition
({
color_attachment
,
depth_attachment
});
vkcv
::
PassHandle
forwardPass
=
core
.
createPass
(
forwardPassDefinition
);
vkcv
::
shader
::
GLSLCompiler
compiler
;
...
...
@@ -174,7 +175,8 @@ int main(int argc, const char** argv) {
vkcv
::
SamplerAddressMode
::
CLAMP_TO_EDGE
);
vkcv
::
ImageHandle
depthBuffer
=
core
.
createImage
(
vk
::
Format
::
eD32Sfloat
,
windowWidth
,
windowHeight
).
getHandle
();
vkcv
::
ImageHandle
depthBuffer
=
core
.
createImage
(
depthBufferFormat
,
windowWidth
,
windowHeight
).
getHandle
();
vkcv
::
ImageHandle
colorBuffer
=
core
.
createImage
(
colorBufferFormat
,
windowWidth
,
windowHeight
,
1
,
true
,
true
).
getHandle
();
const
vkcv
::
ImageHandle
swapchainInput
=
vkcv
::
ImageHandle
::
createSwapchainImageHandle
();
...
...
@@ -288,7 +290,7 @@ int main(int argc, const char** argv) {
const
vkcv
::
AttachmentDescription
voxelVisualisationColorAttachments
(
vkcv
::
AttachmentOperation
::
STORE
,
vkcv
::
AttachmentOperation
::
LOAD
,
co
re
.
getSwapchainImage
Format
()
co
lorBuffer
Format
);
const
vkcv
::
AttachmentDescription
voxelVisualisationDepthAttachments
(
...
...
@@ -435,6 +437,7 @@ int main(int argc, const char** argv) {
if
((
swapchainWidth
!=
windowWidth
)
||
((
swapchainHeight
!=
windowHeight
)))
{
depthBuffer
=
core
.
createImage
(
depthBufferFormat
,
swapchainWidth
,
swapchainHeight
).
getHandle
();
colorBuffer
=
core
.
createImage
(
colorBufferFormat
,
swapchainWidth
,
swapchainHeight
,
1
,
true
,
true
).
getHandle
();
windowWidth
=
swapchainWidth
;
windowHeight
=
swapchainHeight
;
...
...
@@ -445,7 +448,9 @@ int main(int argc, const char** argv) {
// update descriptor sets which use swapchain image
vkcv
::
DescriptorWrites
gammaCorrectionDescriptorWrites
;
gammaCorrectionDescriptorWrites
.
storageImageWrites
=
{
vkcv
::
StorageImageDescriptorWrite
(
0
,
swapchainInput
)
};
gammaCorrectionDescriptorWrites
.
storageImageWrites
=
{
vkcv
::
StorageImageDescriptorWrite
(
0
,
colorBuffer
),
vkcv
::
StorageImageDescriptorWrite
(
1
,
swapchainInput
)
};
core
.
writeDescriptorSet
(
gammaCorrectionDescriptorSet
,
gammaCorrectionDescriptorWrites
);
start
=
end
;
...
...
@@ -510,7 +515,7 @@ int main(int argc, const char** argv) {
}
vkcv
::
PushConstantData
pushConstantData
((
void
*
)
mainPassMatrices
.
data
(),
2
*
sizeof
(
glm
::
mat4
));
const
std
::
vector
<
vkcv
::
ImageHandle
>
renderTargets
=
{
swapchainInput
,
depthBuffer
};
const
std
::
vector
<
vkcv
::
ImageHandle
>
renderTargets
=
{
colorBuffer
,
depthBuffer
};
const
vkcv
::
PushConstantData
shadowPushConstantData
((
void
*
)
mvpLight
.
data
(),
sizeof
(
glm
::
mat4
));
const
vkcv
::
PushConstantData
voxelizationPushConstantData
((
void
*
)
voxelizationMatrices
.
data
(),
2
*
sizeof
(
glm
::
mat4
));
...
...
@@ -583,6 +588,7 @@ int main(int argc, const char** argv) {
};
core
.
prepareImageForStorage
(
cmdStream
,
swapchainInput
);
core
.
prepareImageForStorage
(
cmdStream
,
colorBuffer
);
core
.
recordComputeDispatchToCmdStream
(
cmdStream
,
...
...
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