Fix parallel build by switching to generating .obj files from .glsl files and treat the shader source as an externed global resolved at link time.

Additionally, remove the no longer necessary shader generated headers folder from .gitignore

git-svn-id: https://svn.eduke32.com/eduke32@7793 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	.gitignore
#	source/build/src/polymost.cpp
This commit is contained in:
pogokeen 2019-07-14 01:48:23 +00:00 committed by Christoph Oelckers
parent 9fde5434f8
commit 12ce6a78fe
5 changed files with 57 additions and 23 deletions

1
.gitignore vendored
View file

@ -55,7 +55,6 @@ project.xcworkspace/
.DS_Store
._*
/source/build/src/generated/
Platform/Windows/Build
Platform/Windows/Win32
Platform/Windows/x64

View file

@ -1012,12 +1012,12 @@ $$($1_obj)/%.$$o: $$($1_obj)/%.c | $$($1_obj)
$$(COMPILE_STATUS)
$$(RECIPE_IF) $$(COMPILER_C) $$($1_cflags) -c $$< -o $$@ $$(RECIPE_RESULT_COMPILE)
$$($1_obj)/%.$$o: $$($1_src)/%.glsl | $$($1_obj) $$($1_src)/generated
@echo Creating $$(<D)/generated/$$(<F).h from $$<
@$$(call RAW_ECHO,char const *$$(basename $$(<F)) = R"shader$$(paren_open)) > $$(<D)/generated/$$(<F).h
@$$(call CAT,$$<) >> $$(<D)/generated/$$(<F).h
@$$(call RAW_ECHO,$$(paren_close)shader";) >> $$(<D)/generated/$$(<F).h
@$$(COMPILER_CXX) $$($1_cflags) -x c++ -c $$($1_src)/empty.cpp -o $$@
$$($1_obj)/%.$$o: $$($1_src)/%.glsl | $$($1_obj)
@echo Creating $$($1_obj)/$$(<F).cpp from $$<
@$$(call RAW_ECHO,char const *$$(basename $$(<F)) = R"shader$$(paren_open)) > $$($1_obj)/$$(<F).cpp
@$$(call CAT,$$<) >> $$($1_obj)/$$(<F).cpp
@$$(call RAW_ECHO,$$(paren_close)shader";) >> $$($1_obj)/$$(<F).cpp
@$$(RECIPE_IF) $$(COMPILER_CXX) $$($1_cflags) -c $$($1_obj)/$$(<F).cpp -o $$@ $$(RECIPE_RESULT_COMPILE)
## Cosmetic stuff
@ -1052,7 +1052,7 @@ $(engine_obj)/rev.$o: $(engine_src)/rev.cpp | $(engine_obj)
### Directories
$(foreach i,$(components),$($i_obj)) $(foreach i,$(components),$($i_src)/generated):
$(foreach i,$(components),$($i_obj)):
-$(call MKDIR,$@)
### Phonies

View file

@ -380,21 +380,57 @@
<ItemGroup>
<CustomBuild Include="..\..\source\build\src\polymost1Frag.glsl">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mkdir %(RelativeDir)generated
echo char const *%(Filename) = R^"shader( &gt; %(RelativeDir)generated\%(Filename)%(Extension).h
type %(Identity) &gt;&gt; %(RelativeDir)generated\%(Filename)%(Extension).h
echo )shader^"; &gt;&gt; %(RelativeDir)generated\%(Filename)%(Extension).h</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Creating header from %(Identity)</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(RelativeDir)\generated\%(Filename)%(Extension).h</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">echo char const *%(Filename) = R^"shader( &gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
type %(Identity) &gt;&gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
echo )shader^"; &gt;&gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
cl /c /MP /GS /GL /analyze- /W3 /wd"4996" /wd"4244" /wd"4018" /wd"4267" /Gy /Zc:wchar_t /I"./include" /I"./include/vpx/" /I"./include/sdl2/" /I"../../source/build/include" /I"../../source/mact/include" /I"../../source/audiolib/include" /I"../../source/enet/include" /I"../../source/glad/include" /I"../../source/libxmp-lite/include" /I"../../source/libxmp-lite/include/libxmp-lite" /Gm- /O2 /Fd"Win32\Build\build\Release\build.pdb" /Zc:inline /fp:precise /D "NDEBUG" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /D "WIN32" /D "RENDERTYPESDL=1" /D "MIXERTYPEWIN=1" /D "SDL_USEFOLDER" /D "SDL_TARGET=2" /D "USE_OPENGL=1" /D "POLYMER=1" /D "STARTUP_WINDOW" /D "USE_LIBVPX" /D "HAVE_VORBIS" /D "HAVE_XMP" /errorReport:prompt /WX- /Zc:forScope /arch:SSE2 /Gd /Oy /Oi /MD /Fa"Win32\Build\build\Release\\" /EHs /nologo /Fo"Win32\Build\build\Release\\" /Ot /Fp"Win32\Build\build\Release\build.pch" "$(IntermediateOutputPath)%(Filename)%(Extension).cpp"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">echo char const *%(Filename) = R^"shader( &gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
type %(Identity) &gt;&gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
echo )shader^"; &gt;&gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
cl /c /MP /GS- /analyze- /W3 /wd"4996" /wd"4244" /wd"4018" /wd"4267" /Gy /Zc:wchar_t /I"./include" /I"./include/vpx/" /I"./include/sdl2/" /I"../../source/build/include" /I"../../source/mact/include" /I"../../source/audiolib/include" /I"../../source/enet/include" /I"../../source/glad/include" /I"../../source/libxmp-lite/include" /I"../../source/libxmp-lite/include/libxmp-lite" /Zi /Gm /Od /Fd"Win32\Build\build\Debug\build.pdb" /Zc:inline /fp:precise /D "_DEBUG" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /D "WIN32" /D "RENDERTYPESDL=1" /D "MIXERTYPEWIN=1" /D "SDL_USEFOLDER" /D "SDL_TARGET=2" /D "USE_OPENGL=1" /D "POLYMER=1" /D "STARTUP_WINDOW" /D "USE_LIBVPX" /D "HAVE_VORBIS" /D "HAVE_XMP" /errorReport:prompt /WX- /Zc:forScope /RTC1 /arch:SSE2 /Gd /Oy- /MDd /Fa"Win32\Build\build\Debug\\" /EHs /nologo /Fo"Win32\Build\build\Debug\\" /Fp"Win32\Build\build\Debug\build.pch" $(IntermediateOutputPath)%(Filename)%(Extension).cpp</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling shader to %(Identity).obj</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling shader to %(Identity).obj</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">echo char const *%(Filename) = R^"shader( &gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
type %(Identity) &gt;&gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
echo )shader^"; &gt;&gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
cl /c /MP /GS /GL /W3 /wd"4996" /wd"4244" /wd"4018" /wd"4267" /Gy /Zc:wchar_t /I"./include" /I"./include/vpx/" /I"./include/sdl2/" /I"../../source/build/include" /I"../../source/mact/include" /I"../../source/audiolib/include" /I"../../source/enet/include" /I"../../source/glad/include" /I"../../source/libxmp-lite/include" /I"../../source/libxmp-lite/include/libxmp-lite" /Gm- /O2 /Fd"x64\Build\build\Release\build.pdb" /Zc:inline /fp:precise /D "NDEBUG" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /D "WIN32" /D "RENDERTYPESDL=1" /D "MIXERTYPEWIN=1" /D "SDL_USEFOLDER" /D "SDL_TARGET=2" /D "USE_OPENGL=1" /D "POLYMER=1" /D "STARTUP_WINDOW" /D "USE_LIBVPX" /D "HAVE_VORBIS" /D "HAVE_XMP" /D "NOASM=1" /errorReport:prompt /WX- /Zc:forScope /Gd /Oy /Oi /MD /Fa"x64\Build\build\Release\\" /EHs /nologo /Fo"x64\Build\build\Release\\" /Ot /Fp"x64\Build\build\Release\build.pch" $(IntermediateOutputPath)%(Filename)%(Extension).cpp</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">echo char const *%(Filename) = R^"shader( &gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
type %(Identity) &gt;&gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
echo )shader^"; &gt;&gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
cl /c /MP /GS- /W3 /wd"4996" /wd"4244" /wd"4018" /wd"4267" /Gy /Zc:wchar_t /I"./include" /I"./include/vpx/" /I"./include/sdl2/" /I"../../source/build/include" /I"../../source/mact/include" /I"../../source/audiolib/include" /I"../../source/enet/include" /I"../../source/glad/include" /I"../../source/libxmp-lite/include" /I"../../source/libxmp-lite/include/libxmp-lite" /Zi /Gm /Od /Fd"x64\Build\build\Debug\build.pdb" /Zc:inline /fp:precise /D "_DEBUG" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /D "WIN32" /D "RENDERTYPESDL=1" /D "MIXERTYPEWIN=1" /D "SDL_USEFOLDER" /D "SDL_TARGET=2" /D "USE_OPENGL=1" /D "POLYMER=1" /D "STARTUP_WINDOW" /D "USE_LIBVPX" /D "HAVE_VORBIS" /D "HAVE_XMP" /D "NOASM=1" /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /Oy- /MDd /Fa"x64\Build\build\Debug\\" /EHs /nologo /Fo"x64\Build\build\Debug\\" /Fp"x64\Build\build\Debug\build.pch" $(IntermediateOutputPath)%(Filename)%(Extension).cpp</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compiling shader to %(Identity).obj</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compiling shader to %(Identity).obj</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntermediateOutputPath)%(Filename)%(Extension).obj;$(IntermediateOutputPath)%(Filename)%(Extension).cpp</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntermediateOutputPath)%(Filename)%(Extension).obj;$(IntermediateOutputPath)%(Filename)%(Extension).cpp</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntermediateOutputPath)%(Filename)%(Extension).obj;$(IntermediateOutputPath)%(Filename)%(Extension).cpp</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntermediateOutputPath)%(Filename)%(Extension).obj;$(IntermediateOutputPath)%(Filename)%(Extension).cpp</Outputs>
</CustomBuild>
<CustomBuild Include="..\..\source\build\src\polymost1Vert.glsl">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mkdir %(RelativeDir)generated
echo char const *%(Filename) = R^"shader( &gt; %(RelativeDir)generated\%(Filename)%(Extension).h
type %(Identity) &gt;&gt; %(RelativeDir)generated\%(Filename)%(Extension).h
echo )shader^"; &gt;&gt; %(RelativeDir)generated\%(Filename)%(Extension).h</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Creating header from %(Identity)</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(RelativeDir)\generated\%(Filename)%(Extension).h</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">echo char const *%(Filename) = R^"shader( &gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
type %(Identity) &gt;&gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
echo )shader^"; &gt;&gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
cl /c /MP /GS /GL /analyze- /W3 /wd"4996" /wd"4244" /wd"4018" /wd"4267" /Gy /Zc:wchar_t /I"./include" /I"./include/vpx/" /I"./include/sdl2/" /I"../../source/build/include" /I"../../source/mact/include" /I"../../source/audiolib/include" /I"../../source/enet/include" /I"../../source/glad/include" /I"../../source/libxmp-lite/include" /I"../../source/libxmp-lite/include/libxmp-lite" /Gm- /O2 /Fd"Win32\Build\build\Release\build.pdb" /Zc:inline /fp:precise /D "NDEBUG" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /D "WIN32" /D "RENDERTYPESDL=1" /D "MIXERTYPEWIN=1" /D "SDL_USEFOLDER" /D "SDL_TARGET=2" /D "USE_OPENGL=1" /D "POLYMER=1" /D "STARTUP_WINDOW" /D "USE_LIBVPX" /D "HAVE_VORBIS" /D "HAVE_XMP" /errorReport:prompt /WX- /Zc:forScope /arch:SSE2 /Gd /Oy /Oi /MD /Fa"Win32\Build\build\Release\\" /EHs /nologo /Fo"Win32\Build\build\Release\\" /Ot /Fp"Win32\Build\build\Release\build.pch" "$(IntermediateOutputPath)%(Filename)%(Extension).cpp"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">echo char const *%(Filename) = R^"shader( &gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
type %(Identity) &gt;&gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
echo )shader^"; &gt;&gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
cl /c /MP /GS- /analyze- /W3 /wd"4996" /wd"4244" /wd"4018" /wd"4267" /Gy /Zc:wchar_t /I"./include" /I"./include/vpx/" /I"./include/sdl2/" /I"../../source/build/include" /I"../../source/mact/include" /I"../../source/audiolib/include" /I"../../source/enet/include" /I"../../source/glad/include" /I"../../source/libxmp-lite/include" /I"../../source/libxmp-lite/include/libxmp-lite" /Zi /Gm /Od /Fd"Win32\Build\build\Debug\build.pdb" /Zc:inline /fp:precise /D "_DEBUG" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /D "WIN32" /D "RENDERTYPESDL=1" /D "MIXERTYPEWIN=1" /D "SDL_USEFOLDER" /D "SDL_TARGET=2" /D "USE_OPENGL=1" /D "POLYMER=1" /D "STARTUP_WINDOW" /D "USE_LIBVPX" /D "HAVE_VORBIS" /D "HAVE_XMP" /errorReport:prompt /WX- /Zc:forScope /RTC1 /arch:SSE2 /Gd /Oy- /MDd /Fa"Win32\Build\build\Debug\\" /EHs /nologo /Fo"Win32\Build\build\Debug\\" /Fp"Win32\Build\build\Debug\build.pch" $(IntermediateOutputPath)%(Filename)%(Extension).cpp</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling shader to %(Identity).obj</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling shader to %(Identity).obj</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">echo char const *%(Filename) = R^"shader( &gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
type %(Identity) &gt;&gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
echo )shader^"; &gt;&gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
cl /c /MP /GS /GL /W3 /wd"4996" /wd"4244" /wd"4018" /wd"4267" /Gy /Zc:wchar_t /I"./include" /I"./include/vpx/" /I"./include/sdl2/" /I"../../source/build/include" /I"../../source/mact/include" /I"../../source/audiolib/include" /I"../../source/enet/include" /I"../../source/glad/include" /I"../../source/libxmp-lite/include" /I"../../source/libxmp-lite/include/libxmp-lite" /Gm- /O2 /Fd"x64\Build\build\Release\build.pdb" /Zc:inline /fp:precise /D "NDEBUG" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /D "WIN32" /D "RENDERTYPESDL=1" /D "MIXERTYPEWIN=1" /D "SDL_USEFOLDER" /D "SDL_TARGET=2" /D "USE_OPENGL=1" /D "POLYMER=1" /D "STARTUP_WINDOW" /D "USE_LIBVPX" /D "HAVE_VORBIS" /D "HAVE_XMP" /D "NOASM=1" /errorReport:prompt /WX- /Zc:forScope /Gd /Oy /Oi /MD /Fa"x64\Build\build\Release\\" /EHs /nologo /Fo"x64\Build\build\Release\\" /Ot /Fp"x64\Build\build\Release\build.pch" $(IntermediateOutputPath)%(Filename)%(Extension).cpp</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">echo char const *%(Filename) = R^"shader( &gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
type %(Identity) &gt;&gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
echo )shader^"; &gt;&gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp
cl /c /MP /GS- /W3 /wd"4996" /wd"4244" /wd"4018" /wd"4267" /Gy /Zc:wchar_t /I"./include" /I"./include/vpx/" /I"./include/sdl2/" /I"../../source/build/include" /I"../../source/mact/include" /I"../../source/audiolib/include" /I"../../source/enet/include" /I"../../source/glad/include" /I"../../source/libxmp-lite/include" /I"../../source/libxmp-lite/include/libxmp-lite" /Zi /Gm /Od /Fd"x64\Build\build\Debug\build.pdb" /Zc:inline /fp:precise /D "_DEBUG" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /D "WIN32" /D "RENDERTYPESDL=1" /D "MIXERTYPEWIN=1" /D "SDL_USEFOLDER" /D "SDL_TARGET=2" /D "USE_OPENGL=1" /D "POLYMER=1" /D "STARTUP_WINDOW" /D "USE_LIBVPX" /D "HAVE_VORBIS" /D "HAVE_XMP" /D "NOASM=1" /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /Oy- /MDd /Fa"x64\Build\build\Debug\\" /EHs /nologo /Fo"x64\Build\build\Debug\\" /Fp"x64\Build\build\Debug\build.pch" $(IntermediateOutputPath)%(Filename)%(Extension).cpp</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compiling shader to %(Identity).obj</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compiling shader to %(Identity).obj</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntermediateOutputPath)%(Filename)%(Extension).obj;$(IntermediateOutputPath)%(Filename)%(Extension).cpp</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntermediateOutputPath)%(Filename)%(Extension).obj;$(IntermediateOutputPath)%(Filename)%(Extension).cpp</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntermediateOutputPath)%(Filename)%(Extension).obj;$(IntermediateOutputPath)%(Filename)%(Extension).cpp</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntermediateOutputPath)%(Filename)%(Extension).obj;$(IntermediateOutputPath)%(Filename)%(Extension).cpp</Outputs>
</CustomBuild>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View file

@ -154,6 +154,8 @@ static vec2f_t tilesheetHalfTexelSize = { 0.f, 0.f };
static int32_t lastbasepal = -1;
static FHardwareTexture *paletteTextureIDs[MAXBASEPALS];
static FHardwareTexture *palswapTextureID = nullptr;
extern char const *polymost1Frag;
extern char const *polymost1Vert;
static GLuint polymost1CurrentShaderProgramID = 0;
static GLuint polymost1BasicShaderProgramID = 0;
static GLuint polymost1ExtendedShaderProgramID = 0;
@ -891,9 +893,6 @@ void polymost_glinit()
fogRangeLoc = glGetUniformLocation(polymost2BasicShaderProgramID, "u_fogRange");
fogColorLoc = glGetUniformLocation(polymost2BasicShaderProgramID, "u_fogColor");
#include "generated/polymost1Vert.glsl.h"
#include "generated/polymost1Frag.glsl.h"
polymost1ExtendedShaderProgramID = glCreateProgram();
GLuint polymost1BasicVertexShaderID = polymost2_compileShader(GL_VERTEX_SHADER, polymost1Vert);
GLuint polymost1ExtendedFragmentShaderID = polymost2_compileShader(GL_FRAGMENT_SHADER, polymost1Frag);