Бранимир Караџић 5 yıl önce
ebeveyn
işleme
22df26ab70

+ 6 - 6
tools/shaderc/shaderc.h

@@ -11,12 +11,12 @@ namespace bgfx
 	extern bool g_verbose;
 }
 
-#define _BX_TRACE(_format, ...)                                                               \
-				BX_MACRO_BLOCK_BEGIN                                                          \
-					if (bgfx::g_verbose)                                                      \
-					{                                                                         \
-						fprintf(stdout, BX_FILE_LINE_LITERAL "" _format "\n", ##__VA_ARGS__); \
-					}                                                                         \
+#define _BX_TRACE(_format, ...)                                                          \
+				BX_MACRO_BLOCK_BEGIN                                                     \
+					if (bgfx::g_verbose)                                                 \
+					{                                                                    \
+						bx::printf(BX_FILE_LINE_LITERAL "" _format "\n", ##__VA_ARGS__); \
+					}                                                                    \
 				BX_MACRO_BLOCK_END
 
 #define _BX_WARN(_condition, _format, ...)                        \

+ 2 - 2
tools/shaderc/shaderc_glsl.cpp

@@ -61,7 +61,7 @@ namespace bgfx { namespace glsl
 			}
 
 			printCode(_code.c_str(), line, start, end, column);
-			fprintf(stderr, "Error: %s\n", log);
+			bx::printf("Error: %s\n", log);
 			glslopt_shader_delete(shader);
 			glslopt_cleanup(ctx);
 			return false;
@@ -302,7 +302,7 @@ namespace bgfx { namespace glsl
 						}
 					}
 					char uniformName[256];
-					bx::strCopy(uniformName, parse.getLength() + 1, parse);					
+					bx::strCopy(uniformName, parse.getLength() + 1, parse);
 					un.name = uniformName;
 					const char* regIndexBeg = textureName.getPtr() + textureNameMark.getLength();
 					bx::StringView regIndex = bx::strFind(regIndexBeg, ")");

+ 10 - 10
tools/shaderc/shaderc_hlsl.cpp

@@ -115,7 +115,7 @@ namespace bgfx { namespace hlsl
 			return compiler;
 		}
 
-		fprintf(stderr, "Error: Unable to open D3DCompiler_*.dll shader compiler.\n");
+		bx::printf("Error: Unable to open D3DCompiler_*.dll shader compiler.\n");
 		return NULL;
 	}
 
@@ -311,7 +311,7 @@ namespace bgfx { namespace hlsl
 				uint32_t tableSize = (commentSize - 1) * 4;
 				if (tableSize < sizeof(CTHeader) || header->Size != sizeof(CTHeader) )
 				{
-					fprintf(stderr, "Error: Invalid constant table data\n");
+					bx::printf("Error: Invalid constant table data\n");
 					return false;
 				}
 				break;
@@ -323,7 +323,7 @@ namespace bgfx { namespace hlsl
 
 		if (!header)
 		{
-			fprintf(stderr, "Error: Could not find constant table data\n");
+			bx::printf("Error: Could not find constant table data\n");
 			return false;
 		}
 
@@ -390,7 +390,7 @@ namespace bgfx { namespace hlsl
 			);
 		if (FAILED(hr) )
 		{
-			fprintf(stderr, "Error: D3DReflect failed 0x%08x\n", (uint32_t)hr);
+			bx::printf("Error: D3DReflect failed 0x%08x\n", (uint32_t)hr);
 			return false;
 		}
 
@@ -398,7 +398,7 @@ namespace bgfx { namespace hlsl
 		hr = reflect->GetDesc(&desc);
 		if (FAILED(hr) )
 		{
-			fprintf(stderr, "Error: ID3D11ShaderReflection::GetDesc failed 0x%08x\n", (uint32_t)hr);
+			bx::printf("Error: ID3D11ShaderReflection::GetDesc failed 0x%08x\n", (uint32_t)hr);
 			return false;
 		}
 
@@ -551,7 +551,7 @@ namespace bgfx { namespace hlsl
 
 		if (profile[0] == '\0')
 		{
-			fprintf(stderr, "Error: Shader profile must be specified.\n");
+			bx::printf("Error: Shader profile must be specified.\n");
 			return false;
 		}
 
@@ -646,7 +646,7 @@ namespace bgfx { namespace hlsl
 			}
 
 			printCode(_code.c_str(), line, start, end, column);
-			fprintf(stderr, "Error: D3DCompile failed 0x%08x %s\n", (uint32_t)hr, log);
+			bx::printf("Error: D3DCompile failed 0x%08x %s\n", (uint32_t)hr, log);
 			errorMsg->Release();
 			return false;
 		}
@@ -660,7 +660,7 @@ namespace bgfx { namespace hlsl
 		{
 			if (!getReflectionDataD3D9(code, uniforms) )
 			{
-				fprintf(stderr, "Error: Unable to get D3D9 reflection data.\n");
+				bx::printf("Error: Unable to get D3D9 reflection data.\n");
 				goto error;
 			}
 		}
@@ -669,7 +669,7 @@ namespace bgfx { namespace hlsl
 			UniformNameList unusedUniforms;
 			if (!getReflectionDataD3D11(code, profile[0] == 'v', uniforms, numAttrs, attrs, size, unusedUniforms) )
 			{
-				fprintf(stderr, "Error: Unable to get D3D11 reflection data.\n");
+				bx::printf("Error: Unable to get D3D11 reflection data.\n");
 				goto error;
 			}
 
@@ -833,7 +833,7 @@ namespace bgfx
 	bool compileHLSLShader(const Options& _options, uint32_t _version, const std::string& _code, bx::WriterI* _writer)
 	{
 		BX_UNUSED(_options, _version, _code, _writer);
-		fprintf(stderr, "HLSL compiler is not supported on this platform.\n");
+		bx::printf("HLSL compiler is not supported on this platform.\n");
 		return false;
 	}
 

+ 1 - 1
tools/shaderc/shaderc_pssl.cpp

@@ -10,7 +10,7 @@ namespace bgfx
 	bool compilePSSLShader(const Options& _options, uint32_t _version, const std::string& _code, bx::WriterI* _writer)
 	{
 		BX_UNUSED(_options, _version, _code, _writer);
-		fprintf(stderr, "PSSL compiler is not supported.\n");
+		bx::printf("PSSL compiler is not supported.\n");
 		return false;
 	}