From b2cf1b0a55d05e46507323adb4c33dc7a3cf6349 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Tue, 2 Oct 2018 12:19:46 +0200 Subject: [PATCH] move pixel shader into header file --- inc/paletteshader.h | 26 ++++++++++++++++++++++---- src/render_d3d9.c | 18 +----------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/inc/paletteshader.h b/inc/paletteshader.h index 29887ba..dccd9aa 100644 --- a/inc/paletteshader.h +++ b/inc/paletteshader.h @@ -1,6 +1,6 @@ // old -const GLchar *PassthroughVertShader110Src = +static const char *PassthroughVertShader110Src = "#version 110\n" "varying vec2 TexCoord0; \n" "\n" @@ -10,7 +10,7 @@ const GLchar *PassthroughVertShader110Src = " TexCoord0 = gl_MultiTexCoord0.xy; \n" "}\n"; -const GLchar *PaletteFragShader110Src = +static const char *PaletteFragShader110Src = "#version 110\n" "uniform sampler2D SurfaceTex; \n" "uniform sampler2D PaletteTex; \n" @@ -26,7 +26,7 @@ const GLchar *PaletteFragShader110Src = // new -const GLchar *PassthroughVertShaderSrc = +static const char *PassthroughVertShaderSrc = "#if __VERSION__ >= 130\n" "#define COMPAT_VARYING out\n" "#define COMPAT_ATTRIBUTE in\n" @@ -59,7 +59,7 @@ const GLchar *PassthroughVertShaderSrc = "}\n"; -const GLchar *PaletteFragShaderSrc = +static const char *PaletteFragShaderSrc = "#if __VERSION__ >= 130\n" "#define COMPAT_VARYING in\n" "#define COMPAT_TEXTURE texture\n" @@ -91,3 +91,21 @@ const GLchar *PaletteFragShaderSrc = " vec4 outTexel = COMPAT_TEXTURE(PaletteTex, vec2(paletteIndex.r, 0));\n" " FragColor = outTexel;\n" "}\n"; + + +static const BYTE PalettePixelShaderSrc[] = +{ + 0,2,255,255,254,255,42,0,67,84,65,66,28,0,0,0,115,0,0,0,0,2,255,255, + 2,0,0,0,28,0,0,0,0,1,0,0,108,0,0,0,68,0,0,0,3,0,0,0, + 1,0,2,0,72,0,0,0,0,0,0,0,88,0,0,0,3,0,1,0,1,0,6,0, + 92,0,0,0,0,0,0,0,115,48,0,171,4,0,12,0,1,0,1,0,1,0,0,0, + 0,0,0,0,115,49,0,171,4,0,12,0,1,0,1,0,1,0,0,0,0,0,0,0, + 112,115,95,50,95,48,0,77,105,99,114,111,115,111,102,116,32,40,82,41,32,72,76,83, + 76,32,83,104,97,100,101,114,32,67,111,109,112,105,108,101,114,32,57,46,50,57,46,57, + 53,50,46,51,49,49,49,0,81,0,0,5,0,0,15,160,0,0,127,63,0,0,0,59, + 0,0,0,0,0,0,0,0,31,0,0,2,0,0,0,128,0,0,3,176,31,0,0,2, + 0,0,0,144,0,8,15,160,31,0,0,2,0,0,0,144,1,8,15,160,66,0,0,3, + 0,0,15,128,0,0,228,176,0,8,228,160,4,0,0,4,0,0,1,128,0,0,0,128, + 0,0,0,160,0,0,85,160,1,0,0,2,0,0,2,128,0,0,170,160,66,0,0,3, + 0,0,15,128,0,0,228,128,1,8,228,160,1,0,0,2,0,8,15,128,0,0,228,128,255,255,0,0 +}; diff --git a/src/render_d3d9.c b/src/render_d3d9.c index c3cbdb9..4144ea8 100644 --- a/src/render_d3d9.c +++ b/src/render_d3d9.c @@ -3,23 +3,7 @@ #include #include "main.h" #include "surface.h" - -const BYTE PalettePixelShaderSrc[] = -{ - 0,2,255,255,254,255,42,0,67,84,65,66,28,0,0,0,115,0,0,0,0,2,255,255, - 2,0,0,0,28,0,0,0,0,1,0,0,108,0,0,0,68,0,0,0,3,0,0,0, - 1,0,2,0,72,0,0,0,0,0,0,0,88,0,0,0,3,0,1,0,1,0,6,0, - 92,0,0,0,0,0,0,0,115,48,0,171,4,0,12,0,1,0,1,0,1,0,0,0, - 0,0,0,0,115,49,0,171,4,0,12,0,1,0,1,0,1,0,0,0,0,0,0,0, - 112,115,95,50,95,48,0,77,105,99,114,111,115,111,102,116,32,40,82,41,32,72,76,83, - 76,32,83,104,97,100,101,114,32,67,111,109,112,105,108,101,114,32,57,46,50,57,46,57, - 53,50,46,51,49,49,49,0,81,0,0,5,0,0,15,160,0,0,127,63,0,0,0,59, - 0,0,0,0,0,0,0,0,31,0,0,2,0,0,0,128,0,0,3,176,31,0,0,2, - 0,0,0,144,0,8,15,160,31,0,0,2,0,0,0,144,1,8,15,160,66,0,0,3, - 0,0,15,128,0,0,228,176,0,8,228,160,4,0,0,4,0,0,1,128,0,0,0,128, - 0,0,0,160,0,0,85,160,1,0,0,2,0,0,2,128,0,0,170,160,66,0,0,3, - 0,0,15,128,0,0,228,128,1,8,228,160,1,0,0,2,0,8,15,128,0,0,228,128,255,255,0,0 -}; +#include "paletteshader.h" typedef struct CUSTOMVERTEX { float x, y, z, rhw, u, v; } CUSTOMVERTEX;