1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-23 03:02:53 +01:00

Limit shaderlog writing behind log_programs setting

This commit is contained in:
msuih 2019-05-31 17:41:33 +03:00 committed by Ivan
parent f2cac26154
commit ef587d4cdc
5 changed files with 12 additions and 7 deletions

View File

@ -129,8 +129,8 @@ struct D3D12Traits
fragmentProgramData.FragmentConstantOffsetCache.push_back(offset);
}
}
fs::file(fs::get_cache_dir() + "shaderlog/FragmentProgram" + std::to_string(ID) + ".hlsl", fs::rewrite).write(shader);
if (g_cfg.video.log_programs)
fs::file(fs::get_cache_dir() + "shaderlog/FragmentProgram" + std::to_string(ID) + ".hlsl", fs::rewrite).write(shader);
fragmentProgramData.id = (u32)ID;
}
@ -141,7 +141,8 @@ struct D3D12Traits
std::string shaderCode = VS.Decompile();
vertexProgramData.Compile(shaderCode, Shader::SHADER_TYPE::SHADER_TYPE_VERTEX);
vertexProgramData.vertex_shader_input_count = RSXVP.rsx_vertex_inputs.size();
fs::file(fs::get_cache_dir() + "shaderlog/VertexProgram" + std::to_string(ID) + ".hlsl", fs::rewrite).write(shaderCode);
if (g_cfg.video.log_programs)
fs::file(fs::get_cache_dir() + "shaderlog/VertexProgram" + std::to_string(ID) + ".hlsl", fs::rewrite).write(shaderCode);
vertexProgramData.id = (u32)ID;
}

View File

@ -12,6 +12,7 @@
#include "../GCM.h"
#include "../Common/TextureUtils.h"
#include "Emu/System.h"
#include "Utilities/geometry.h"
#define GL_FRAGMENT_TEXTURES_START 0
@ -2421,7 +2422,7 @@ public:
{
const char* str = src.c_str();
const GLint length = (GLint)src.length();
if (g_cfg.video.log_programs)
{
std::string base_name;
switch (shader_type)

View File

@ -358,7 +358,8 @@ void GLVertexProgram::Compile()
const char* str = shader.c_str();
const int strlen = ::narrow<int>(shader.length());
fs::file(fs::get_cache_dir() + "shaderlog/VertexProgram" + std::to_string(id) + ".glsl", fs::rewrite).write(str);
if (g_cfg.video.log_programs)
fs::file(fs::get_cache_dir() + "shaderlog/VertexProgram" + std::to_string(id) + ".glsl", fs::rewrite).write(str);
glShaderSource(id, 1, &str, &strlen);
glCompileShader(id);

View File

@ -455,7 +455,8 @@ void VKFragmentProgram::Decompile(const RSXFragmentProgram& prog)
void VKFragmentProgram::Compile()
{
fs::file(fs::get_cache_dir() + "shaderlog/FragmentProgram" + std::to_string(id) + ".spirv", fs::rewrite).write(shader.get_source());
if (g_cfg.video.log_programs)
fs::file(fs::get_cache_dir() + "shaderlog/FragmentProgram" + std::to_string(id) + ".spirv", fs::rewrite).write(shader.get_source());
handle = shader.compile();
}

View File

@ -365,7 +365,8 @@ void VKVertexProgram::Decompile(const RSXVertexProgram& prog)
void VKVertexProgram::Compile()
{
fs::file(fs::get_cache_dir() + "shaderlog/VertexProgram" + std::to_string(id) + ".spirv", fs::rewrite).write(shader.get_source());
if (g_cfg.video.log_programs)
fs::file(fs::get_cache_dir() + "shaderlog/VertexProgram" + std::to_string(id) + ".spirv", fs::rewrite).write(shader.get_source());
handle = shader.compile();
}