brw_wm.h File Reference

Include dependency graph for brw_wm.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  brw_wm_prog_key
struct  brw_wm_compile

Defines

#define IZ_PS_KILL_ALPHATEST_BIT   0x1
#define IZ_PS_COMPUTES_DEPTH_BIT   0x2
#define IZ_DEPTH_WRITE_ENABLE_BIT   0x4
#define IZ_DEPTH_TEST_ENABLE_BIT   0x8
#define IZ_STENCIL_WRITE_ENABLE_BIT   0x10
#define IZ_STENCIL_TEST_ENABLE_BIT   0x20
#define IZ_EARLY_DEPTH_TEST_BIT   0x40
#define IZ_BIT_MAX   0x80
#define AA_NEVER   0
#define AA_SOMETIMES   1
#define AA_ALWAYS   2
#define PROGRAM_INTERNAL_PARAM
#define MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS   1024
#define BRW_WM_MAX_INSN   (MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS*3 + PIPE_MAX_ATTRIBS + 3)
#define BRW_WM_MAX_GRF   128
#define BRW_WM_MAX_VREG   (BRW_WM_MAX_INSN * 4)
#define BRW_WM_MAX_REF   (BRW_WM_MAX_INSN * 12)
#define BRW_WM_MAX_PARAM   256
#define BRW_WM_MAX_CONST   256
#define BRW_WM_MAX_KILLS   MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS
#define PAYLOAD_DEPTH   (PIPE_MAX_ATTRIBS)
#define MAX_IFSN   32
#define MAX_LOOP_DEPTH   32

Functions

void brw_wm_lookup_iz (unsigned line_aa, unsigned lookup, struct brw_wm_prog_key *key)
void brw_wm_glsl_emit (struct brw_wm_compile *c)
void brw_wm_emit_decls (struct brw_wm_compile *c)


Define Documentation

#define AA_ALWAYS   2

Definition at line 56 of file brw_wm.h.

#define AA_NEVER   0

Definition at line 54 of file brw_wm.h.

#define AA_SOMETIMES   1

Definition at line 55 of file brw_wm.h.

#define BRW_WM_MAX_CONST   256

Definition at line 84 of file brw_wm.h.

#define BRW_WM_MAX_GRF   128

Definition at line 80 of file brw_wm.h.

#define BRW_WM_MAX_INSN   (MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS*3 + PIPE_MAX_ATTRIBS + 3)

Definition at line 79 of file brw_wm.h.

#define BRW_WM_MAX_KILLS   MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS

Definition at line 85 of file brw_wm.h.

#define BRW_WM_MAX_PARAM   256

Definition at line 83 of file brw_wm.h.

#define BRW_WM_MAX_REF   (BRW_WM_MAX_INSN * 12)

Definition at line 82 of file brw_wm.h.

#define BRW_WM_MAX_VREG   (BRW_WM_MAX_INSN * 4)

Definition at line 81 of file brw_wm.h.

#define IZ_BIT_MAX   0x80

Definition at line 52 of file brw_wm.h.

#define IZ_DEPTH_TEST_ENABLE_BIT   0x8

Definition at line 48 of file brw_wm.h.

#define IZ_DEPTH_WRITE_ENABLE_BIT   0x4

Definition at line 47 of file brw_wm.h.

#define IZ_EARLY_DEPTH_TEST_BIT   0x40

Definition at line 51 of file brw_wm.h.

#define IZ_PS_COMPUTES_DEPTH_BIT   0x2

Definition at line 46 of file brw_wm.h.

#define IZ_PS_KILL_ALPHATEST_BIT   0x1

Definition at line 45 of file brw_wm.h.

#define IZ_STENCIL_TEST_ENABLE_BIT   0x20

Definition at line 50 of file brw_wm.h.

#define IZ_STENCIL_WRITE_ENABLE_BIT   0x10

Definition at line 49 of file brw_wm.h.

#define MAX_IFSN   32

Definition at line 89 of file brw_wm.h.

#define MAX_LOOP_DEPTH   32

Definition at line 90 of file brw_wm.h.

#define MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS   1024

Definition at line 78 of file brw_wm.h.

#define PAYLOAD_DEPTH   (PIPE_MAX_ATTRIBS)

Definition at line 87 of file brw_wm.h.

#define PROGRAM_INTERNAL_PARAM

Definition at line 77 of file brw_wm.h.


Function Documentation

void brw_wm_emit_decls ( struct brw_wm_compile c  ) 

Definition at line 337 of file brw_wm_decl.c.

References tgsi_full_declaration::Declaration, tgsi_full_declaration::DeclarationRange, emit_cinterp(), emit_linterp(), tgsi_declaration::File, tgsi_declaration_range::First, brw_wm_compile::fp, tgsi_full_token::FullDeclaration, tgsi_parse_context::FullToken, tgsi_declaration::Interpolate, tgsi_declaration_range::Last, prealloc_reg(), brw_fragment_program::program, release_tmps(), TGSI_FILE_INPUT, TGSI_INTERPOLATE_CONSTANT, TGSI_INTERPOLATE_LINEAR, TGSI_INTERPOLATE_PERSPECTIVE, tgsi_parse_end_of_tokens(), tgsi_parse_free(), tgsi_parse_init(), tgsi_parse_token(), TGSI_TOKEN_TYPE_DECLARATION, TGSI_TOKEN_TYPE_IMMEDIATE, TGSI_TOKEN_TYPE_INSTRUCTION, tgsi_full_token::Token, pipe_shader_state::tokens, tgsi_token::Type, and tgsi_declaration::UsageMask.

00338 {
00339    struct tgsi_parse_context parse;
00340    int done = 0;
00341 
00342    prealloc_reg(c);
00343 
00344    tgsi_parse_init( &parse, c->fp->program.tokens );
00345 
00346    while( !done &&
00347           !tgsi_parse_end_of_tokens( &parse ) ) 
00348    {
00349       tgsi_parse_token( &parse );
00350 
00351       switch( parse.FullToken.Token.Type ) {
00352       case TGSI_TOKEN_TYPE_DECLARATION:
00353       {
00354          const struct tgsi_full_declaration *decl = &parse.FullToken.FullDeclaration;
00355          unsigned first = decl->DeclarationRange.First;
00356          unsigned last = decl->DeclarationRange.Last;
00357          unsigned mask = decl->Declaration.UsageMask; /* ? */
00358          unsigned i;
00359 
00360          if (decl->Declaration.File != TGSI_FILE_INPUT)
00361             break;
00362 
00363          for( i = first; i <= last; i++ ) {
00364             switch (decl->Declaration.Interpolate) {
00365             case TGSI_INTERPOLATE_CONSTANT:
00366                emit_cinterp(c, i, mask);
00367                break;
00368 
00369             case TGSI_INTERPOLATE_LINEAR:
00370                emit_linterp(c, i, mask);
00371                break;
00372 
00373             case TGSI_INTERPOLATE_PERSPECTIVE:
00374                //emit_pinterp(c, i, mask);
00375                emit_linterp(c, i, mask);
00376                break;
00377             }
00378          }
00379          break;
00380       }
00381       case TGSI_TOKEN_TYPE_IMMEDIATE:
00382       case TGSI_TOKEN_TYPE_INSTRUCTION:
00383       default:
00384          done = 1;
00385          break;
00386       }
00387    }
00388 
00389    tgsi_parse_free (&parse);
00390    
00391    release_tmps(c);
00392 }

void brw_wm_glsl_emit ( struct brw_wm_compile c  ) 

Definition at line 998 of file brw_wm_glsl.c.

References assert, brw_address(), BRW_COMPRESSION_NONE, brw_imm_d(), brw_indirect(), brw_init_compile(), brw_MOV(), brw_set_compression_control(), brw_set_src1(), brw_wm_emit_decls(), brw_wm_emit_instruction(), brw_wm_compile::fp, tgsi_full_token::FullInstruction, tgsi_parse_context::FullToken, brw_wm_compile::func, get_addr_reg(), brw_wm_compile::if_insn, brw_wm_compile::loop_insn, offset(), brw_wm_compile::prog_data, brw_fragment_program::program, brw_wm_compile::reg_index, brw_wm_compile::stack, brw_wm_compile::stack_index, TGSI_OPCODE_CAL, tgsi_parse_end_of_tokens(), tgsi_parse_free(), tgsi_parse_init(), tgsi_parse_token(), TGSI_TOKEN_TYPE_DECLARATION, TGSI_TOKEN_TYPE_IMMEDIATE, TGSI_TOKEN_TYPE_INSTRUCTION, tgsi_full_token::Token, pipe_shader_state::tokens, brw_wm_prog_data::total_grf, brw_wm_prog_data::total_scratch, and tgsi_token::Type.

00999 {
01000    struct tgsi_parse_context parse;
01001    struct brw_compile *p = &c->func;
01002 
01003    brw_init_compile(&c->func);
01004    brw_set_compression_control(p, BRW_COMPRESSION_NONE);
01005 
01006    c->reg_index = 0;
01007    c->if_insn = 0;
01008    c->loop_insn = 0;
01009    c->stack_index = brw_indirect(0,0);
01010 
01011    /* Do static register allocation and parameter interpolation:
01012     */
01013    brw_wm_emit_decls( c );
01014 
01015    /* Emit the actual program.  All done with very direct translation,
01016     * hopefully we can improve on this shortly...
01017     */
01018    brw_MOV(p, get_addr_reg(c->stack_index), brw_address(c->stack));
01019 
01020    tgsi_parse_init( &parse, c->fp->program.tokens );
01021 
01022    while( !tgsi_parse_end_of_tokens( &parse ) ) 
01023    {
01024       tgsi_parse_token( &parse );
01025 
01026       switch( parse.FullToken.Token.Type ) {
01027       case TGSI_TOKEN_TYPE_DECLARATION:
01028          /* already done */
01029          break;
01030 
01031       case TGSI_TOKEN_TYPE_IMMEDIATE:
01032          /* not handled yet */
01033          assert(0);
01034          break;
01035 
01036       case TGSI_TOKEN_TYPE_INSTRUCTION:
01037          brw_wm_emit_instruction(c, &parse.FullToken.FullInstruction);
01038          break;
01039 
01040       default:
01041          assert( 0 );
01042       }
01043    }
01044 
01045    tgsi_parse_free (&parse);
01046    
01047    /* Fix up call targets:
01048     */
01049 #if 0
01050    {
01051       unsigned nr_insns = c->fp->program.Base.NumInstructions;
01052       unsigned insn, target_insn;
01053       struct tgsi_full_instruction *inst1, *inst2;
01054       struct brw_instruction *brw_inst1, *brw_inst2;
01055       int offset;
01056       for (insn = 0; insn < nr_insns; insn++) {
01057          inst1 = &c->fp->program.Base.Instructions[insn];
01058          brw_inst1 = inst1->Data;
01059          switch (inst1->Opcode) {
01060          case TGSI_OPCODE_CAL:
01061             target_insn = inst1->BranchTarget;
01062             inst2 = &c->fp->program.Base.Instructions[target_insn];
01063             brw_inst2 = inst2->Data;
01064             offset = brw_inst2 - brw_inst1;
01065             brw_set_src1(brw_inst1, brw_imm_d(offset*16));
01066             break;
01067          default:
01068             break;
01069          }
01070       }
01071    }
01072 #endif
01073 
01074    c->prog_data.total_grf = c->reg_index;
01075    c->prog_data.total_scratch = 0;
01076 }

void brw_wm_lookup_iz ( unsigned  line_aa,
unsigned  lookup,
struct brw_wm_prog_key key 
)

Definition at line 181 of file brw_wm_iz.c.

References brw_wm_prog_key::aa_dest_stencil_reg, AA_NEVER, AA_SOMETIMES, assert, brw_wm_prog_key::computes_depth, dd_present, brw_wm_prog_key::dest_depth_reg, ds_present, IZ_BIT_MAX, IZ_PS_COMPUTES_DEPTH_BIT, brw_wm_prog_key::nr_depth_regs, brw_wm_prog_key::runtime_check_aads_emit, sd_present, sd_to_rt, brw_wm_prog_key::source_depth_reg, brw_wm_prog_key::source_depth_to_render_target, and wm_iz_table.

00184 {
00185    unsigned reg = 2;
00186 
00187    assert (lookup < IZ_BIT_MAX);
00188       
00189    if (lookup & IZ_PS_COMPUTES_DEPTH_BIT)
00190       key->computes_depth = 1;
00191 
00192    if (wm_iz_table[lookup].sd_present) {
00193       key->source_depth_reg = reg;
00194       reg += 2;
00195    }
00196 
00197    if (wm_iz_table[lookup].sd_to_rt)
00198       key->source_depth_to_render_target = 1;
00199 
00200    if (wm_iz_table[lookup].ds_present || line_aa != AA_NEVER) {
00201       key->aa_dest_stencil_reg = reg;
00202       key->runtime_check_aads_emit = (!wm_iz_table[lookup].ds_present &&
00203                                       line_aa == AA_SOMETIMES);
00204       reg++;
00205    }
00206 
00207    if (wm_iz_table[lookup].dd_present) {
00208       key->dest_depth_reg = reg;
00209       reg+=2;
00210    }
00211 
00212    key->nr_depth_regs = (reg+1)/2;
00213 }


Generated on Tue Sep 29 06:25:39 2009 for Gallium3D by  doxygen 1.5.4