mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-13 17:25:54 +00:00
Put demos temp files in each demo's tmp directory
This commit is contained in:
@@ -76,3 +76,8 @@ std::string GetExecutableName()
|
||||
{
|
||||
return "__undefined__";
|
||||
}
|
||||
|
||||
uint32_t GetPID()
|
||||
{
|
||||
return (uint32_t)getpid();
|
||||
}
|
||||
|
||||
@@ -42,3 +42,4 @@
|
||||
#define MakeDir(dir) mkdir(dir, 0755)
|
||||
|
||||
std::string GetExecutableName();
|
||||
uint32_t GetPID();
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <mach-o/dyld.h>
|
||||
#include <mach/mach.h>
|
||||
#include <unistd.h>
|
||||
#include "test_common.h"
|
||||
|
||||
uint64_t GetMemoryUsage()
|
||||
@@ -95,3 +96,8 @@ std::string GetExecutableName()
|
||||
|
||||
return selfName;
|
||||
}
|
||||
|
||||
uint32_t GetPID()
|
||||
{
|
||||
return (uint32_t)getpid();
|
||||
}
|
||||
|
||||
@@ -42,3 +42,4 @@
|
||||
#define MakeDir(dir) mkdir(dir, 0755)
|
||||
|
||||
std::string GetExecutableName();
|
||||
uint32_t GetPID();
|
||||
|
||||
@@ -38,20 +38,20 @@ RD_TEST(D3D11_Stripped_Shaders, D3D11GraphicsTest)
|
||||
ID3DBlobPtr vsblob = Compile(D3DDefaultVertex, "main", "vs_5_0");
|
||||
ID3DBlobPtr psblob = Compile(D3DDefaultPixel, "main", "ps_5_0");
|
||||
|
||||
WriteBlob(GetCWD() + "/shader_debug.vs", vsblob, false);
|
||||
WriteBlob(GetCWD() + "/shader_debug.ps", psblob, true);
|
||||
WriteBlob(GetCWD() + "tmp/D3D11_Stripped_Shaders/shader_debug.vs", vsblob, false);
|
||||
WriteBlob(GetCWD() + "tmp/D3D11_Stripped_Shaders/shader_debug.ps", psblob, true);
|
||||
|
||||
Strip(vsblob);
|
||||
Strip(psblob);
|
||||
|
||||
SetBlobPath(GetCWD() + "/shader_debug.vs", vsblob);
|
||||
SetBlobPath(GetCWD() + "tmp/D3D11_Stripped_Shaders/shader_debug.vs", vsblob);
|
||||
|
||||
CreateDefaultInputLayout(vsblob);
|
||||
|
||||
ID3D11VertexShaderPtr vs = CreateVS(vsblob);
|
||||
ID3D11PixelShaderPtr ps = CreatePS(psblob);
|
||||
|
||||
SetBlobPath("lz4#shader_debug.ps", ps);
|
||||
SetBlobPath("lz4#tmp/D3D11_Stripped_Shaders/shader_debug.ps", ps);
|
||||
|
||||
ID3D11BufferPtr vb = MakeBuffer().Vertex().Data(DefaultTri);
|
||||
|
||||
|
||||
@@ -1560,6 +1560,9 @@ ID3DBlobPtr D3D12GraphicsTest::Compile(std::string src, std::string entry, std::
|
||||
path.erase(path.find_last_of("/\\"));
|
||||
path += "/tmp/";
|
||||
MakeDir(path.c_str());
|
||||
path += demoName;
|
||||
path += "/";
|
||||
MakeDir(path.c_str());
|
||||
path += "dxcDebugBlobs/";
|
||||
MakeDir(path.c_str());
|
||||
|
||||
|
||||
@@ -342,10 +342,10 @@ void main()
|
||||
GLuint vsShad = glCreateShader(GL_VERTEX_SHADER);
|
||||
GLuint psShad = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
|
||||
std::vector<uint32_t> vsSPIRV =
|
||||
CompileShaderToSpv(vs, SPIRVTarget::opengl, ShaderLang::glsl, ShaderStage::vert, "main");
|
||||
std::vector<uint32_t> fsSPIRV =
|
||||
CompileShaderToSpv(ps, SPIRVTarget::opengl, ShaderLang::glsl, ShaderStage::frag, "main");
|
||||
std::vector<uint32_t> vsSPIRV = CompileShaderToSpv(
|
||||
demoName, vs, SPIRVTarget::opengl, ShaderLang::glsl, ShaderStage::vert, "main");
|
||||
std::vector<uint32_t> fsSPIRV = CompileShaderToSpv(
|
||||
demoName, ps, SPIRVTarget::opengl, ShaderLang::glsl, ShaderStage::frag, "main");
|
||||
|
||||
glShaderBinary(1, &vsShad, GL_SHADER_BINARY_FORMAT_SPIR_V, vsSPIRV.data(),
|
||||
(GLsizei)vsSPIRV.size() * 4);
|
||||
|
||||
@@ -160,9 +160,9 @@ void main()
|
||||
GLuint fs = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
|
||||
std::vector<uint32_t> vsSPIRV = CompileShaderToSpv(
|
||||
vertex, SPIRVTarget::opengl, ShaderLang::glsl, ShaderStage::vert, "main");
|
||||
demoName, vertex, SPIRVTarget::opengl, ShaderLang::glsl, ShaderStage::vert, "main");
|
||||
std::vector<uint32_t> fsSPIRV = CompileShaderToSpv(
|
||||
pixel, SPIRVTarget::opengl, ShaderLang::glsl, ShaderStage::frag, "main");
|
||||
demoName, pixel, SPIRVTarget::opengl, ShaderLang::glsl, ShaderStage::frag, "main");
|
||||
|
||||
glShaderBinary(1, &vs, GL_SHADER_BINARY_FORMAT_SPIR_V, vsSPIRV.data(),
|
||||
(GLsizei)vsSPIRV.size() * 4);
|
||||
|
||||
@@ -83,3 +83,8 @@ std::string GetExecutableName()
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
uint32_t GetPID()
|
||||
{
|
||||
return (uint32_t)getpid();
|
||||
}
|
||||
|
||||
@@ -42,3 +42,4 @@
|
||||
#define MakeDir(dir) mkdir(dir, 0755)
|
||||
|
||||
std::string GetExecutableName();
|
||||
uint32_t GetPID();
|
||||
|
||||
@@ -315,8 +315,9 @@ bool SpvCompilationSupported()
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<uint32_t> CompileShaderToSpv(const std::string &source_text, SPIRVTarget target,
|
||||
ShaderLang lang, ShaderStage stage, const char *entry_point,
|
||||
std::vector<uint32_t> CompileShaderToSpv(const char *demo_name, const std::string &source_text,
|
||||
SPIRVTarget target, ShaderLang lang, ShaderStage stage,
|
||||
const char *entry_point,
|
||||
const std::map<std::string, std::string> ¯os)
|
||||
{
|
||||
std::vector<uint32_t> ret;
|
||||
@@ -409,7 +410,8 @@ std::vector<uint32_t> CompileShaderToSpv(const std::string &source_text, SPIRVTa
|
||||
|
||||
std::string path = GetExecutableName();
|
||||
path.erase(path.find_last_of("/\\"));
|
||||
path += "/tmp";
|
||||
path += "/tmp/";
|
||||
path += demo_name;
|
||||
|
||||
MakeDir(path.c_str());
|
||||
|
||||
|
||||
@@ -85,8 +85,9 @@ enum class ShaderStage
|
||||
|
||||
bool InternalSpvCompiler();
|
||||
bool SpvCompilationSupported();
|
||||
std::vector<uint32_t> CompileShaderToSpv(const std::string &source_text, SPIRVTarget target,
|
||||
ShaderLang lang, ShaderStage stage, const char *entry_point,
|
||||
std::vector<uint32_t> CompileShaderToSpv(const char *demo_name, const std::string &source_text,
|
||||
SPIRVTarget target, ShaderLang lang, ShaderStage stage,
|
||||
const char *entry_point,
|
||||
const std::map<std::string, std::string> ¯os = {});
|
||||
|
||||
struct Vec2f
|
||||
@@ -205,7 +206,7 @@ struct GraphicsTest
|
||||
virtual GraphicsWindow *MakeWindow(int width, int height, const char *title) { return NULL; }
|
||||
virtual int main() { return 9; }
|
||||
virtual void Prepare(int argc, char **argv);
|
||||
virtual void SetName(const char *name) { screenTitle = name; }
|
||||
virtual void SetName(const char *name) { demoName = screenTitle = name; }
|
||||
virtual bool Init();
|
||||
virtual void Shutdown();
|
||||
|
||||
@@ -217,6 +218,7 @@ struct GraphicsTest
|
||||
|
||||
int curFrame = -1;
|
||||
|
||||
const char *demoName = "Unknown_Test";
|
||||
const char *screenTitle = "RenderDoc test program";
|
||||
|
||||
bool headless = false;
|
||||
|
||||
@@ -214,7 +214,7 @@ void main()
|
||||
pipeCreateInfo.vertexInputState.vertexAttributeDescriptions = {};
|
||||
|
||||
std::vector<uint32_t> spirv = ::CompileShaderToSpv(
|
||||
vertex, SPIRVTarget::vulkan12, ShaderLang::glsl, ShaderStage::vert, "main", {});
|
||||
demoName, vertex, SPIRVTarget::vulkan12, ShaderLang::glsl, ShaderStage::vert, "main", {});
|
||||
|
||||
VkShaderModuleCreateInfo vertShad = vkh::ShaderModuleCreateInfo(spirv);
|
||||
|
||||
@@ -235,8 +235,8 @@ void main()
|
||||
libInfo.pNext = NULL;
|
||||
pipeCreateInfo.flags = VK_PIPELINE_CREATE_LIBRARY_BIT_KHR;
|
||||
|
||||
spirv = ::CompileShaderToSpv(pixel, SPIRVTarget::vulkan12, ShaderLang::glsl, ShaderStage::frag,
|
||||
"main", {});
|
||||
spirv = ::CompileShaderToSpv(demoName, pixel, SPIRVTarget::vulkan12, ShaderLang::glsl,
|
||||
ShaderStage::frag, "main", {});
|
||||
|
||||
VkShaderModuleCreateInfo fragShad = vkh::ShaderModuleCreateInfo(spirv);
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ void main()
|
||||
|
||||
{
|
||||
std::vector<uint32_t> spirv = ::CompileShaderToSpv(
|
||||
pixel, SPIRVTarget::vulkan, ShaderLang::glsl, ShaderStage::frag, "main", {});
|
||||
demoName, pixel, SPIRVTarget::vulkan, ShaderLang::glsl, ShaderStage::frag, "main", {});
|
||||
|
||||
if(spirv.empty())
|
||||
return 4;
|
||||
|
||||
@@ -1014,7 +1014,7 @@ VkPipelineShaderStageCreateInfo VulkanGraphicsTest::CompileShaderModule(
|
||||
VkShaderModule ret = VK_NULL_HANDLE;
|
||||
|
||||
std::vector<uint32_t> spirv =
|
||||
::CompileShaderToSpv(source_text, target, lang, stage, entry_point, macros);
|
||||
::CompileShaderToSpv(demoName, source_text, target, lang, stage, entry_point, macros);
|
||||
|
||||
if(spirv.empty())
|
||||
return {};
|
||||
|
||||
@@ -136,3 +136,8 @@ std::string GetExecutableName()
|
||||
|
||||
return Wide2UTF8(curFile);
|
||||
}
|
||||
|
||||
uint32_t GetPID()
|
||||
{
|
||||
return (uint32_t)GetCurrentProcessId();
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ std::string Wide2UTF8(const std::wstring &s);
|
||||
std::wstring UTF82Wide(const std::string &s);
|
||||
|
||||
std::string GetExecutableName();
|
||||
uint32_t GetPID();
|
||||
|
||||
#define DEBUG_BREAK() \
|
||||
do \
|
||||
|
||||
Reference in New Issue
Block a user