Skip to content

List of available semantics

MWstudios edited this page Nov 4, 2021 · 3 revisions

Pixel shaders

Note: Pixel shader semantics are influenced by the vertex shader's output. Assuming the vertex shader stage is skipped, these are the default values.

Semantic Type Description
SV_POSITION float4 The absolute position of the pixel, starting in the top left corner of the window (not the monitor).
SCENE_POSITION float4 Most of the time this will be considered by other programs as a non-existant semantic (even here on Github), however I can assure you it is. If you're using DeviceContext.DrawImage() to draw a shader at a specific location, then it's the position of the pixel relative to the position where you're drawing, also starting in the top left corner. If you're using DeviceContext.RenderScreenShaders() to draw a shader on the screen, then it's equal to SV_POSITION.
TEXCOORDX float4 Same as SCENE_POSITION, but mapped to a range between 0-1 and the uppercase X is the slot of a texture input. If you're passing two textures with different sizes, then TEXCOORD0 is relative to the first bitmap's size and TEXCOORD1 is relative to the second bitmap's size. If you're rendering a shader on the whole screen, TEXCOORD0 will be screen ratio dependent, which could make your effects look stretched.
SV_TARGET none The output of the pixel shader, basically what makes main the "main" rendering method.
SV_ISFRONTFACE bool Splits a bitmap into two triangles. The lower left triangle returns false and the upper right triangle returns true. This flag indicates if the face is flipped, which means half of the image is facing the wrong way, which is strange.
SV_PRIMITIVEID uint Same as SV_ISFRONTFACE , but in integer form. Returns 1 for the lower left triangle and 0 for the upper left triangle.

Visualization

Compute shaders

Semantic Type Description
SV_DispatchThreadID uint3 The position of the pixel relative to the top left corner of the drawn image (equivalent to SCENE_POSITION in pixel shaders).
SV_GroupThreadID uint3 The position of the pixel relative to the tile. Imagine it as a modulo of the pixel position and the tile size.
SV_GroupID uint3 The ID of the tile being drawn, starting from the top left corner.
SV_GroupIndex uint The ID of the pixel in the tile's "scanline". The pixels are indexed from left to right, then from top to bottom.

Visualization

In this wiki you can find out all the information on how to use the Ensoftener library. For more information on how to add Ensoftener to your project, see "Installing and running". The rest is dedicated to the library's features.

Notice: This wiki shows information for Ensoftener 5.0 and is currently outdated.

Clone this wiki locally