From fc618350f616fbb264fbe00090742cf140cd5301 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sun, 20 May 2012 22:38:05 +0000 Subject: [PATCH] gpu: start working on the LolFx format. --- src/Makefile.am | 3 +- src/gpu/testmaterial.lolfx | 81 +++++++++++++++++++++++++++++++++++ test/tutorial/02_cube.lolfx | 2 +- win32/lolcore.vcxproj | 1 + win32/lolcore.vcxproj.filters | 5 ++- 5 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 src/gpu/testmaterial.lolfx diff --git a/src/Makefile.am b/src/Makefile.am index f94d457b..e337f900 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -47,7 +47,8 @@ liblol_a_SOURCES = \ debug/quad.cpp debug/quad.h nodist_liblol_a_SOURCES = \ gpu/defaultmaterial.lolfx.cpp \ - gpu/emptymaterial.lolfx.cpp + gpu/emptymaterial.lolfx.cpp \ + gpu/testmaterial.lolfx.cpp liblol_a_CPPFLAGS = @LOL_CFLAGS@ CLEANFILES = $(filter %.lolfx.cpp, $(SOURCES)) diff --git a/src/gpu/testmaterial.lolfx b/src/gpu/testmaterial.lolfx new file mode 100644 index 00000000..a2a0769e --- /dev/null +++ b/src/gpu/testmaterial.lolfx @@ -0,0 +1,81 @@ +/* + * LolFx Test Material + */ + +technique Foo // can have lots of different techniques in a single lolfx file +{ + pass p0 + { + texture[0] = null; + texture[1] = null; + texture[2] = null; + + cullmode = none; // ccw + lighting = false; + zenable = true; // false + alphablendenable = true; // false + srcblend = src_alpha; // one + destblend = inv_src_alpha; + + colorop[0] = select_arg1; + colorarg1[0] = diffuse; + + alphaop[0] = select_arg1; + alphaarg1[0] = diffuse; + + colorop[1] = disable; + + alphaop[1] = disable; + + // Ye old way + vertexshader = ... + geometryshader = ... + pixelshader = ... + + // Ogre crap + SetBlendState(AdditiveBlending, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF); + SetDepthStencilState(DisableDepth, 0); + + // D3D11 way + SetBlendState() + SetDepthStencilState() + SetRasterizerState() + + SetVertexShader + SetDomainShader + SetHullShader + SetGeometryShader + SetPixelShader + SetComputeShader /* WTF? */ + + SetRenderTargets(RTV0, DSV); + SetRenderTargets(RTV0, RTV1, DSV); + ... + SetRenderTargets(RTV0, RTV1, RTV2, RTV3, RTV4, RTV5, RTV6, RTV7, DSV); + } + + pass p1 + { + // Autres vertex/pixel shaders avec éventuellement des + // dépendances sur le résultat des passes précédentes + vertexshader = ... + } +} + +-- GLSL.Vert -- + +#version 120 + +/* Valid with my GLSL compiler */ +#pragma lolfx semantic(in_Vertex, POSITION) +#pragma lolfx semantic(in_Normal, NORMAL) +#pragma lolfx semantic(in_Color, COLOR) +attribute vec3 in_Vertex; +attribute vec3 in_Normal; +attribute vec4 in_Color; + +void main(void) +{ + ... +} + diff --git a/test/tutorial/02_cube.lolfx b/test/tutorial/02_cube.lolfx index 2297b3a2..9ec39d6b 100644 --- a/test/tutorial/02_cube.lolfx +++ b/test/tutorial/02_cube.lolfx @@ -1,6 +1,6 @@ -- GLSL.Vert -- -#version 120\n +#version 120 attribute vec3 in_Vertex; attribute vec3 in_Color; diff --git a/win32/lolcore.vcxproj b/win32/lolcore.vcxproj index 8fb51f8f..3f661977 100644 --- a/win32/lolcore.vcxproj +++ b/win32/lolcore.vcxproj @@ -194,6 +194,7 @@ + diff --git a/win32/lolcore.vcxproj.filters b/win32/lolcore.vcxproj.filters index 40768f20..a2135fd5 100644 --- a/win32/lolcore.vcxproj.filters +++ b/win32/lolcore.vcxproj.filters @@ -407,5 +407,8 @@ src\gpu + + src\gpu + - \ No newline at end of file +