Skip to content

Commit

Permalink
V1.2.0 (#50)
Browse files Browse the repository at this point in the history
* removing scripts folder. Renaming IndexFormat_I32_UINT -> IndexFormat_UINT_32

* adding logging support

* adding tests

* bumping version, fixing minimal sample test

* Compile fixes

* fixing tests on gcc. Renaming test for logger

* Changing to correct version number (1.2.1 -> 1.2.0)

* removing unused function

* adding support for UNORM16 and FP16 uv formats

* Increasing consistency by adding omm_ prefix to all shader files

* compile fix

* Compile fix #2

* chaning from bitwise to logical operators for consistency

* Adding TexCoord enum shader side

* Increasing stride between consecutive execute indirect calls

* Updating to latest ShaderMake. Removing benchmark

* updating submodules

* fixing comment
  • Loading branch information
nv-jdeligiannis authored Jul 9, 2024
1 parent 65b7eb4 commit 948f07d
Show file tree
Hide file tree
Showing 69 changed files with 1,097 additions and 3,819 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
[submodule "benchmark/thirdparty/gbenchmark"]
path = benchmark/thirdparty/gbenchmark
url = https://github.com/google/benchmark.git
[submodule "vm_bench/thirdparty/gbenchmark"]
path = thirdparty/gbenchmark
url = https://github.com/google/benchmark.git
[submodule "thirdparty/xxHash"]
path = thirdparty/xxHash
url = https://github.com/Cyan4973/xxHash.git
Expand Down
8 changes: 0 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
cmake_minimum_required(VERSION 3.12)

if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gbenchmark)
option(OMM_ENABLE_BENCHMARK "Enable benchmark" ON)
endif()

if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gtest)
option(OMM_ENABLE_TESTS "Enable unit test" ON)
endif()
Expand Down Expand Up @@ -40,10 +36,6 @@ add_subdirectory(shared)
add_subdirectory(omm-sdk)
add_subdirectory(integration)

if (OMM_ENABLE_BENCHMARK)
add_subdirectory(benchmark)
endif()

if (OMM_ENABLE_TESTS)
add_subdirectory(tests)
endif()
6 changes: 0 additions & 6 deletions benchmark/CMakeLists.txt

This file was deleted.

186 changes: 0 additions & 186 deletions benchmark/bm_ommbake.cpp

This file was deleted.

40 changes: 32 additions & 8 deletions integration/omm-sdk-nvrhi/omm-sdk-nvrhi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,28 @@ namespace
}
}

static omm::TexCoordFormat GetTexCoordFormat(nvrhi::Format format)
{
switch (format)
{
case nvrhi::Format::R16_UNORM:
{
return omm::TexCoordFormat::UV16_UNORM;
}
case nvrhi::Format::R16_FLOAT:
{
return omm::TexCoordFormat::UV16_FLOAT;
}
case nvrhi::Format::R32_FLOAT:
{
return omm::TexCoordFormat::UV32_FLOAT;
}
default:
assert(false);
return omm::TexCoordFormat::UV32_FLOAT;
}
}

/// -- BINDING CACHE FROM DONUT --

/*
Expand Down Expand Up @@ -191,6 +213,7 @@ class GpuBakeNvrhiImpl
const std::vector<uint8_t>& ommIndexHistogramBuffer,
const void* indexBuffer,
const uint32_t indexCount,
nvrhi::Format ommTexCoordBufferFormat,
const void* texCoords,
const float* imageData,
const uint32_t width,
Expand Down Expand Up @@ -346,7 +369,6 @@ void GpuBakeNvrhiImpl::InitBaker(GpuBakeNvrhi::ShaderProvider* shaderProvider)
{
omm::BakerCreationDesc desc;
desc.type = omm::BakerType::GPU;
desc.enableValidation = true;

omm::Result res = omm::CreateBaker(desc, &m_baker);
assert(res == omm::Result::SUCCESS);
Expand All @@ -355,7 +377,6 @@ void GpuBakeNvrhiImpl::InitBaker(GpuBakeNvrhi::ShaderProvider* shaderProvider)
{
omm::BakerCreationDesc desc;
desc.type = omm::BakerType::CPU;
desc.enableValidation = true;

omm::Result res = omm::CreateBaker(desc, &m_cpuBaker);
assert(res == omm::Result::SUCCESS);
Expand Down Expand Up @@ -644,10 +665,10 @@ omm::Gpu::DispatchConfigDesc GpuBakeNvrhiImpl::GetConfig(const GpuBakeNvrhi::Inp
config.alphaTextureChannel = params.alphaTextureChannel;
config.alphaMode = AlphaMode::Test;
config.alphaCutoff = params.alphaCutoff;
config.texCoordFormat = TexCoordFormat::UV32_FLOAT;
config.texCoordFormat = GetTexCoordFormat(params.texCoordFormat);
config.texCoordOffsetInBytes = params.texCoordBufferOffsetInBytes;
config.texCoordStrideInBytes = params.texCoordStrideInBytes;
config.indexFormat = IndexFormat::I32_UINT;
config.indexFormat = IndexFormat::UINT_32;
config.indexCount = (uint32_t)params.numIndices;
config.globalFormat = params.format == nvrhi::rt::OpacityMicromapFormat::OC1_2_State ? Format::OC1_2_State : Format::OC1_4_State;
config.maxScratchMemorySize = params.minimalMemoryMode ? Gpu::ScratchMemoryBudget::MB_4 : Gpu::ScratchMemoryBudget::MB_256;
Expand Down Expand Up @@ -692,7 +713,7 @@ void GpuBakeNvrhiImpl::GetPreDispatchInfo(const GpuBakeNvrhi::Input& params, Gpu
omm::Result res = Gpu::GetPreDispatchInfo(m_pipeline, config, &preBuildInfo);
assert(res == omm::Result::SUCCESS);

info.ommIndexFormat = preBuildInfo.outOmmIndexBufferFormat == omm::IndexFormat::I16_UINT ? nvrhi::Format::R16_UINT : nvrhi::Format::R32_UINT;
info.ommIndexFormat = preBuildInfo.outOmmIndexBufferFormat == omm::IndexFormat::UINT_16 ? nvrhi::Format::R16_UINT : nvrhi::Format::R32_UINT;
info.ommIndexBufferSize = preBuildInfo.outOmmIndexBufferSizeInBytes;
info.ommIndexHistogramSize = preBuildInfo.outOmmIndexHistogramSizeInBytes;
info.ommIndexCount = preBuildInfo.outOmmIndexCount;
Expand Down Expand Up @@ -1101,13 +1122,14 @@ void GpuBakeNvrhiImpl::DumpDebug(
const std::vector<uint8_t>& ommIndexHistogramBuffer,
const void* indexBuffer,
const uint32_t indexCount,
nvrhi::Format ommTexCoordBufferFormat,
const void* texCoords,
const float* imageData,
const uint32_t width,
const uint32_t height
)
{
const omm::IndexFormat ommIndexBufferFormat = indexBufferFormat == nvrhi::Format::R32_UINT ? omm::IndexFormat::I32_UINT : omm::IndexFormat::I16_UINT;
const omm::IndexFormat ommIndexBufferFormat = indexBufferFormat == nvrhi::Format::R32_UINT ? omm::IndexFormat::UINT_32 : omm::IndexFormat::UINT_16;

omm::Cpu::BakeResultDesc result;
result.arrayData = ommArrayBuffer.data();
Expand Down Expand Up @@ -1139,10 +1161,10 @@ void GpuBakeNvrhiImpl::DumpDebug(
config.alphaMode = /*task.geometry->material->domain == MaterialDomain::AlphaBlended ? omm::AlphaMode::Blend : */omm::AlphaMode::Test;
config.indexBuffer = indexBuffer;
config.indexCount = indexCount;
config.indexFormat = omm::IndexFormat::I32_UINT;
config.indexFormat = omm::IndexFormat::UINT_32;
config.texture = texHandle;
config.texCoords = texCoords;
config.texCoordFormat = omm::TexCoordFormat::UV32_FLOAT;
config.texCoordFormat = GetTexCoordFormat(ommTexCoordBufferFormat);
config.alphaCutoff = params.alphaCutoff;
config.runtimeSamplerDesc.addressingMode = GetTextureAddressMode(params.sampleMode);
config.runtimeSamplerDesc.filter = params.bilinearFilter ? omm::TextureFilterMode::Linear : omm::TextureFilterMode::Nearest;
Expand Down Expand Up @@ -1237,6 +1259,7 @@ void GpuBakeNvrhi::DumpDebug(
const std::vector<uint8_t>& ommIndexHistogramBuffer,
const void* indexBuffer,
const uint32_t indexCount,
nvrhi::Format ommTexCoordBufferFormat,
const void* texCoords,
const float* imageData,
const uint32_t width,
Expand All @@ -1255,6 +1278,7 @@ void GpuBakeNvrhi::DumpDebug(
ommIndexHistogramBuffer,
indexBuffer,
indexCount,
ommTexCoordBufferFormat,
texCoords,
imageData,
width,
Expand Down
2 changes: 2 additions & 0 deletions integration/omm-sdk-nvrhi/omm-sdk-nvrhi.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ namespace omm
bool enableLevelLineIntersection = true;
nvrhi::SamplerAddressMode sampleMode = nvrhi::SamplerAddressMode::Clamp;

nvrhi::Format texCoordFormat = nvrhi::Format::R32_FLOAT;
nvrhi::BufferHandle texCoordBuffer;
uint32_t texCoordBufferOffsetInBytes = 0;
uint32_t texCoordStrideInBytes = 0;
Expand Down Expand Up @@ -154,6 +155,7 @@ namespace omm
const std::vector<uint8_t>& ommIndexHistogramBuffer,
const void* indexBuffer,
const uint32_t indexCount,
nvrhi::Format ommTexCoordBufferFormat,
const void* texCoords,
const float* imageData,
const uint32_t width,
Expand Down
Loading

0 comments on commit 948f07d

Please sign in to comment.