Cleanup.
This commit is contained in:
parent
15349a45a9
commit
e5b9b8d7aa
@ -58,6 +58,7 @@ Languages:
|
|||||||
* [Go language API bindings](https://github.com/james4k/go-bgfx)
|
* [Go language API bindings](https://github.com/james4k/go-bgfx)
|
||||||
* [Haskell language API bindings](https://github.com/haskell-game/bgfx)
|
* [Haskell language API bindings](https://github.com/haskell-game/bgfx)
|
||||||
* [Java language API bindings](https://github.com/enleeten/twilight-bgfx)
|
* [Java language API bindings](https://github.com/enleeten/twilight-bgfx)
|
||||||
|
* [Lightweight Java Game Library 3 bindings](https://github.com/LWJGL/lwjgl3)
|
||||||
* [Lua language API bindings](https://github.com/excessive/lua-bgfx)
|
* [Lua language API bindings](https://github.com/excessive/lua-bgfx)
|
||||||
* [Nim language API bindings](https://github.com/Halsys/nim-bgfx)
|
* [Nim language API bindings](https://github.com/Halsys/nim-bgfx)
|
||||||
* [Python language API bindings](https://github.com/jnadro/pybgfx#pybgf)
|
* [Python language API bindings](https://github.com/jnadro/pybgfx#pybgf)
|
||||||
|
@ -15,14 +15,14 @@ ifndef TARGET
|
|||||||
.PHONY: all
|
.PHONY: all
|
||||||
all:
|
all:
|
||||||
@echo Usage: make TARGET=# [clean, all, rebuild]
|
@echo Usage: make TARGET=# [clean, all, rebuild]
|
||||||
@echo " TARGET=0 (hlsl - dx9)"
|
@echo " TARGET=0 (hlsl - d3d9)"
|
||||||
@echo " TARGET=1 (hlsl - dx11)"
|
@echo " TARGET=1 (hlsl - d3d11)"
|
||||||
@echo " TARGET=2 (essl - nacl)"
|
@echo " TARGET=2 (essl - nacl)"
|
||||||
@echo " TARGET=3 (essl - android)"
|
@echo " TARGET=3 (essl - android)"
|
||||||
@echo " TARGET=4 (glsl - linux)"
|
@echo " TARGET=4 (glsl)"
|
||||||
@echo " TARGET=5 (metal - osx/ios)"
|
@echo " TARGET=5 (metal)"
|
||||||
@echo " TARGET=6 (pssl - ps4)"
|
@echo " TARGET=6 (pssl)"
|
||||||
@echo " VERBOSE=1 show build commands."
|
@echo " TARGET=7 (spriv)"
|
||||||
else
|
else
|
||||||
|
|
||||||
ifeq ($(TARGET), 0)
|
ifeq ($(TARGET), 0)
|
||||||
|
@ -377,7 +377,7 @@ namespace bgfx
|
|||||||
strReplace(_str, "\r", "\n");
|
strReplace(_str, "\r", "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void printCode(const char* _code, int32_t _line, int32_t _start, int32_t _end)
|
void printCode(const char* _code, int32_t _line, int32_t _start, int32_t _end, int32_t _column)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Code:\n---\n");
|
fprintf(stderr, "Code:\n---\n");
|
||||||
|
|
||||||
@ -386,7 +386,20 @@ namespace bgfx
|
|||||||
{
|
{
|
||||||
if (line >= _start)
|
if (line >= _start)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s%3d: %s", _line == line ? ">>> " : " ", line, lr.getLine().c_str() );
|
if (_line == line)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
fprintf(stderr, ">>> %3d: %s", line, lr.getLine().c_str() );
|
||||||
|
if (-1 != _column)
|
||||||
|
{
|
||||||
|
fprintf(stderr, ">>> %3d: %*s\n", _column, _column, "^");
|
||||||
|
}
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(stderr, " %3d: %s", line, lr.getLine().c_str() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@ namespace bgfx
|
|||||||
BX_MACRO_BLOCK_BEGIN \
|
BX_MACRO_BLOCK_BEGIN \
|
||||||
if (bgfx::g_verbose) \
|
if (bgfx::g_verbose) \
|
||||||
{ \
|
{ \
|
||||||
fprintf(stderr, BX_FILE_LINE_LITERAL "" _format "\n", ##__VA_ARGS__); \
|
fprintf(stdout, BX_FILE_LINE_LITERAL "" _format "\n", ##__VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
BX_MACRO_BLOCK_END
|
BX_MACRO_BLOCK_END
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ namespace bgfx
|
|||||||
|
|
||||||
typedef std::vector<Uniform> UniformArray;
|
typedef std::vector<Uniform> UniformArray;
|
||||||
|
|
||||||
void printCode(const char* _code, int32_t _line = 0, int32_t _start = 0, int32_t _end = INT32_MAX);
|
void printCode(const char* _code, int32_t _line = 0, int32_t _start = 0, int32_t _end = INT32_MAX, int32_t _column = -1);
|
||||||
void strReplace(char* _str, const char* _find, const char* _replace);
|
void strReplace(char* _str, const char* _find, const char* _replace);
|
||||||
int32_t writef(bx::WriterI* _writer, const char* _format, ...);
|
int32_t writef(bx::WriterI* _writer, const char* _format, ...);
|
||||||
void writeFile(const char* _filePath, const void* _data, int32_t _size);
|
void writeFile(const char* _filePath, const void* _data, int32_t _size);
|
||||||
|
@ -48,14 +48,18 @@ namespace bgfx { namespace glsl
|
|||||||
int32_t start = 0;
|
int32_t start = 0;
|
||||||
int32_t end = INT32_MAX;
|
int32_t end = INT32_MAX;
|
||||||
|
|
||||||
if (3 == sscanf(log, "%u:%u(%u):", &source, &line, &column)
|
bool found = false
|
||||||
|
|| 3 == sscanf(log, "%u:%u(%u):", &source, &line, &column)
|
||||||
|
;
|
||||||
|
|
||||||
|
if (found
|
||||||
&& 0 != line)
|
&& 0 != line)
|
||||||
{
|
{
|
||||||
start = bx::uint32_imax(1, line-10);
|
start = bx::uint32_imax(1, line-10);
|
||||||
end = start + 20;
|
end = start + 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
printCode(_code.c_str(), line, start, end);
|
printCode(_code.c_str(), line, start, end, column);
|
||||||
fprintf(stderr, "Error: %s\n", log);
|
fprintf(stderr, "Error: %s\n", log);
|
||||||
glslopt_cleanup(ctx);
|
glslopt_cleanup(ctx);
|
||||||
return false;
|
return false;
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# define __out
|
# define __out
|
||||||
#endif // defined(__MINGW32__)
|
#endif // defined(__MINGW32__)
|
||||||
|
|
||||||
|
#define COM_NO_WINDOWS_H
|
||||||
#include <d3dcompiler.h>
|
#include <d3dcompiler.h>
|
||||||
#include <d3d11shader.h>
|
#include <d3d11shader.h>
|
||||||
#include <bx/os.h>
|
#include <bx/os.h>
|
||||||
@ -67,7 +68,7 @@ namespace bgfx { namespace hlsl
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const D3DCompiler s_d3dcompiler[] =
|
static const D3DCompiler s_d3dcompiler[] =
|
||||||
{ // BK - the only different in interface is GetRequiresFlags at the end
|
{ // BK - the only different method in interface is GetRequiresFlags at the end
|
||||||
// of IID_ID3D11ShaderReflection47 (which is not used anyway).
|
// of IID_ID3D11ShaderReflection47 (which is not used anyway).
|
||||||
{ "D3DCompiler_47.dll", { 0x8d536ca1, 0x0cca, 0x4956, { 0xa8, 0x37, 0x78, 0x69, 0x63, 0x75, 0x55, 0x84 } } },
|
{ "D3DCompiler_47.dll", { 0x8d536ca1, 0x0cca, 0x4956, { 0xa8, 0x37, 0x78, 0x69, 0x63, 0x75, 0x55, 0x84 } } },
|
||||||
{ "D3DCompiler_46.dll", { 0x0a233719, 0x3960, 0x4578, { 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1 } } },
|
{ "D3DCompiler_46.dll", { 0x0a233719, 0x3960, 0x4578, { 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1 } } },
|
||||||
@ -536,7 +537,7 @@ namespace bgfx { namespace hlsl
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool compile(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::string& _code, bx::WriterI* _writer, bool _firstPass)
|
static bool compile(bx::CommandLine& _cmdLine, uint32_t _version, const std::string& _code, bx::WriterI* _writer, bool _firstPass)
|
||||||
{
|
{
|
||||||
const char* profile = _cmdLine.findOption('p', "profile");
|
const char* profile = _cmdLine.findOption('p', "profile");
|
||||||
if (NULL == profile)
|
if (NULL == profile)
|
||||||
@ -616,14 +617,19 @@ namespace bgfx { namespace hlsl
|
|||||||
int32_t start = 0;
|
int32_t start = 0;
|
||||||
int32_t end = INT32_MAX;
|
int32_t end = INT32_MAX;
|
||||||
|
|
||||||
if (2 == sscanf(log, "(%u,%u):", &line, &column)
|
bool found = false
|
||||||
|
|| 2 == sscanf(log, "(%u,%u):", &line, &column)
|
||||||
|
|| 2 == sscanf(log, " :%u:%u: ", &line, &column)
|
||||||
|
;
|
||||||
|
|
||||||
|
if (found
|
||||||
&& 0 != line)
|
&& 0 != line)
|
||||||
{
|
{
|
||||||
start = bx::uint32_imax(1, line - 10);
|
start = bx::uint32_imax(1, line - 10);
|
||||||
end = start + 20;
|
end = start + 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
printCode(_code.c_str(), line, start, end);
|
printCode(_code.c_str(), line, start, end, column);
|
||||||
fprintf(stderr, "Error: D3DCompile failed 0x%08x %s\n", (uint32_t)hr, log);
|
fprintf(stderr, "Error: D3DCompile failed 0x%08x %s\n", (uint32_t)hr, log);
|
||||||
errorMsg->Release();
|
errorMsg->Release();
|
||||||
return false;
|
return false;
|
||||||
@ -634,7 +640,7 @@ namespace bgfx { namespace hlsl
|
|||||||
uint16_t attrs[bgfx::Attrib::Count];
|
uint16_t attrs[bgfx::Attrib::Count];
|
||||||
uint16_t size = 0;
|
uint16_t size = 0;
|
||||||
|
|
||||||
if (_d3d == 9)
|
if (_version == 9)
|
||||||
{
|
{
|
||||||
if (!getReflectionDataD3D9(code, uniforms) )
|
if (!getReflectionDataD3D9(code, uniforms) )
|
||||||
{
|
{
|
||||||
@ -687,7 +693,7 @@ namespace bgfx { namespace hlsl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// recompile with the unused uniforms converted to statics
|
// recompile with the unused uniforms converted to statics
|
||||||
return compileHLSLShader(_cmdLine, _d3d, output.c_str(), _writer);
|
return compileHLSLShader(_cmdLine, _version, output.c_str(), _writer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -742,7 +748,7 @@ namespace bgfx { namespace hlsl
|
|||||||
bx::write(_writer, nul);
|
bx::write(_writer, nul);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_d3d > 9)
|
if (_version > 9)
|
||||||
{
|
{
|
||||||
bx::write(_writer, numAttrs);
|
bx::write(_writer, numAttrs);
|
||||||
bx::write(_writer, attrs, numAttrs*sizeof(uint16_t) );
|
bx::write(_writer, attrs, numAttrs*sizeof(uint16_t) );
|
||||||
|
Loading…
Reference in New Issue
Block a user