summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/benchmark.yml2
-rw-r--r--.github/workflows/ci.yml2
-rw-r--r--.github/workflows/compile-regression-test.yml2
-rw-r--r--.github/workflows/falcor-compiler-perf-test.yml2
-rw-r--r--.github/workflows/falcor-test.yml2
-rw-r--r--.github/workflows/release-linux-glibc-2-17.yml2
-rw-r--r--.github/workflows/release.yml2
-rw-r--r--.gitmodules3
-rw-r--r--CMakeLists.txt3
-rw-r--r--external/CMakeLists.txt6
m---------external/slang-rhi0
-rw-r--r--source/core/slang-render-api-util.cpp3
-rw-r--r--source/core/slang-render-api-util.h4
-rw-r--r--tests/bugs/gh-4504.slang3
-rw-r--r--tests/bugs/gh-4556.slang1
-rw-r--r--tests/compute/dynamic-dispatch-14.slang1
-rw-r--r--tests/compute/texture-subscript-multisample.slang1
-rw-r--r--tests/compute/texture-subscript.slang3
-rw-r--r--tests/render/cross-compile-entry-point.slang4
-rw-r--r--tools/gfx-unit-test/gfx-test-util.cpp3
-rw-r--r--tools/render-test/options.cpp19
-rw-r--r--tools/render-test/options.h4
-rw-r--r--tools/render-test/render-test-main.cpp73
-rw-r--r--tools/render-test/shader-input-layout.cpp14
-rw-r--r--tools/render-test/shader-input-layout.h8
-rw-r--r--tools/render-test/shader-renderer-util.cpp91
-rw-r--r--tools/render-test/shader-renderer-util.h2
-rw-r--r--tools/render-test/slang-support.cpp6
-rw-r--r--tools/render-test/slang-support.h4
-rw-r--r--tools/slang-test/options.h3
-rw-r--r--tools/slang-test/slang-test-main.cpp6
31 files changed, 175 insertions, 104 deletions
diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml
index e704adedb..77eb00c64 100644
--- a/.github/workflows/benchmark.yml
+++ b/.github/workflows/benchmark.yml
@@ -25,7 +25,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
- submodules: 'true'
+ submodules: 'recursive'
fetch-depth: '0'
- name: Common setup
uses: ./.github/actions/common-setup
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b80f41423..e4d9fb06b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -84,7 +84,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
- submodules: 'true'
+ submodules: 'recursive'
fetch-depth: '0'
- name: Setup
uses: ./.github/actions/common-setup
diff --git a/.github/workflows/compile-regression-test.yml b/.github/workflows/compile-regression-test.yml
index e10492370..f1809ea71 100644
--- a/.github/workflows/compile-regression-test.yml
+++ b/.github/workflows/compile-regression-test.yml
@@ -42,7 +42,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
- submodules: 'true'
+ submodules: 'recursive'
fetch-depth: '0'
- name: Setup
uses: ./.github/actions/common-setup
diff --git a/.github/workflows/falcor-compiler-perf-test.yml b/.github/workflows/falcor-compiler-perf-test.yml
index 841462c68..d329642d9 100644
--- a/.github/workflows/falcor-compiler-perf-test.yml
+++ b/.github/workflows/falcor-compiler-perf-test.yml
@@ -44,7 +44,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
- submodules: 'true'
+ submodules: 'recursive'
fetch-depth: '0'
- name: Setup
diff --git a/.github/workflows/falcor-test.yml b/.github/workflows/falcor-test.yml
index af1c70d7e..bb5faeddc 100644
--- a/.github/workflows/falcor-test.yml
+++ b/.github/workflows/falcor-test.yml
@@ -42,7 +42,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
- submodules: 'true'
+ submodules: 'recursive'
fetch-depth: '0'
- name: Setup
uses: ./.github/actions/common-setup
diff --git a/.github/workflows/release-linux-glibc-2-17.yml b/.github/workflows/release-linux-glibc-2-17.yml
index 02d302b49..d147f38e1 100644
--- a/.github/workflows/release-linux-glibc-2-17.yml
+++ b/.github/workflows/release-linux-glibc-2-17.yml
@@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
- submodules: 'true'
+ submodules: 'recursive'
fetch-depth: '0'
# build the binary in docker image
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index ac583361c..7cbb04f83 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -42,7 +42,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
- submodules: 'true'
+ submodules: 'recursive'
fetch-depth: '0'
- name: Setup
uses: ./.github/actions/common-setup
diff --git a/.gitmodules b/.gitmodules
index 8158ca7f5..29dff6c36 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -35,3 +35,6 @@
[submodule "external/metal-cpp"]
path = external/metal-cpp
url = https://github.com/bkaradzic/metal-cpp
+[submodule "external/slang-rhi"]
+ path = external/slang-rhi
+ url = https://github.com/shader-slang/slang-rhi.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d2972e642..e1225022e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -637,8 +637,7 @@ if(SLANG_ENABLE_TESTS)
core
compiler-core
slang
- gfx
- gfx-util
+ slang-rhi
platform
$<$<BOOL:${SLANG_ENABLE_CUDA}>:CUDA::cuda_driver>
EXTRA_COMPILE_DEFINITIONS_PRIVATE
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
index 007390431..f55b5ae9e 100644
--- a/external/CMakeLists.txt
+++ b/external/CMakeLists.txt
@@ -66,6 +66,12 @@ endif()
add_library(imgui INTERFACE)
target_include_directories(imgui INTERFACE "${CMAKE_CURRENT_LIST_DIR}/imgui")
+# slang-rhi
+set(SLANG_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
+set(SLANG_BINARY_DIR ${CMAKE_BINARY_DIR})
+set(SLANG_RHI_BUILD_TESTS OFF)
+add_subdirectory(slang-rhi)
+
# Tidy things up:
# Restore log level if we set it
diff --git a/external/slang-rhi b/external/slang-rhi
new file mode 160000
+Subproject 162d0a530578927b29718e003e84513dfd315dd
diff --git a/source/core/slang-render-api-util.cpp b/source/core/slang-render-api-util.cpp
index 4fd345840..0a303b665 100644
--- a/source/core/slang-render-api-util.cpp
+++ b/source/core/slang-render-api-util.cpp
@@ -13,7 +13,6 @@ namespace Slang {
// NOTE! Must keep in same order as RenderApiType and have same amount of entries
/* static */const RenderApiUtil::Info RenderApiUtil::s_infos[] =
{
- { RenderApiType::OpenGl, "gl,ogl,opengl", "glsl,glsl-rewrite,glsl-cross"},
{ RenderApiType::Vulkan, "vk,vulkan", ""},
{ RenderApiType::D3D12, "dx12,d3d12", ""},
{ RenderApiType::D3D11, "dx11,d3d11", "hlsl,hlsl-rewrite,slang"},
@@ -265,13 +264,11 @@ static bool _canLoadSharedLibrary(const char* libName)
switch (type)
{
#if SLANG_WINDOWS_FAMILY
- case RenderApiType::OpenGl: return _canLoadSharedLibrary("opengl32");
case RenderApiType::Vulkan: return _canLoadSharedLibrary("vulkan-1") || _canLoadSharedLibrary("vk_swiftshader");
#elif SLANG_APPLE_FAMILY
case RenderApiType::Vulkan: return true;
case RenderApiType::Metal: return true;
#elif SLANG_UNIX_FAMILY
- case RenderApiType::OpenGl: return true;
case RenderApiType::Vulkan: return true;
#endif
diff --git a/source/core/slang-render-api-util.h b/source/core/slang-render-api-util.h
index 41728e5f2..224fe6996 100644
--- a/source/core/slang-render-api-util.h
+++ b/source/core/slang-render-api-util.h
@@ -11,8 +11,7 @@ namespace Slang
enum class RenderApiType
{
Unknown = -1,
- OpenGl = 0,
- Vulkan,
+ Vulkan = 0,
D3D12,
D3D11,
Metal,
@@ -26,7 +25,6 @@ struct RenderApiFlag
{
enum Enum
{
- OpenGl = 1 << int(RenderApiType::OpenGl),
Vulkan = 1 << int(RenderApiType::Vulkan),
D3D12 = 1 << int(RenderApiType::D3D12),
D3D11 = 1 << int(RenderApiType::D3D11),
diff --git a/tests/bugs/gh-4504.slang b/tests/bugs/gh-4504.slang
index d6fc28e0c..d6678e087 100644
--- a/tests/bugs/gh-4504.slang
+++ b/tests/bugs/gh-4504.slang
@@ -1,6 +1,5 @@
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-slang -dx12 -compute -shaderobj
//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -compute -shaderobj
-//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -glsl -compute -shaderobj
//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=CHECK):-mtl -compute -shaderobj
//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
@@ -20,4 +19,4 @@ void computeMain(uint3 threadId: SV_DispatchThreadID)
&& size.y == 2
&& size.z == 1
;
-} \ No newline at end of file
+}
diff --git a/tests/bugs/gh-4556.slang b/tests/bugs/gh-4556.slang
index 1f779e199..d3c606507 100644
--- a/tests/bugs/gh-4556.slang
+++ b/tests/bugs/gh-4556.slang
@@ -1,6 +1,5 @@
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -compute -output-using-type -shaderobj
//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -compute -output-using-type -shaderobj
-//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -glsl -compute -output-using-type -shaderobj
//TEST(compute):SIMPLE(filecheck=SPIRV): -target spirv-asm -stage compute
//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-mtl -compute -output-using-type -shaderobj
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -cpu -output-using-type -shaderobj
diff --git a/tests/compute/dynamic-dispatch-14.slang b/tests/compute/dynamic-dispatch-14.slang
index 609d1a215..641fe938c 100644
--- a/tests/compute/dynamic-dispatch-14.slang
+++ b/tests/compute/dynamic-dispatch-14.slang
@@ -2,7 +2,6 @@
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile sm_6_0 -use-dxil
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx11 -profile sm_5_0
-//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -gl -profile glsl_440
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -vk -profile glsl_440
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -cpu
diff --git a/tests/compute/texture-subscript-multisample.slang b/tests/compute/texture-subscript-multisample.slang
index 76ededbda..5bd40ae66 100644
--- a/tests/compute/texture-subscript-multisample.slang
+++ b/tests/compute/texture-subscript-multisample.slang
@@ -4,7 +4,6 @@
// Due to this, Metal compute test is disabled
//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF): -slang -output-using-type -shaderobj -mtl
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF): -slang -output-using-type -shaderobj -vk
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF): -slang -output-using-type -shaderobj -vk -glsl
//METAL_ERROR: error 41402
//METALLIB: error 41402
diff --git a/tests/compute/texture-subscript.slang b/tests/compute/texture-subscript.slang
index c15a0824b..efcc491e6 100644
--- a/tests/compute/texture-subscript.slang
+++ b/tests/compute/texture-subscript.slang
@@ -4,7 +4,6 @@
// Due to this, Metal compute test is disabled
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF): -slang -output-using-type -shaderobj -mtl
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF): -slang -output-using-type -shaderobj -vk
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUF): -slang -output-using-type -shaderobj -vk -glsl
//METAL-NOT: error 41402
//METALLIB: @computeMain
@@ -59,4 +58,4 @@ void computeMain()
);
}
-//BUF: 1 \ No newline at end of file
+//BUF: 1
diff --git a/tests/render/cross-compile-entry-point.slang b/tests/render/cross-compile-entry-point.slang
index 869df80bc..816acbe1f 100644
--- a/tests/render/cross-compile-entry-point.slang
+++ b/tests/render/cross-compile-entry-point.slang
@@ -1,5 +1,5 @@
-//TEST(render):COMPARE_HLSL_CROSS_COMPILE_RENDER:
-//TEST(render):COMPARE_HLSL_CROSS_COMPILE_RENDER: -dx12
+// //TEST(render):COMPARE_HLSL_CROSS_COMPILE_RENDER:
+// //TEST(render):COMPARE_HLSL_CROSS_COMPILE_RENDER: -dx12
// This is a test to ensure that we can cross-compile a complete entry point.
diff --git a/tools/gfx-unit-test/gfx-test-util.cpp b/tools/gfx-unit-test/gfx-test-util.cpp
index 3ca67e67b..1c7289325 100644
--- a/tools/gfx-unit-test/gfx-test-util.cpp
+++ b/tools/gfx-unit-test/gfx-test-util.cpp
@@ -263,9 +263,6 @@ namespace gfx_test
case Slang::RenderApiFlag::CUDA:
deviceDesc.deviceType = gfx::DeviceType::CUDA;
break;
- case Slang::RenderApiFlag::OpenGl:
- deviceDesc.deviceType = gfx::DeviceType::OpenGl;
- break;
default:
SLANG_IGNORE_TEST
}
diff --git a/tools/render-test/options.cpp b/tools/render-test/options.cpp
index aca42a25c..2879acfac 100644
--- a/tools/render-test/options.cpp
+++ b/tools/render-test/options.cpp
@@ -22,20 +22,19 @@
namespace renderer_test {
using namespace Slang;
-static gfx::DeviceType _toRenderType(Slang::RenderApiType apiType)
+static rhi::DeviceType _toRenderType(Slang::RenderApiType apiType)
{
using namespace Slang;
switch (apiType)
{
- case RenderApiType::D3D11: return gfx::DeviceType::DirectX11;
- case RenderApiType::D3D12: return gfx::DeviceType::DirectX12;
- case RenderApiType::OpenGl: return gfx::DeviceType::OpenGl;
- case RenderApiType::Vulkan: return gfx::DeviceType::Vulkan;
- case RenderApiType::Metal: return gfx::DeviceType::Metal;
- case RenderApiType::CPU: return gfx::DeviceType::CPU;
- case RenderApiType::CUDA: return gfx::DeviceType::CUDA;
+ case RenderApiType::D3D11: return rhi::DeviceType::D3D11;
+ case RenderApiType::D3D12: return rhi::DeviceType::D3D12;
+ case RenderApiType::Vulkan: return rhi::DeviceType::Vulkan;
+ case RenderApiType::Metal: return rhi::DeviceType::Metal;
+ case RenderApiType::CPU: return rhi::DeviceType::CPU;
+ case RenderApiType::CUDA: return rhi::DeviceType::CUDA;
default:
- return gfx::DeviceType::Unknown;
+ return rhi::DeviceType::Unknown;
}
}
@@ -254,7 +253,7 @@ static gfx::DeviceType _toRenderType(Slang::RenderApiType apiType)
// Lookup the target language type
DeviceType targetLanguageDeviceType = _toRenderType(RenderApiUtil::findImplicitLanguageRenderApiType(argName));
- if (targetLanguageDeviceType != DeviceType::Unknown)
+ if (targetLanguageDeviceType != DeviceType::Unknown || argName == "glsl")
{
outOptions.targetLanguageDeviceType = targetLanguageDeviceType;
outOptions.inputLanguageID = (argName == "hlsl" || argName == "glsl" || argName == "cpp" || argName == "cxx" || argName == "c") ? InputLanguageID::Native : InputLanguageID::Slang;
diff --git a/tools/render-test/options.h b/tools/render-test/options.h
index 1400f0129..6b0841c7d 100644
--- a/tools/render-test/options.h
+++ b/tools/render-test/options.h
@@ -14,11 +14,11 @@
#include "../../source/compiler-core/slang-command-line-args.h"
-#include "slang-gfx.h"
+#include <slang-rhi.h>
namespace renderer_test {
-using namespace gfx;
+using namespace rhi;
struct Options
{
diff --git a/tools/render-test/render-test-main.cpp b/tools/render-test/render-test-main.cpp
index 6f67dfd1e..5712485cc 100644
--- a/tools/render-test/render-test-main.cpp
+++ b/tools/render-test/render-test-main.cpp
@@ -3,8 +3,8 @@
#define _CRT_SECURE_NO_WARNINGS 1
#include "options.h"
-#include "slang-gfx.h"
-#include "tools/gfx-util/shader-cursor.h"
+#include <slang-rhi.h>
+#include <slang-rhi/shader-cursor.h>
#include "slang-support.h"
#include "png-serialize-util.h"
@@ -670,7 +670,7 @@ void RenderTestApp::_initializeRenderPass()
m_queue = m_device->createCommandQueue(queueDesc);
SLANG_ASSERT(m_queue);
- gfx::ITextureResource::Desc depthBufferDesc;
+ rhi::ITextureResource::Desc depthBufferDesc;
depthBufferDesc.type = IResource::Type::Texture2D;
depthBufferDesc.size.width = gWindowWidth;
depthBufferDesc.size.height = gWindowHeight;
@@ -680,11 +680,11 @@ void RenderTestApp::_initializeRenderPass()
depthBufferDesc.defaultState = ResourceState::DepthWrite;
depthBufferDesc.allowedStates = ResourceState::DepthWrite;
- ComPtr<gfx::ITextureResource> depthBufferResource =
+ ComPtr<rhi::ITextureResource> depthBufferResource =
m_device->createTextureResource(depthBufferDesc, nullptr);
SLANG_ASSERT(depthBufferResource);
- gfx::ITextureResource::Desc colorBufferDesc;
+ rhi::ITextureResource::Desc colorBufferDesc;
colorBufferDesc.type = IResource::Type::Texture2D;
colorBufferDesc.size.width = gWindowWidth;
colorBufferDesc.size.height = gWindowHeight;
@@ -696,33 +696,33 @@ void RenderTestApp::_initializeRenderPass()
m_colorBuffer = m_device->createTextureResource(colorBufferDesc, nullptr);
SLANG_ASSERT(m_colorBuffer);
- gfx::IResourceView::Desc colorBufferViewDesc = {};
+ rhi::IResourceView::Desc colorBufferViewDesc = {};
memset(&colorBufferViewDesc, 0, sizeof(colorBufferViewDesc));
- colorBufferViewDesc.format = gfx::Format::R8G8B8A8_UNORM;
- colorBufferViewDesc.renderTarget.shape = gfx::IResource::Type::Texture2D;
- colorBufferViewDesc.type = gfx::IResourceView::Type::RenderTarget;
- ComPtr<gfx::IResourceView> rtv =
+ colorBufferViewDesc.format = rhi::Format::R8G8B8A8_UNORM;
+ colorBufferViewDesc.renderTarget.shape = rhi::IResource::Type::Texture2D;
+ colorBufferViewDesc.type = rhi::IResourceView::Type::RenderTarget;
+ ComPtr<rhi::IResourceView> rtv =
m_device->createTextureView(m_colorBuffer.get(), colorBufferViewDesc);
SLANG_ASSERT(rtv);
- gfx::IResourceView::Desc depthBufferViewDesc = {};
+ rhi::IResourceView::Desc depthBufferViewDesc = {};
memset(&depthBufferViewDesc, 0, sizeof(depthBufferViewDesc));
- depthBufferViewDesc.format = gfx::Format::D32_FLOAT;
- depthBufferViewDesc.renderTarget.shape = gfx::IResource::Type::Texture2D;
- depthBufferViewDesc.type = gfx::IResourceView::Type::DepthStencil;
- ComPtr<gfx::IResourceView> dsv =
+ depthBufferViewDesc.format = rhi::Format::D32_FLOAT;
+ depthBufferViewDesc.renderTarget.shape = rhi::IResource::Type::Texture2D;
+ depthBufferViewDesc.type = rhi::IResourceView::Type::DepthStencil;
+ ComPtr<rhi::IResourceView> dsv =
m_device->createTextureView(depthBufferResource.get(), depthBufferViewDesc);
SLANG_ASSERT(dsv);
- IFramebufferLayout::TargetLayout colorTarget = {gfx::Format::R8G8B8A8_UNORM, 1};
- IFramebufferLayout::TargetLayout depthTarget = {gfx::Format::D32_FLOAT, 1};
- gfx::IFramebufferLayout::Desc framebufferLayoutDesc;
+ IFramebufferLayout::TargetLayout colorTarget = {rhi::Format::R8G8B8A8_UNORM, 1};
+ IFramebufferLayout::TargetLayout depthTarget = {rhi::Format::D32_FLOAT, 1};
+ rhi::IFramebufferLayout::Desc framebufferLayoutDesc;
framebufferLayoutDesc.renderTargetCount = 1;
framebufferLayoutDesc.renderTargets = &colorTarget;
framebufferLayoutDesc.depthStencil = &depthTarget;
m_device->createFramebufferLayout(framebufferLayoutDesc, m_framebufferLayout.writeRef());
- gfx::IFramebuffer::Desc framebufferDesc;
+ rhi::IFramebuffer::Desc framebufferDesc;
framebufferDesc.renderTargetCount = 1;
framebufferDesc.depthStencilView = dsv.get();
framebufferDesc.renderTargetViews = rtv.readRef();
@@ -1074,7 +1074,7 @@ Result RenderTestApp::update()
else
{
auto encoder = commandBuffer->encodeRenderCommands(m_renderPass, m_framebuffer);
- gfx::Viewport viewport = {};
+ rhi::Viewport viewport = {};
viewport.maxZ = 1.0f;
viewport.extentX = (float)gWindowWidth;
viewport.extentY = (float)gWindowHeight;
@@ -1222,17 +1222,17 @@ static void renderDocBeginFrame(){}
static void renderDocEndFrame(){}
#endif
-class StdWritersDebugCallback : public gfx::IDebugCallback
+class StdWritersDebugCallback : public rhi::IDebugCallback
{
public:
Slang::StdWriters* writers;
virtual SLANG_NO_THROW void SLANG_MCALL handleMessage(
- gfx::DebugMessageType type,
- gfx::DebugMessageSource source,
+ rhi::DebugMessageType type,
+ rhi::DebugMessageSource source,
const char* message) override
{
SLANG_UNUSED(source);
- if (type == gfx::DebugMessageType::Error)
+ if (type == rhi::DebugMessageType::Error)
{
writers->getOut().print("%s\n", message);
}
@@ -1252,6 +1252,10 @@ static SlangResult _innerMain(Slang::StdWriters* stdWriters, SlangSession* sessi
// Parse command-line options
SLANG_RETURN_ON_FAIL(Options::parse(argcIn, argvIn, StdWriters::getError(), options));
+ if (options.deviceType == DeviceType::Unknown)
+ {
+ return SLANG_OK;
+ }
ShaderCompilerUtil::Input input;
@@ -1263,7 +1267,7 @@ static SlangResult _innerMain(Slang::StdWriters* stdWriters, SlangSession* sessi
char const* profileName = "";
switch (options.deviceType)
{
- case DeviceType::DirectX11:
+ case DeviceType::D3D11:
input.target = SLANG_DXBC;
input.profile = "sm_5_0";
nativeLanguage = SLANG_SOURCE_LANGUAGE_HLSL;
@@ -1271,7 +1275,7 @@ static SlangResult _innerMain(Slang::StdWriters* stdWriters, SlangSession* sessi
break;
- case DeviceType::DirectX12:
+ case DeviceType::D3D12:
input.target = SLANG_DXBC;
input.profile = "sm_5_0";
nativeLanguage = SLANG_SOURCE_LANGUAGE_HLSL;
@@ -1285,13 +1289,6 @@ static SlangResult _innerMain(Slang::StdWriters* stdWriters, SlangSession* sessi
}
break;
- case DeviceType::OpenGl:
- input.target = SLANG_GLSL;
- input.profile = "";
- nativeLanguage = SLANG_SOURCE_LANGUAGE_GLSL;
- slangPassThrough = SLANG_PASS_THROUGH_GLSLANG;
- break;
-
case DeviceType::Vulkan:
input.target = SLANG_SPIRV;
input.profile = "";
@@ -1349,16 +1346,16 @@ static SlangResult _innerMain(Slang::StdWriters* stdWriters, SlangSession* sessi
}
#ifdef _DEBUG
- gfxEnableDebugLayer();
+ rhiEnableDebugLayer();
#endif
StdWritersDebugCallback debugCallback;
debugCallback.writers = stdWriters;
- gfxSetDebugCallback(&debugCallback);
+ rhiSetDebugCallback(&debugCallback);
struct ResetDebugCallbackRAII
{
~ResetDebugCallbackRAII()
{
- gfxSetDebugCallback(nullptr);
+ rhiSetDebugCallback(nullptr);
}
} resetDebugCallbackRAII;
@@ -1367,7 +1364,7 @@ static SlangResult _innerMain(Slang::StdWriters* stdWriters, SlangSession* sessi
StringBuilder rendererName;
auto info =
- rendererName << "[" << gfxGetDeviceTypeName(options.deviceType) << "] ";
+ rendererName << "[" << rhiGetDeviceTypeName(options.deviceType) << "] ";
if (options.onlyStartup)
{
@@ -1447,7 +1444,7 @@ static SlangResult _innerMain(Slang::StdWriters* stdWriters, SlangSession* sessi
desc.slang.slangGlobalSession = session;
desc.slang.targetProfile = options.profileName.getBuffer();
{
- SlangResult res = gfxCreateDevice(&desc, device.writeRef());
+ SlangResult res = rhiCreateDevice(&desc, device.writeRef());
if (SLANG_FAILED(res))
{
// We need to be careful here about SLANG_E_NOT_AVAILABLE. This return value means that the renderer couldn't
diff --git a/tools/render-test/shader-input-layout.cpp b/tools/render-test/shader-input-layout.cpp
index ac99d5cd8..97b82e1e9 100644
--- a/tools/render-test/shader-input-layout.cpp
+++ b/tools/render-test/shader-input-layout.cpp
@@ -5,7 +5,7 @@
#include "core/slang-token-reader.h"
#include "core/slang-type-text-util.h"
-#include "slang-gfx.h"
+#include <slang-rhi.h>
namespace renderer_test
{
@@ -21,7 +21,7 @@ namespace renderer_test
{
#define SLANG_FORMAT_CASE(name, blockSizeInBytes, pixelsPerBlock) if (slice == #name) return Format::name; else
- GFX_FORMAT(SLANG_FORMAT_CASE)
+ SLANG_RHI_FORMAT(SLANG_FORMAT_CASE)
return Format::Unknown;
}
@@ -1155,7 +1155,7 @@ namespace renderer_test
// T for type to return, F for function pointer to operate on uint8->T
template<typename T, typename F>
- void generateTextureDataWithTargetTStorage(TextureData& output, const InputTextureDesc& desc, gfx::FormatInfo& formatInfo, F loadUint8ToT)
+ void generateTextureDataWithTargetTStorage(TextureData& output, const InputTextureDesc& desc, rhi::FormatInfo& formatInfo, F loadUint8ToT)
{
// the following function assumes input of 0 or 1 since our testing framework only tests with 0 or 1
TextureData work;
@@ -1229,8 +1229,8 @@ namespace renderer_test
}
void generateTextureData(TextureData& output, const InputTextureDesc& desc)
{
- gfx::FormatInfo formatInfo;
- gfxGetFormatInfo(desc.format, &formatInfo);
+ rhi::FormatInfo formatInfo;
+ rhiGetFormatInfo(desc.format, &formatInfo);
switch (desc.format)
{
@@ -1348,8 +1348,8 @@ namespace renderer_test
kFloat,
};
SimpleScalarType type;
- gfx::FormatInfo formatInfo;
- gfxGetFormatInfo(inputDesc.format, &formatInfo);
+ rhi::FormatInfo formatInfo;
+ rhiGetFormatInfo(inputDesc.format, &formatInfo);
switch (formatInfo.channelType)
{
case SLANG_SCALAR_TYPE_UINT64:
diff --git a/tools/render-test/shader-input-layout.h b/tools/render-test/shader-input-layout.h
index 996635b94..59aea2562 100644
--- a/tools/render-test/shader-input-layout.h
+++ b/tools/render-test/shader-input-layout.h
@@ -6,11 +6,11 @@
#include "source/core/slang-writer.h"
-#include "slang-gfx.h"
+#include <slang-rhi.h>
namespace renderer_test {
-using namespace gfx;
+using namespace rhi;
enum class ShaderInputType
{
@@ -128,7 +128,7 @@ struct TextureData
clearSlices();
FormatInfo formatSizeInfo;
- gfxGetFormatInfo(format, &formatSizeInfo);
+ rhiGetFormatInfo(format, &formatSizeInfo);
m_formatSize = uint8_t(formatSizeInfo.blockSizeInBytes / formatSizeInfo.pixelsPerBlock);
m_format = format;
}
@@ -147,7 +147,7 @@ struct TextureData
m_slices.clear();
}
- gfx::Format m_format = gfx::Format::Unknown;
+ rhi::Format m_format = rhi::Format::Unknown;
uint8_t m_formatSize = 0;
Slang::List<Slice> m_slices;
diff --git a/tools/render-test/shader-renderer-util.cpp b/tools/render-test/shader-renderer-util.cpp
index fe726012e..c2f7583a7 100644
--- a/tools/render-test/shader-renderer-util.cpp
+++ b/tools/render-test/shader-renderer-util.cpp
@@ -2,13 +2,100 @@
#include "shader-renderer-util.h"
-#include "tools/gfx/resource-desc-utils.h"
-
namespace renderer_test {
using namespace Slang;
using Slang::Result;
+inline int calcMipSize(int size, int level)
+{
+ size = size >> level;
+ return size > 0 ? size : 1;
+}
+
+inline ITextureResource::Extents calcMipSize(ITextureResource::Extents size, int mipLevel)
+{
+ ITextureResource::Extents rs;
+ rs.width = calcMipSize(size.width, mipLevel);
+ rs.height = calcMipSize(size.height, mipLevel);
+ rs.depth = calcMipSize(size.depth, mipLevel);
+ return rs;
+}
+
+/// Calculate the effective array size - in essence the amount if mip map sets needed.
+/// In practice takes into account if the arraySize is 0 (it's not an array, but it will still have
+/// at least one mip set) and if the type is a cubemap (multiplies the amount of mip sets by 6)
+inline int calcEffectiveArraySize(const ITextureResource::Desc& desc)
+{
+ const int arrSize = (desc.arraySize > 0) ? desc.arraySize : 1;
+
+ switch (desc.type)
+ {
+ case IResource::Type::Texture1D: // fallthru
+ case IResource::Type::Texture2D:
+ {
+ return arrSize;
+ }
+ case IResource::Type::TextureCube:
+ return arrSize * 6;
+ case IResource::Type::Texture3D:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+/// Given the type works out the maximum dimension size
+inline int calcMaxDimension(ITextureResource::Extents size, IResource::Type type)
+{
+ switch (type)
+ {
+ case IResource::Type::Texture1D:
+ return size.width;
+ case IResource::Type::Texture3D:
+ return Math::Max(Math::Max(size.width, size.height), size.depth);
+ case IResource::Type::TextureCube: // fallthru
+ case IResource::Type::Texture2D:
+ {
+ return Math::Max(size.width, size.height);
+ }
+ default:
+ return 0;
+ }
+}
+
+/// Given the type, calculates the number of mip maps. 0 on error
+inline int calcNumMipLevels(IResource::Type type, ITextureResource::Extents size)
+{
+ const int maxDimensionSize = calcMaxDimension(size, type);
+ return (maxDimensionSize > 0) ? (Math::Log2Floor(maxDimensionSize) + 1) : 0;
+}
+
+/// Calculate the total number of sub resources. 0 on error.
+inline int calcNumSubResources(const ITextureResource::Desc& desc)
+{
+ const int numMipMaps =
+ (desc.numMipLevels > 0) ? desc.numMipLevels : calcNumMipLevels(desc.type, desc.size);
+ const int arrSize = (desc.arraySize > 0) ? desc.arraySize : 1;
+
+ switch (desc.type)
+ {
+ case IResource::Type::Texture1D:
+ case IResource::Type::Texture2D:
+ case IResource::Type::Texture3D:
+ {
+ return numMipMaps * arrSize;
+ }
+ case IResource::Type::TextureCube:
+ {
+ // There are 6 faces to a cubemap
+ return numMipMaps * arrSize * 6;
+ }
+ default:
+ return 0;
+ }
+}
+
/* static */ Result ShaderRendererUtil::generateTextureResource(
const InputTextureDesc& inputDesc,
ResourceState defaultState,
diff --git a/tools/render-test/shader-renderer-util.h b/tools/render-test/shader-renderer-util.h
index 1a1edf997..188562fa8 100644
--- a/tools/render-test/shader-renderer-util.h
+++ b/tools/render-test/shader-renderer-util.h
@@ -1,7 +1,7 @@
// shader-renderer-util.h
#pragma once
-#include "slang-gfx.h"
+#include <slang-rhi.h>
#include "shader-input-layout.h"
namespace renderer_test {
diff --git a/tools/render-test/slang-support.cpp b/tools/render-test/slang-support.cpp
index 326e86a60..c819aede2 100644
--- a/tools/render-test/slang-support.cpp
+++ b/tools/render-test/slang-support.cpp
@@ -23,16 +23,16 @@ static const char rtEntryPointName[] = "raygenMain";
static const char taskEntryPointName[] = "taskMain";
static const char meshEntryPointName[] = "meshMain";
-gfx::StageType translateStage(SlangStage slangStage)
+rhi::StageType translateStage(SlangStage slangStage)
{
switch(slangStage)
{
default:
SLANG_ASSERT(!"unhandled case");
- return gfx::StageType::Unknown;
+ return rhi::StageType::Unknown;
#define CASE(FROM, TO) \
- case SLANG_STAGE_##FROM: return gfx::StageType::TO
+ case SLANG_STAGE_##FROM: return rhi::StageType::TO
CASE(VERTEX, Vertex);
CASE(HULL, Hull);
diff --git a/tools/render-test/slang-support.h b/tools/render-test/slang-support.h
index 0ed6216a9..e08440377 100644
--- a/tools/render-test/slang-support.h
+++ b/tools/render-test/slang-support.h
@@ -1,7 +1,7 @@
// slang-support.h
#pragma once
-#include "slang-gfx.h"
+#include <slang-rhi.h>
#include "slang.h"
@@ -10,7 +10,7 @@
namespace renderer_test {
-gfx::StageType translateStage(SlangStage slangStage);
+rhi::StageType translateStage(SlangStage slangStage);
struct ShaderCompileRequest
{
diff --git a/tools/slang-test/options.h b/tools/slang-test/options.h
index 2b9ed946b..2485ee2e1 100644
--- a/tools/slang-test/options.h
+++ b/tools/slang-test/options.h
@@ -104,10 +104,9 @@ struct Options
// By default we potentially synthesize test for all
// TODO: Vulkan is disabled by default for now as the majority as vulkan synthesized tests
- // OpenGL is disabled for now
// CPU is disabled by default
// CUDA is disabled by default
- Slang::RenderApiFlags synthesizedTestApis = Slang::RenderApiFlag::AllOf & ~(Slang::RenderApiFlag::Vulkan | Slang::RenderApiFlag::OpenGl | Slang::RenderApiFlag::CPU);
+ Slang::RenderApiFlags synthesizedTestApis = Slang::RenderApiFlag::AllOf & ~(Slang::RenderApiFlag::Vulkan | Slang::RenderApiFlag::CPU);
// The adapter to use. If empty will match first found adapter.
Slang::String adapter;
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index 7616ab614..b49d7be73 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -1096,12 +1096,6 @@ static SlangResult _extractRenderTestRequirements(const CommandLine& cmdLine, Te
passThru = SLANG_PASS_THROUGH_DXC;
}
break;
-
- case RenderApiType::OpenGl:
- target = SLANG_GLSL;
- nativeLanguage = SLANG_SOURCE_LANGUAGE_GLSL;
- passThru = SLANG_PASS_THROUGH_GLSLANG;
- break;
case RenderApiType::Vulkan:
target = SLANG_SPIRV;
nativeLanguage = SLANG_SOURCE_LANGUAGE_GLSL;