summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/gfx/gfx.slang53
-rw-r--r--tools/slang-unit-test/unit-test-decl-tree-reflection.cpp4
2 files changed, 32 insertions, 25 deletions
diff --git a/tools/gfx/gfx.slang b/tools/gfx/gfx.slang
index e14f5e282..fded20eeb 100644
--- a/tools/gfx/gfx.slang
+++ b/tools/gfx/gfx.slang
@@ -105,9 +105,9 @@ public enum class ShaderModuleSourceType
public struct ShaderProgramDesc2
{
- public ShaderModuleSourceType sourceType;
- public void *sourceData;
- public Size sourceDataSize;
+ public ShaderModuleSourceType sourceType = ShaderModuleSourceType::SlangSource;
+ public void *sourceData = nullptr;
+ public Size sourceDataSize = 0;
// Number of entry points to include in the shader program. 0 means include all entry points
// defined in the module.
@@ -345,7 +345,7 @@ public enum class InteropHandleAPI
public struct InteropHandle
{
public InteropHandleAPI api = InteropHandleAPI::Unknown;
- public uint64_t handleValue;
+ public uint64_t handleValue = 0LLU;
};
// Declare opaque type
@@ -378,12 +378,12 @@ public enum class ResourceType
/// Base class for Descs
public struct ResourceDescBase
{
- public ResourceType type;
- public ResourceState defaultState;
- public ResourceStateSet allowedStates;
- public MemoryType memoryType;
- public InteropHandle existingHandle;
- public bool isShared;
+ public ResourceType type = ResourceType::Unknown;
+ public ResourceState defaultState = ResourceState::Undefined;
+ public ResourceStateSet allowedStates = {};
+ public MemoryType memoryType = MemoryType::DeviceLocal;
+ public InteropHandle existingHandle = {};
+ public bool isShared = false;
};
[COM("a0e39f34-8398-4522-95c2-ebc0f984ef3f")]
@@ -1056,6 +1056,7 @@ public struct AspectBlendDesc
{
srcFactor = BlendFactor::One;
dstFactor = BlendFactor::Zero;
+ op = BlendOp::Add;
}
};
@@ -1076,10 +1077,10 @@ public struct TargetBlendDesc
public struct BlendDesc
{
- public TargetBlendDesc targets[kMaxRenderTargetCount];
- public GfxCount targetCount;
+ public TargetBlendDesc targets[kMaxRenderTargetCount] = {};
+ public GfxCount targetCount = 0;
- public bool alphaToCoverageEnable;
+ public bool alphaToCoverageEnable = false;
};
public struct FramebufferTargetLayout
@@ -1113,7 +1114,13 @@ public struct GraphicsPipelineStateDesc
public __init()
{
+ program = {IShaderProgram()};
+ inputLayout = {IInputLayout()};
+ framebufferLayout = {IFramebufferLayout()};
primitiveType = PrimitiveType::Triangle;
+ depthStencil = {};
+ rasterizer = {};
+ blend = {};
}
};
@@ -1230,14 +1237,14 @@ public struct WindowHandle
public void* handleValues[2];
public static WindowHandle fromHwnd(void *hwnd)
{
- WindowHandle handle = {};
+ WindowHandle handle = {WindowHandleType::Unknown, {nullptr, nullptr}};
handle.type = WindowHandleType::Win32Handle;
handle.handleValues[0] = hwnd;
return handle;
}
public static WindowHandle fromXWindow(void *xdisplay, uint32_t xwindow)
{
- WindowHandle handle = {};
+ WindowHandle handle = {WindowHandleType::Unknown, {nullptr, nullptr}};
handle.type = WindowHandleType::XLibHandle;
handle.handleValues[0] = xdisplay;
handle.handleValues[1] = (void*)xwindow;
@@ -1698,17 +1705,17 @@ public interface IDebugCallback
public struct SlangDesc
{
- public NativeRef<slang::IGlobalSession> slangGlobalSession; // (optional) A slang global session object. If null will create automatically.
+ public NativeRef<slang::IGlobalSession> slangGlobalSession = {slang::IGlobalSession()}; // (optional) A slang global session object. If null will create automatically.
public slang::SlangMatrixLayoutMode defaultMatrixLayoutMode = slang::SlangMatrixLayoutMode::SLANG_MATRIX_LAYOUT_ROW_MAJOR;
- public NativeString *searchPaths;
- public GfxCount searchPathCount;
+ public NativeString *searchPaths = nullptr;
+ public GfxCount searchPathCount = 0;
- public slang::PreprocessorMacroDesc *preprocessorMacros;
+ public slang::PreprocessorMacroDesc *preprocessorMacros = nullptr;
public GfxCount preprocessorMacroCount = 0;
- public NativeString targetProfile; // (optional) Target shader profile. If null this will be set to platform dependent default.
+ public NativeString targetProfile = ""; // (optional) Target shader profile. If null this will be set to platform dependent default.
public slang::SlangFloatingPointMode floatingPointMode = slang::SlangFloatingPointMode::SLANG_FLOATING_POINT_MODE_DEFAULT;
public slang::SlangOptimizationLevel optimizationLevel = slang::SlangOptimizationLevel::SLANG_OPTIMIZATION_LEVEL_DEFAULT;
public slang::SlangTargetFlags targetFlags = slang::SlangTargetFlags.None;
@@ -1718,7 +1725,7 @@ public struct SlangDesc
public struct ShaderCacheDesc
{
// The root directory for the shader cache. If not set, shader cache is disabled.
- public NativeString shaderCachePath;
+ public NativeString shaderCachePath = "";
// The maximum number of entries stored in the cache.
public GfxCount maxEntryCount = 0;
};
@@ -1735,9 +1742,9 @@ public struct DeviceDesc
// The device's handles (if they exist) and their associated API. For D3D12, this contains a single InteropHandle
// for the ID3D12Device. For Vulkan, the first InteropHandle is the VkInstance, the second is the VkPhysicalDevice,
// and the third is the VkDevice. For CUDA, this only contains a single value for the CUDADevice.
- public DeviceInteropHandles existingDeviceHandles;
+ public DeviceInteropHandles existingDeviceHandles = {};
// Name to identify the adapter to use
- public NativeString adapter;
+ public NativeString adapter = "";
// Number of required features.
public GfxCount requiredFeatureCount = 0;
// Array of required feature names, whose size is `requiredFeatureCount`.
diff --git a/tools/slang-unit-test/unit-test-decl-tree-reflection.cpp b/tools/slang-unit-test/unit-test-decl-tree-reflection.cpp
index 512be9be5..0d6a333f0 100644
--- a/tools/slang-unit-test/unit-test-decl-tree-reflection.cpp
+++ b/tools/slang-unit-test/unit-test-decl-tree-reflection.cpp
@@ -130,10 +130,10 @@ SLANG_UNIT_TEST(declTreeReflection)
SLANG_CHECK(moduleDeclReflection->getKind() == slang::DeclReflection::Kind::Module);
SLANG_CHECK(moduleDeclReflection->getChildrenCount() == 9);
- // First declaration should be a struct with 1 variable
+ // First declaration should be a struct with 1 variable and a synthesized constructor
auto firstDecl = moduleDeclReflection->getChild(0);
SLANG_CHECK(firstDecl->getKind() == slang::DeclReflection::Kind::Struct);
- SLANG_CHECK(firstDecl->getChildrenCount() == 1);
+ SLANG_CHECK(firstDecl->getChildrenCount() == 2);
{
slang::TypeReflection* type = firstDecl->getType();