Replace fixed C arrays with wrapper class in public interface

* These map more naturally to python tuples and are easier to wrap in and out.
* We also tidy up the FloatVecVal etc and standardise the members of
  ShaderValue.
This commit is contained in:
baldurk committed 2020-12-09 18:16:08 +00:00
1 parent 580f96c8a1
commit 7ff7e0a71d
66 files changed
+1833 -1459

No files matched your search

+16 -17
View File
@@ -300,11 +300,10 @@ struct Sampler
bool operator==(const Sampler &o) const
{
return resourceId == o.resourceId && addressU == o.addressU && addressV == o.addressV &&
addressW == o.addressW && borderColor[0] == o.borderColor[0] &&
borderColor[1] == o.borderColor[1] && borderColor[2] == o.borderColor[2] &&
borderColor[3] == o.borderColor[3] && compareFunction == o.compareFunction &&
filter == o.filter && maxAnisotropy == o.maxAnisotropy && maxLOD == o.maxLOD &&
minLOD == o.minLOD && mipLODBias == o.mipLODBias;
addressW == o.addressW && borderColor == o.borderColor &&
compareFunction == o.compareFunction && filter == o.filter &&
maxAnisotropy == o.maxAnisotropy && maxLOD == o.maxLOD && minLOD == o.minLOD &&
mipLODBias == o.mipLODBias;
}
bool operator<(const Sampler &o) const
{
@@ -316,14 +315,8 @@ struct Sampler
return addressV < o.addressV;
if(!(addressW == o.addressW))
return addressW < o.addressW;
if(!(borderColor[0] == o.borderColor[0]))
return borderColor[0] < o.borderColor[0];
if(!(borderColor[1] == o.borderColor[1]))
return borderColor[1] < o.borderColor[1];
if(!(borderColor[2] == o.borderColor[2]))
return borderColor[2] < o.borderColor[2];
if(!(borderColor[3] == o.borderColor[3]))
return borderColor[3] < o.borderColor[3];
if(!(borderColor == o.borderColor))
return borderColor < o.borderColor;
if(!(compareFunction == o.compareFunction))
return compareFunction < o.compareFunction;
if(!(filter == o.filter))
@@ -346,8 +339,11 @@ struct Sampler
AddressMode addressV = AddressMode::Wrap;
DOCUMENT("The :class:`AddressMode` in the W direction.");
AddressMode addressW = AddressMode::Wrap;
DOCUMENT("The RGBA border color.");
float borderColor[4] = {0.0f, 0.0f, 0.0f, 0.0f};
DOCUMENT(R"(The RGBA border color.
:type: Tuple[float,float,float,float]
)");
rdcfixedarray<float, 4> borderColor = {0.0f, 0.0f, 0.0f, 0.0f};
DOCUMENT("The :class:`CompareFunction` for comparison samplers.");
CompareFunction compareFunction = CompareFunction::AlwaysTrue;
DOCUMENT(R"(The filtering mode.
@@ -641,8 +637,11 @@ struct BlendState
)");
rdcarray<ColorBlend> blends;
DOCUMENT("The constant blend factor to use in blend equations.");
float blendFactor[4] = {1.0f, 1.0f, 1.0f, 1.0f};
DOCUMENT(R"(The constant blend factor to use in blend equations.
:type: Tuple[float,float,float,float]
)");
rdcfixedarray<float, 4> blendFactor = {1.0f, 1.0f, 1.0f, 1.0f};
DOCUMENT("The mask determining which samples are written to.");
uint32_t sampleMask = ~0U;
};
+16 -17
View File
@@ -315,11 +315,10 @@ struct Sampler
bool operator==(const Sampler &o) const
{
return bind == o.bind && tableIndex == o.tableIndex && addressU == o.addressU &&
addressV == o.addressV && addressW == o.addressW && borderColor[0] == o.borderColor[0] &&
borderColor[1] == o.borderColor[1] && borderColor[2] == o.borderColor[2] &&
borderColor[3] == o.borderColor[3] && compareFunction == o.compareFunction &&
filter == o.filter && maxAnisotropy == o.maxAnisotropy && maxLOD == o.maxLOD &&
minLOD == o.minLOD && mipLODBias == o.mipLODBias;
addressV == o.addressV && addressW == o.addressW && borderColor == o.borderColor &&
compareFunction == o.compareFunction && filter == o.filter &&
maxAnisotropy == o.maxAnisotropy && maxLOD == o.maxLOD && minLOD == o.minLOD &&
mipLODBias == o.mipLODBias;
}
bool operator<(const Sampler &o) const
{
@@ -333,14 +332,8 @@ struct Sampler
return addressV < o.addressV;
if(!(addressW == o.addressW))
return addressW < o.addressW;
if(!(borderColor[0] == o.borderColor[0]))
return borderColor[0] < o.borderColor[0];
if(!(borderColor[1] == o.borderColor[1]))
return borderColor[1] < o.borderColor[1];
if(!(borderColor[2] == o.borderColor[2]))
return borderColor[2] < o.borderColor[2];
if(!(borderColor[3] == o.borderColor[3]))
return borderColor[3] < o.borderColor[3];
if(!(borderColor == o.borderColor))
return borderColor < o.borderColor;
if(!(compareFunction == o.compareFunction))
return compareFunction < o.compareFunction;
if(!(filter == o.filter))
@@ -366,8 +359,11 @@ struct Sampler
AddressMode addressV = AddressMode::Wrap;
DOCUMENT("The :class:`AddressMode` in the W direction.");
AddressMode addressW = AddressMode::Wrap;
DOCUMENT("The RGBA border color.");
float borderColor[4] = {0.0f, 0.0f, 0.0f, 0.0f};
DOCUMENT(R"(The RGBA border color.
:type: Tuple[float,float,float,float]
)");
rdcfixedarray<float, 4> borderColor = {0.0f, 0.0f, 0.0f, 0.0f};
DOCUMENT("The :class:`CompareFunction` for comparison samplers.");
CompareFunction compareFunction = CompareFunction::AlwaysTrue;
DOCUMENT(R"(The filtering mode.
@@ -721,8 +717,11 @@ struct BlendState
)");
rdcarray<ColorBlend> blends;
DOCUMENT("The constant blend factor to use in blend equations.");
float blendFactor[4] = {1.0f, 1.0f, 1.0f, 1.0f};
DOCUMENT(R"(The constant blend factor to use in blend equations.
:type: Tuple[float,float,float,float]
)");
rdcfixedarray<float, 4> blendFactor = {1.0f, 1.0f, 1.0f, 1.0f};
};
DOCUMENT("Describes the current state of the output-merger stage of the D3D12 pipeline.");
+47 -25
View File
@@ -1522,7 +1522,7 @@ struct DrawcallDescription
eventId = 0;
drawcallId = 0;
flags = DrawFlags::NoFlags;
markerColor[0] = markerColor[1] = markerColor[2] = markerColor[3] = 0.0f;
markerColor = FloatVector();
numIndices = 0;
numInstances = 0;
indexOffset = 0;
@@ -1565,8 +1565,11 @@ struct DrawcallDescription
DOCUMENT("A set of :class:`DrawFlags` properties describing what kind of drawcall this is.");
DrawFlags flags;
DOCUMENT("A RGBA color specified by a debug marker call.");
float markerColor[4];
DOCUMENT(R"(A RGBA color specified by a debug marker call.
:type: FloatVector
)");
FloatVector markerColor;
DOCUMENT("The number of indices or vertices as appropriate for the drawcall. 0 if not used.");
uint32_t numIndices;
@@ -1593,14 +1596,23 @@ struct DrawcallDescription
)");
uint32_t drawIndex;
DOCUMENT("The 3D number of workgroups to dispatch in a dispatch call.");
uint32_t dispatchDimension[3];
DOCUMENT(R"(The 3D number of workgroups to dispatch in a dispatch call.
DOCUMENT("The 3D size of each workgroup in threads if the call allows an override, or 0 if not.");
uint32_t dispatchThreadsDimension[3];
:type: Tuple[int,int,int]
)");
rdcfixedarray<uint32_t, 3> dispatchDimension;
DOCUMENT("The 3D base offset of the workgroup ID if the call allows an override, or 0 if not.");
uint32_t dispatchBase[3];
DOCUMENT(R"(The 3D size of each workgroup in threads if the call allows an override, or 0 if not.
:type: Tuple[int,int,int]
)");
rdcfixedarray<uint32_t, 3> dispatchThreadsDimension;
DOCUMENT(R"(The 3D base offset of the workgroup ID if the call allows an override, or 0 if not.
:type: Tuple[int,int,int]
)");
rdcfixedarray<uint32_t, 3> dispatchBase;
DOCUMENT(R"(The width in bytes of each index.
@@ -1651,10 +1663,12 @@ frame.
)");
const DrawcallDescription *next;
DOCUMENT(R"(A simple list of the :class:`ResourceId` ids for the color outputs, which can be used
DOCUMENT(R"(An 8-tuple of the :class:`ResourceId` ids for the color outputs, which can be used
for very coarse bucketing of drawcalls into similar passes by their outputs.
:type: Tuple[ResourceId,...]
)");
ResourceId outputs[8];
rdcfixedarray<ResourceId, 8> outputs;
DOCUMENT("The resource used for depth output - see :data:`outputs`.");
ResourceId depthOut;
@@ -1759,15 +1773,14 @@ struct Uuid
Uuid &operator=(const Uuid &) = default;
DOCUMENT("Compares two ``Uuid`` objects for less-than.");
bool operator<(const Uuid &rhs) const
{
return std::lexicographical_compare(words, words + 4, rhs.words, rhs.words + 4);
}
bool operator<(const Uuid &rhs) const { return words < rhs.words; }
DOCUMENT("Compares two ``Uuid`` objects for equality.");
bool operator==(const Uuid &rhs) const { return ::memcmp(words, rhs.words, sizeof(words)) == 0; }
DOCUMENT("The Uuid bytes as an array of four 32-bit integers.")
uint32_t words[4];
bool operator==(const Uuid &rhs) const { return words == rhs.words; }
DOCUMENT(R"(The Uuid bytes as a tuple of four 32-bit integers.
:type: Tuple[int,int,int,int]
)")
rdcfixedarray<uint32_t, 4> words;
};
DECLARE_REFLECTION_STRUCT(Uuid);
@@ -1922,12 +1935,21 @@ DECLARE_REFLECTION_STRUCT(CounterResult);
DOCUMENT("The contents of an RGBA pixel.");
union PixelValue
{
DOCUMENT("The RGBA value interpreted as ``float``.");
float floatValue[4];
DOCUMENT("The RGBA value interpreted as 32-bit unsigned integer.");
uint32_t uintValue[4];
DOCUMENT("The RGBA value interpreted as 32-bit signed integer.");
int32_t intValue[4];
DOCUMENT(R"(The RGBA value interpreted as ``float``.
:type: Tuple[float, float, float, float]
)");
rdcfixedarray<float, 4> floatValue;
DOCUMENT(R"(The RGBA value interpreted as 32-bit unsigned integer.
:type: Tuple[int, int, int, int]
)");
rdcfixedarray<uint32_t, 4> uintValue;
DOCUMENT(R"(The RGBA value interpreted as 32-bit signed integer.
:type: Tuple[int, int, int, int]
)");
rdcfixedarray<int32_t, 4> intValue;
};
DECLARE_REFLECTION_STRUCT(PixelValue);
+48 -32
View File
@@ -215,15 +215,24 @@ struct FixedVertexProcessing
FixedVertexProcessing(const FixedVertexProcessing &) = default;
FixedVertexProcessing &operator=(const FixedVertexProcessing &) = default;
DOCUMENT("A list of ``float`` giving the default inner level of tessellation.");
float defaultInnerLevel[2] = {0.0f, 0.0f};
DOCUMENT("A list of ``float`` giving the default outer level of tessellation.");
float defaultOuterLevel[4] = {0.0f, 0.0f, 0.0f, 0.0f};
DOCUMENT(R"(A tuple of ``float`` giving the default inner level of tessellation.
:type: Tuple[float,float]
)");
rdcfixedarray<float, 2> defaultInnerLevel = {0.0f, 0.0f};
DOCUMENT(R"(A tuple of ``float`` giving the default outer level of tessellation.
:type: Tuple[float,float,float,float]
)");
rdcfixedarray<float, 4> defaultOuterLevel = {0.0f, 0.0f, 0.0f, 0.0f};
DOCUMENT("``True`` if primitives should be discarded during rasterization.");
bool discard = false;
DOCUMENT("A list of ``bool`` determining which user clipping planes are enabled.");
bool clipPlanes[8] = {false, false, false, false, false, false, false, false};
DOCUMENT(R"(An 8-tuple of ``bool`` determining which user clipping planes are enabled.
:type: Tuple[bool,...]
)");
rdcfixedarray<bool, 8> clipPlanes = {false, false, false, false, false, false, false, false};
DOCUMENT(R"(``True`` if the clipping origin should be in the lower left.
``False`` if it's in the upper left.
@@ -306,12 +315,10 @@ struct Sampler
bool operator==(const Sampler &o) const
{
return resourceId == o.resourceId && addressS == o.addressS && addressT == o.addressT &&
addressR == o.addressR && borderColor[0] == o.borderColor[0] &&
borderColor[1] == o.borderColor[1] && borderColor[2] == o.borderColor[2] &&
borderColor[3] == o.borderColor[3] && compareFunction == o.compareFunction &&
filter == o.filter && seamlessCubeMap == o.seamlessCubeMap &&
maxAnisotropy == o.maxAnisotropy && maxLOD == o.maxLOD && minLOD == o.minLOD &&
mipLODBias == o.mipLODBias;
addressR == o.addressR && borderColor == o.borderColor &&
compareFunction == o.compareFunction && filter == o.filter &&
seamlessCubeMap == o.seamlessCubeMap && maxAnisotropy == o.maxAnisotropy &&
maxLOD == o.maxLOD && minLOD == o.minLOD && mipLODBias == o.mipLODBias;
}
bool operator<(const Sampler &o) const
{
@@ -323,14 +330,8 @@ struct Sampler
return addressT < o.addressT;
if(!(addressR == o.addressR))
return addressR < o.addressR;
if(!(borderColor[0] == o.borderColor[0]))
return borderColor[0] < o.borderColor[0];
if(!(borderColor[1] == o.borderColor[1]))
return borderColor[1] < o.borderColor[1];
if(!(borderColor[2] == o.borderColor[2]))
return borderColor[2] < o.borderColor[2];
if(!(borderColor[3] == o.borderColor[3]))
return borderColor[3] < o.borderColor[3];
if(!(borderColor == o.borderColor))
return borderColor < o.borderColor;
if(!(compareFunction == o.compareFunction))
return compareFunction < o.compareFunction;
if(!(filter == o.filter))
@@ -355,8 +356,11 @@ struct Sampler
AddressMode addressT = AddressMode::Wrap;
DOCUMENT("The :class:`AddressMode` in the R direction.");
AddressMode addressR = AddressMode::Wrap;
DOCUMENT("The RGBA border color.");
float borderColor[4] = {0.0f, 0.0f, 0.0f, 0.0f};
DOCUMENT(R"(The RGBA border color.
:type: Tuple[float,float,float,float]
)");
rdcfixedarray<float, 4> borderColor = {0.0f, 0.0f, 0.0f, 0.0f};
DOCUMENT("The :class:`CompareFunction` for comparison samplers.");
CompareFunction compareFunction = CompareFunction::AlwaysTrue;
DOCUMENT(R"(The filtering mode.
@@ -484,12 +488,21 @@ struct Feedback
DOCUMENT("The :class:`ResourceId` of the transform feedback binding.");
ResourceId feedbackResourceId;
DOCUMENT("A list of :class:`ResourceId` with the buffer bindings.");
ResourceId bufferResourceId[4];
DOCUMENT("A list of ``int`` with the buffer byte offsets.");
uint64_t byteOffset[4] = {0, 0, 0, 0};
DOCUMENT("A list of ``int`` with the buffer byte sizes.");
uint64_t byteSize[4] = {0, 0, 0, 0};
DOCUMENT(R"(The buffer bindings.
:type: Tuple[ResourceId,ResourceId,ResourceId,ResourceId]
)");
rdcfixedarray<ResourceId, 4> bufferResourceId;
DOCUMENT(R"(The buffer byte offsets.
:type: Tuple[int,int,int,int]
)");
rdcfixedarray<uint64_t, 4> byteOffset = {0, 0, 0, 0};
DOCUMENT(R"(The buffer byte sizes.
:type: Tuple[int,int,int,int]
)");
rdcfixedarray<uint64_t, 4> byteSize = {0, 0, 0, 0};
DOCUMENT("``True`` if the transform feedback object is currently active.");
bool active = false;
DOCUMENT("``True`` if the transform feedback object is currently paused.");
@@ -724,8 +737,11 @@ struct BlendState
)");
rdcarray<ColorBlend> blends;
DOCUMENT("The constant blend factor to use in blend equations.");
float blendFactor[4] = {1.0f, 1.0f, 1.0f, 1.0f};
DOCUMENT(R"(The constant blend factor to use in blend equations.
:type: Tuple[float,float,float,float]
)");
rdcfixedarray<float, 4> blendFactor = {1.0f, 1.0f, 1.0f, 1.0f};
};
DOCUMENT("Describes the current state of the framebuffer stage of the pipeline.");
@@ -805,8 +821,8 @@ struct State
DOCUMENT(R"(The tessellation control shader stage.
:type: GLShader
)");
:type: GLShader
)");
Shader tessControlShader;
DOCUMENT(R"(The tessellation evaluation shader stage.
+101 -4
View File
@@ -45,7 +45,7 @@ struct ItemHelper
new(first + i) T();
}
static bool equalRange(T *a, T *b, size_t count)
static bool equalRange(const T *a, const T *b, size_t count)
{
for(size_t i = 0; i < count; i++)
if(!(a[i] == b[i]))
@@ -54,7 +54,7 @@ struct ItemHelper
return true;
}
static bool lessthanRange(T *a, T *b, size_t count)
static bool lessthanRange(const T *a, const T *b, size_t count)
{
for(size_t i = 0; i < count; i++)
if(a[i] < b[i])
@@ -68,8 +68,11 @@ template <typename T>
struct ItemHelper<T, true>
{
static void initRange(T *first, size_t itemCount) { memset(first, 0, itemCount * sizeof(T)); }
static bool equalRange(T *a, T *b, size_t count) { return !memcmp(a, b, count * sizeof(T)); }
static bool lessthanRange(T *a, T *b, size_t count)
static bool equalRange(const T *a, const T *b, size_t count)
{
return !memcmp(a, b, count * sizeof(T));
}
static bool lessthanRange(const T *a, const T *b, size_t count)
{
return memcmp(a, b, count * sizeof(T)) < 0;
}
@@ -815,6 +818,100 @@ public:
#endif
};
// fixed size array, wrapped to be more python-friendly (mapped to an N-tuple)
template <typename T, size_t N>
struct rdcfixedarray
{
public:
/////////////////////////////////////////////////////////////////
// simple accessors
T &operator[](size_t i) { return elems[i]; }
const T &operator[](size_t i) const { return elems[i]; }
bool operator==(const rdcfixedarray<T, N> &o) const
{
return ItemHelper<T>::equalRange(elems, o.elems, N);
}
bool operator!=(const rdcfixedarray<T, N> &o) const { return !(*this == o); }
bool operator<(const rdcfixedarray<T, N> &o) const
{
return ItemHelper<T>::lessthanRange(elems, o.elems, N);
}
T *data() { return elems; }
const T *data() const { return elems; }
T *begin() { return elems; }
T *end() { return elems + N; }
T &front() { return *elems; }
T &back() { return *(elems + N - 1); }
T &at(size_t idx) { return elems[idx]; }
const T *begin() const { return elems; }
const T *end() const { return elems + N; }
const T &front() const { return *elems; }
const T &back() const { return *(elems + N - 1); }
const T &at(size_t idx) const { return elems[idx]; }
size_t size() const { return N; }
size_t byteSize() const { return N * sizeof(T); }
int32_t count() const { return (int32_t)N; }
// find the first occurrence of an element
int32_t indexOf(const T &el, size_t first = 0, size_t last = ~0U) const
{
for(size_t i = first; i < N && i < last; i++)
{
if(elems[i] == el)
return (int32_t)i;
}
return -1;
}
// return true if an element is found
bool contains(const T &el) const { return indexOf(el) != -1; }
rdcfixedarray<T, N> &operator=(const std::initializer_list<T> &in)
{
size_t i = 0;
for(const T &t : in)
{
elems[i] = t;
i++;
if(i >= N)
break;
}
return *this;
}
rdcfixedarray<T, N> &operator=(const T (&in)[N])
{
for(size_t i = 0; i < N; i++)
elems[i] = in[i];
return *this;
}
rdcfixedarray() = default;
rdcfixedarray(const std::initializer_list<T> &in)
{
static_assert(std::is_trivial<T>::value,
"rdcfixedarray should only be used with POD types like float or uint32_t.");
// consume all available in the initializer_list, up to N
size_t i = 0;
for(const T &t : in)
{
elems[i] = t;
i++;
if(i >= N)
break;
}
// default-initialise any others
for(; i < N; i++)
elems[i] = T();
}
private:
T elems[N];
};
typedef uint8_t byte;
struct bytebuf : public rdcarray<byte>
+1 -1
View File
@@ -576,7 +576,7 @@ public:
char &front()
{
ensure_mutable();
return data()[0];
return *data();
}
char back() const { return *(end() - 1); }
char &back()
+63 -125
View File
@@ -33,78 +33,6 @@
#include "resourceid.h"
#include "stringise.h"
DOCUMENT("A ``float`` 4 component vector.")
struct FloatVecVal
{
DOCUMENT("");
FloatVecVal() = default;
FloatVecVal(const FloatVecVal &) = default;
FloatVecVal &operator=(const FloatVecVal &) = default;
DOCUMENT("The x component.");
float x;
DOCUMENT("The y component.");
float y;
DOCUMENT("The z component.");
float z;
DOCUMENT("The w component.");
float w;
};
DOCUMENT("A ``double`` 4 component vector.")
struct DoubleVecVal
{
DOCUMENT("");
DoubleVecVal() = default;
DoubleVecVal(const DoubleVecVal &) = default;
DoubleVecVal &operator=(const DoubleVecVal &) = default;
DOCUMENT("The x component.");
double x;
DOCUMENT("The y component.");
double y;
DOCUMENT("The z component.");
double z;
DOCUMENT("The w component.");
double w;
};
DOCUMENT("A 32-bit signed ``int`` 4 component vector.")
struct IntVecVal
{
DOCUMENT("");
IntVecVal() = default;
IntVecVal(const IntVecVal &) = default;
IntVecVal &operator=(const IntVecVal &) = default;
DOCUMENT("The x component.");
int32_t x;
DOCUMENT("The y component.");
int32_t y;
DOCUMENT("The z component.");
int32_t z;
DOCUMENT("The w component.");
int32_t w;
};
DOCUMENT("A 32-bit unsigned ``int`` 4 component vector.")
struct UIntVecVal
{
DOCUMENT("");
UIntVecVal() = default;
UIntVecVal(const UIntVecVal &) = default;
UIntVecVal &operator=(const UIntVecVal &) = default;
DOCUMENT("The x component.");
uint32_t x;
DOCUMENT("The y component.");
uint32_t y;
DOCUMENT("The z component.");
uint32_t z;
DOCUMENT("The w component.");
uint32_t w;
};
DOCUMENT("A 64-bit pointer value with optional type information.")
struct PointerVal
{
@@ -184,58 +112,65 @@ DECLARE_REFLECTION_STRUCT(BindpointIndex);
DOCUMENT("A C union that holds 16 values, with each different basic variable type.");
union ShaderValue
{
DOCUMENT(R"(A convenient subset of :data:`fv` as a named 4 component vector.
DOCUMENT(R"(16-tuple of ``float`` values.
:type: FloatVecVal
:type: Tuple[float,...]
)");
FloatVecVal f;
rdcfixedarray<float, 16> f32v;
DOCUMENT("16-tuple of ``float`` values.");
float fv[16];
DOCUMENT(R"(16-tuple of 32-bit signed integer values.
DOCUMENT(R"(A convenient subset of :data:`iv` as a named 4 component vector.
:type: IntVecVal
:type: Tuple[int,...]
)");
IntVecVal i;
rdcfixedarray<int32_t, 16> s32v;
DOCUMENT("16-tuple of 32-bit signed integer values.");
int32_t iv[16];
DOCUMENT(R"(16-tuple of 32-bit unsigned integer values.
DOCUMENT(R"(A convenient subset of :data:`uv` as a named 4 component vector.
:type: UIntVecVal
:type: Tuple[int,...]
)");
UIntVecVal u;
rdcfixedarray<uint32_t, 16> u32v;
DOCUMENT("16-tuple of 32-bit unsigned integer values.");
uint32_t uv[16];
DOCUMENT(R"(16-tuple of ``double`` values.
DOCUMENT(R"(A convenient subset of :data:`dv` as a named 4 component vector.
:type: DoubleVecVal
:type: Tuple[float,...]
)");
DoubleVecVal d;
DOCUMENT("16-tuple of ``double`` values.");
double dv[16];
rdcfixedarray<double, 16> f64v;
DOCUMENT("16-tuple of 64-bit unsigned integer values.");
uint64_t u64v[16];
DOCUMENT(R"(16-tuple of 64-bit unsigned integer values.
DOCUMENT("16-tuple of 64-bit signed integer values.");
int64_t s64v[16];
:type: Tuple[int,...]
)");
rdcfixedarray<uint64_t, 16> u64v;
DOCUMENT("16-tuple of 16-bit unsigned integer values.");
uint16_t u16v[16];
DOCUMENT(R"(16-tuple of 64-bit signed integer values.
DOCUMENT("16-tuple of 16-bit signed integer values.");
int16_t s16v[16];
:type: Tuple[int,...]
)");
rdcfixedarray<int64_t, 16> s64v;
DOCUMENT("16-tuple of 8-bit unsigned integer values.");
uint8_t u8v[16];
DOCUMENT(R"(16-tuple of 16-bit unsigned integer values.
DOCUMENT("16-tuple of 8-bit signed integer values.");
int8_t s8v[16];
:type: Tuple[int,...]
)");
rdcfixedarray<uint16_t, 16> u16v;
DOCUMENT(R"(16-tuple of 16-bit signed integer values.
:type: Tuple[int,...]
)");
rdcfixedarray<int16_t, 16> s16v;
DOCUMENT(R"(16-tuple of 8-bit unsigned integer values.
:type: Tuple[int,...]
)");
rdcfixedarray<uint8_t, 16> u8v;
DOCUMENT(R"(16-tuple of 8-bit signed integer values.
:type: Tuple[int,...]
)");
rdcfixedarray<int8_t, 16> s8v;
};
DOCUMENT(R"(Holds a single named shader variable. It contains either a primitive type (up to a 4x4
@@ -266,10 +201,10 @@ struct ShaderVariable
displayAsHex = isStruct = rowMajor = false;
memset(&value, 0, sizeof(value));
type = VarType::Float;
value.f.x = x;
value.f.y = y;
value.f.z = z;
value.f.w = w;
value.f32v[0] = x;
value.f32v[1] = y;
value.f32v[2] = z;
value.f32v[3] = w;
}
ShaderVariable(const rdcstr &n, int x, int y, int z, int w)
{
@@ -279,10 +214,10 @@ struct ShaderVariable
displayAsHex = isStruct = rowMajor = false;
memset(&value, 0, sizeof(value));
type = VarType::SInt;
value.i.x = x;
value.i.y = y;
value.i.z = z;
value.i.w = w;
value.s32v[0] = x;
value.s32v[1] = y;
value.s32v[2] = z;
value.s32v[3] = w;
}
ShaderVariable(const rdcstr &n, uint32_t x, uint32_t y, uint32_t z, uint32_t w)
{
@@ -292,10 +227,10 @@ struct ShaderVariable
displayAsHex = isStruct = rowMajor = false;
memset(&value, 0, sizeof(value));
type = VarType::UInt;
value.u.x = x;
value.u.y = y;
value.u.z = z;
value.u.w = w;
value.u32v[0] = x;
value.u32v[1] = y;
value.u32v[2] = z;
value.u32v[3] = w;
}
bool operator==(const ShaderVariable &o) const
{
@@ -412,9 +347,9 @@ binding is given by the :data:`type` member.
)");
inline void SetBinding(int32_t bindset, int32_t bind, uint32_t arrayIndex)
{
value.iv[0] = bindset;
value.iv[1] = bind;
value.uv[2] = arrayIndex;
value.s32v[0] = bindset;
value.s32v[1] = bind;
value.u32v[2] = arrayIndex;
}
DOCUMENT(R"(Utility function for getting the bindpoint referenced by this variable.
@@ -428,7 +363,7 @@ binding is given by the :data:`type` member.
)");
inline BindpointIndex GetBinding() const
{
return BindpointIndex(value.iv[0], value.iv[1], value.uv[2]);
return BindpointIndex(value.s32v[0], value.s32v[1], value.u32v[2]);
}
};
@@ -1403,8 +1338,11 @@ struct ShaderReflection
)");
bytebuf rawBytes;
DOCUMENT("The 3D dimensions of a compute workgroup, for compute shaders.");
uint32_t dispatchThreadsDimension[3];
DOCUMENT(R"(The 3D dimensions of a compute workgroup, for compute shaders.
:type: Tuple[int,int,int]
)");
rdcfixedarray<uint32_t, 3> dispatchThreadsDimension;
DOCUMENT(R"(The input signature.
+13 -15
View File
@@ -47,9 +47,7 @@ struct BindingElement
addressU == o.addressU && addressV == o.addressV && addressW == o.addressW &&
mipBias == o.mipBias && maxAnisotropy == o.maxAnisotropy &&
compareFunction == o.compareFunction && minLOD == o.minLOD && maxLOD == o.maxLOD &&
borderColor[0] == o.borderColor[0] && borderColor[1] == o.borderColor[1] &&
borderColor[2] == o.borderColor[2] && borderColor[3] == o.borderColor[3] &&
unnormalized == o.unnormalized;
borderColor == o.borderColor && unnormalized == o.unnormalized;
}
bool operator<(const BindingElement &o) const
{
@@ -99,14 +97,8 @@ struct BindingElement
return minLOD < o.minLOD;
if(!(maxLOD == o.maxLOD))
return maxLOD < o.maxLOD;
if(!(borderColor[0] == o.borderColor[0]))
return borderColor[0] < o.borderColor[0];
if(!(borderColor[1] == o.borderColor[1]))
return borderColor[1] < o.borderColor[1];
if(!(borderColor[2] == o.borderColor[2]))
return borderColor[2] < o.borderColor[2];
if(!(borderColor[3] == o.borderColor[3]))
return borderColor[3] < o.borderColor[3];
if(!(borderColor == o.borderColor))
return borderColor < o.borderColor;
if(!(unnormalized == o.unnormalized))
return unnormalized < o.unnormalized;
return false;
@@ -178,8 +170,11 @@ since single descriptors may only be dynamically skipped by control flow.
float minLOD = 0.0f;
DOCUMENT("For samplers - the maximum mip level that can be used.");
float maxLOD = 0.0f;
DOCUMENT("For samplers - the RGBA border color.");
float borderColor[4];
DOCUMENT(R"(For samplers - the RGBA border color.
:type: Tuple[float,float,float,float]
)");
rdcfixedarray<float, 4> borderColor = {0.0f, 0.0f, 0.0f, 0.0f};
DOCUMENT("For samplers - ``True`` if unnormalized co-ordinates are used in this sampler.");
bool unnormalized = false;
@@ -879,8 +874,11 @@ struct ColorBlendState
)");
rdcarray<ColorBlend> blends;
DOCUMENT("The constant blend factor to use in blend equations.");
float blendFactor[4] = {1.0f, 1.0f, 1.0f, 1.0f};
DOCUMENT(R"(The constant blend factor to use in blend equations.
:type: Tuple[float,float,float,float]
)");
rdcfixedarray<float, 4> blendFactor = {1.0f, 1.0f, 1.0f, 1.0f};
};
DOCUMENT("Describes the pipeline depth-stencil state.");