| 3175 | } |
| 3176 | |
| 3177 | void Scene::buildBlas(RenderContext* pRenderContext) |
| 3178 | { |
| 3179 | FALCOR_PROFILE(pRenderContext, "buildBlas"); |
| 3180 | |
| 3181 | if (!mBlasDataValid) FALCOR_THROW("buildBlas() BLAS data is invalid"); |
| 3182 | if (!pRenderContext->getDevice()->isFeatureSupported(Device::SupportedFeatures::Raytracing)) |
| 3183 | { |
| 3184 | FALCOR_THROW("Raytracing is not supported by the current device"); |
| 3185 | } |
| 3186 | |
| 3187 | // Add barriers for the VB and IB which will be accessed by the build. |
| 3188 | for (size_t i = 0; i < mMeshStaticData.getBufferCount(); ++i) |
| 3189 | { |
| 3190 | ref<Buffer> pVb = mMeshStaticData.getGpuBuffer(i); |
| 3191 | if (pVb) |
| 3192 | pRenderContext->resourceBarrier(pVb.get(), Resource::State::NonPixelShader); |
| 3193 | } |
| 3194 | |
| 3195 | for (size_t i = 0; i < mMeshIndexData.getBufferCount(); ++i) |
| 3196 | { |
| 3197 | ref<Buffer> pIb = mMeshIndexData.getGpuBuffer(i); |
| 3198 | if (pIb) |
| 3199 | pRenderContext->resourceBarrier(pIb.get(), Resource::State::NonPixelShader); |
| 3200 | } |
| 3201 | |
| 3202 | if (mpCurveVao) |
| 3203 | { |
| 3204 | const ref<Buffer>& pCurveVb = mpCurveVao->getVertexBuffer(kStaticDataBufferIndex); |
| 3205 | const ref<Buffer>& pCurveIb = mpCurveVao->getIndexBuffer(); |
| 3206 | pRenderContext->resourceBarrier(pCurveVb.get(), Resource::State::NonPixelShader); |
| 3207 | pRenderContext->resourceBarrier(pCurveIb.get(), Resource::State::NonPixelShader); |
| 3208 | } |
| 3209 | |
| 3210 | if (!mSDFGrids.empty()) |
| 3211 | { |
| 3212 | if (mSDFGridConfig.implementation == SDFGrid::Type::NormalizedDenseGrid || |
| 3213 | mSDFGridConfig.implementation == SDFGrid::Type::SparseVoxelOctree) |
| 3214 | { |
| 3215 | pRenderContext->resourceBarrier(mSDFGrids.back()->getAABBBuffer().get(), Resource::State::NonPixelShader); |
| 3216 | } |
| 3217 | else if (mSDFGridConfig.implementation == SDFGrid::Type::SparseVoxelSet || |
| 3218 | mSDFGridConfig.implementation == SDFGrid::Type::SparseBrickSet) |
| 3219 | { |
| 3220 | for (const ref<SDFGrid>& pSDFGrid : mSDFGrids) |
| 3221 | { |
| 3222 | pRenderContext->resourceBarrier(pSDFGrid->getAABBBuffer().get(), Resource::State::NonPixelShader); |
| 3223 | } |
| 3224 | } |
| 3225 | } |
| 3226 | |
| 3227 | if (mpRtAABBBuffer) |
| 3228 | { |
| 3229 | pRenderContext->resourceBarrier(mpRtAABBBuffer.get(), Resource::State::NonPixelShader); |
| 3230 | } |
| 3231 | |
| 3232 | // On the first time, or if a full rebuild is necessary we will: |
| 3233 | // - Update all build inputs and prebuild info |
| 3234 | // - Compute BLAS groups |
nothing calls this directly
no test coverage detected