16 KiB
VkScript
The VkScript format is a clone of the format used by VkRunner as described in [1].
General
Comments
The # symbol can be used to start a comment which extends to the end of the line.
Continuations
The \ can be used at the end of a line to signal a continuation, the new line will be skipped and parsing will treat the following line as a continuation of the current line.
Descriptor Sets and Bindings
Any command below which accepts a binding will accept either a single integer
value which will have a descriptor set of 0 and a binding of the value give or
a string can be provided of the form set integer:binding integer in which
case the descriptor set value will be set and the binding value will be
binding.
Sections
The format is broken down into five main sections:
requireshadersindicesvertex datatest
Require
The require section lists all of the requirements for the testing environment.
There are four types of information that can be encoded in the require section.
The feature list contains a list of features that are required in order for the test to execute. If a feature is missing an error will be reported and the test will fail. The features are listed below in the Available Require Features section.
The framebuffer and depthstencil commands allow setting the format for the given buffer. The valid values are listed below in the Image Formats section.
The fbsize command allows setting the width and height of the framebuffer.
The fence_timeout option allows setting an integer number of milliseconds for any fence timeouts.
The last option is extensions. Any string which isn't listed above is assumed to be an extension. The extensions must be of the format [a-zA-Z0-9_]+. If the device extension is not available we will report it is not available and the test will continue.
Require Examples
[require]
independentBlend
VK_KHR_storage_buffer_storage_class
Shaders
The shader section allows you to specify the content of the shaders under test.
This can be done as GLSL, SPIRV-ASM or SPIRV-Hex depending on how the shader is
formatted. There is also a special passthrough vertex shader which can be
used which just passes the vec4 input location 0 through to the gl_Position.
The shader format is specified in the header after the word shader. The
default is GLSL, SPIRV-ASM is specified as spirv and SPIRV-Hex as
spirv hex.
The shaders accepted are:
computefragmentgeometrytessellation controltessellation evaulationvertex
Shader examples
[fragment shader]
#version 430
layout(location = 0) out vec4 color_out;
void main() {
color_out = vec4(1, 2, 3, 4);
}
Other example shader header lines are:
[fragment shader spirv hex]-- a hex encoded SPIRV binary fragment shader[tessellation evaluation shader spirv]-- a spirv-asm tessellation evaluation shader[vertex shader passthrough]
Vertex Data
The vertex data section provides vertex attributes and data for draw array
commands. The data is formated with a header row followed by data rows.
The headers can be provided in one of two forms. The first,
attribute_location/format where attribute_location is the location of the
attribute to be bound. The format is one of the Image Formats listed below.
The second, attribute_location/gl_type/glsl_type. The gl_type is one of
the types listed in the GL Types section below. The glsl_type is one listed
in the GLSL Types section below.
Vertex Data example
[vertex data]
0/R32G32B32_SFLOAT 1/R8G8B8_UNORM
-1 -1 0.25 255 0 0 # ending comment
# Another Row
0.25 -1 0.25 255 0 255
Indices
The indices section contains the list of indices to use along with the
provided vertex data. The indices are used if the indexed option is
provided to the draw arrays command. The indices themselves are a list of
integer indexes to use.
Indices Example
[indices]
# comment line
1 2 3 4 5 6
# another comment
7 8 9 10 11 12
Test
The test section contains a list of commands which can be executed to perform the actual testing. The commands range from setting up pipeline parameters, executing compute shaders and probing buffers to verify results.
Draw Rect
draw rect [ortho] [patch] _x_ _y_ _width_ _height_
The draw rect command draws a rectangle at the given coordinates. The vertices
are uploaded at location 0 as a vec3. The ortho modifier scales the
coordinates to be in the range of [-1,1] instead of [0,window size]. The patch
modifier sets the draw call to use a given topology. Accepted possible
topology value are listed in Topologies. The patch size will be set to 4.
Draw Arrays
draw arrays [indexed] [instanced] _topology_ _first_vertex_ _vertex_count_ [instance_count]
The draw arrays command uses data from the vertex data section when executing
the draw command. The topology is from the Topologies list. If the indexed
modifier is provided then the indices section data will be used as well.
Compute
compute _x_ _y_ _z_
Executes the compute shader with the given x, y, and z parameters.
Shader Entry Point
_stage_ entrypoint _name_
Sets the stage shader to use the entry point of name for subsequent
executions.
Probe all
probe all (rgb|rgba) _r_ _g_ _b_ [_a_]
Probes the entire window to verify all pixels are of color r,g,b and optionally
a. If rgba is specified then the a parameter is required. If rgb is
specified then the a parameter is dis-allowed.
Probe
[relative] probe [rect] (rgb|rgba) (_x_, _y_[, _width_, _height_]) (_r_, _g_, _b_[, _a_])
Probes a portion of the window to verify the pixes are of color r,g,b and
optionally a. If rgba is specifed then the a parameter is required. If
rgb is specified then the a parameter is dis-allowed. If rect is specified
then width and height are required. If rect is not specified then width
and height are dis-allowed and a value of 1 will be used for each parameter.
If the relative parameter is provided the coordinates are normalized to
be in the range [0.0, 1.0].
Probe SSBO
probe ssbo _type_ _binding_ _offset_ _comparison_ _values_+
Probes the value in the storage buffer at binding and offset within that
binding. The type is the data type to be probed as seen in the Data Types
section below.
The comparison operators are:
==(equal)!=(not equal)<(less than)- '>' (greater than)
<=(less or equal)>=(greater or equal)~=(fuzzy equal, for floating point comparisons usingtolerances)
The values provided must be a non-zero multiple of the type.
Uniform
uniform _type_ _offset _values_+
Sets the push constants at offset. The type is from the Data Types
section below. The values must be a non-zero multiple of the requested
type.
When setting push constant data each call to uniform must use the same
type or the script will be rejected as invalid.
Unifom UBO
uniform ubo _binding_ _type_ _offset_ _values_+
Sets the values in the uniform buffer at binding and offset. The type
is from the Data Types section below. The values must be a non-zero
multiple of the requested type.
When setting data into a single binding, each call to uniform ubo must
use the same type or the script will be rejected as invalid.
SSBO size
ssbo _binding_ _size_
Sets the number of elements in the SSBO at binding to size. The buffer will
be created with a default format of char. This default format will be
overridden by a call to ssbo subdata or probe ssbo.
SSBO subdata
ssbo _binding_ subdata _type_ _offset_ _values_+
Sets the value of the buffer at binding and offset. The type is from the
Data Types section below. The values must be a non-zero multiple of the
requested type. The offset must be a multiple of the type size in bytes.
When setting data into a single binding, each call to ssbo subdata must
use the same type or the script will be rejected as invalid.
Patch Parameters
patch parameter vertices _count_
Sets the number of control points for tessellation patches to count. Defaults
to 3.
Tolerance
tolerance tolerance0 [tolerance1 tolerance2 tolerance3]
The tolerance command sets the amount of fuzzyness used when using the ~=
comparator. If a single tolerance value is set it is used for every comparison.
If all four values are set then each vecN command will use the first N
tolerance values. Each column of a matMxN will also use the first N
tolerances. A tolerance maybe either a number or a percentage 0.01%.
Clear Color
clear color _r_ _g_ _b_ _a_
Sets the clear color. Defaults to (0, 0, 0, 0).
Clear Depth
clear depth _value_
Sets the depth clear value. The value is a float and defaults to 1.0.
Clear Stencil
clear stencil _value_
Sets the stencil clear value. The value is an integer and defaults to 0.
Clear
clear
Clears the framebuffer.
Pipeline Configuration
There are a number of pipeline flags which can be set to alter execution. Each draw call uses the pipeline configuration that was specified prior to the draw call.
The pipeline commands with their accepted data are:
primitiveRestartEnable <bool>depthClampEnable <bool>rasterizerDiscardEnable <bool>depthBiasEnable <bool>logicOpEnable <bool>blendEnable <bool>depthTestEnable <bool>depthWriteEnable <bool>depthBoundsTestEnable <bool>stencilTestEnable <bool>topology <VkPrimitiveTopology>polygonMode <VkPolygonMode>logicOp <VkLogicOp>frontFace <VkFrontFace>cullMode <VkCullMode>depthBiasConstantFactor <float>depthBiasClamp <float>depthBiasSlopeFactor <float>lineWidth <float>minDepthBounds <float>maxDepthBounds <float>srcColorBlendFactor <VkBlendFactor>dstColorBlendFactor <VkBlendFactor>srcAlphaBlendFactor <VkBlendFactor>dstAlphaBlendFactor <VkBlendFactor>colorBlendOp <VkBlendOp>alphaBlendOp <VkBlendOp>depthCompareOp <VkCompareOp>front.compareOp <VkCompareOp>back.compareOp <VkCompareOp>front.failOp <VkStencilOp>front.passOp <VkStencilOp>front.depthFailOp <VkStencilOp>back.failOp <VkStencilOp>back.passOp <VkStencilOp>back.depthFailOp <VkStencilOp>front.reference <uint32_t>back.reference <uint32_t>colorWriteMask <VkColorComponent bitmask>
Test Example
[test]
clear color 1 0.4 0.5 0.2
clear
relative probe rect rgba (0.0, 0.0, 1.0, 1.0) (1.0, 0.4, 0.5, 0.2)
Data Types
intuintint8_tuint8_tint16_tuint16_tint64_tuint64_tfloatdoublevecvec[234]dvecdvec[234]ivecivec[234]uvecuvec[234]i8veci8vec[234]u8vecu8vec[234]i16veci16vec[234]u16vecu16vec[234]i64veci64vec[234]u64vecu64vec[234]matmat[234]x[234]dmatdmat[234]x[234]
Topologies
PATCH_LISTPOINT_LISTGL_LINE_STRIP_ADJACENCYGL_LINE_STRIPGL_LINESGL_LINES_ADJACENCYGL_PATCHESGL_POINTSGL_TRIANGLE_STRIPGL_TRIANGLE_FANGL_TRIANGLESGL_TRIANGLES_ADJACENCYGL_TRIANGLE_STRIP_ADJACENCYLINE_LISTLINE_LIST_WITH_ADJACENCYLINE_STRIPLINE_STRIP_WITH_ADJACENCYTRIANGLE_FANTRIANGLE_LISTTRIANGLE_LIST_WITH_ADJACENCYTRIANGLE_STRIPTRIANGLE_STRIP_WITH_ADJACENCY
GL Types
byteubyteshortushortintuinthalffloatdouble
GLSL Types
intuintfloatdoublevecvec2vec3vec4dvecdvec2dvec3dvec4uvecuvec2uvec3uvec4ivecivec2ivec3ivec4
Available Require Features
robustBufferAccessfullDrawIndexUint32imageCubeArrayindependentBlendgeometryShadertessellationShadersampleRateShadingdualSrcBlendlogicOpmultiDrawIndirectdrawIndirectFirstInstancedepthClampdepthBiasClampfillModeNonSoliddepthBoundswideLineslargePointsalphaToOnemultiViewportsamplerAnisotropytextureCompressionETC2textureCompressionASTC_LDRtextureCompressionBCocclusionQueryPrecisepipelineStatisticsQueryvertexPipelineStoresAndAtomicsfragmentStoresAndAtomicsshaderTessellationAndGeometryPointSizeshaderImageGatherExtendedshaderStorageImageExtendedFormatsshaderStorageImageMultisampleshaderStorageImageReadWithoutFormatshaderStorageImageWriteWithoutFormatshaderUniformBufferArrayDynamicIndexingshaderSampledImageArrayDynamicIndexingshaderStorageBufferArrayDynamicIndexingshaderStorageImageArrayDynamicIndexingshaderClipDistanceshaderCullDistanceshaderFloat64shaderInt64shaderInt16shaderResourceResidencyshaderResourceMinLodsparseBindingsparseResidencyBuffersparseResidencyImage2DsparseResidencyImage3DsparseResidency2SamplessparseResidency4SamplessparseResidency8SamplessparseResidency16SamplessparseResidencyAliasedvariableMultisampleRateinheritedQueries
Image Formats
A1R5G5B5_UNORM_PACK16A2B10G10R10_SINT_PACK32A2B10G10R10_SNORM_PACK32A2B10G10R10_SSCALED_PACK32A2B10G10R10_UINT_PACK32A2B10G10R10_UNORM_PACK32A2B10G10R10_USCALED_PACK32A2R10G10B10_SINT_PACK32A2R10G10B10_SNORM_PACK32A2R10G10B10_SSCALED_PACK32A2R10G10B10_UINT_PACK32A2R10G10B10_UNORM_PACK32A2R10G10B10_USCALED_PACK32A8B8G8R8_SINT_PACK32A8B8G8R8_SNORM_PACK32A8B8G8R8_SRGB_PACK32A8B8G8R8_SSCALED_PACK32A8B8G8R8_UINT_PACK32A8B8G8R8_UNORM_PACK32A8B8G8R8_USCALED_PACK32B10G11R11_UFLOAT_PACK32B4G4R4A4_UNORM_PACK16B5G5R5A1_UNORM_PACK16B5G6R5_UNORM_PACK16B8G8R8A8_SINTB8G8R8A8_SNORMB8G8R8A8_SRGBB8G8R8A8_SSCALEDB8G8R8A8_UINTB8G8R8A8_UNORMB8G8R8A8_USCALEDB8G8R8_SINTB8G8R8_SNORMB8G8R8_SRGBB8G8R8_SSCALEDB8G8R8_UINTB8G8R8_UNORMB8G8R8_USCALEDD16_UNORMD16_UNORM_S8_UINTD24_UNORM_S8_UINTD32_SFLOATD32_SFLOAT_S8_UINTR16G16B16A16_SFLOATR16G16B16A16_SINTR16G16B16A16_SNORMR16G16B16A16_SSCALEDR16G16B16A16_UINTR16G16B16A16_UNORMR16G16B16A16_USCALEDR16G16B16_SFLOATR16G16B16_SINTR16G16B16_SNORMR16G16B16_SSCALEDR16G16B16_UINTR16G16B16_UNORMR16G16B16_USCALEDR16G16_SFLOATR16G16_SINTR16G16_SNORMR16G16_SSCALEDR16G16_UINTR16G16_UNORMR16G16_USCALEDR16_SFLOATR16_SINTR16_SNORMR16_SSCALEDR16_UINTR16_UNORMR16_USCALEDR32G32B32A32_SFLOATR32G32B32A32_SINTR32G32B32A32_UINTR32G32B32_SFLOATR32G32B32_SINTR32G32B32_UINTR32G32_SFLOATR32G32_SINTR32G32_UINTR32_SFLOATR32_SINTR32_UINTR4G4B4A4_UNORM_PACK16R4G4_UNORM_PACK8R5G5B5A1_UNORM_PACK16R5G6B5_UNORM_PACK16R64G64B64A64_SFLOATR64G64B64A64_SINTR64G64B64A64_UINTR64G64B64_SFLOATR64G64B64_SINTR64G64B64_UINTR64G64_SFLOATR64G64_SINTR64G64_UINTR64_SFLOATR64_SINTR64_UINTR8G8B8A8_SINTR8G8B8A8_SNORMR8G8B8A8_SRGBR8G8B8A8_SSCALEDR8G8B8A8_UINTR8G8B8A8_UNORMR8G8B8A8_USCALEDR8G8B8_SINTR8G8B8_SNORMR8G8B8_SRGBR8G8B8_SSCALEDR8G8B8_UINTR8G8B8_UNORMR8G8B8_USCALEDR8G8_SINTR8G8_SNORMR8G8_SRGBR8G8_SSCALEDR8G8_UINTR8G8_UNORMR8G8_USCALEDR8_SINTR8_SNORMR8_SRGBR8_SSCALEDR8_UINTR8_UNORMR8_USCALEDS8_UINTX8_D24_UNORM_PACK32