コード例 #1
0
ファイル: svga_tgsi_decl_sm30.c プロジェクト: notaz/mesa
boolean
svga_translate_decl_sm30( struct svga_shader_emitter *emit,
                          const struct tgsi_full_declaration *decl )
{
   unsigned first = decl->Range.First;
   unsigned last = decl->Range.Last;
   unsigned idx;

   for( idx = first; idx <= last; idx++ ) {
      boolean ok = TRUE;

      switch (decl->Declaration.File) {
      case TGSI_FILE_SAMPLER:
         assert (emit->unit == PIPE_SHADER_FRAGMENT);
         /* just keep track of the number of samplers here.
          * Will emit the declaration in the helpers function.
          */
         emit->num_samplers = MAX2(emit->num_samplers, decl->Range.Last + 1);
         break;

      case TGSI_FILE_INPUT:
         if (emit->unit == PIPE_SHADER_VERTEX)
            ok = vs30_input( emit, decl->Semantic, idx );
         else
            ok = ps30_input( emit, decl->Semantic, idx );
         break;

      case TGSI_FILE_OUTPUT:
         if (emit->unit == PIPE_SHADER_VERTEX)
            ok = vs30_output( emit, decl->Semantic, idx );
         else
            ok = ps30_output( emit, decl->Semantic, idx );
         break;

      case TGSI_FILE_SAMPLER_VIEW:
         {
            unsigned unit = decl->Range.First;
            assert(decl->Range.First == decl->Range.Last);
            emit->sampler_target[unit] = decl->SamplerView.Resource;
         }
         break;

      default:
         /* don't need to declare other vars */
         ok = TRUE;
      }

      if (!ok)
         return FALSE;
   }

   return TRUE;
}
コード例 #2
0
boolean
svga_translate_decl_sm30( struct svga_shader_emitter *emit,
                          const struct tgsi_full_declaration *decl )
{
   unsigned first = decl->Range.First;
   unsigned last = decl->Range.Last;
   unsigned idx;

   for( idx = first; idx <= last; idx++ ) {
      boolean ok;

      switch (decl->Declaration.File) {
      case TGSI_FILE_SAMPLER:
         assert (emit->unit == PIPE_SHADER_FRAGMENT);
         ok = ps30_sampler( emit, decl->Semantic, idx );
         break;

      case TGSI_FILE_INPUT:
         if (emit->unit == PIPE_SHADER_VERTEX)
            ok = vs30_input( emit, decl->Semantic, idx );
         else
            ok = ps30_input( emit, decl->Semantic, idx );
         break;

      case TGSI_FILE_OUTPUT:
         if (emit->unit == PIPE_SHADER_VERTEX)
            ok = vs30_output( emit, decl->Semantic, idx );
         else
            ok = ps30_output( emit, decl->Semantic, idx );
         break;

      default:
         /* don't need to declare other vars */
         ok = TRUE;
      }

      if (!ok)
         return FALSE;
   }

   return TRUE;
}