Skip to content

Commit

Permalink
Update slang-rhi (shader-slang#5187)
Browse files Browse the repository at this point in the history
* update slang-rhi

* fix render-test

* update slang-rhi

---------

Co-authored-by: Yong He <yonghe@outlook.com>
  • Loading branch information
skallweitNV and csyonghe authored Sep 30, 2024
1 parent 59168f4 commit bc11579
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion external/slang-rhi
Submodule slang-rhi updated 91 files
+198 −0 docs/api.md
+15 −62 include/slang-rhi.h
+4 −14 src/command-encoder-com-forward.h
+5 −5 src/cpu/cpu-texture-view.cpp
+5 −5 src/cpu/cpu-texture.cpp
+11 −51 src/cuda/cuda-command-encoder.cpp
+5 −25 src/cuda/cuda-command-encoder.h
+8 −14 src/cuda/cuda-device.cpp
+1 −2 src/cuda/cuda-device.h
+3 −17 src/d3d/d3d-util.cpp
+24 −32 src/d3d11/d3d11-device.cpp
+1 −2 src/d3d11/d3d11-device.h
+7 −7 src/d3d11/d3d11-helper-functions.cpp
+1 −1 src/d3d11/d3d11-swap-chain.cpp
+0 −1 src/d3d11/d3d11-texture.h
+103 −0 src/d3d12/d3d12-command-buffer.cpp
+8 −0 src/d3d12/d3d12-command-buffer.h
+150 −278 src/d3d12/d3d12-command-encoder.cpp
+8 −27 src/d3d12/d3d12-command-encoder.h
+111 −129 src/d3d12/d3d12-device.cpp
+2 −11 src/d3d12/d3d12-device.h
+1 −2 src/d3d12/d3d12-helper-functions.cpp
+2 −2 src/d3d12/d3d12-helper-functions.h
+64 −5 src/d3d12/d3d12-shader-object.cpp
+24 −2 src/d3d12/d3d12-shader-object.h
+8 −2 src/d3d12/d3d12-shader-table.cpp
+1 −1 src/d3d12/d3d12-swap-chain.cpp
+4 −4 src/d3d12/d3d12-texture-view.cpp
+36 −16 src/d3d12/d3d12-texture.cpp
+10 −6 src/d3d12/d3d12-texture.h
+3 −0 src/debug-layer/debug-command-buffer.cpp
+10 −62 src/debug-layer/debug-command-encoder.cpp
+5 −25 src/debug-layer/debug-command-encoder.h
+2 −8 src/debug-layer/debug-device.cpp
+1 −2 src/debug-layer/debug-device.h
+2 −2 src/debug-layer/debug-helper-functions.cpp
+0 −6 src/enum-strings.cpp
+12 −53 src/immediate-device.cpp
+1 −2 src/immediate-device.h
+9 −30 src/metal/metal-command-encoder.cpp
+5 −24 src/metal/metal-command-encoder.h
+7 −13 src/metal/metal-device.cpp
+1 −2 src/metal/metal-device.h
+1 −1 src/metal/metal-swap-chain.cpp
+2 −2 src/resource-desc-utils.cpp
+16 −2 src/rhi-shared.cpp
+1 −0 src/rhi-shared.h
+194 −0 src/state-tracking.h
+130 −0 src/vulkan/vk-command-buffer.cpp
+8 −0 src/vulkan/vk-command-buffer.h
+99 −235 src/vulkan/vk-command-encoder.cpp
+6 −27 src/vulkan/vk-command-encoder.h
+98 −19 src/vulkan/vk-device.cpp
+1 −2 src/vulkan/vk-device.h
+20 −22 src/vulkan/vk-helper-functions.cpp
+1 −1 src/vulkan/vk-helper-functions.h
+76 −6 src/vulkan/vk-shader-object.cpp
+7 −0 src/vulkan/vk-shader-object.h
+1 −1 src/vulkan/vk-shader-table.cpp
+1 −1 src/vulkan/vk-swap-chain.cpp
+1 −1 src/vulkan/vk-texture-view.cpp
+3 −3 src/vulkan/vk-texture.cpp
+7 −3 src/vulkan/vk-texture.h
+3 −21 src/vulkan/vk-util.cpp
+8 −30 src/wgpu/wgpu-command-encoder.cpp
+5 −24 src/wgpu/wgpu-command-encoder.h
+1 −7 src/wgpu/wgpu-device.cpp
+1 −2 src/wgpu/wgpu-device.h
+2 −2 src/wgpu/wgpu-texture.cpp
+3 −11 src/wgpu/wgpu-util.cpp
+1 −5 tests/test-buffer-barrier.cpp
+2 −3 tests/test-clear-texture.cpp
+1 −1 tests/test-compute-smoke.cpp
+2 −33 tests/test-copy-texture.cpp
+1 −1 tests/test-formats.cpp
+2 −12 tests/test-instanced-draw.cpp
+0 −8 tests/test-mutable-shader-object.cpp
+1 −1 tests/test-native-handle.cpp
+2 −12 tests/test-ray-tracing.cpp
+8 −28 tests/test-resolve-resource-tests.cpp
+13 −23 tests/test-resource-states.cpp
+0 −5 tests/test-root-mutable-shader-object.cpp
+1 −1 tests/test-sampler-array.cpp
+1 −3 tests/test-shader-cache.cpp
+2 −2 tests/test-shared-texture.cpp
+13 −54 tests/test-texture-types.cpp
+1 −1 tests/test-uint16-structured-buffer.cpp
+1 −2 tests/testing.cpp
+0 −1 tests/testing.h
+0 −12 tests/texture-utils.cpp
+0 −1 tests/texture-utils.h
11 changes: 3 additions & 8 deletions tools/render-test/render-test-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ void RenderTestApp::_initializeRenderPass()
depthBufferDesc.size.width = gWindowWidth;
depthBufferDesc.size.height = gWindowHeight;
depthBufferDesc.size.depth = 1;
depthBufferDesc.numMipLevels = 1;
depthBufferDesc.mipLevelCount = 1;
depthBufferDesc.format = Format::D32_FLOAT;
depthBufferDesc.usage = TextureUsage::DepthWrite;
depthBufferDesc.defaultState = ResourceState::DepthWrite;
Expand All @@ -675,7 +675,7 @@ void RenderTestApp::_initializeRenderPass()
colorBufferDesc.size.width = gWindowWidth;
colorBufferDesc.size.height = gWindowHeight;
colorBufferDesc.size.depth = 1;
colorBufferDesc.numMipLevels = 1;
colorBufferDesc.mipLevelCount = 1;
colorBufferDesc.format = Format::R8G8B8A8_UNORM;
colorBufferDesc.usage = TextureUsage::RenderTarget;
colorBufferDesc.defaultState = ResourceState::RenderTarget;
Expand Down Expand Up @@ -959,8 +959,7 @@ Result RenderTestApp::writeScreen(const String& filename)
{
size_t rowPitch, pixelSize;
ComPtr<ISlangBlob> blob;
SLANG_RETURN_ON_FAIL(m_device->readTexture(
m_colorBuffer, ResourceState::RenderTarget, blob.writeRef(), &rowPitch, &pixelSize));
SLANG_RETURN_ON_FAIL(m_device->readTexture(m_colorBuffer, blob.writeRef(), &rowPitch, &pixelSize));
auto bufferSize = blob->getBufferSize();
uint32_t width = static_cast<uint32_t>(rowPitch / pixelSize);
uint32_t height = static_cast<uint32_t>(bufferSize / rowPitch);
Expand All @@ -982,14 +981,10 @@ Result RenderTestApp::update()
colorAttachment.view = m_colorBufferView;
colorAttachment.loadOp = LoadOp::Clear;
colorAttachment.storeOp = StoreOp::Store;
colorAttachment.initialState = ResourceState::Undefined;
colorAttachment.finalState = ResourceState::RenderTarget;
RenderPassDepthStencilAttachment depthStencilAttachment = {};
depthStencilAttachment.view = m_depthBufferView;
depthStencilAttachment.depthLoadOp = LoadOp::Clear;
depthStencilAttachment.depthStoreOp = StoreOp::Store;
depthStencilAttachment.initialState = ResourceState::Undefined;
depthStencilAttachment.finalState = ResourceState::DepthWrite;
RenderPassDesc renderPass = {};
renderPass.colorAttachments = &colorAttachment;
renderPass.colorAttachmentCount = 1;
Expand Down
8 changes: 4 additions & 4 deletions tools/render-test/shader-renderer-util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ inline int calcNumMipLevels(TextureType type, Extents size)

textureDesc.sampleCount = inputDesc.sampleCount;
textureDesc.format = format;
textureDesc.numMipLevels = texData.m_mipLevels;
textureDesc.mipLevelCount = texData.m_mipLevels;
textureDesc.arrayLength = inputDesc.arrayLength > 0 ? inputDesc.arrayLength : 1;
textureDesc.usage = TextureUsage::CopyDestination | TextureUsage::CopySource;
switch (defaultState)
Expand Down Expand Up @@ -119,17 +119,17 @@ inline int calcNumMipLevels(TextureType type, Extents size)
}
}

if (textureDesc.numMipLevels == 0)
if (textureDesc.mipLevelCount == 0)
{
textureDesc.numMipLevels = calcNumMipLevels(textureDesc.type, textureDesc.size);
textureDesc.mipLevelCount = calcNumMipLevels(textureDesc.type, textureDesc.size);
}

List<SubresourceData> initSubresources;
int arrayLayerCount = textureDesc.arrayLength * (textureDesc.type == TextureType::TextureCube ? 6 : 1);
int subResourceCounter = 0;
for( int a = 0; a < arrayLayerCount; ++a )
{
for( int m = 0; m < textureDesc.numMipLevels; ++m )
for( int m = 0; m < textureDesc.mipLevelCount; ++m )
{
int subResourceIndex = subResourceCounter++;
const int mipWidth = calcMipSize(textureDesc.size.width, m);
Expand Down

0 comments on commit bc11579

Please sign in to comment.