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
6474b395
Commit
6474b395
authored
3 years ago
by
Lars Hoerttrich
Browse files
Options
Downloads
Patches
Plain Diff
[
#92
] descriptorWrites for output image and pushconstants for camera
parent
f7dee64f
No related branches found
No related tags found
1 merge request
!75
Resolve "RTX-Module"
Pipeline
#27167
passed
3 years ago
Stage: build
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
modules/rtx/include/vkcv/rtx/RTX.hpp
+0
-1
0 additions, 1 deletion
modules/rtx/include/vkcv/rtx/RTX.hpp
projects/rtx/resources/shaders/raytrace.rgen
+1
-1
1 addition, 1 deletion
projects/rtx/resources/shaders/raytrace.rgen
projects/rtx/src/main.cpp
+34
-5
34 additions, 5 deletions
projects/rtx/src/main.cpp
with
35 additions
and
7 deletions
modules/rtx/include/vkcv/rtx/RTX.hpp
+
0
−
1
View file @
6474b395
...
...
@@ -3,7 +3,6 @@
#include
<vector>
#include
"vulkan/vulkan.hpp"
#include
"vkcv/Core.hpp"
//#include "RTXDescriptorWrites.hpp"
#include
"ASManager.hpp"
namespace
vkcv
::
rtx
{
...
...
This diff is collapsed.
Click to expand it.
projects/rtx/resources/shaders/raytrace.rgen
+
1
−
1
View file @
6474b395
...
...
@@ -5,7 +5,7 @@
// A location for a ray payload (we can have multiple of these)
//layout(location = 0) rayPayloadEXT RayPayload pay;
//
layout(binding = 0, set = 0, rgba32f) uniform image2D outImg; // the output image -> maybe use 16 bit values?
layout(binding = 0, set = 0, rgba32f) uniform image2D outImg; // the output image -> maybe use 16 bit values?
layout(binding = 1, set = 0) uniform accelerationStructureEXT tlas; // top level acceleration structure (for the noobs here (you!))
/*
layout( push_constant ) uniform constants { // TODO: add push_constants in main.cpp!
...
...
This diff is collapsed.
Click to expand it.
projects/rtx/src/main.cpp
+
34
−
5
View file @
6474b395
...
...
@@ -168,11 +168,6 @@ int main(int argc, const char** argv) {
true
};
vkcv
::
PipelineHandle
scenePipeline
=
core
.
createGraphicsPipeline
(
scenePipelineDefinition
);
// TODO
//vkcv::RTXDescriptorWrites vertexShaderDescriptorWrites;
//vertexShaderDescriptorWrites.storageBufferWrites = { vkcv::BufferDescriptorWrite(0, matrixBuffer.getHandle()) };
//core.writeDescriptorSet(vertexShaderDescriptorSet, vertexShaderDescriptorWrites);
if
(
!
scenePipeline
)
{
std
::
cout
<<
"Error. Could not create graphics pipeline. Exiting."
<<
std
::
endl
;
return
EXIT_FAILURE
;
...
...
@@ -182,7 +177,10 @@ int main(int argc, const char** argv) {
const
vkcv
::
ImageHandle
swapchainInput
=
vkcv
::
ImageHandle
::
createSwapchainImageHandle
();
vkcv
::
DescriptorWrites
rtxWrites
;
auto
start
=
std
::
chrono
::
system_clock
::
now
();
uint32_t
frameCount
=
0
;
while
(
window
.
isWindowOpen
())
{
vkcv
::
Window
::
pollEvents
();
...
...
@@ -208,8 +206,39 @@ int main(int argc, const char** argv) {
cameraManager
.
update
(
0.000001
*
static_cast
<
double
>
(
deltatime
.
count
()));
const
std
::
vector
<
vkcv
::
ImageHandle
>
renderTargets
=
{
swapchainInput
,
depthBuffer
};
/*
TODO: ADD PUSH CONSTANTS TO SHADER CALL WHEN PIPELINE IS WORKING/FINISHED
*/
struct
RaytracingPushConstantData
{
glm
::
vec4
camera_position
;
// as origin for ray generation
glm
::
vec4
camera_right
;
// for computing ray direction
glm
::
vec4
camera_up
;
// for computing ray direction
glm
::
vec4
camera_forward
;
// for computing ray direction
glm
::
uint
frameCount
;
// what is this? the actual frame?
};
RaytracingPushConstantData
raytracingPushData
;
raytracingPushData
.
camera_position
=
glm
::
vec4
(
cameraManager
.
getActiveCamera
().
getPosition
(),
0
);
raytracingPushData
.
camera_right
=
glm
::
vec4
(
glm
::
cross
(
cameraManager
.
getActiveCamera
().
getFront
(),
cameraManager
.
getActiveCamera
().
getUp
()),
0
);
raytracingPushData
.
camera_up
=
glm
::
vec4
(
cameraManager
.
getActiveCamera
().
getUp
(),
0
);
raytracingPushData
.
camera_forward
=
glm
::
vec4
(
cameraManager
.
getActiveCamera
().
getFront
(),
0
);
raytracingPushData
.
frameCount
=
frameCount
++
;
vkcv
::
PushConstants
pushConstantsRTX
(
sizeof
(
RaytracingPushConstantData
));
pushConstantsRTX
.
appendDrawcall
(
raytracingPushData
);
auto
cmdStream
=
core
.
createCommandStream
(
vkcv
::
QueueType
::
Graphics
);
rtxWrites
.
storageImageWrites
=
{
vkcv
::
StorageImageDescriptorWrite
(
0
,
swapchainInput
)
};
core
.
writeDescriptorSet
(
rayGenShaderDescriptorSet
,
rtxWrites
);
core
.
prepareImageForStorage
(
cmdStream
,
swapchainInput
);
auto
recordMesh
=
[](
const
glm
::
mat4
&
MVP
,
const
glm
::
mat4
&
M
,
vkcv
::
PushConstants
&
pushConstants
,
vkcv
::
DrawcallInfo
&
drawcallInfo
)
{
...
...
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