source: trunk/src/gpu/testmaterial.lolfx @ 1687

Last change on this file since 1687 was 1590, checked in by sam, 9 years ago

core: start working on a higher level LolFx compiler based on the latest
GLSL grammar and some personal attempts at writing an HLSL grammar.

File size: 2.3 KB
RevLine 
[1406]1/*
2 * LolFx Test Material
3 */
4
[1407]5// Can have lots of different techniques in a single lolfx file,
6// especially if they share common shader code.
7technique Foo
[1406]8{
[1407]9    // Multiple passes, with alpha on/off, with various blending methods,
10    // with depth test disabled...
[1406]11    pass p0
12    {
13        texture[0] = null;
14        texture[1] = null;
15        texture[2] = null;
16
17        cullmode = none; // ccw
18        lighting = false;
19        zenable = true; // false
20        alphablendenable = true; // false
21        srcblend = src_alpha; // one
22        destblend = inv_src_alpha;
23
24        colorop[0] = select_arg1;
25        colorarg1[0] = diffuse;
26
27        alphaop[0] = select_arg1;
28        alphaarg1[0] = diffuse;
29
30        colorop[1] = disable;
31
32        alphaop[1] = disable;
33
34        // Ye old way
[1590]35        vertexshader = blah;
36        geometryshader = blah;
37        pixelshader = blah;
[1406]38
39        // Ogre crap
[1407]40
41        // The D3D11 way, but we must make it work with GLSL too
[1590]42        //SetBlendState(AdditiveBlending, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
43        //SetDepthStencilState(DisableDepth, 0);
44        //SetRasterizerState()
[1406]45
[1590]46        //SetVertexShader
47        //SetDomainShader
48        //SetHullShader
49        //SetGeometryShader
50        //SetPixelShader
51        //SetComputeShader /* WTF? */
[1406]52
[1590]53        //SetRenderTargets(RTV0, DSV);
54        //SetRenderTargets(RTV0, RTV1, DSV);
55        //...
56        //SetRenderTargets(RTV0, RTV1, RTV2, RTV3, RTV4, RTV5, RTV6, RTV7, DSV);
[1406]57    }
58
59    pass p1
60    {
61        // Autres vertex/pixel shaders avec éventuellement des
62        // dépendances sur le résultat des passes précédentes
[1590]63        vertexshader = something_else;
[1406]64    }
65}
66
[1407]67/* Defines GLSL shader "Prout" */
[1406]68
[1590]69#pragma lolfx vertexshader(lang=GLSL 1.20, name=prout)
[1407]70
[1406]71#version 120
72
73/* Valid with my GLSL compiler */
[1590]74//#pragma lolfx semantic(in_Vertex, POSITION)
75//#pragma lolfx semantic(in_Normal, NORMAL)
76//#pragma lolfx semantic(in_Color, COLOR)
[1406]77attribute vec3 in_Vertex;
78attribute vec3 in_Normal;
79attribute vec4 in_Color;
80
81void main(void)
82{
[1590]83    /* ... */
[1406]84}
85
[1407]86/* Defines GLSL shader "Zob" */
[1590]87#pragma lolfx vertexshader(lang=GLSL 1.20, name=zob)
[1407]88
89void main(void)
90{
[1590]91    shit(); fuck(); fuck(); shit();
[1407]92}
93
[1590]94/* Defines HLSL vertex shader "Prout" */
[1407]95
[1590]96#pragma lolfx vertexshader(lang=HLSL, name=prout)
[1407]97
98void main(void)
99{
100    /* Blah */
101}
102
Note: See TracBrowser for help on using the repository browser.