Lowered min spec shader version to 2.0b. Better shaderc error messages.

This commit is contained in:
bkaradzic 2012-05-14 22:31:40 -07:00
parent 9b132944f5
commit 39610d656e
2 changed files with 21 additions and 14 deletions

View File

@ -190,9 +190,9 @@ namespace bgfx
BGFX_FATAL( (D3DPTEXTURECAPS_SQUAREONLY & m_caps.TextureCaps) == 0, bgfx::Fatal::MinimumRequiredSpecs, "D3DPTEXTURECAPS_SQUAREONLY");
BGFX_FATAL( (D3DPTEXTURECAPS_MIPMAP & m_caps.TextureCaps) == D3DPTEXTURECAPS_MIPMAP, bgfx::Fatal::MinimumRequiredSpecs, "D3DPTEXTURECAPS_MIPMAP");
BGFX_FATAL( (D3DPTEXTURECAPS_ALPHA & m_caps.TextureCaps) == D3DPTEXTURECAPS_ALPHA, bgfx::Fatal::MinimumRequiredSpecs, "D3DPTEXTURECAPS_ALPHA");
BGFX_FATAL(m_caps.VertexShaderVersion >= D3DVS_VERSION(3, 0) && m_caps.PixelShaderVersion >= D3DPS_VERSION(3, 0)
BGFX_FATAL(m_caps.VertexShaderVersion >= D3DVS_VERSION(2, 0) && m_caps.PixelShaderVersion >= D3DPS_VERSION(2, 1)
, bgfx::Fatal::MinimumRequiredSpecs
, "Shader Version is not 3.0 (vs: %x, ps: %x)."
, "Shader Model Version (vs: %x, ps: %x)."
, m_caps.VertexShaderVersion
, m_caps.PixelShaderVersion
);
@ -203,9 +203,10 @@ namespace bgfx
, m_caps.MaxTextureHeight
);
BX_TRACE("Max vertex shader instr. slots: %d", m_caps.MaxVertexShader30InstructionSlots);
BX_TRACE("Max vertex shader 3.0 instr. slots: %d", m_caps.MaxVertexShader30InstructionSlots);
BX_TRACE("Max vertex shader constants: %d", m_caps.MaxVertexShaderConst);
BX_TRACE("Max fragment shader instr slots: %d", m_caps.MaxPixelShader30InstructionSlots);
BX_TRACE("Max fragment shader 2.0 instr. slots: %d", m_caps.PS20Caps.NumInstructionSlots);
BX_TRACE("Max fragment shader 3.0 instr. slots: %d", m_caps.MaxPixelShader30InstructionSlots);
m_fmtNULL = SUCCEEDED(m_d3d9->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, D3DFMT_NULL) );
m_fmtDF16 = SUCCEEDED(m_d3d9->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, D3DFMT_DF16) );

View File

@ -195,7 +195,8 @@ bool compileGLSLShader(CommandLine& _cmdLine, const std::string& _code, const ch
if( !glslopt_get_status(shader) )
{
fprintf(stderr, "Error %s\n%s\n", _code.c_str(), glslopt_get_log(shader) );
fprintf(stderr, "Code:\n---\n%s\n---\n", _code.c_str() );
fprintf(stderr, "Error: %s\n", glslopt_get_log(shader) );
glslopt_cleanup(ctx);
return false;
}
@ -274,7 +275,8 @@ bool compileHLSLShader(CommandLine& _cmdLine, const std::string& _code, const ch
);
if (FAILED(hr) )
{
fprintf(stderr, "0x%08x: %s\n", hr, errorMsg->GetBufferPointer() );
fprintf(stderr, "Code:\n---\n%s\n---\n", _code.c_str() );
fprintf(stderr, "Error: 0x%08x %s\n", hr, errorMsg->GetBufferPointer() );
return false;
}
@ -457,16 +459,14 @@ struct Preprocessor
FILE* file = fopen(m_filePath, "r");
long int size = fsize(file);
char* input = new char[size+1];
fread(input, size, 1, file);
size = fread(input, 1, size, file);
input[size] = '\0';
fclose(file);
m_input = m_default;
m_input += input;
fclose(file);
fppTag* tagptr = m_tagptr;
tagptr->tag = FPPTAG_END;
@ -609,13 +609,19 @@ int main(int _argc, const char* _argv[])
return EXIT_FAILURE;
}
if (0 == _stricmp(type, "fragment") )
switch (tolower(type[0]) )
{
case 'f':
preprocessor.setDefine("BGFX_SHADER_TYPE_FRAGMENT=1");
}
else
{
break;
case 'v':
preprocessor.setDefine("BGFX_SHADER_TYPE_VERTEX=1");
break;
default:
fprintf(stderr, "Unknown type: %s?!", type);
return EXIT_FAILURE;
}
if (preprocessor.run() )