mojoshader.c
changeset 1049 ac4c2e745802
parent 1048 d58bd6348b15
child 1050 56b06b1ebb27
equal deleted inserted replaced
1048:d58bd6348b15 1049:ac4c2e745802
   143     int have_multi_color_outputs;
   143     int have_multi_color_outputs;
   144     int determined_constants_arrays;
   144     int determined_constants_arrays;
   145     int predicated;
   145     int predicated;
   146     int glsl_generated_lit_opcode;
   146     int glsl_generated_lit_opcode;
   147     int glsl_generated_texldd_setup;
   147     int glsl_generated_texldd_setup;
       
   148     int arb1_wrote_position;
   148     int have_preshader;
   149     int have_preshader;
   149     MOJOSHADER_preshader *preshader;
   150     MOJOSHADER_preshader *preshader;
   150 
   151 
   151 #if SUPPORT_PROFILE_ARB1_NV
   152 #if SUPPORT_PROFILE_ARB1_NV
   152     int profile_supports_nv2;
   153     int profile_supports_nv2;
  4008     return (support_nv4(ctx)) ? "FLOAT TEMP" : "TEMP";
  4009     return (support_nv4(ctx)) ? "FLOAT TEMP" : "TEMP";
  4009 } // arb1_float_temp
  4010 } // arb1_float_temp
  4010 
  4011 
  4011 static void emit_ARB1_finalize(Context *ctx)
  4012 static void emit_ARB1_finalize(Context *ctx)
  4012 {
  4013 {
  4013     // !!! FIXME: if we never wrote the position register, add the
  4014     push_output(ctx, &ctx->preflight);
  4014     // !!! FIXME:  position_invariant program option here.
  4015 
       
  4016     if (shader_is_vertex(ctx) && !ctx->arb1_wrote_position)
       
  4017         output_line(ctx, "OPTION ARB_position_invariant;");
  4015 
  4018 
  4016     if (shader_is_pixel(ctx) && ctx->have_multi_color_outputs)
  4019     if (shader_is_pixel(ctx) && ctx->have_multi_color_outputs)
  4017     {
       
  4018         // We have to gamble that you have GL_ARB_draw_buffers.
       
  4019         // You probably do at this point if you have a sane setup.
       
  4020         push_output(ctx, &ctx->preflight);
       
  4021         output_line(ctx, "OPTION ARB_draw_buffers;");
  4020         output_line(ctx, "OPTION ARB_draw_buffers;");
  4022         pop_output(ctx);
  4021 
  4023     } // if
  4022     pop_output(ctx);
  4024 
  4023 
  4025     const char *tmpstr = arb1_float_temp(ctx);
  4024     const char *tmpstr = arb1_float_temp(ctx);
  4026     int i;
  4025     int i;
  4027     push_output(ctx, &ctx->globals);
  4026     push_output(ctx, &ctx->globals);
  4028     for (i = 0; i < ctx->max_scratch_registers; i++)
  4027     for (i = 0; i < ctx->max_scratch_registers; i++)
  4271         else if (regtype == REG_TYPE_OUTPUT)
  4270         else if (regtype == REG_TYPE_OUTPUT)
  4272         {
  4271         {
  4273             switch (usage)
  4272             switch (usage)
  4274             {
  4273             {
  4275                 case MOJOSHADER_USAGE_POSITION:
  4274                 case MOJOSHADER_USAGE_POSITION:
       
  4275                     ctx->arb1_wrote_position = 1;
  4276                     usage_str = "result.position";
  4276                     usage_str = "result.position";
  4277                     break;
  4277                     break;
  4278                 case MOJOSHADER_USAGE_POINTSIZE:
  4278                 case MOJOSHADER_USAGE_POINTSIZE:
  4279                     usage_str = "result.pointsize";
  4279                     usage_str = "result.pointsize";
  4280                     break;
  4280                     break;