Commit 380ea221 authored by Gargaj's avatar Gargaj
Browse files

add dx9 shader keywords + move shader filename to renderer-specific

parent 061b9f96
......@@ -41,11 +41,15 @@
<LinkIncremental>true</LinkIncremental>
<IncludePath>external;external\scintilla\include;external\scintilla\lexlib;external\scintilla\src;external\glee;external\sdl\include;external\bass;$(IncludePath)</IncludePath>
<LibraryPath>external\bass\;external\sdl\lib\;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)\</OutDir>
<IntDir>$(ProjectName)_$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>external;external\scintilla\include;external\scintilla\lexlib;external\scintilla\src;external\glee;external\sdl\include;external\bass;$(IncludePath)</IncludePath>
<LibraryPath>external\bass\;external\sdl\lib\;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)\</OutDir>
<IntDir>$(ProjectName)_$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
......
......@@ -41,11 +41,15 @@
<LinkIncremental>true</LinkIncremental>
<IncludePath>external;external\scintilla\include;external\scintilla\lexlib;external\scintilla\src;external\glee;external\sdl\include;external\bass;$(IncludePath)</IncludePath>
<LibraryPath>external\bass\;external\sdl\lib\;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)\</OutDir>
<IntDir>$(ProjectName)_$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>external;external\scintilla\include;external\scintilla\lexlib;external\scintilla\src;external\glee;external\sdl\include;external\bass;$(IncludePath)</IncludePath>
<LibraryPath>external\bass\;external\sdl\lib\;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)\</OutDir>
<IntDir>$(ProjectName)_$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
......
......@@ -15,6 +15,7 @@ typedef struct
namespace Renderer
{
extern char * defaultShaderFilename;
extern char defaultShader[65536];
extern int nWidth;
......
......@@ -33,92 +33,9 @@ const int markersArray[][NB_FOLDER_STATE] = {
{SC_MARK_CIRCLEMINUS, SC_MARK_CIRCLEPLUS,SC_MARK_VLINE, SC_MARK_LCORNERCURVE, SC_MARK_CIRCLEPLUSCONNECTED, SC_MARK_CIRCLEMINUSCONNECTED, SC_MARK_TCORNERCURVE},
{SC_MARK_BOXMINUS, SC_MARK_BOXPLUS, SC_MARK_VLINE, SC_MARK_LCORNER, SC_MARK_BOXPLUSCONNECTED, SC_MARK_BOXMINUSCONNECTED, SC_MARK_TCORNER}
};
const char glslKeyword[] =
"discard struct if else switch case default break goto return for while do continue";
const char glslType[] =
"attribute const in inout out uniform varying invariant "
"centroid flat smooth noperspective layout patch sample "
"subroutine lowp mediump highp precision "
"void float vec2 vec3 vec4 bvec2 bvec3 bvec4 ivec2 ivec3 ivec4 "
"uvec2 uvec3 uvec4 dvec2 dvec3 dvec4 "
"sampler1D sampler2D sampler3D isampler2D isampler1D isampler3D "
"usampler1D usampler2D usampler3D "
"sampler1DShadow sampler2DShadow sampler1DArray sampler2DArray "
"sampler1DArrayShadow sampler2DArrayShadow "
"samplerCube samperCubeShadow samperCubeArrayShadow ";
const char glslBuiltin[] =
"radians degrees sin cos tan asin acos atan sinh "
"cosh tanh asinh acosh atanh pow exp log exp2 "
"log2 sqrt inversesqrt abs sign floor trunc round "
"roundEven ceil fract mod modf min max clamp mix "
"step smoothstep isnan isinf floatBitsToInt floatBitsToUint "
"intBitsToFloat uintBitsToFloat fma frexp ldexp packUnorm2x16 "
"packUnorm4x8 packSnorm4x8 unpackUnorm2x16 unpackUnorm4x8 "
"unpackSnorm4x8 packDouble2x32 unpackDouble2x32 length distance "
"dot cross normalize ftransform faceforward reflect "
"refract matrixCompMult outerProduct transpose determinant "
"inverse lessThan lessThanEqual greaterThan greaterThanEqual "
"equal notEqual any all not uaddCarry usubBorrow "
"umulExtended imulExtended bitfieldExtract bitfildInsert "
"bitfieldReverse bitCount findLSB findMSB textureSize "
"textureQueryLOD texture textureProj textureLod textureOffset "
"texelFetch texelFetchOffset textureProjOffset textureLodOffset "
"textureProjLod textureProjLodOffset textureGrad textureGradOffset "
"textureProjGrad textureProjGradOffset textureGather "
"textureGatherOffset texture1D texture2D texture3D texture1DProj "
"texture2DProj texture3DProj texture1DLod texture2DLod "
"texture3DLod texture1DProjLod texture2DProjLod texture3DProjLod "
"textureCube textureCubeLod shadow1D shadow2D shadow1DProj "
"shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod "
"shadow2DProjLod dFdx dFdy fwidth interpolateAtCentroid "
"interpolateAtSample interpolateAtOffset noise1 noise2 noise3 "
"noise4 EmitStreamVertex EndStreamPrimitive EmitVertex "
"EndPrimitive barrier "
"gl_VertexID gl_InstanceID gl_Position gl_PointSize "
"gl_ClipDistance gl_PrimitiveIDIn gl_InvocationID gl_PrimitiveID "
"gl_Layer gl_PatchVerticesIn gl_TessLevelOuter gl_TessLevelInner "
"gl_TessCoord gl_FragCoord gl_FrontFacing gl_PointCoord "
"gl_SampleID gl_SamplePosition gl_FragColor gl_FragData "
"gl_FragDepth gl_SampleMask gl_ClipVertex gl_FrontColor "
"gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor "
"gl_TexCoord gl_FogFragCoord gl_Color gl_SecondaryColor "
"gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 "
"gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 "
"gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord "
"gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats "
"gl_MaxVaryingComponents gl_MaxVertexOutputComponents "
"gl_MaxGeometryInputComponents gl_MaxGeometryOutputComponents "
"gl_MaxFragmentInputComponents gl_MaxVertexTextureImageUnits "
"gl_MaxCombinedTextureImageUnits gl_MaxTextureImageUnits "
"gl_MaxFragmentUniformComponents gl_MaxDrawBuffers gl_MaxClipDistances "
"gl_MaxGeometryTextureImageUnits gl_MaxGeometryOutputVertices "
"gl_MaxGeometryTotalOutputComponents gl_MaxGeometryUniformComponents "
"gl_MaxGeometryVaryingComponents gl_MaxTessControlInputComponents "
"gl_MaxTessControlOutputComponents gl_MaxTessControlTextureImageUnits "
"gl_MaxTessControlUniformComponents "
"gl_MaxTessControlTotalOutputComponents "
"gl_MaxTessEvaluationInputComponents gl_MaxTessEvaluationOutputComponents "
"gl_MaxTessEvaluationTextureImageUnits "
"gl_MaxTessEvaluationUniformComponents gl_MaxTessPatchComponents "
"gl_MaxPatchVertices gl_MaxTessGenLevel gl_MaxTextureUnits "
"gl_MaxTextureCoords gl_MaxClipPlanes "
"gl_DepthRange gl_ModelViewMatrix gl_ProjectionMatrix "
"gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix "
"gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse "
"gl_ModelViewProjectionMatrixInverse gl_TextureMatrixInverse "
"gl_ModelViewMatrixTranspose gl_ProjectionMatrixTranspose "
"gl_ModelViewProjectionMatrixTranspose gl_TextureMatrixTranspose "
"gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose "
"gl_ModelViewProjectionMatrixInverseTranspose "
"gl_TextureMatrixInverseTranspose gl_NormalScale gl_ClipPlane "
"gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource "
"gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct "
"gl_FrontLightProduct gl_BackLightProduct gl_TextureEnvColor "
"gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ "
"gl_ObjectPlaneS gl_ObjectPlaneT gl_ObjectPlaneR gl_ObjectPlaneQ "
"gl_Fog";
extern const char * shaderKeyword;
extern const char * shaderType;
extern const char * shaderBuiltin;
using namespace Scintilla;
class Scintilla::LexState : public LexInterface {
......@@ -192,10 +109,10 @@ void ShaderEditor::Initialise()
WndProc(SCI_SETTABWIDTH, 4, NULL);
WndProc(SCI_SETINDENTATIONGUIDES, SC_IV_REAL, NULL);
lexState->SetLexer( SCLEX_CPP );
lexState->SetWordList(0, glslKeyword);
lexState->SetWordList(1, glslType);
lexState->SetWordList(4, glslBuiltin);
lexState->SetLexer( SCLEX_CPPNOCASE );
lexState->SetWordList(0, shaderKeyword);
lexState->SetWordList(1, shaderType);
lexState->SetWordList(4, shaderBuiltin);
SetAStyle(SCE_C_DEFAULT, 0xFFFFFFFF, BACKGROUND( 0x000000 ), nFontSize, sFontFile.c_str() );
SetAStyle(SCE_C_WORD, 0xFF0066FF, BACKGROUND( 0x000000 ));
......
......@@ -81,7 +81,7 @@ void main()
bool shaderInitSuccessful = false;
char szShader[65535];
char szError[4096];
FILE * f = fopen("shader.fs","rb");
FILE * f = fopen(Renderer::defaultShaderFilename,"rb");
if (f)
{
memset( szShader, 0, 65535 );
......@@ -147,7 +147,7 @@ void main()
mShaderEditor.GetText(szShader,65535);
if (Renderer::ReloadShader( szShader, strlen(szShader), szError, 4096 ))
{
FILE * f = fopen("shader.fs","wb");
FILE * f = fopen(Renderer::defaultShaderFilename,"wb");
fwrite( szShader, strlen(szShader), 1, f );
fclose(f);
mDebugOutput.SetText( "" );
......
......@@ -10,8 +10,96 @@
#include <stb_image.c>
#include "../external/scintilla/include/Scintilla.h"
const char * shaderKeyword =
"discard struct if else switch case default break goto return for while do continue";
const char * shaderType =
"attribute const in inout out uniform varying invariant "
"centroid flat smooth noperspective layout patch sample "
"subroutine lowp mediump highp precision "
"void float vec2 vec3 vec4 bvec2 bvec3 bvec4 ivec2 ivec3 ivec4 "
"uvec2 uvec3 uvec4 dvec2 dvec3 dvec4 "
"sampler1D sampler2D sampler3D isampler2D isampler1D isampler3D "
"usampler1D usampler2D usampler3D "
"sampler1DShadow sampler2DShadow sampler1DArray sampler2DArray "
"sampler1DArrayShadow sampler2DArrayShadow "
"samplerCube samperCubeShadow samperCubeArrayShadow ";
const char * shaderBuiltin =
"radians degrees sin cos tan asin acos atan sinh "
"cosh tanh asinh acosh atanh pow exp log exp2 "
"log2 sqrt inversesqrt abs sign floor trunc round "
"roundEven ceil fract mod modf min max clamp mix "
"step smoothstep isnan isinf floatBitsToInt floatBitsToUint "
"intBitsToFloat uintBitsToFloat fma frexp ldexp packUnorm2x16 "
"packUnorm4x8 packSnorm4x8 unpackUnorm2x16 unpackUnorm4x8 "
"unpackSnorm4x8 packDouble2x32 unpackDouble2x32 length distance "
"dot cross normalize ftransform faceforward reflect "
"refract matrixCompMult outerProduct transpose determinant "
"inverse lessThan lessThanEqual greaterThan greaterThanEqual "
"equal notEqual any all not uaddCarry usubBorrow "
"umulExtended imulExtended bitfieldExtract bitfildInsert "
"bitfieldReverse bitCount findLSB findMSB textureSize "
"textureQueryLOD texture textureProj textureLod textureOffset "
"texelFetch texelFetchOffset textureProjOffset textureLodOffset "
"textureProjLod textureProjLodOffset textureGrad textureGradOffset "
"textureProjGrad textureProjGradOffset textureGather "
"textureGatherOffset texture1D texture2D texture3D texture1DProj "
"texture2DProj texture3DProj texture1DLod texture2DLod "
"texture3DLod texture1DProjLod texture2DProjLod texture3DProjLod "
"textureCube textureCubeLod shadow1D shadow2D shadow1DProj "
"shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod "
"shadow2DProjLod dFdx dFdy fwidth interpolateAtCentroid "
"interpolateAtSample interpolateAtOffset noise1 noise2 noise3 "
"noise4 EmitStreamVertex EndStreamPrimitive EmitVertex "
"EndPrimitive barrier "
"gl_VertexID gl_InstanceID gl_Position gl_PointSize "
"gl_ClipDistance gl_PrimitiveIDIn gl_InvocationID gl_PrimitiveID "
"gl_Layer gl_PatchVerticesIn gl_TessLevelOuter gl_TessLevelInner "
"gl_TessCoord gl_FragCoord gl_FrontFacing gl_PointCoord "
"gl_SampleID gl_SamplePosition gl_FragColor gl_FragData "
"gl_FragDepth gl_SampleMask gl_ClipVertex gl_FrontColor "
"gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor "
"gl_TexCoord gl_FogFragCoord gl_Color gl_SecondaryColor "
"gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 "
"gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 "
"gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord "
"gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats "
"gl_MaxVaryingComponents gl_MaxVertexOutputComponents "
"gl_MaxGeometryInputComponents gl_MaxGeometryOutputComponents "
"gl_MaxFragmentInputComponents gl_MaxVertexTextureImageUnits "
"gl_MaxCombinedTextureImageUnits gl_MaxTextureImageUnits "
"gl_MaxFragmentUniformComponents gl_MaxDrawBuffers gl_MaxClipDistances "
"gl_MaxGeometryTextureImageUnits gl_MaxGeometryOutputVertices "
"gl_MaxGeometryTotalOutputComponents gl_MaxGeometryUniformComponents "
"gl_MaxGeometryVaryingComponents gl_MaxTessControlInputComponents "
"gl_MaxTessControlOutputComponents gl_MaxTessControlTextureImageUnits "
"gl_MaxTessControlUniformComponents "
"gl_MaxTessControlTotalOutputComponents "
"gl_MaxTessEvaluationInputComponents gl_MaxTessEvaluationOutputComponents "
"gl_MaxTessEvaluationTextureImageUnits "
"gl_MaxTessEvaluationUniformComponents gl_MaxTessPatchComponents "
"gl_MaxPatchVertices gl_MaxTessGenLevel gl_MaxTextureUnits "
"gl_MaxTextureCoords gl_MaxClipPlanes "
"gl_DepthRange gl_ModelViewMatrix gl_ProjectionMatrix "
"gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix "
"gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse "
"gl_ModelViewProjectionMatrixInverse gl_TextureMatrixInverse "
"gl_ModelViewMatrixTranspose gl_ProjectionMatrixTranspose "
"gl_ModelViewProjectionMatrixTranspose gl_TextureMatrixTranspose "
"gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose "
"gl_ModelViewProjectionMatrixInverseTranspose "
"gl_TextureMatrixInverseTranspose gl_NormalScale gl_ClipPlane "
"gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource "
"gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct "
"gl_FrontLightProduct gl_BackLightProduct gl_TextureEnvColor "
"gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ "
"gl_ObjectPlaneS gl_ObjectPlaneT gl_ObjectPlaneR gl_ObjectPlaneQ "
"gl_Fog";
namespace Renderer
{
char * defaultShaderFilename = "shader.glsl";
char defaultShader[65536] =
"#version 430 core\n"
"\n"
......
......@@ -10,8 +10,53 @@
#define DEVTYPE D3DDEVTYPE_HAL
const char * shaderKeyword =
"BlendState break Buffer cbuffer class compile const continue DepthStencilState"
" DepthStencilView discard do else extern false for GeometryShader if in inline"
" inout interface namespace linear centroid nointerpolation noperspective sample"
" out pass PixelShader precise RasterizerState RenderTargetView return register"
" Sampler Sampler1D Sampler2D Sampler3D SamplerCUBE SamplerState"
" SamplerComparisonState shared Stateblock StateblockState static struct switch"
" tbuffer technique technique10 technique11 texture Texture1D Texture1DArray"
" Texture2D Texture2DArray Texture2DMS Texture2DMSArray Texture3D TextureCube"
" TextureCubeArray true typedef uniform VertexShader void volatile while";
const char * shaderType =
"AppendStructuredBuffer bool bool2 bool3 bool4 Buffer ByteAddressBuffer"
" ConsumeStructuredBuffer double double2 double3 double4 float float1x1"
" float1x2 float1x3 float1x4 float2 float2x1 float2x2 float2x3 float2x4"
" float3 float3x1 float3x2 float3x3 float3x4 float4 float4x1 float4x2"
" float4x3 float4x4 half half2 half3 half4 InputPatch int int2 int3 int4 line"
" lineadj LineStream matrix OutputPatch point PointStream RWBuffer"
" RWByteAddressBuffer RWStructuredBuffer RWTexture1D RWTexture1DArray"
" RWTexture2D RWTexture2DArray RWTexture3D string StructuredBuffer Texture1D"
" Texture1DArray Texture2D Texture2DArray Texture2DMS Texture2DMSArray"
" Texture3D triangle triangleadj TriangleStream uint uint2 uint3 uint4 vector";
const char * shaderBuiltin =
"abs acos all AllMemoryBarrier AllMemoryBarrierWithGroupSync any asdouble"
" asfloat asin asint asuint atan atan2 ceil clamp clip cos cosh countbits"
" cross D3DCOLORtoUBYTE4 ddx ddx_coarse ddx_fine ddy ddy_coarse ddy_fine"
" degrees determinant DeviceMemoryBarrier DeviceMemoryBarrierWithGroupSync"
" distance dot dst EvaluateAttributeAtCentroid EvaluateAttributeAtSample"
" EvaluateAttributeSnapped exp exp2 f16tof32 f32tof16 faceforward firstbithigh"
" firstbitlow floor fmod frac frexp fwidth GetRenderTargetSampleCount"
" GetRenderTargetSamplePosition GroupMemoryBarrier GroupMemoryBarrierWithGroupSync"
" InterlockedAdd InterlockedAnd InterlockedCompareExchange InterlockedCompareStore"
" InterlockedExchange InterlockedMax InterlockedMin InterlockedOr InterlockedXor"
" isfinite isinf isnan ldexp length lerp lit log log10 log2 mad max min modf mul"
" noise normalize pow Process2DQuadTessFactorsAvg Process2DQuadTessFactorsMax"
" Process2DQuadTessFactorsMin ProcessIsolineTessFactors ProcessQuadTessFactorsAvg"
" ProcessQuadTessFactorsMax ProcessQuadTessFactorsMin ProcessTriTessFactorsAvg"
" ProcessTriTessFactorsMax ProcessTriTessFactorsMin radians rcp reflect refract"
" reversebits round rsqrt saturate sign sin sincos sinh smoothstep sqrt step"
" tan tanh tex1D tex1Dbias tex1Dgrad tex1Dlod tex1Dproj tex2D tex2Dbias"
" tex2Dgrad tex2Dlod tex2Dproj tex3D tex3Dbias tex3Dgrad tex3Dlod tex3Dproj"
" texCUBE texCUBEbias texCUBEgrad texCUBElod texCUBEproj transpose trunc";
namespace Renderer
{
char * defaultShaderFilename = "shader.dx9.hlsl";
char defaultShader[65536] =
"texture texTFFT; sampler1D texFFT = sampler_state { SRGBTexture = FALSE; Texture = <texTFFT>; }; \n"
"texture texTNoise; sampler2D texNoise = sampler_state { SRGBTexture = TRUE; Texture = <texTNoise>; };\n"
......@@ -224,7 +269,7 @@ namespace Renderer
RECT wr={0,0,pSetup->nWidth,pSetup->nHeight};
AdjustWindowRectEx(&wr, wStyle, FALSE, wExStyle);
hWnd = CreateWindowEx(wExStyle,_T("fwzwnd"),_T("mlat design"),wStyle,
hWnd = CreateWindowEx(wExStyle,_T("fwzwnd"),_T("BONZOMATIC - Direct3D 9.0c edition"),wStyle,
(GetSystemMetrics(SM_CXSCREEN) - pSetup->nWidth )/2,
(GetSystemMetrics(SM_CYSCREEN) - pSetup->nHeight)/2,
wr.right-wr.left, wr.bottom-wr.top,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment