From 7a2e7e6837baec4b27f6e49a883ec0d741339b19 Mon Sep 17 00:00:00 2001 From: Mathias Heyer Date: Mon, 11 Oct 2021 15:41:48 -0700 Subject: [PATCH] Bulk update nvpro-samples 10/11/21 --- CONTRIBUTING | 36 +++++++++++++++++++++++++++ ray_tracing_gltf/shaders/binding.glsl | 23 ----------------- ray_tracing_manyhits/hello_vulkan.cpp | 13 +++++----- 3 files changed, 43 insertions(+), 29 deletions(-) create mode 100644 CONTRIBUTING delete mode 100644 ray_tracing_gltf/shaders/binding.glsl diff --git a/CONTRIBUTING b/CONTRIBUTING new file mode 100644 index 0000000..06ab2b1 --- /dev/null +++ b/CONTRIBUTING @@ -0,0 +1,36 @@ +https://developercertificate.org/ + +Developer Certificate of Origin +Version 1.1 + +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. \ No newline at end of file diff --git a/ray_tracing_gltf/shaders/binding.glsl b/ray_tracing_gltf/shaders/binding.glsl deleted file mode 100644 index 8bfad9a..0000000 --- a/ray_tracing_gltf/shaders/binding.glsl +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-FileCopyrightText: Copyright (c) 2019-2021 NVIDIA CORPORATION - * SPDX-License-Identifier: Apache-2.0 - */ - - -#define B_CAMERA 0 -#define B_SCENEDESC 1 -#define B_TEXTURES 2 diff --git a/ray_tracing_manyhits/hello_vulkan.cpp b/ray_tracing_manyhits/hello_vulkan.cpp index 3861e22..aaeed5b 100644 --- a/ray_tracing_manyhits/hello_vulkan.cpp +++ b/ray_tracing_manyhits/hello_vulkan.cpp @@ -890,13 +890,13 @@ void HelloVulkan::createRtShaderBindingTable() // The SBT (buffer) need to have starting groups to be aligned and handles in the group to be aligned. uint32_t handleSizeAligned = nvh::align_up(handleSize, m_rtProperties.shaderGroupHandleAlignment); - + m_rgenRegion.stride = nvh::align_up(handleSizeAligned, m_rtProperties.shaderGroupBaseAlignment); - m_rgenRegion.size = m_rgenRegion.stride; // The size member of pRayGenShaderBindingTable must be equal to its stride member + m_rgenRegion.size = m_rgenRegion.stride; // The size member of pRayGenShaderBindingTable must be equal to its stride member m_missRegion.stride = handleSizeAligned; - m_missRegion.size = nvh::align_up(missCount * handleSizeAligned, m_rtProperties.shaderGroupBaseAlignment); + m_missRegion.size = nvh::align_up(missCount * m_missRegion.stride, m_rtProperties.shaderGroupBaseAlignment); m_hitRegion.stride = nvh::align_up(handleSize + sizeof(HitRecordBuffer), m_rtProperties.shaderGroupHandleAlignment); - m_hitRegion.size = nvh::align_up(hitCount * handleSizeAligned, m_rtProperties.shaderGroupBaseAlignment); + m_hitRegion.size = nvh::align_up(hitCount * m_hitRegion.stride, m_rtProperties.shaderGroupBaseAlignment); // Allocate a buffer for storing the SBT. VkDeviceSize sbtSize = m_rgenRegion.size + m_missRegion.size + m_hitRegion.size + m_callRegion.size; @@ -934,17 +934,18 @@ void HelloVulkan::createRtShaderBindingTable() pData = pSBTBuffer + m_rgenRegion.size + m_missRegion.size; memcpy(pData, getHandle(handleIdx++), handleSize); + auto recordDataSize = sizeof(HitRecordBuffer); // hit 1 pData = pSBTBuffer + m_rgenRegion.size + m_missRegion.size + m_hitRegion.stride; memcpy(pData, getHandle(handleIdx++), handleSize); pData += handleSize; - memcpy(pData, &m_hitShaderRecord[0], sizeof(HitRecordBuffer)); // Hit 1 data + memcpy(pData, &m_hitShaderRecord[0], recordDataSize); // Hit 1 data // hit 2 pData = pSBTBuffer + m_rgenRegion.size + m_missRegion.size + (2 * m_hitRegion.stride); memcpy(pData, getHandle(handleIdx++), handleSize); pData += handleSize; - memcpy(pData, &m_hitShaderRecord[1], sizeof(HitRecordBuffer)); // Hit 2 data + memcpy(pData, &m_hitShaderRecord[1], recordDataSize); // Hit 2 data m_alloc.unmap(m_rtSBTBuffer);