|
|
@@ -409,7 +409,7 @@ namespace bgfx
|
|
|
|
|
|
struct Preprocessor
|
|
|
{
|
|
|
- Preprocessor(const char* _filePath, bool _gles, const char* _includeDir = NULL)
|
|
|
+ Preprocessor(const char* _filePath, bool _essl, const char* _includeDir = NULL)
|
|
|
: m_tagptr(m_tags)
|
|
|
, m_scratchPos(0)
|
|
|
, m_fgetsPos(0)
|
|
|
@@ -451,7 +451,7 @@ namespace bgfx
|
|
|
addInclude(_includeDir);
|
|
|
}
|
|
|
|
|
|
- if (!_gles)
|
|
|
+ if (!_essl)
|
|
|
{
|
|
|
m_default = "#define lowp\n#define mediump\n#define highp\n";
|
|
|
}
|
|
|
@@ -779,9 +779,10 @@ namespace bgfx
|
|
|
|
|
|
uint32_t glsl = 0;
|
|
|
uint32_t essl = 0;
|
|
|
- uint32_t hlsl = 2;
|
|
|
+ uint32_t hlsl = 0;
|
|
|
uint32_t d3d = 11;
|
|
|
uint32_t metal = 0;
|
|
|
+ uint32_t pssl = 0;
|
|
|
const char* profile = cmdLine.findOption('p', "profile");
|
|
|
if (NULL != profile)
|
|
|
{
|
|
|
@@ -806,6 +807,10 @@ namespace bgfx
|
|
|
{
|
|
|
metal = 1;
|
|
|
}
|
|
|
+ else if (0 == strcmp(profile, "pssl") )
|
|
|
+ {
|
|
|
+ pssl = 1;
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
glsl = atoi(profile);
|
|
|
@@ -881,12 +886,14 @@ namespace bgfx
|
|
|
preprocessor.setDefaultDefine("BX_PLATFORM_LINUX");
|
|
|
preprocessor.setDefaultDefine("BX_PLATFORM_NACL");
|
|
|
preprocessor.setDefaultDefine("BX_PLATFORM_OSX");
|
|
|
+ preprocessor.setDefaultDefine("BX_PLATFORM_PS4");
|
|
|
preprocessor.setDefaultDefine("BX_PLATFORM_WINDOWS");
|
|
|
preprocessor.setDefaultDefine("BX_PLATFORM_XBOX360");
|
|
|
- // preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_ESSL");
|
|
|
+// preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_ESSL");
|
|
|
preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_GLSL");
|
|
|
preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_HLSL");
|
|
|
preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_METAL");
|
|
|
+ preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_PSSL");
|
|
|
preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_COMPUTE");
|
|
|
preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_FRAGMENT");
|
|
|
preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_VERTEX");
|
|
|
@@ -939,6 +946,11 @@ namespace bgfx
|
|
|
preprocessor.setDefine("BX_PLATFORM_XBOX360=1");
|
|
|
preprocessor.setDefine("BGFX_SHADER_LANGUAGE_HLSL=3");
|
|
|
}
|
|
|
+ else if (0 == bx::stricmp(platform, "orbis") )
|
|
|
+ {
|
|
|
+ preprocessor.setDefine("BX_PLATFORM_PS4=1");
|
|
|
+ preprocessor.setDefine("BGFX_SHADER_LANGUAGE_PSSL=1");
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
fprintf(stderr, "Unknown platform %s?!", platform);
|
|
|
@@ -1193,6 +1205,10 @@ namespace bgfx
|
|
|
|
|
|
compiled = true;
|
|
|
}
|
|
|
+ else if (0 != pssl)
|
|
|
+ {
|
|
|
+ compiled = compilePSSLShader(cmdLine, 0, input, writer);
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
compiled = compileHLSLShader(cmdLine, d3d, input, writer);
|
|
|
@@ -1354,6 +1370,10 @@ namespace bgfx
|
|
|
compiled = compileGLSLShader(cmdLine, essl, code, writer);
|
|
|
#endif // 0
|
|
|
}
|
|
|
+ else if (0 != pssl)
|
|
|
+ {
|
|
|
+ compiled = compilePSSLShader(cmdLine, 0, preprocessor.m_preprocessed, writer);
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
compiled = compileHLSLShader(cmdLine, d3d, preprocessor.m_preprocessed, writer);
|
|
|
@@ -1467,7 +1487,8 @@ namespace bgfx
|
|
|
"#define mat4 float4x4\n"
|
|
|
);
|
|
|
|
|
|
- if (hlsl < 4)
|
|
|
+ if (hlsl != 0
|
|
|
+ && hlsl < 4)
|
|
|
{
|
|
|
preprocessor.writef(
|
|
|
"#define centroid\n"
|
|
|
@@ -1690,7 +1711,8 @@ namespace bgfx
|
|
|
"\t} \\\n"
|
|
|
);
|
|
|
|
|
|
- if (hlsl <= 3)
|
|
|
+ if (hlsl != 0
|
|
|
+ && hlsl <= 3)
|
|
|
{
|
|
|
// preprocessor.writef(
|
|
|
// "\tgl_Position.xy += u_viewTexel.xy * gl_Position.w; \\\n"
|
|
|
@@ -1922,18 +1944,26 @@ namespace bgfx
|
|
|
|
|
|
code += preprocessor.m_preprocessed;
|
|
|
compiled = compileGLSLShader(cmdLine
|
|
|
- , metal ? BX_MAKEFOURCC('M', 'T', 'L', 0) : essl
|
|
|
- , code
|
|
|
- , writer
|
|
|
- );
|
|
|
+ , metal ? BX_MAKEFOURCC('M', 'T', 'L', 0) : essl
|
|
|
+ , code
|
|
|
+ , writer
|
|
|
+ );
|
|
|
+ }
|
|
|
+ else if (0 != pssl)
|
|
|
+ {
|
|
|
+ compiled = compilePSSLShader(cmdLine
|
|
|
+ , 0
|
|
|
+ , preprocessor.m_preprocessed
|
|
|
+ , writer
|
|
|
+ );
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
compiled = compileHLSLShader(cmdLine
|
|
|
- , d3d
|
|
|
- , preprocessor.m_preprocessed
|
|
|
- , writer
|
|
|
- );
|
|
|
+ , d3d
|
|
|
+ , preprocessor.m_preprocessed
|
|
|
+ , writer
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
bx::close(writer);
|