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,7 +129,7 @@ struct D3D12Traits
fragmentProgramData.FragmentConstantOffsetCache.push_back(offset);
}
}
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,6 +141,7 @@ 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();
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,6 +358,7 @@ void GLVertexProgram::Compile()
const char* str = shader.c_str();
const int strlen = ::narrow<int>(shader.length());
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);

View File

@ -455,6 +455,7 @@ void VKFragmentProgram::Decompile(const RSXFragmentProgram& prog)
void VKFragmentProgram::Compile()
{
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,6 +365,7 @@ void VKVertexProgram::Decompile(const RSXVertexProgram& prog)
void VKVertexProgram::Compile()
{
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();
}