aboutsummaryrefslogtreecommitdiff
path: root/include/spirv-tools/instrument.hpp
diff options
context:
space:
mode:
authorgreg-lunarg <greg@lunarg.com>2019-03-19 06:53:43 -0700
committeralan-baker <33432579+alan-baker@users.noreply.github.com>2019-03-19 09:53:43 -0400
commite1a76269b649b7263266c1197622468dae9950b3 (patch)
treea2bda24b3aa3e7c6f8d4abc6746b8211a6e42e8d /include/spirv-tools/instrument.hpp
parent9244e6ff62b8bf45154d4b4515d4df41e0cd9bc2 (diff)
downloadspirv-tools-e1a76269b649b7263266c1197622468dae9950b3.tar.gz
Bindless Validation: Descriptor Initialization Check (#2419)
If SPV_EXT_descriptor_indexing is enabled, add check that for a descriptor-based reference, the descriptor is initialized. Initialization data is stored in the debug input buffer, added to the length information already there. This feature must be seperately enabled on the pass creation routine. NOTE: Currently just supports image references; buffer references are still TODO.
Diffstat (limited to 'include/spirv-tools/instrument.hpp')
-rw-r--r--include/spirv-tools/instrument.hpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/include/spirv-tools/instrument.hpp b/include/spirv-tools/instrument.hpp
index 01c7c6d1..9711b929 100644
--- a/include/spirv-tools/instrument.hpp
+++ b/include/spirv-tools/instrument.hpp
@@ -110,6 +110,16 @@ static const int kInstValidationOutError = kInstStageOutCnt;
// about the validation error.
//
// A bindless bounds error will output the index and the bound.
+static const int kInstBindlessBoundsOutDescIndex = kInstStageOutCnt + 1;
+static const int kInstBindlessBoundsOutDescBound = kInstStageOutCnt + 2;
+static const int kInstBindlessBoundsOutCnt = kInstStageOutCnt + 3;
+
+// A bindless uninitialized error will output the index.
+static const int kInstBindlessUninitOutDescIndex = kInstStageOutCnt + 1;
+static const int kInstBindlessUninitOutUnused = kInstStageOutCnt + 2;
+static const int kInstBindlessUninitOutCnt = kInstStageOutCnt + 3;
+
+// DEPRECATED
static const int kInstBindlessOutDescIndex = kInstStageOutCnt + 1;
static const int kInstBindlessOutDescBound = kInstStageOutCnt + 2;
static const int kInstBindlessOutCnt = kInstStageOutCnt + 3;
@@ -121,6 +131,7 @@ static const int kInstMaxOutCnt = kInstStageOutCnt + 3;
//
// These are the possible validation error codes.
static const int kInstErrorBindlessBounds = 0;
+static const int kInstErrorBindlessUninit = 1;
// Direct Input Buffer Offsets
//
@@ -141,11 +152,8 @@ static const int kDebugInputDataOffset = 0;
// and possibly other future validations.
static const int kDebugOutputBindingStream = 0;
-// The binding for the input buffer for InstBindlessCheckPass. The input
-// buffer needs only be created if the shaders being validated contain a
-// descriptor array of runtime size, and validation of runtime size descriptor
-// arrays have been enabled at the time of the bindless validation pass
-// creation.
+// The binding for the input buffer read by InstBindlessCheckPass and
+// possibly other future validations.
static const int kDebugInputBindingBindless = 1;
// Bindless Validation Input Buffer Format
@@ -153,11 +161,19 @@ static const int kDebugInputBindingBindless = 1;
// An input buffer for bindless validation consists of a single array of
// unsigned integers we will call Data[]. This array is formatted as follows.
//
-// At the beginning of the array is a single uint reserved for future use.
+// At offset kDebugInputBindlessInitOffset in Data[] is a single uint which
+// gives an offset to the start of the bindless initialization data. More
+// specifically, if the following value is zero, we know that the descriptor at
+// (set = s, binding = b, index = i) is not initialized:
+// Data[ i + Data[ b + Data[ s + Data[ kDebugInputBindlessInitOffset ] ] ] ]
+static const int kDebugInputBindlessInitOffset = 0;
+
+// DEPRECATED
static const int kDebugInputBindlessOffsetReserved = 0;
-// Following the reserved uint is some number of uints such that the following
-// is true: the number of descriptors at (set=s, binding=b) is:
+// At offset kDebugInputBindlessOffsetLengths is some number of uints which
+// provide the bindless length data. More specifically, the number of
+// descriptors at (set=s, binding=b) is:
// Data[ Data[ s + kDebugInputBindlessOffsetLengths ] + b ]
static const int kDebugInputBindlessOffsetLengths = 1;