Name Strings

SPV_GOOGLE_user_type

Contact

See Issues list in the Khronos SPIRV-Registry repository: https://github.com/KhronosGroup/SPIRV-Registry

Contributors

  • Hai Nguyen, Google

  • David Neto, Google

  • Ehsan Nasiri, Google

  • Natalie Chouinard, Google

Status

  • Draft

Version

Last Modified Date

2024-01-29

Revision

5

Dependencies

This extension is written against the SPIR-V Specification, Version 1.2 Revision 4, Unified.

This extension requires SPIR-V 1.0.

This extension also implicitly includes the SPV_GOOGLE_decorate_string extension.

Overview

This extension provides one new decoration, UserTypeGOOGLE, that allows HLL shader compilers to optionally embed unambiguous type information.

The decoration UserTypeGOOGLE is used with OpDecorateString(GOOGLE) and OpMemberDecorateString(GOOGLE) to store a string name for the type of the decorated object in the user’s source. It can decorate only a variable, a type, or a member of a structure type. This has no semantic impact.

The following table describes standard HLSL resource types and their corresponding string names:

cbuffer

cbuffer

tbuffer

tbuffer

AppendStructuredBuffer

appendstructuredbuffer

Buffer

buffer

ByteAddressBuffer

byteaddressbuffer

ConstantBuffer

constantbuffer

ConsumeStructuredBuffer

consumestructuredbuffer

InputPatch

inputpatch

OutputPatch

outputpatch

RasterizerOrderedBuffer

rasterizerorderedbuffer

RasterizerOrderedByteAddressBuffer

rasterizerorderedbyteaddressbuffer

RasterizerOrderedStructuredBuffer

rasterizerorderedstructuredbuffer

RasterizerOrderedTexture1D

rasterizerorderedtexture1d

RasterizerOrderedTexture1DArray

rasterizerorderedtexture1darray

RasterizerOrderedTexture2D

rasterizerorderedtexture2d

RasterizerOrderedTexture2DArray

rasterizerorderedtexture2darray

RasterizerOrderedTexture3D

rasterizerorderedtexture3d

RaytracingAccelerationStructure

raytracingaccelerationstructure

RWBuffer

rwbuffer

RWByteAddressBuffer

rwbyteaddressbuffer

RWStructuredBuffer

rwstructuredbuffer

RWTexture1D

rwtexture1d

RWTexture1DArray

rwtexture1darray

RWTexture2D

rwtexture2d

RWTexture2DArray

rwtexture2darray

RWTexture3D

rwtexture3d

StructuredBuffer

structuredbuffer

SubpassInput

subpassinput

SubpassInputMS

subpassinputms

Texture1D

texture1d

Texture1DArray

texture1darray

Texture2D

texture2d

Texture2DArray

texture2darray

Texture2DMS

texture2dms

Texture2DMSArray

texture2dmsarray

Texture3D

texture3d

TextureBuffer

texturebuffer

TextureCube

texturecube

TextureCubeArray

texturecubearray

If the HLSL type includes template parameters, they will be appended to the corresponding string name in the format :<comma-separated-list>. For example, the SPIR-V variable corresponding to an HLSL variable with type Texture2DMSArray<float4, 64> would be decorated with "texture2dmsarray:<float4,64>".

Extension Name

To use this extension within a SPIR-V module, the following OpExtension must be present in the module:

OpExtension "SPV_GOOGLE_user_type"

New Capabilities

None.

New Decorations

UserTypeGOOGLE

New Builtins

None.

New Instructions

None.

Token Number Assignments

UserTypeGoogle

5636

Modifications to the SPIR-V Specification, Version 1.0

(Modify Section 3.20, Decoration)
Decoration Enabling Capabilities Extra Operands

5636

UserTypeGOOGLE

Literal String
User Type Name

Validation Rules

An OpExtension must be added to the SPIR-V for validation layers to check legal use of this extension:

OpExtension "SPV_GOOGLE_user_type"

Issues

  1. Can UserTypeGOOGLE be used with variables or is it restricted to types?

  2. You can have multiple UserTypeGOOGLE decorations on the same object or member of an object.  Those conflicts can come as types are collapsed by the front-end. This is ok.

  3. When OpExtension "SPV_GOOGLE_user_type" is included, all features of SPV_GOOGLE_decorate_string can be used without explicitly declaring that SPV_GOOGLE_decorate_string extension.

Revision History

Rev Date Author Changes

1

2019-05-16

Hai Nguyen

Initial draft

2

2019-05-17

Hai Nguyen

Added GOOGLE suffix and token number

3

2019-05-17

David Neto

Clarified definition of UserTypeGOOGLE

4

2019-07-30

Ehsan Nasiri

Added table of user type names

5

2024-01-29

Natalie Chouinard

Added and disambiguated some type names