Add some new shader builtins

This commit is contained in:
baldurk
2020-01-10 11:22:20 +00:00
parent cb0e8958b1
commit 0b9a4b0100
3 changed files with 107 additions and 0 deletions
+15
View File
@@ -621,6 +621,21 @@ rdcstr DoStringise(const ShaderBuiltin &el)
STRINGISE_ENUM_CLASS_NAMED(DepthOutputGreaterEqual, "Depth Output (GEqual)");
STRINGISE_ENUM_CLASS_NAMED(DepthOutputLessEqual, "Depth Output (LEqual)");
STRINGISE_ENUM_CLASS_NAMED(StencilReference, "Stencil Ref Value");
STRINGISE_ENUM_CLASS_NAMED(PointCoord, "Point Co-ord");
STRINGISE_ENUM_CLASS_NAMED(IsHelper, "Is Helper");
STRINGISE_ENUM_CLASS_NAMED(SubgroupSize, "Subgroup Size");
STRINGISE_ENUM_CLASS_NAMED(NumSubgroups, "Num Subgroups");
STRINGISE_ENUM_CLASS_NAMED(SubgroupIndexInWorkgroup, "Subgroup Index in Workgroup");
STRINGISE_ENUM_CLASS_NAMED(IndexInSubgroup, "Index in Subgroup");
STRINGISE_ENUM_CLASS_NAMED(SubgroupEqualMask, "Subgroup Equal Mask");
STRINGISE_ENUM_CLASS_NAMED(SubgroupGreaterEqualMask, "Subgroup Greater-Equal Mask");
STRINGISE_ENUM_CLASS_NAMED(SubgroupGreaterMask, "Subgroup Greater Mask");
STRINGISE_ENUM_CLASS_NAMED(SubgroupLessEqualMask, "Subgroup Less-Equal Mask");
STRINGISE_ENUM_CLASS_NAMED(SubgroupLessMask, "Subgroup Less Mask");
STRINGISE_ENUM_CLASS_NAMED(DeviceIndex, "Device Index");
STRINGISE_ENUM_CLASS_NAMED(IsFullyCovered, "Is Fully Covered");
STRINGISE_ENUM_CLASS_NAMED(FragAreaSize, "Fragment Area Size");
STRINGISE_ENUM_CLASS_NAMED(FragInvocationCount, "Fragment Invocation Count");
}
END_ENUM_STRINGISE();
}
+77
View File
@@ -865,7 +865,69 @@ to apply to multiple related things - see :data:`ClipDistance`, :data:`CullDista
.. data:: StencilReference
The stencil reference to be used for stenciling operations on this fragment.
.. data:: PointCoord
The fragments co-ordinates within a point primitive being rasterized.
.. data:: IsHelper
Indicates if the current invocation is a helper invocation.
.. data:: SubgroupSize
The number of invocations in a subgroup.
.. data:: NumSubgroups
The number of subgroups in the local workgroup.
.. data:: SubgroupIndexInWorkgroup
The index of the current subgroup within all subgroups in the workgroup, up to
:data:`NumSubgroups` - 1.
.. data:: IndexInSubgroup
The index of the current thread in the current subgroup, up to :data:`SubgroupSize` - 1.
.. data:: SubgroupEqualMask
A bitmask where the bit corresponding to :data:`IndexInSubgroup` is set.
.. data:: SubgroupGreaterEqualMask
A bitmask where all bits greater or equal to the one corresponding to :data:`IndexInSubgroup` are
set.
.. data:: SubgroupGreaterMask
A bitmask where all bits greater than the one corresponding to :data:`IndexInSubgroup` are set.
.. data:: SubgroupLessEqualMask
A bitmask where all bits less or equal to the one corresponding to :data:`IndexInSubgroup` are
set.
.. data:: SubgroupLessMask
A bitmask where all bits less than the one corresponding to :data:`IndexInSubgroup` are set.
.. data:: DeviceIndex
The device index executing the shader, relative to the current device group.
.. data:: IsFullyCovered
Indicates if the current fragment area is fully covered by the generating primitive.
.. data:: FragAreaSize
Gives the dimensions of the area that the fragment covers.
.. data:: FragInvocationCount
Gives the maximum number of invocations for the fragment being covered.
)");
enum class ShaderBuiltin : uint32_t
{
@@ -903,6 +965,21 @@ enum class ShaderBuiltin : uint32_t
BaseInstance,
DrawIndex,
StencilReference,
PointCoord,
IsHelper,
SubgroupSize,
NumSubgroups,
SubgroupIndexInWorkgroup,
IndexInSubgroup,
SubgroupEqualMask,
SubgroupGreaterEqualMask,
SubgroupGreaterMask,
SubgroupLessEqualMask,
SubgroupLessMask,
DeviceIndex,
IsFullyCovered,
FragAreaSize,
FragInvocationCount,
Count,
};
@@ -272,6 +272,21 @@ ShaderBuiltin MakeShaderBuiltin(ShaderStage stage, const rdcspv::BuiltIn el)
case rdcspv::BuiltIn::LocalInvocationIndex: return ShaderBuiltin::GroupFlatIndex;
case rdcspv::BuiltIn::LocalInvocationId: return ShaderBuiltin::GroupThreadIndex;
case rdcspv::BuiltIn::TessCoord: return ShaderBuiltin::DomainLocation;
case rdcspv::BuiltIn::PointCoord: return ShaderBuiltin::PointCoord;
case rdcspv::BuiltIn::HelperInvocation: return ShaderBuiltin::IsHelper;
case rdcspv::BuiltIn::SubgroupSize: return ShaderBuiltin::SubgroupSize;
case rdcspv::BuiltIn::NumSubgroups: return ShaderBuiltin::NumSubgroups;
case rdcspv::BuiltIn::SubgroupId: return ShaderBuiltin::SubgroupIndexInWorkgroup;
case rdcspv::BuiltIn::SubgroupLocalInvocationId: return ShaderBuiltin::IndexInSubgroup;
case rdcspv::BuiltIn::SubgroupEqMask: return ShaderBuiltin::SubgroupEqualMask;
case rdcspv::BuiltIn::SubgroupGeMask: return ShaderBuiltin::SubgroupGreaterEqualMask;
case rdcspv::BuiltIn::SubgroupGtMask: return ShaderBuiltin::SubgroupGreaterMask;
case rdcspv::BuiltIn::SubgroupLeMask: return ShaderBuiltin::SubgroupLessEqualMask;
case rdcspv::BuiltIn::SubgroupLtMask: return ShaderBuiltin::SubgroupLessMask;
case rdcspv::BuiltIn::DeviceIndex: return ShaderBuiltin::DeviceIndex;
case rdcspv::BuiltIn::FullyCoveredEXT: return ShaderBuiltin::IsFullyCovered;
case rdcspv::BuiltIn::FragSizeEXT: return ShaderBuiltin::FragAreaSize;
case rdcspv::BuiltIn::FragInvocationCountEXT: return ShaderBuiltin::FragInvocationCount;
default: break;
}