Skip to content

Commit ac2ce5c

Browse files
committed
Pull out compile settings from OpModuleProcessed, use for re-compilation
1 parent 346419f commit ac2ce5c

13 files changed

+535
-105
lines changed

renderdoc/driver/gl/gl_driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <algorithm>
2828
#include "common/common.h"
2929
#include "data/glsl_shaders.h"
30-
#include "driver/shaders/spirv/spirv_common.h"
30+
#include "driver/shaders/spirv/spirv_compile.h"
3131
#include "jpeg-compressor/jpge.h"
3232
#include "maths/matrix.h"
3333
#include "maths/vec.h"

renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "../gl_driver.h"
2727
#include "../gl_shader_refl.h"
2828
#include "common/common.h"
29-
#include "driver/shaders/spirv/spirv_common.h"
29+
#include "driver/shaders/spirv/spirv_compile.h"
3030
#include "serialise/string_utils.h"
3131

3232
void WrappedOpenGL::ShaderData::Compile(WrappedOpenGL &gl, ResourceId id)
@@ -73,8 +73,11 @@ void WrappedOpenGL::ShaderData::Compile(WrappedOpenGL &gl, ResourceId id)
7373

7474
vector<uint32_t> spirvwords;
7575

76-
SPIRVCompilationSettings settings(SPIRVSourceLanguage::OpenGLGLSL,
77-
SPIRVShaderStage(ShaderIdx(type)));
76+
SPIRVCompilationSettings settings;
77+
78+
settings.lang = SPIRVSourceLanguage::OpenGLGLSL;
79+
settings.entryPoint = "main";
80+
settings.stage = SPIRVShaderStage(ShaderIdx(type));
7881

7982
string s = CompileSPIRV(settings, sources, spirvwords);
8083
if(!spirvwords.empty())

renderdoc/driver/shaders/spirv/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ if(UNIX)
8989
endif()
9090

9191
set(sources
92-
spirv_common.cpp
9392
spirv_common.h
9493
spirv_compile.cpp
94+
spirv_compile.h
9595
spirv_disassemble.cpp
9696
${glslang_sources})
9797

renderdoc/driver/shaders/spirv/renderdoc_spirv.vcxproj

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<PreprocessorDefinitions>RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
6060
</ClCompile>
6161
</ItemDefinitionGroup>
62-
<ItemDefinitionGroup>
62+
<ItemDefinitionGroup>
6363
<ClCompile>
6464
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
6565
<RuntimeTypeInfo>false</RuntimeTypeInfo>
@@ -145,12 +145,6 @@
145145
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
146146
<ForcedIncludeFiles>precompiled.h</ForcedIncludeFiles>
147147
</ClCompile>
148-
<ClCompile Include="spirv_common.cpp">
149-
<WarningLevel>Level4</WarningLevel>
150-
<PrecompiledHeader>Use</PrecompiledHeader>
151-
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
152-
<ForcedIncludeFiles>precompiled.h</ForcedIncludeFiles>
153-
</ClCompile>
154148
<ClCompile Include="spirv_compile.cpp">
155149
<WarningLevel>Level4</WarningLevel>
156150
<PrecompiledHeader>Use</PrecompiledHeader>
@@ -217,6 +211,7 @@
217211
<ClInclude Include="..\..\..\3rdparty\glslang\SPIRV\spvIR.h" />
218212
<ClInclude Include="precompiled.h" />
219213
<ClInclude Include="spirv_common.h" />
214+
<ClInclude Include="spirv_compile.h" />
220215
</ItemGroup>
221216
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
222217
<ImportGroup Label="ExtensionTargets">

renderdoc/driver/shaders/spirv/renderdoc_spirv.vcxproj.filters

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@
107107
</ClCompile>
108108
<ClCompile Include="spirv_compile.cpp" />
109109
<ClCompile Include="spirv_disassemble.cpp" />
110-
<ClCompile Include="spirv_common.cpp" />
111110
<ClCompile Include="..\..\..\3rdparty\glslang\hlsl\hlslGrammar.cpp">
112111
<Filter>3rdparty\glslang</Filter>
113112
</ClCompile>
@@ -300,5 +299,6 @@
300299
<ClInclude Include="precompiled.h">
301300
<Filter>PCH</Filter>
302301
</ClInclude>
302+
<ClInclude Include="spirv_compile.h" />
303303
</ItemGroup>
304304
</Project>

renderdoc/driver/shaders/spirv/spirv_common.cpp

Lines changed: 0 additions & 50 deletions
This file was deleted.

renderdoc/driver/shaders/spirv/spirv_common.h

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -29,42 +29,11 @@
2929
#include <utility>
3030
#include <vector>
3131
#include "3rdparty/glslang/SPIRV/spirv.hpp"
32+
#include "api/replay/renderdoc_replay.h"
3233

3334
using std::string;
3435
using std::vector;
3536

36-
enum class SPIRVShaderStage
37-
{
38-
Vertex,
39-
TessControl,
40-
TessEvaluation,
41-
Geometry,
42-
Fragment,
43-
Compute,
44-
Invalid,
45-
};
46-
47-
enum class SPIRVSourceLanguage
48-
{
49-
Unknown,
50-
OpenGLGLSL,
51-
VulkanGLSL,
52-
VulkanHLSL,
53-
};
54-
55-
struct SPIRVCompilationSettings
56-
{
57-
SPIRVCompilationSettings(SPIRVSourceLanguage l, SPIRVShaderStage s) : stage(s), lang(l) {}
58-
SPIRVCompilationSettings() = default;
59-
60-
SPIRVShaderStage stage = SPIRVShaderStage::Invalid;
61-
SPIRVSourceLanguage lang = SPIRVSourceLanguage::Unknown;
62-
std::string entryPoint;
63-
};
64-
65-
void InitSPIRVCompiler();
66-
void ShutdownSPIRVCompiler();
67-
6837
struct SPVInstruction;
6938

7039
enum class ShaderStage : uint32_t;
@@ -105,6 +74,7 @@ struct SPVModule
10574
spv::SourceLanguage sourceLang;
10675
uint32_t sourceVer;
10776

77+
ShaderCompileFlags compileFlags;
10878
vector<std::pair<string, string>> sourceFiles;
10979

11080
vector<string> extensions;
@@ -132,6 +102,4 @@ struct SPVModule
132102
ShaderBindpointMapping &mapping, SPIRVPatchData &patchData);
133103
};
134104

135-
string CompileSPIRV(const SPIRVCompilationSettings &settings, const vector<string> &sources,
136-
vector<uint32_t> &spirv);
137105
void ParseSPIRV(uint32_t *spirv, size_t spirvLength, SPVModule &module);

0 commit comments

Comments
 (0)