TEST_F(ShaderExtensionTest, FragDepthExtRequiresExt) { // Extension is required to compile properly. mResources.EXT_frag_depth = 0; InitializeCompiler(); TestShaderExtension(FragDepthExtShdr, 2, false); }
TEST_F(ShaderExtensionTest, TextureLODExtRequiresPragma) { // Pragma is required to compile properly. mResources.EXT_shader_texture_lod = 1; InitializeCompiler(); TestShaderExtension(&TextureLODShdr[1], 1, false); }
TEST_F(ShaderExtensionTest, TextureLODExtCompiles) { // Test that it compiles properly with extension enabled. mResources.EXT_shader_texture_lod = 1; InitializeCompiler(); TestShaderExtension(TextureLODShdr, 2, true); }
TEST_F(ShaderExtensionTest, StandDerivExtRequiresPragma) { // Pragma is required to compile properly. mResources.OES_standard_derivatives = 1; InitializeCompiler(); TestShaderExtension(&StandDerivExtShdr[1], 1, false); }
TEST_F(ShaderExtensionTest, FragDepthExtRequiresPragma) { // Pragma is required to compile properly. mResources.EXT_frag_depth = 1; InitializeCompiler(); TestShaderExtension(&FragDepthExtShdr[1], 1, false); }
TEST_F(ShaderExtensionTest, StandDerivExtCompiles) { // Test that it compiles properly with extension enabled. mResources.OES_standard_derivatives = 1; InitializeCompiler(); TestShaderExtension(StandDerivExtShdr, 2, true); }
TEST_F(ShaderExtensionTest, StandDerivExtRequiresExt) { // Extension is required to compile properly. mResources.OES_standard_derivatives = 0; InitializeCompiler(); TestShaderExtension(StandDerivExtShdr, 2, false); }
TEST_F(ShaderExtensionTest, FragDepthExtCompiles) { // Test that it compiles properly with extension enabled. mResources.EXT_frag_depth = 1; InitializeCompiler(); TestShaderExtension(FragDepthExtShdr, 2, true); }
TEST_F(ShaderExtensionTest, TextureLODExtRequiresExt) { // Extension is required to compile properly. mResources.EXT_shader_texture_lod = 0; InitializeCompiler(); TestShaderExtension(TextureLODShdr, 2, false); }
TEST_F(ShaderExtensionTest, FragDepthExtResetsInternalStates) { // Test that extension internal states are reset properly between compiles. mResources.EXT_frag_depth = 1; InitializeCompiler(); TestShaderExtension(FragDepthExtShdr, 2, true); TestShaderExtension(&FragDepthExtShdr[1], 1, false); TestShaderExtension(FragDepthExtShdr, 2, true); }
// The GLES SL 3.0 built-in variable gl_FragDepth compiles with GLES SL 3.0. TEST_P(FragDepthTest, CompileSucceedsESSL300) { static const char shaderString[] = "precision mediump float;\n" "void main() { \n" " gl_FragDepth = 1.0;\n" "}\n"; InitializeCompiler(); EXPECT_TRUE(TestShaderCompile(ESSLVersion300, "", shaderString)); }
TEST_F(ShaderExtensionTest, TextureLODExtResetsInternalStates) { // Test that extension internal states are reset properly between compiles. mResources.EXT_shader_texture_lod = 1; InitializeCompiler(); TestShaderExtension(&TextureLODShdr[1], 1, false); TestShaderExtension(TextureLODShdr, 2, true); TestShaderExtension(&TextureLODShdr[1], 1, false); TestShaderExtension(TextureLODShdr, 2, true); }
TEST_F(ShaderExtensionTest, StandDerivExtResetsInternalStates) { // Test that extension internal states are reset properly between compiles. mResources.OES_standard_derivatives = 1; InitializeCompiler(); TestShaderExtension(StandDerivExtShdr, 2, true); TestShaderExtension(&StandDerivExtShdr[1], 1, false); TestShaderExtension(StandDerivExtShdr, 2, true); TestShaderExtension(&StandDerivExtShdr[1], 1, false); }
// The GLES SL 3.0 built-in variable gl_FragDepth fails to compile with GLES SL 1.0. TEST_P(FragDepthTest, CompileFailsESSL100) { static const char shaderString[] = "precision mediump float;\n" "void main() { \n" " gl_FragDepth = 1.0;\n" "}\n"; InitializeCompiler(); EXPECT_FALSE(TestShaderCompile(ESSLVersion100, "", shaderString)); EXPECT_FALSE(TestShaderCompile("", "", shaderString)); EXPECT_FALSE(TestShaderCompile("", EXTFDPragma, shaderString)); }
// Test a bug where we could modify the value of a builtin variable. TEST_F(ShaderExtensionTest, BuiltinRewritingBug) { mResources.MaxDrawBuffers = 4; mResources.EXT_draw_buffers = 1; InitializeCompiler(); const std::string &shaderString = "#extension GL_EXT_draw_buffers : require\n" "precision mediump float;\n" "void main() {\n" " gl_FragData[gl_MaxDrawBuffers] = vec4(0.0);\n" "}"; const char *shaderStrings[] = { shaderString.c_str() }; TestShaderExtension(shaderStrings, 1, false); TestShaderExtension(shaderStrings, 1, false); }
// Using #extension GL_EXT_frag_depth in GLSL ES 3.0 shader fails to compile. TEST_P(FragDepthTest, ExtensionFDFailsESSL300) { static const char shaderString[] = "precision mediump float;\n" "out vec4 fragColor;\n" "void main() { \n" " fragColor = vec4(1.0);\n" "}\n"; InitializeCompiler(); if (mResources.EXT_frag_depth == 1) { // TODO(kkinnunen, geofflang): this should fail. Extensions need to have similar level // system to SymbolTable. The biggest task is to implement version-aware preprocessor, so // that the extension defines can be defined depending on the version that the preprocessor // saw or did not see. EXPECT_TRUE(TestShaderCompile(ESSLVersion300, EXTFDPragma, shaderString)); } else { EXPECT_FALSE(TestShaderCompile(ESSLVersion300, EXTFDPragma, shaderString)); } }
int main(int argc, char* argv[]) { int l; char *s; clock_t start; start = clock(); message(0,"Nintendo NES High Level Assembler"); message(0,"Version %s, %s",SZ_VERSION,SZ_BUILD_DATE); message(0,"By Brian Provinciano :: http://www.bripro.com"); message(0,""); if(argc < 1) return 3; s = argv[0]; if(strlen(s) > 0) { strcpy(szprogdir,argv[0]); l = strlen(szprogdir)-1; s = szprogdir+l; while(l>0) { if(*s == '/' || *s == '\\') { *s = '\0'; break; } s--; } } else { if(!getcwd(szprogdir, sizeof(szprogdir)-1)) return 3; } l = strlen(szprogdir); if(l && szprogdir[l-1]!='/') { szprogdir[l] = '/'; szprogdir[l+1] = '\0'; } if(!InitConfig()) return 4; ParseCommandLine(argc, argv); sysDirList = includeDirList = libDirList = NULL; l = strlen(szoutdir); if(l && szoutdir[l-1]!='/') { szoutdir[l] = '/'; szoutdir[l+1] = '\0'; } strcpy(outDir,szoutdir); sprintf(szTemp,"%s",szprogdir); AddDirList(&sysDirList, szTemp); sprintf(szTemp,"%sinclude/",szprogdir); printf("Standard includes: %s\n", szTemp); AddDirList(&includeDirList, szTemp); sprintf(szTemp,"%slib/",szprogdir); printf("Standard libs: %s\n", szTemp); AddDirList(&libDirList, szTemp); if(InitializeCompiler()) { message(0,"Compiling file: %s ... \n", szfilename); DoCompile(szfilename); } { float fl = (float)(clock() - start) / CLOCKS_PER_SEC; printf("Compilation time: %f seconds.\n", fl); } if(COMPILE_SUCCESS) { ShutDownCompiler(); PrintTime(); message(MSG_COMPSUCCESS); //if(warnCnt) // getch(); } else // automatically shuts down fatal(FTL_COMPFAIL); message(0,""); return 0; }