Fix a couple of small errors in ray tracing examples

nv_ray_tracing_basic.cpp
 - update to 3 component vertex data (4 component isn't supported)
 - update type to TOP_LEVEL when building the TLAS

nv_ray_tracing_reflections.cpp
 - update AS info type to TOP_LEVEL when building the TLAS

nv_ray_tracing_shadows.cpp
 - update AS info type to TOP_LEVEL when building the TLAS

Validation layer changes coming soon :)
This commit is contained in:
Jason Macnak 2019-07-26 16:31:19 -07:00
parent 2a5d7df56e
commit 6ead6171a7
3 changed files with 8 additions and 5 deletions

View file

@ -246,12 +246,12 @@ public:
{
// Setup vertices for a single uv-mapped quad made from two triangles
struct Vertex {
float pos[4];
float pos[3];
};
std::vector<Vertex> vertices = {
{ { 1.0f, 1.0f, 0.0f, 1.0f } },
{ { -1.0f, 1.0f, 0.0f, 1.0f } },
{ { 0.0f, -1.0f, 0.0f, 1.0f } }
{ { 1.0f, 1.0f, 0.0f } },
{ { -1.0f, 1.0f, 0.0f } },
{ { 0.0f, -1.0f, 0.0f } }
};
// Setup indices
@ -286,7 +286,7 @@ public:
geometry.geometry.triangles.vertexOffset = 0;
geometry.geometry.triangles.vertexCount = static_cast<uint32_t>(vertices.size());
geometry.geometry.triangles.vertexStride = sizeof(Vertex);
geometry.geometry.triangles.vertexFormat = VK_FORMAT_R32G32B32A32_SFLOAT;
geometry.geometry.triangles.vertexFormat = VK_FORMAT_R32G32B32_SFLOAT;
geometry.geometry.triangles.indexData = indexBuffer.buffer;
geometry.geometry.triangles.indexOffset = 0;
geometry.geometry.triangles.indexCount = indexCount;
@ -385,6 +385,7 @@ public:
/*
Build top-level acceleration structure
*/
buildInfo.type = VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV;
buildInfo.pGeometries = 0;
buildInfo.geometryCount = 0;
buildInfo.instanceCount = 1;