Top 1K Features Creators Events Podcasts Books Extensions Interviews Blog Explorer CSV

HLSL

< >

HLSL is a shading language created in 2002.

#325on PLDB 22Years Old 2kRepos
Wikipedia

The High-Level Shader Language or High-Level Shading Language (HLSL) is a proprietary shading language developed by Microsoft for the Direct3D 9 API to augment the shader assembly language, and went on to become the required shading language for the unified shader model of Direct3D 10 and higher. HLSL is analogous to the GLSL shading language used with the OpenGL standard. It is very similar to the Nvidia Cg shading language, as it was developed alongside it. Read more on Wikipedia...


Example from Compiler Explorer:
// The entry point and target profile are needed to compile this example: // -T ps_6_6 -E PSMain struct PSInput { float4 position : SV_Position; float4 color : COLOR0; }; float4 PSMain(PSInput input) : SV_Target0 { return input.color * input.color; }
Example from Linguist:
float alpha = 1.f; texture tex; sampler tex_sampler = sampler_state { Texture = (tex); MipFilter = LINEAR; MinFilter = LINEAR; MagFilter = LINEAR; AddressU = WRAP; AddressV = WRAP; }; struct VS_OUTPUT { float4 pos : POSITION; float2 tex : TEXCOORD1; }; VS_OUTPUT vertex(float4 ipos : POSITION, float2 tex : TEXCOORD0) { VS_OUTPUT Out; Out.pos = ipos; Out.tex = tex * 2; return Out; } float4 pixel(VS_OUTPUT In) : COLOR { return tex2D(tex_sampler, In.tex) * alpha; } technique blur_ps_vs_2_0 { pass P0 { VertexShader = compile vs_2_0 vertex(); PixelShader = compile ps_2_0 pixel(); } }

Language features

Feature Supported Example Token
Comments ✓
MultiLine Comments ✓
Line Comments ✓
Integers ✓
Floats ✓
Hexadecimals ✓
Octals ✓

- Build the next great programming language · Add · Issues · About · Search · Keywords · Livestreams · Labs · Resources · Acknowledgements

Built with Scroll v154.3.0