mojoshader_opengl.c
branchtrunk
changeset 421 bfd3d95273ec
parent 420 bfcebc3bf560
child 422 1d5eaf3a4c98
equal deleted inserted replaced
420:bfcebc3bf560 421:bfd3d95273ec
   139     int have_base_opengl:1;
   139     int have_base_opengl:1;
   140     int have_GL_ARB_vertex_program:1;
   140     int have_GL_ARB_vertex_program:1;
   141     int have_GL_ARB_fragment_program:1;
   141     int have_GL_ARB_fragment_program:1;
   142     int have_GL_NV_vertex_program2_option:1;
   142     int have_GL_NV_vertex_program2_option:1;
   143     int have_GL_NV_fragment_program2:1;
   143     int have_GL_NV_fragment_program2:1;
       
   144     int have_GL_NV_vertex_program3:1;
   144     int have_GL_ARB_shader_objects:1;
   145     int have_GL_ARB_shader_objects:1;
   145     int have_GL_ARB_vertex_shader:1;
   146     int have_GL_ARB_vertex_shader:1;
   146     int have_GL_ARB_fragment_shader:1;
   147     int have_GL_ARB_fragment_shader:1;
   147     int have_GL_ARB_shading_language_100:1;
   148     int have_GL_ARB_shading_language_100:1;
   148     int have_GL_NV_half_float:1;
   149     int have_GL_NV_half_float:1;
   692     ctx->have_base_opengl = 1;
   693     ctx->have_base_opengl = 1;
   693     ctx->have_GL_ARB_vertex_program = 1;
   694     ctx->have_GL_ARB_vertex_program = 1;
   694     ctx->have_GL_ARB_fragment_program = 1;
   695     ctx->have_GL_ARB_fragment_program = 1;
   695     ctx->have_GL_NV_vertex_program2_option = 1;
   696     ctx->have_GL_NV_vertex_program2_option = 1;
   696     ctx->have_GL_NV_fragment_program2 = 1;
   697     ctx->have_GL_NV_fragment_program2 = 1;
       
   698     ctx->have_GL_NV_vertex_program3 = 1;
   697     ctx->have_GL_ARB_shader_objects = 1;
   699     ctx->have_GL_ARB_shader_objects = 1;
   698     ctx->have_GL_ARB_vertex_shader = 1;
   700     ctx->have_GL_ARB_vertex_shader = 1;
   699     ctx->have_GL_ARB_fragment_shader = 1;
   701     ctx->have_GL_ARB_fragment_shader = 1;
   700     ctx->have_GL_ARB_shading_language_100 = 1;
   702     ctx->have_GL_ARB_shading_language_100 = 1;
   701     ctx->have_GL_NV_half_float = 1;
   703     ctx->have_GL_NV_half_float = 1;
   722     VERIFY_EXT(GL_ARB_vertex_shader, 2, 0);
   724     VERIFY_EXT(GL_ARB_vertex_shader, 2, 0);
   723     VERIFY_EXT(GL_ARB_fragment_shader, 2, 0);
   725     VERIFY_EXT(GL_ARB_fragment_shader, 2, 0);
   724     VERIFY_EXT(GL_ARB_shading_language_100, 2, 0);
   726     VERIFY_EXT(GL_ARB_shading_language_100, 2, 0);
   725     VERIFY_EXT(GL_NV_vertex_program2_option, -1, -1);
   727     VERIFY_EXT(GL_NV_vertex_program2_option, -1, -1);
   726     VERIFY_EXT(GL_NV_fragment_program2, -1, -1);
   728     VERIFY_EXT(GL_NV_fragment_program2, -1, -1);
       
   729     VERIFY_EXT(GL_NV_vertex_program3, -1, -1);
   727     VERIFY_EXT(GL_NV_half_float, -1, -1);
   730     VERIFY_EXT(GL_NV_half_float, -1, -1);
   728 
   731 
   729     #undef VERIFY_EXT
   732     #undef VERIFY_EXT
   730 } // load_extensions
   733 } // load_extensions
   731 
   734 
   755     {
   758     {
   756         MUST_HAVE(MOJOSHADER_PROFILE_NV2, GL_ARB_vertex_program);
   759         MUST_HAVE(MOJOSHADER_PROFILE_NV2, GL_ARB_vertex_program);
   757         MUST_HAVE(MOJOSHADER_PROFILE_NV2, GL_ARB_fragment_program);
   760         MUST_HAVE(MOJOSHADER_PROFILE_NV2, GL_ARB_fragment_program);
   758         MUST_HAVE(MOJOSHADER_PROFILE_NV2, GL_NV_vertex_program2_option);
   761         MUST_HAVE(MOJOSHADER_PROFILE_NV2, GL_NV_vertex_program2_option);
   759         MUST_HAVE(MOJOSHADER_PROFILE_NV2, GL_NV_fragment_program2);
   762         MUST_HAVE(MOJOSHADER_PROFILE_NV2, GL_NV_fragment_program2);
       
   763     } // else if
       
   764 
       
   765     else if (strcmp(profile, MOJOSHADER_PROFILE_NV3) == 0)
       
   766     {
       
   767         MUST_HAVE(MOJOSHADER_PROFILE_NV3, GL_ARB_vertex_program);
       
   768         MUST_HAVE(MOJOSHADER_PROFILE_NV3, GL_ARB_fragment_program);
       
   769         MUST_HAVE(MOJOSHADER_PROFILE_NV3, GL_NV_vertex_program3);
       
   770         MUST_HAVE(MOJOSHADER_PROFILE_NV3, GL_NV_fragment_program2);
   760     } // else if
   771     } // else if
   761     #endif
   772     #endif
   762 
   773 
   763     #if SUPPORT_PROFILE_GLSL
   774     #if SUPPORT_PROFILE_GLSL
   764     else if (strcmp(profile, MOJOSHADER_PROFILE_GLSL120) == 0)
   775     else if (strcmp(profile, MOJOSHADER_PROFILE_GLSL120) == 0)
   806     if (ctx->have_base_opengl)
   817     if (ctx->have_base_opengl)
   807     {
   818     {
   808         static const char *priority[] = {
   819         static const char *priority[] = {
   809             MOJOSHADER_PROFILE_GLSL120,
   820             MOJOSHADER_PROFILE_GLSL120,
   810             MOJOSHADER_PROFILE_GLSL,
   821             MOJOSHADER_PROFILE_GLSL,
       
   822             MOJOSHADER_PROFILE_NV3,
   811             MOJOSHADER_PROFILE_NV2,
   823             MOJOSHADER_PROFILE_NV2,
   812             MOJOSHADER_PROFILE_ARB1,
   824             MOJOSHADER_PROFILE_ARB1,
   813         };
   825         };
   814 
   826 
   815         int i;
   827         int i;
   887     } // if
   899     } // if
   888 #endif
   900 #endif
   889 
   901 
   890 #if SUPPORT_PROFILE_ARB1
   902 #if SUPPORT_PROFILE_ARB1
   891     else if ( (strcmp(profile, MOJOSHADER_PROFILE_ARB1) == 0) ||
   903     else if ( (strcmp(profile, MOJOSHADER_PROFILE_ARB1) == 0) ||
   892               (strcmp(profile, MOJOSHADER_PROFILE_NV2) == 0) )
   904               (strcmp(profile, MOJOSHADER_PROFILE_NV2) == 0) ||
       
   905               (strcmp(profile, MOJOSHADER_PROFILE_NV3) == 0) )
   893     {
   906     {
   894         ctx->profileMaxUniforms = impl_ARB1_MaxUniforms;
   907         ctx->profileMaxUniforms = impl_ARB1_MaxUniforms;
   895         ctx->profileCompileShader = impl_ARB1_CompileShader;
   908         ctx->profileCompileShader = impl_ARB1_CompileShader;
   896         ctx->profileDeleteShader = impl_ARB1_DeleteShader;
   909         ctx->profileDeleteShader = impl_ARB1_DeleteShader;
   897         ctx->profileDeleteProgram = impl_ARB1_DeleteProgram;
   910         ctx->profileDeleteProgram = impl_ARB1_DeleteProgram;