summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/gfx-unit-test/gfx-test-util.cpp7
-rw-r--r--tools/gfx-unit-test/shader-cache-tests.cpp3
-rw-r--r--tools/gfx/debug-layer/debug-device.cpp14
-rw-r--r--tools/gfx/debug-layer/debug-device.h4
-rw-r--r--tools/render-test/slang-support.cpp3
-rw-r--r--tools/slang-test/options.cpp13
-rw-r--r--tools/slang-test/options.h4
-rw-r--r--tools/slang-test/slang-test-main.cpp15
8 files changed, 41 insertions, 22 deletions
diff --git a/tools/gfx-unit-test/gfx-test-util.cpp b/tools/gfx-unit-test/gfx-test-util.cpp
index 5cbb30e71..fcebdda9f 100644
--- a/tools/gfx-unit-test/gfx-test-util.cpp
+++ b/tools/gfx-unit-test/gfx-test-util.cpp
@@ -239,6 +239,13 @@ namespace gfx_test
void* extDescPtr = &extDesc;
deviceDesc.extendedDescs = &extDescPtr;
+ // TODO: We should also set the debug callback
+ // (And in general reduce the differences (and duplication) between
+ // here and render-test-main.cpp)
+#ifdef _DEBUG
+ gfx::gfxEnableDebugLayer();
+#endif
+
auto createDeviceResult = gfxCreateDevice(&deviceDesc, device.writeRef());
if (SLANG_FAILED(createDeviceResult))
{
diff --git a/tools/gfx-unit-test/shader-cache-tests.cpp b/tools/gfx-unit-test/shader-cache-tests.cpp
index e1607ac59..de699c2d6 100644
--- a/tools/gfx-unit-test/shader-cache-tests.cpp
+++ b/tools/gfx-unit-test/shader-cache-tests.cpp
@@ -141,7 +141,8 @@ namespace gfx_test
[this, func] (IDevice* device, UnitTestContext* ctx)
{
this->device = device;
- device->queryInterface(SLANG_UUID_IShaderCache, (void**)this->shaderCache.writeRef());
+ SLANG_CHECK_ABORT(SLANG_SUCCEEDED(
+ device->queryInterface(SLANG_UUID_IShaderCache, (void**)this->shaderCache.writeRef())));
func();
this->device = nullptr;
this->shaderCache = nullptr;
diff --git a/tools/gfx/debug-layer/debug-device.cpp b/tools/gfx/debug-layer/debug-device.cpp
index 7790149b6..45374b64f 100644
--- a/tools/gfx/debug-layer/debug-device.cpp
+++ b/tools/gfx/debug-layer/debug-device.cpp
@@ -26,6 +26,20 @@ using namespace Slang;
namespace debug
{
+SlangResult DebugDevice::queryInterface(SlangUUID const& uuid, void** outObject) noexcept
+{
+ void* intf = getInterface(uuid);
+ if (intf)
+ {
+ addRef();
+ *outObject = intf;
+ return SLANG_OK;
+ }
+
+ // Fallback to trying to get the interface from the debugged object
+ return baseObject->queryInterface(uuid, outObject);
+}
+
Result DebugDevice::getNativeDeviceHandles(InteropHandles* outHandles)
{
return baseObject->getNativeDeviceHandles(outHandles);
diff --git a/tools/gfx/debug-layer/debug-device.h b/tools/gfx/debug-layer/debug-device.h
index db07cdd1b..5b8424093 100644
--- a/tools/gfx/debug-layer/debug-device.h
+++ b/tools/gfx/debug-layer/debug-device.h
@@ -12,7 +12,9 @@ namespace debug
class DebugDevice : public DebugObject<IDevice>
{
public:
- SLANG_COM_OBJECT_IUNKNOWN_ALL;
+ SlangResult SLANG_MCALL queryInterface(SlangUUID const& uuid, void** outObject) noexcept override;
+ SLANG_COM_OBJECT_IUNKNOWN_ADD_REF;
+ SLANG_COM_OBJECT_IUNKNOWN_RELEASE;
public:
DebugDevice();
diff --git a/tools/render-test/slang-support.cpp b/tools/render-test/slang-support.cpp
index 5b2d69bf4..54f1b94a1 100644
--- a/tools/render-test/slang-support.cpp
+++ b/tools/render-test/slang-support.cpp
@@ -10,6 +10,7 @@
#include <stdio.h>
#include "../../source/core/slang-string-util.h"
+#include "../../source/core/slang-test-tool-util.h"
namespace renderer_test {
using namespace Slang;
@@ -199,7 +200,7 @@ void ShaderCompilerUtil::Output::reset()
if (auto diagnostics = spGetDiagnosticOutput(slangRequest))
{
- fprintf(stderr, "%s", diagnostics);
+ StdWriters::getError().print("%s", diagnostics);
}
SLANG_RETURN_ON_FAIL(res);
diff --git a/tools/slang-test/options.cpp b/tools/slang-test/options.cpp
index 11188d766..ab0d3a01e 100644
--- a/tools/slang-test/options.cpp
+++ b/tools/slang-test/options.cpp
@@ -310,18 +310,7 @@ static bool _isSubCommand(const char* arg)
// first positional argument is source shader path
- if (positionalArgs.getCount())
- {
- optionsOut->testPrefix = positionalArgs[0];
- positionalArgs.removeAt(0);
- }
-
- // any remaining arguments represent an error
- if (positionalArgs.getCount() != 0)
- {
- stdError.print("unexpected arguments\n");
- return SLANG_FAIL;
- }
+ optionsOut->testPrefixes = std::move(positionalArgs);
if (optionsOut->binDir.getLength() == 0)
{
diff --git a/tools/slang-test/options.h b/tools/slang-test/options.h
index 26b8e7500..e786a0a74 100644
--- a/tools/slang-test/options.h
+++ b/tools/slang-test/options.h
@@ -52,8 +52,8 @@ struct Options
// Directory to use when looking for binaries to run. If empty it's not set.
Slang::String binDir;
- // only run test cases with names that have this prefix.
- char const* testPrefix = nullptr;
+ // only run test cases with names have one of these prefixes.
+ Slang::List<const char *> testPrefixes;
// generate extra output (notably: command lines we run)
bool shouldBeVerbose = false;
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index 71f5c04bd..51c618187 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -3900,15 +3900,20 @@ static bool shouldRunTest(
if(!endsWithAllowedExtension(context, filePath))
return false;
- if( context->options.testPrefix )
+ if(!context->options.testPrefixes.getCount())
{
- if( strncmp(context->options.testPrefix, filePath.begin(), strlen(context->options.testPrefix)) != 0 )
+ return true;
+ }
+
+ // If we have prefixes, it has to match one of them
+ for(auto& p : context->options.testPrefixes)
+ {
+ if(filePath.startsWith(p))
{
- return false;
+ return true;
}
}
-
- return true;
+ return false;
}
void getFilesInDirectory(String directoryPath, List<String>& files)