Rename shaderhlsl to shadersources
and updateshaders to update
This commit is contained in:
parent
a7bc6a307d
commit
93e36f7be3
|
@ -684,8 +684,8 @@ void CxbxInitWindow(bool bFullInit)
|
|||
ImGui_ImplWin32_Shutdown();
|
||||
});
|
||||
|
||||
g_ShaderHlsl.UpdateShaders();
|
||||
g_ShaderHlsl.InitShaderHotloading();
|
||||
g_ShaderSources.Update();
|
||||
g_ShaderSources.InitShaderHotloading();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@ bool IsTextureSampled(DecodedRegisterCombiner* pShader, int reg)
|
|||
|
||||
void BuildShader(DecodedRegisterCombiner* pShader, std::stringstream& hlsl)
|
||||
{
|
||||
hlsl << g_ShaderHlsl.pixelShaderTemplateHlsl[0]; // Start with the HLSL template header
|
||||
hlsl << g_ShaderSources.pixelShaderTemplateHlsl[0]; // Start with the HLSL template header
|
||||
|
||||
hlsl << "\n#define ALPHAKILL {"
|
||||
<< (pShader->AlphaKill[0] ? "true, " : "false, ")
|
||||
|
@ -338,7 +338,7 @@ void BuildShader(DecodedRegisterCombiner* pShader, std::stringstream& hlsl)
|
|||
OutputDefineFlag(hlsl, pShader->FinalCombiner.ClampSum, "PS_FINALCOMBINERSETTING_CLAMP_SUM");
|
||||
hlsl << '\n';
|
||||
|
||||
hlsl << g_ShaderHlsl.pixelShaderTemplateHlsl[1];
|
||||
hlsl << g_ShaderSources.pixelShaderTemplateHlsl[1];
|
||||
|
||||
// Generate all four texture stages
|
||||
for (unsigned i = 0; i < PSH_XBOX_MAX_T_REGISTER_COUNT; i++) {
|
||||
|
@ -385,7 +385,7 @@ void BuildShader(DecodedRegisterCombiner* pShader, std::stringstream& hlsl)
|
|||
|
||||
FinalCombinerStageHlsl(hlsl, pShader->FinalCombiner, pShader->hasFinalCombiner);
|
||||
|
||||
hlsl << g_ShaderHlsl.pixelShaderTemplateHlsl[2]; // Finish with the HLSL template footer
|
||||
hlsl << g_ShaderSources.pixelShaderTemplateHlsl[2]; // Finish with the HLSL template footer
|
||||
}
|
||||
|
||||
// recompile xbox pixel shader function
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include <thread>
|
||||
//#include <sstream>
|
||||
|
||||
ShaderHlsl g_ShaderHlsl;
|
||||
ShaderSources g_ShaderSources;
|
||||
|
||||
std::string DebugPrependLineNumbers(std::string shaderString) {
|
||||
std::stringstream shader(shaderString);
|
||||
|
@ -166,7 +166,7 @@ std::ifstream OpenWithRetry(const std::string& path) {
|
|||
return fstream;
|
||||
}
|
||||
|
||||
int ShaderHlsl::UpdateShaders() {
|
||||
int ShaderSources::Update() {
|
||||
int versionOnDisk = shaderVersionOnDisk;
|
||||
if (shaderVersionLoadedFromDisk != versionOnDisk) {
|
||||
LoadShadersFromDisk();
|
||||
|
@ -176,7 +176,7 @@ int ShaderHlsl::UpdateShaders() {
|
|||
return shaderVersionLoadedFromDisk;
|
||||
}
|
||||
|
||||
void ShaderHlsl::LoadShadersFromDisk() {
|
||||
void ShaderSources::LoadShadersFromDisk() {
|
||||
const auto hlslDir = std::filesystem::path(szFilePath_CxbxReloaded_Exe)
|
||||
.parent_path()
|
||||
.append("hlsl");
|
||||
|
@ -262,7 +262,7 @@ void ShaderHlsl::LoadShadersFromDisk() {
|
|||
}
|
||||
}
|
||||
|
||||
void ShaderHlsl::InitShaderHotloading() {
|
||||
void ShaderSources::InitShaderHotloading() {
|
||||
static std::thread fsWatcherThread;
|
||||
|
||||
if (fsWatcherThread.joinable()) {
|
||||
|
@ -303,7 +303,7 @@ void ShaderHlsl::InitShaderHotloading() {
|
|||
}
|
||||
|
||||
EmuLog(LOG_LEVEL::DEBUG, "Change detected in shader folder");
|
||||
g_ShaderHlsl.shaderVersionOnDisk += 1;
|
||||
g_ShaderSources.shaderVersionOnDisk += 1;
|
||||
}
|
||||
else {
|
||||
EmuLog(LOG_LEVEL::ERROR2, "Shader filewatcher failed to get the next notification");
|
||||
|
|
|
@ -11,7 +11,7 @@ extern HRESULT EmuCompileShader
|
|||
const char* pSourceName = nullptr
|
||||
);
|
||||
|
||||
struct ShaderHlsl {
|
||||
struct ShaderSources {
|
||||
// Pixel Shader
|
||||
std::string pixelShaderTemplateHlsl[3];
|
||||
|
||||
|
@ -29,7 +29,7 @@ struct ShaderHlsl {
|
|||
|
||||
// Load shaders from disk (if out-of-date)
|
||||
// and return the current loaded shader version
|
||||
int UpdateShaders();
|
||||
int Update();
|
||||
|
||||
// Start a thread to watch for changes in the shader folder
|
||||
void InitShaderHotloading();
|
||||
|
@ -44,4 +44,4 @@ private:
|
|||
int shaderVersionLoadedFromDisk = -1;
|
||||
};
|
||||
|
||||
extern ShaderHlsl g_ShaderHlsl;
|
||||
extern ShaderSources g_ShaderSources;
|
||||
|
|
|
@ -292,9 +292,9 @@ extern HRESULT EmuCompileVertexShader
|
|||
|
||||
// Combine the shader template with the shader program
|
||||
auto hlsl_stream = std::stringstream();
|
||||
hlsl_stream << g_ShaderHlsl.vertexShaderTemplateHlsl[0]; // Start with the HLSL template header
|
||||
hlsl_stream << g_ShaderSources.vertexShaderTemplateHlsl[0]; // Start with the HLSL template header
|
||||
BuildShader(pIntermediateShader, hlsl_stream);
|
||||
hlsl_stream << g_ShaderHlsl.vertexShaderTemplateHlsl[1]; // Finish with the HLSL template footer
|
||||
hlsl_stream << g_ShaderSources.vertexShaderTemplateHlsl[1]; // Finish with the HLSL template footer
|
||||
std::string hlsl_str = hlsl_stream.str();
|
||||
|
||||
auto notionalSourceName = "CxbxVertexShaderTemplate.hlsl";
|
||||
|
@ -312,10 +312,10 @@ extern HRESULT EmuCompileVertexShader
|
|||
|
||||
extern void EmuCompileFixedFunction(ID3DBlob** ppHostShader)
|
||||
{
|
||||
EmuCompileShader(g_ShaderHlsl.fixedFunctionVertexShaderHlsl, g_vs_model, ppHostShader, g_ShaderHlsl.fixedFunctionVertexShaderPath.c_str());
|
||||
EmuCompileShader(g_ShaderSources.fixedFunctionVertexShaderHlsl, g_vs_model, ppHostShader, g_ShaderSources.fixedFunctionVertexShaderPath.c_str());
|
||||
};
|
||||
|
||||
extern void EmuCompileXboxPassthrough(ID3DBlob** ppHostShader)
|
||||
{
|
||||
EmuCompileShader(g_ShaderHlsl.vertexShaderPassthroughHlsl, g_vs_model, ppHostShader, g_ShaderHlsl.vertexShaderPassthroughPath.c_str());
|
||||
EmuCompileShader(g_ShaderSources.vertexShaderPassthroughHlsl, g_vs_model, ppHostShader, g_ShaderSources.vertexShaderPassthroughPath.c_str());
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
#include "core\kernel\support\Emu.h"
|
||||
#include "core\hle\D3D8\Direct3D9\Direct3D9.h" // For g_pD3DDevice, g_pXbox_PixelShader
|
||||
#include "core\hle\D3D8\Direct3D9\Shader.h" // For g_ShaderHlsl
|
||||
#include "core\hle\D3D8\Direct3D9\Shader.h" // For g_ShaderSources
|
||||
#include "core\hle\D3D8\XbPixelShader.h"
|
||||
#include "core\hle\D3D8\Direct3D9\PixelShader.h" // EmuCompilePixelShader
|
||||
#include "core\hle\D3D8\XbD3D8Logging.h" // For D3DErrorString()
|
||||
|
@ -766,7 +766,7 @@ IDirect3DPixelShader9* GetFixedFunctionShader()
|
|||
|
||||
// Support hotloading hlsl
|
||||
static int pixelShaderVersion = -1;
|
||||
int shaderVersion = g_ShaderHlsl.UpdateShaders();
|
||||
int shaderVersion = g_ShaderSources.Update();
|
||||
if (pixelShaderVersion != shaderVersion) {
|
||||
pixelShaderVersion = shaderVersion;
|
||||
g_pD3DDevice->SetPixelShader(nullptr);
|
||||
|
@ -861,7 +861,7 @@ IDirect3DPixelShader9* GetFixedFunctionShader()
|
|||
}
|
||||
|
||||
// Build and compile a new shader
|
||||
std::string hlslTemplate = g_ShaderHlsl.fixedFunctionPixelShaderHlsl;
|
||||
std::string hlslTemplate = g_ShaderSources.fixedFunctionPixelShaderHlsl;
|
||||
|
||||
// In D3D9 it seems we need to know hardcode if we're doing a 2D or 3D lookup
|
||||
const std::string sampleTypePattern = "TEXTURE_SAMPLE_TYPE;";
|
||||
|
@ -1030,7 +1030,7 @@ void DxbxUpdateActivePixelShader() // NOPATCH
|
|||
|
||||
// Support hotloading hlsl
|
||||
static int pixelShaderVersion = -1;
|
||||
int shaderVersion = g_ShaderHlsl.UpdateShaders();
|
||||
int shaderVersion = g_ShaderSources.Update();
|
||||
if (pixelShaderVersion != shaderVersion) {
|
||||
pixelShaderVersion = shaderVersion;
|
||||
g_pD3DDevice->SetPixelShader(nullptr);
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "core\hle\D3D8\Direct3D9\Direct3D9.h" // For g_Xbox_VertexShader_Handle
|
||||
#include "core\hle\D3D8\Direct3D9\RenderStates.h" // For XboxRenderStateConverter
|
||||
#include "core\hle\D3D8\Direct3D9\VertexShaderCache.h" // For g_VertexShaderCache
|
||||
#include "core\hle\D3D8\Direct3D9\Shader.h" // For g_ShaderHlsl
|
||||
#include "core\hle\D3D8\Direct3D9\Shader.h" // For g_ShaderSources
|
||||
#include "core\hle\D3D8\XbVertexBuffer.h" // For CxbxImpl_SetVertexData4f
|
||||
#include "core\hle\D3D8\XbVertexShader.h"
|
||||
#include "core\hle\D3D8\XbD3D8Logging.h" // For DEBUG_D3DRESULT
|
||||
|
@ -1148,7 +1148,7 @@ void CxbxUpdateHostVertexShader()
|
|||
static IDirect3DVertexShader* passthroughShader = nullptr;
|
||||
static int vertexShaderVersion = -1;
|
||||
|
||||
int shaderVersion = g_ShaderHlsl.UpdateShaders();
|
||||
int shaderVersion = g_ShaderSources.Update();
|
||||
if (vertexShaderVersion != shaderVersion) {
|
||||
vertexShaderVersion = shaderVersion;
|
||||
g_pD3DDevice->SetVertexShader(nullptr);
|
||||
|
|
Loading…
Reference in New Issue