Ver código fonte

Fixed shaderc.

Branimir Karadžić 7 anos atrás
pai
commit
d4d453a1dd
1 arquivos alterados com 13 adições e 7 exclusões
  1. 13 7
      tools/shaderc/shaderc.cpp

+ 13 - 7
tools/shaderc/shaderc.cpp

@@ -414,8 +414,18 @@ namespace bgfx
 	class File
 	{
 	public:
-		File(const bx::FilePath& _filePath)
+		File()
 			: m_data(NULL)
+			, m_size(0)
+		{
+		}
+
+		~File()
+		{
+			delete [] m_data;
+		}
+
+		void load(const bx::FilePath& _filePath)
 		{
 			bx::FileReader reader;
 			if (bx::open(&reader, _filePath) )
@@ -437,11 +447,6 @@ namespace bgfx
 			}
 		}
 
-		~File()
-		{
-			delete [] m_data;
-		}
-
 		const char* getData() const
 		{
 			return m_data;
@@ -2403,12 +2408,13 @@ namespace bgfx
 		else
 		{
 			const char* varying = NULL;
+			File attribdef;
 
 			if ('c' != options.shaderType)
 			{
 				std::string defaultVarying = dir + "varying.def.sc";
 				const char* varyingdef = cmdLine.findOption("varyingdef", defaultVarying.c_str() );
-				File attribdef(varyingdef);
+				attribdef.load(varyingdef);
 				varying = attribdef.getData();
 				if (NULL     != varying
 				&&  *varying != '\0')