From f8d2936840482b9132a751466c3c056c5988fa9a Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Wed, 27 Mar 2013 00:13:23 +0100 Subject: [PATCH] Fix Windows build, try 3. --- .../Plugin_VideoDX11/Src/LineGeometryShader.cpp | 13 +++++++------ .../Plugin_VideoDX11/Src/PointGeometryShader.cpp | 11 ++++++----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Source/Plugins/Plugin_VideoDX11/Src/LineGeometryShader.cpp b/Source/Plugins/Plugin_VideoDX11/Src/LineGeometryShader.cpp index 3afd38a2e1..74c58e8d17 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/LineGeometryShader.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/LineGeometryShader.cpp @@ -182,11 +182,12 @@ bool LineGeometryShader::SetShader(u32 components, float lineWidth, if (shaderIt == m_shaders.end()) { // Generate new shader. Warning: not thread-safe. - static char code[16384]; - char* p = code; - p = GenerateVSOutputStruct(p, components, API_D3D11); - p += sprintf(p, "\n%s", LINE_GS_COMMON); - + static char buffer[16384]; + ShaderCode code; + code.SetBuffer(buffer); + GenerateVSOutputStruct(code, components, API_D3D11); + code.Write("\n%s", LINE_GS_COMMON); + std::stringstream numTexCoordsStream; numTexCoordsStream << xfregs.numTexGen.numTexGens; @@ -198,7 +199,7 @@ bool LineGeometryShader::SetShader(u32 components, float lineWidth, { "NUM_TEXCOORDS", numTexCoordsStr.c_str() }, { NULL, NULL } }; - ID3D11GeometryShader* newShader = D3D::CompileAndCreateGeometryShader(code, unsigned int(strlen(code)), macros); + ID3D11GeometryShader* newShader = D3D::CompileAndCreateGeometryShader(code.GetBuffer(), unsigned int(strlen(code.GetBuffer())), macros); if (!newShader) { WARN_LOG(VIDEO, "Line geometry shader for components 0x%.08X failed to compile", components); diff --git a/Source/Plugins/Plugin_VideoDX11/Src/PointGeometryShader.cpp b/Source/Plugins/Plugin_VideoDX11/Src/PointGeometryShader.cpp index ad23786610..e6cea19ce9 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/PointGeometryShader.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/PointGeometryShader.cpp @@ -176,10 +176,11 @@ bool PointGeometryShader::SetShader(u32 components, float pointSize, if (shaderIt == m_shaders.end()) { // Generate new shader. Warning: not thread-safe. - static char code[16384]; - char* p = code; - p = GenerateVSOutputStruct(p, components, API_D3D11); - p += sprintf(p, "\n%s", POINT_GS_COMMON); + static char buffer[16384]; + ShaderCode code; + code.SetBuffer(buffer); + GenerateVSOutputStruct(code, components, API_D3D11); + code.Write("\n%s", POINT_GS_COMMON); std::stringstream numTexCoordsStream; numTexCoordsStream << xfregs.numTexGen.numTexGens; @@ -192,7 +193,7 @@ bool PointGeometryShader::SetShader(u32 components, float pointSize, { "NUM_TEXCOORDS", numTexCoordsStr.c_str() }, { NULL, NULL } }; - ID3D11GeometryShader* newShader = D3D::CompileAndCreateGeometryShader(code, unsigned int(strlen(code)), macros); + ID3D11GeometryShader* newShader = D3D::CompileAndCreateGeometryShader(code.GetBuffer(), unsigned int(strlen(code.GetBuffer())), macros); if (!newShader) { WARN_LOG(VIDEO, "Point geometry shader for components 0x%.08X failed to compile", components);