Top 1,000 Features Creators Events Podcasts Extensions Blog Explorer CSV Download


< >

HLSL is a programming language created in 2002.

#323on PLDB 22Years Old 2kRepos

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
MultiLine Comments
Line Comments

View source

- Build the next great programming language · About · Resources · Acknowledgements · Part of the World Wide Scroll