mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Add support for DirectX HLSL / FX files. The FX files are just HLSL files with some additional syntax to set render-states and define multiple shader stages in one file. Samples are either written by me, or taken from Chromium.
		
			
				
	
	
		
			42 lines
		
	
	
		
			616 B
		
	
	
	
		
			HLSL
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			616 B
		
	
	
	
		
			HLSL
		
	
	
	
	
	
| 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();
 | |
| 	}
 | |
| }
 |