nv50/gallium: some new shader stuff
Here's the new and better version of the shader patches I sent some time ago, including some (hopefully) improvements.
I'm probably going to push them next week after pondering them for a while longer, if there are no complaints.
I considered just committing them right away, but well, I'm sending them here just in case ...
There's one quite large patch I considered splitting up more, but that wouldn't work well since it does a lot of restructuring, I added a lot of log text instead ...
Christoph
From 2ccdea8266db2123d382d6375e9942a74c81baf0 Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <e0425955-oe7qfRrRQffzPE21tAIdciO7C/[email protected]>
Date: Thu, 10 Sep 2009 12:00:37 +0200
Subject: [PATCH 01/13] nv50: extend insn src mask function
Extend its usage to avoiding e.g. emission of negation instructions in tx_insn for sources we don't need.
--- src/gallium/drivers/nv50/nv50_program.c | 118 +++++++++++++++++++------------ 1 files changed, 72 insertions(+), 46 deletions(-)
src/gallium/drivers/nv50/nv50_program.c +72 -46
@@ -1159,6 +1159,70 @@ negate_supported(const struct tgsi_full_instruction *insn, int i) } } +/* Return a read mask for source registers deduced from opcode & write mask. */ +static unsigned +nv50_tgsi_src_mask (const struct tgsi_full_instruction *insn,int c) +{ +unsigned x, mask = insn->FullDstRegisters[0 ].DstRegister.WriteMask; + +switch (insn->Instruction.Opcode) { +case TGSI_OPCODE_COS : +case TGSI_OPCODE_SIN : +return (mask &0x8 ) | ((mask &0x7 ) ?0x1 :0x0 ); +case TGSI_OPCODE_DP3 : +return 0x7 ; +case TGSI_OPCODE_DP4 : +case TGSI_OPCODE_DPH : +case TGSI_OPCODE_KIL :/* WriteMask ignored */ +return 0xf ; +case TGSI_OPCODE_DST : +return mask & (c ?0xa :0x6 ); +case TGSI_OPCODE_EX2 : +case TGSI_OPCODE_LG2 : +case TGSI_OPCODE_POW : +case TGSI_OPCODE_RCP : +case TGSI_OPCODE_RSQ : +case TGSI_OPCODE_SCS : +return 0x1 ; +case TGSI_OPCODE_LIT : +return 0xb ; +case TGSI_OPCODE_TEX : +case TGSI_OPCODE_TXP : + { +const struct tgsi_instruction_ext_texture *tex; + +assert (insn->Instruction.Extended); + tex = &insn->InstructionExtTexture; + + mask =0x7 ; +if (insn->Instruction.Opcode ==TGSI_OPCODE_TXP ) + mask |=0x8 ; + +switch (tex->Texture) { +case TGSI_TEXTURE_1D : + mask &=0x9 ; +break ; +case TGSI_TEXTURE_2D : + mask &=0xb ; +break ; +default : +break ; + } + } +return mask; +case TGSI_OPCODE_XPD : + x =0 ; +if (mask &1 ) x |=0x6 ; +if (mask &2 ) x |=0x5 ; +if (mask &4 ) x |=0x3 ; +return x; +default : +break ; + } + +return mask; +} +static struct nv50_reg *tgsi_dst (struct nv50_pc *pc,int c,const struct tgsi_full_dst_register *dst) {
@@ -1310,13 +1374,18 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok)for (i =0 ; i < inst->Instruction.NumSrcRegs; i++) {const struct tgsi_full_src_register *fs = &inst->FullSrcRegisters[i]; +unsigned src_mask; +boolean neg_supp; + + src_mask =nv50_tgsi_src_mask (inst, i); + neg_supp =negate_supported (inst, i);if (fs->SrcRegister.File ==TGSI_FILE_SAMPLER ) unit = fs->SrcRegister.Index;for (c =0 ; c <4 ; c++) - src[i][c] =tgsi_src (pc, c, fs, -negate_supported (inst, i)); +if (src_mask & (1 << c)) + src[i][c] =tgsi_src (pc, c, fs, neg_supp); }if (sat) {
@@ -1636,49 +1705,6 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok)return TRUE; } -/* Adjust a bitmask that indicates what components of a source are used, -* we use this in tx_prep so we only load interpolants that are needed. -*/ -static void -insn_adjust_mask (const struct tgsi_full_instruction *insn,unsigned *mask) -{ -const struct tgsi_instruction_ext_texture *tex; - -switch (insn->Instruction.Opcode) { -case TGSI_OPCODE_DP3 : - *mask =0x7 ; -break ; -case TGSI_OPCODE_DP4 : -case TGSI_OPCODE_DPH : - *mask =0xF ; -break ; -case TGSI_OPCODE_LIT : - *mask =0xB ; -break ; -case TGSI_OPCODE_RCP : -case TGSI_OPCODE_RSQ : - *mask =0x1 ; -break ; -case TGSI_OPCODE_TEX : -case TGSI_OPCODE_TXP : -assert (insn->Instruction.Extended); - tex = &insn->InstructionExtTexture; - - *mask =0x7 ; -if (tex->Texture ==TGSI_TEXTURE_1D ) - *mask =0x1 ; -else -if (tex->Texture ==TGSI_TEXTURE_2D ) - *mask =0x3 ; - -if (insn->Instruction.Opcode ==TGSI_OPCODE_TXP ) - *mask |=0x8 ; -break ; -default : -break ; - } -} -static void prep_inspect_insn (struct nv50_pc *pc,const union tgsi_full_token *tok,unsigned *r_usage[2 ])
@@ -1720,7 +1746,7 @@ prep_inspect_insn(struct nv50_pc *pc, const union tgsi_full_token *tok,continue ; } -insn_adjust_mask (insn, &mask); + mask =nv50_tgsi_src_mask (insn, i);for (c =0 ; c <4 ; c++) {if (!(mask & (1 << c)))
Signature · 1 line
1.6.3.3
From 6751bce2fdae02caecf9123323d5ae22e019c2e0 Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <e0425955-oe7qfRrRQffzPE21tAIdciO7C/[email protected]>
Date: Thu, 10 Sep 2009 13:48:24 +0200
Subject: [PATCH 02/13] nv50: add functions for swizzle resolution
We're going to try to reorder the scalar ops of a vector instr to accomodate swizzles that would otherwise require us to emit to an additional TEMP first (like MOV R0.xy, R0.zx).
--- src/gallium/drivers/nv50/nv50_program.c | 148 ++++++++++++++++++++++++------ 1 files changed, 118 insertions(+), 30 deletions(-)
src/gallium/drivers/nv50/nv50_program.c +118 -30
179 lines not on this page · raw message
Signature · 1 line
1.6.3.3
From 5a05cf1f07102f0d232a3a7f5a25242142ec5e6d Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <e0425955-oe7qfRrRQffzPE21tAIdciO7C/[email protected]>
Date: Thu, 10 Sep 2009 15:49:38 +0200
Subject: [PATCH 03/13] nv50: add nv50_tgsi_insn to handle swizzles safely
--- src/gallium/drivers/nv50/nv50_program.c | 144 +++++++++++++++++++++++++++---- 1 files changed, 125 insertions(+), 19 deletions(-)
src/gallium/drivers/nv50/nv50_program.c +125 -19
204 lines not on this page · raw message
Signature · 1 line
1.6.3.3
From 38bb2aa1d822769d68ac776f00224aa88c778c1a Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <e0425955-oe7qfRrRQffzPE21tAIdciO7C/[email protected]>
Date: Thu, 10 Sep 2009 16:33:54 +0200
Subject: [PATCH 04/13] nv50: use broadcast TEMP reg in tx_insn
Makes some opcode cases nicer and might reduce the total nr of TEMPs required, or save some MOVs.
--- src/gallium/drivers/nv50/nv50_program.c | 88 ++++++++++--------------------- 1 files changed, 28 insertions(+), 60 deletions(-)
src/gallium/drivers/nv50/nv50_program.c +28 -60
160 lines not on this page · raw message
Signature · 1 line
1.6.3.3
From 36313101fb599980be5155c9419f270a8255d958 Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <e0425955-oe7qfRrRQffzPE21tAIdciO7C/[email protected]>
Date: Mon, 7 Sep 2009 18:12:29 +0200
Subject: [PATCH 05/13] nv50: SIN and COS use src0.w for dst.w
Try to save some MOVs.
--- src/gallium/drivers/nv50/nv50_program.c | 36 +++++++++++++++++------------- 1 files changed, 20 insertions(+), 16 deletions(-)
src/gallium/drivers/nv50/nv50_program.c +20 -16
@@ -1337,6 +1337,7 @@ static boolean is_scalar_op(unsigned op) {switch (op) { +case TGSI_OPCODE_COS :case TGSI_OPCODE_DP2 :case TGSI_OPCODE_DP3 :case TGSI_OPCODE_DP4 :
@@ -1346,12 +1347,11 @@ is_scalar_op(unsigned op)case TGSI_OPCODE_POW :case TGSI_OPCODE_RCP :case TGSI_OPCODE_RSQ : +case TGSI_OPCODE_SIN :/* -case TGSI_OPCODE_COS: case TGSI_OPCODE_KIL: case TGSI_OPCODE_LIT: case TGSI_OPCODE_SCS: -case TGSI_OPCODE_SIN: */ return TRUE;default :
@@ -1468,14 +1468,16 @@ nv50_program_tx_insn(struct nv50_pc *pc, }break ;case TGSI_OPCODE_COS : - temp =temp_temp (pc); -emit_precossin (pc, temp, src[0 ][0 ]); -emit_flop (pc,5 , temp, temp); -for (c =0 ; c <4 ; c++) { -if (!(mask & (1 << c))) -continue ; -emit_mov (pc, dst[c], temp); +if (mask &8 ) { +emit_precossin (pc, temp, src[0 ][3 ]); +emit_flop (pc,5 , dst[3 ], temp); +if (!(mask &=7 )) +break ; +if (temp == dst[3 ]) + temp = brdc =temp_temp (pc); } +emit_precossin (pc, temp, src[0 ][0 ]); +emit_flop (pc,5 , brdc, temp);break ;case TGSI_OPCODE_DP3 :emit_mul (pc, temp, src[0 ][0 ], src[1 ][0 ]);
@@ -1612,14 +1614,16 @@ nv50_program_tx_insn(struct nv50_pc *pc, }break ;case TGSI_OPCODE_SIN : - temp =temp_temp (pc); -emit_precossin (pc, temp, src[0 ][0 ]); -emit_flop (pc,4 , temp, temp); -for (c =0 ; c <4 ; c++) { -if (!(mask & (1 << c))) -continue ; -emit_mov (pc, dst[c], temp); +if (mask &8 ) { +emit_precossin (pc, temp, src[0 ][3 ]); +emit_flop (pc,4 , dst[3 ], temp); +if (!(mask &=7 )) +break ; +if (temp == dst[3 ]) + temp = brdc =temp_temp (pc); } +emit_precossin (pc, temp, src[0 ][0 ]); +emit_flop (pc,4 , brdc, temp);break ;case TGSI_OPCODE_SLT :for (c =0 ; c <4 ; c++) {
Signature · 1 line
1.6.3.3
From eab925aa08abff211c7963110003840f8fc14d72 Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <e0425955-oe7qfRrRQffzPE21tAIdciO7C/[email protected]>
Date: Thu, 10 Sep 2009 22:38:09 +0200
Subject: [PATCH 06/13] nv50: handle SEQ, SGT, SLE, SNE opcodes
--- src/gallium/drivers/nv50/nv50_program.c | 91 +++++++++++++++++++++---------- 1 files changed, 61 insertions(+), 30 deletions(-)
src/gallium/drivers/nv50/nv50_program.c +61 -30
153 lines not on this page · raw message
Signature · 1 line
1.6.3.3
From b79a3b863f77866b08c200b025cbcfbca13fdb47 Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <e0425955-oe7qfRrRQffzPE21tAIdciO7C/[email protected]>
Date: Thu, 10 Sep 2009 22:42:57 +0200
Subject: [PATCH 07/13] nv50: handle CEIL and TRUNC opcodes
--- src/gallium/drivers/nv50/nv50_program.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
src/gallium/drivers/nv50/nv50_program.c +16 -0
@@ -1499,6 +1499,14 @@ nv50_program_tx_insn(struct nv50_pc *pc,emit_add (pc, dst[c], src[0 ][c], src[1 ][c]); }break ; +case TGSI_OPCODE_CEIL : +for (c =0 ; c <4 ; c++) { +if (!(mask & (1 << c))) +continue ; +emit_cvt (pc, dst[c], src[0 ][c],-1 , +CVTOP_CEIL ,CVT_F32_F32 ); + } +break ;case TGSI_OPCODE_COS :if (mask &8 ) {emit_precossin (pc, temp, src[0 ][3 ]);
@@ -1678,6 +1686,14 @@ nv50_program_tx_insn(struct nv50_pc *pc,emit_tex (pc, dst, mask, src[0 ], unit, inst->InstructionExtTexture.Texture, TRUE);break ; +case TGSI_OPCODE_TRUNC : +for (c =0 ; c <4 ; c++) { +if (!(mask & (1 << c))) +continue ; +emit_cvt (pc, dst[c], src[0 ][c],-1 , +CVTOP_TRUNC ,CVT_F32_F32 ); + } +break ;case TGSI_OPCODE_XPD : temp =temp_temp (pc);if (mask & (1 <<0 )) {
Signature · 1 line
1.6.3.3
From 985bd5a5f26d66ad6afa2a51a508369a8d1d5b79 Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <e0425955-oe7qfRrRQffzPE21tAIdciO7C/[email protected]>
Date: Thu, 10 Sep 2009 23:44:54 +0200
Subject: [PATCH 08/13] nv50: cleanup nv50_reg initialization a little
--- src/gallium/drivers/nv50/nv50_program.c | 93 ++++++++++++++----------------- 1 files changed, 42 insertions(+), 51 deletions(-)
src/gallium/drivers/nv50/nv50_program.c +42 -51
180 lines not on this page · raw message
Signature · 1 line
1.6.3.3
From 17801b4d71db15041212eb2e50e56afa782f521e Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <e0425955-oe7qfRrRQffzPE21tAIdciO7C/[email protected]>
Date: Sat, 12 Sep 2009 15:36:09 +0200
Subject: [PATCH 09/13] nv50: move allocation of pc regs
Make use of tgsi_shader_info to determine how many nv50_regs we need to allocate, if program uses KIL, or writes DEPR.
--- src/gallium/drivers/nv50/nv50_program.c | 284 ++++++++++++++----------------- 1 files changed, 129 insertions(+), 155 deletions(-)
src/gallium/drivers/nv50/nv50_program.c +129 -155
436 lines not on this page · raw message
Signature · 1 line
1.6.3.3
From 2b379601b411361d7ab92a324425300dcd9a91c2 Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <e0425955-oe7qfRrRQffzPE21tAIdciO7C/[email protected]>
Date: Sat, 12 Sep 2009 21:30:49 +0200
Subject: [PATCH 10/13] nv50: proper linkage between VP and FP
This moves construction of the mapping between VP outputs and FP inputs into validation.
The map also contains slots for special outputs like clip distance and point size, so we need to at least merge the VP related and FP related parts on validation if we want to support those.
Now we match every single FP input component with results from the VP and leave those not read out of the map, or replace those not written by 0 (xyz) or 1 (w). The bitmap indicating linear interpolants is also filled, and flat FP inputs are mapped in only after non-flat ones, as is required.
Furthermore, we can save some space by only fetching VP attrs we actually use, and avoid wasting any output regs because of TGSI using less than 4 components.
--- src/gallium/drivers/nv50/nv50_context.h | 2 + src/gallium/drivers/nv50/nv50_program.c | 408 +++++++++++++++--------- src/gallium/drivers/nv50/nv50_program.h | 28 ++- src/gallium/drivers/nv50/nv50_state_validate.c | 5 + 4 files changed, 283 insertions(+), 160 deletions(-)
src/gallium/drivers/nv50/nv50_context.h +2 -0
@@ -116,6 +116,7 @@ struct nv50_state {unsigned miptree_nr;struct nouveau_stateobj *vertprog;struct nouveau_stateobj *fragprog; +struct nouveau_stateobj *programs;struct nouveau_stateobj *vtxfmt;struct nouveau_stateobj *vtxbuf;struct nouveau_stateobj *vtxattr;
@@ -190,6 +191,7 @@ extern void nv50_clear(struct pipe_context *pipe, unsigned buffers,/* nv50_program.c */ extern void nv50_vertprog_validate (struct nv50_context *nv50);extern void nv50_fragprog_validate (struct nv50_context *nv50); +extern void nv50_linkage_validate (struct nv50_context *nv50);extern void nv50_program_destroy (struct nv50_context *nv50,struct nv50_program *p);/* nv50_state_validate.c */
src/gallium/drivers/nv50/nv50_program.c +256 -152
540 lines not on this page · raw message
src/gallium/drivers/nv50/nv50_program.h +20 -8
@@ -15,6 +15,13 @@ struct nv50_program_exec { } param; }; +struct nv50_sreg4 { +uint8_t hw_id; +uint8_t tgsi_id; +uint8_t mask; +boolean linear; +}; +struct nv50_program {struct pipe_shader_state pipe;struct tgsi_shader_info info;
@@ -36,14 +43,19 @@ struct nv50_program {struct {unsigned high_temp;unsigned high_result; -struct { -unsigned attr[2 ]; - } vp; -struct { -unsigned regs[4 ]; -unsigned map[5 ]; -unsigned high_map; - } fp; + +uint32_t attr[2 ]; +uint32_t regs[4 ]; + +/* for VPs, io_nr doesn't count 'private' results (PSIZ etc.) */ +unsigned io_nr; +struct nv50_sreg4 io[PIPE_MAX_SHADER_OUTPUTS ]; + +/* FP colour inputs, VP/GP back colour outputs */ +struct nv50_sreg4 two_side[2 ]; + +/* VP only */ +uint8_t clpd, clpd_nr; } cfg; };
src/gallium/drivers/nv50/nv50_state_validate.c +5 -0
@@ -189,6 +189,8 @@ nv50_state_emit(struct nv50_context *nv50)so_emit (chan, nv50->state.vertprog);if (nv50->state.dirty &NV50_NEW_FRAGPROG )so_emit (chan, nv50->state.fragprog); +if (nv50->state.dirty & (NV50_NEW_FRAGPROG |NV50_NEW_VERTPROG )) +so_emit (chan, nv50->state.programs);if (nv50->state.dirty &NV50_NEW_RASTERIZER )so_emit (chan, nv50->state.rast);if (nv50->state.dirty &NV50_NEW_BLEND_COLOUR )
@@ -240,6 +242,9 @@ nv50_state_validate(struct nv50_context *nv50)if (nv50->dirty & (NV50_NEW_FRAGPROG |NV50_NEW_FRAGPROG_CB ))nv50_fragprog_validate (nv50); +if (nv50->dirty & (NV50_NEW_FRAGPROG |NV50_NEW_VERTPROG )) +nv50_linkage_validate (nv50); +if (nv50->dirty &NV50_NEW_RASTERIZER )so_ref (nv50->rasterizer->so, &nv50->state.rast);
Signature · 1 line
1.6.3.3
From 4c749e950ad79a9023a2960f17e18d496a3b079e Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <e0425955-oe7qfRrRQffzPE21tAIdciO7C/[email protected]>
Date: Sat, 12 Sep 2009 21:33:56 +0200
Subject: [PATCH 11/13] nv50: add support for light-twoside
--- src/gallium/drivers/nv50/nv50_program.c | 19 +++++++++++++++++++ src/gallium/drivers/nv50/nv50_state.c | 4 +++- 2 files changed, 22 insertions(+), 1 deletions(-)
src/gallium/drivers/nv50/nv50_program.c +19 -0
@@ -2048,6 +2048,11 @@ nv50_program_tx_prep(struct nv50_pc *pc) si = d->Semantic.SemanticIndex;switch (d->Semantic.SemanticName) { +case TGSI_SEMANTIC_BCOLOR : + p->cfg.two_side[si].hw_id = first; +if (p->cfg.io_nr > first) + p->cfg.io_nr = first; +break ;/* case TGSI_SEMANTIC_CLIP_DISTANCE: p->cfg.clpd = MIN2(p->cfg.clpd, first);
@@ -2125,6 +2130,11 @@ nv50_program_tx_prep(struct nv50_pc *pc) p->cfg.io[i].mask |=1 << c; } } + +for (c =0 ; c <2 ; ++c) +if (p->cfg.two_side[c].hw_id <0x40 ) + p->cfg.two_side[c] = p->cfg.io[ + p->cfg.two_side[c].hw_id]; }else if (p->type ==PIPE_SHADER_FRAGMENT ) {int rid, aid;
@@ -2726,6 +2736,15 @@ nv50_linkage_validate(struct nv50_context *nv50) } reg[0 ] += (m -4 ) <<8 ;/* adjust BFC0 id */ + +/* if VP writes any back-face colour, use separate slots */ +if (vp->cfg.two_side[0 ].mask | vp->cfg.two_side[1 ].mask) { + vpo = &vp->cfg.two_side[0 ]; + + m =nv50_sreg4_map (map, m, lin, &fp->cfg.two_side[0 ], &vpo[0 ]); + m =nv50_sreg4_map (map, m, lin, &fp->cfg.two_side[1 ], &vpo[1 ]); + } + reg[0 ] += m -4 ;/* adjust FFC0 id */ reg[4 ] |= m <<8 ;/* set mid where 'normal' FP inputs start */
src/gallium/drivers/nv50/nv50_state.c +3 -1
@@ -264,7 +264,6 @@ nv50_rasterizer_state_create(struct pipe_context *pipe,CALLOC_STRUCT (nv50_rasterizer_stateobj);/*XXX: ignored -* - light_twosize * - point_smooth * - multisample * - point_sprite / sprite_coord_mode
@@ -276,6 +275,9 @@ nv50_rasterizer_state_create(struct pipe_context *pipe,so_method (so, tesla,0x1684 ,1 );so_data (so, cso->flatshade_first ?0 :1 ); +so_method (so, tesla,NV50TCL_VERTEX_TWO_SIDE_ENABLE ,1 ); +so_data (so, cso->light_twoside); +so_method (so, tesla,NV50TCL_LINE_WIDTH ,1 );so_data (so,fui (cso->line_width));so_method (so, tesla,NV50TCL_LINE_SMOOTH_ENABLE ,1 );
Signature · 1 line
1.6.3.3
From 2c6a8d97a2b8ac42d1ab4945e36944bfee25037f Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <e0425955-oe7qfRrRQffzPE21tAIdciO7C/[email protected]>
Date: Sat, 12 Sep 2009 21:36:07 +0200
Subject: [PATCH 12/13] nv50: add support for point size per vertex
--- src/gallium/drivers/nv50/nv50_program.c | 14 ++++++++++++++ src/gallium/drivers/nv50/nv50_program.h | 1 + 2 files changed, 15 insertions(+), 0 deletions(-)
src/gallium/drivers/nv50/nv50_program.c +14 -0
@@ -2053,6 +2053,11 @@ nv50_program_tx_prep(struct nv50_pc *pc)if (p->cfg.io_nr > first) p->cfg.io_nr = first;break ; +case TGSI_SEMANTIC_PSIZE : + p->cfg.psiz = first; +if (p->cfg.io_nr > first) + p->cfg.io_nr = first; +break ;/* case TGSI_SEMANTIC_CLIP_DISTANCE: p->cfg.clpd = MIN2(p->cfg.clpd, first);
@@ -2135,6 +2140,9 @@ nv50_program_tx_prep(struct nv50_pc *pc)if (p->cfg.two_side[c].hw_id <0x40 ) p->cfg.two_side[c] = p->cfg.io[ p->cfg.two_side[c].hw_id]; + +if (p->cfg.psiz <0x40 ) + p->cfg.psiz = p->cfg.io[p->cfg.psiz].hw_id; }else if (p->type ==PIPE_SHADER_FRAGMENT ) {int rid, aid;
@@ -2274,6 +2282,7 @@ ctor_nv50_pc(struct nv50_pc *pc, struct nv50_program *p)switch (p->type) {case PIPE_SHADER_VERTEX : + p->cfg.psiz =0x40 ; p->cfg.clpd =0x40 ; p->cfg.io_nr = pc->result_nr;break ;
@@ -2766,6 +2775,11 @@ nv50_linkage_validate(struct nv50_context *nv50) m =nv50_sreg4_map (map, m, lin, &fp->cfg.io[i], vpo); } +if (vp->cfg.psiz <0x40 ) { + map[m /4 ] |= vp->cfg.psiz << ((m %4 ) *8 ); + reg[3 ] = (m++ <<4 ) |1 ; + } +/* now fill the stateobj */ so =so_new (64 ,0 );
src/gallium/drivers/nv50/nv50_program.h +1 -0
@@ -56,6 +56,7 @@ struct nv50_program {/* VP only */ uint8_t clpd, clpd_nr; +uint8_t psiz; } cfg; };
Signature · 1 line
1.6.3.3
From e6fe11b4aff92e2eab48b5420f67935627e48249 Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <e0425955-oe7qfRrRQffzPE21tAIdciO7C/[email protected]>
Date: Sat, 12 Sep 2009 21:12:37 +0200
Subject: [PATCH 13/13] nv50: add support for point sprites
--- src/gallium/drivers/nv50/nv50_program.c | 54 ++++++++++++++++++++++++++++++- src/gallium/drivers/nv50/nv50_screen.c | 2 +- src/gallium/drivers/nv50/nv50_state.c | 3 ++ 3 files changed, 57 insertions(+), 2 deletions(-)
src/gallium/drivers/nv50/nv50_program.c +53 -1
72 lines not on this page · raw message
src/gallium/drivers/nv50/nv50_screen.c +1 -1
@@ -92,7 +92,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param)case PIPE_CAP_ANISOTROPIC_FILTER :return 1 ;case PIPE_CAP_POINT_SPRITE : -return 0 ; +return 1 ;case PIPE_CAP_MAX_RENDER_TARGETS :return 8 ;case PIPE_CAP_OCCLUSION_QUERY :
src/gallium/drivers/nv50/nv50_state.c +3 -0
@@ -296,6 +296,9 @@ nv50_rasterizer_state_create(struct pipe_context *pipe,so_method (so, tesla,NV50TCL_POINT_SIZE ,1 );so_data (so,fui (cso->point_size)); +so_method (so, tesla,NV50TCL_POINT_SPRITE_ENABLE ,1 ); +so_data (so, cso->point_sprite); +so_method (so, tesla,NV50TCL_POLYGON_MODE_FRONT ,3 );if (cso->front_winding ==PIPE_WINDING_CCW ) {so_data (so,nvgl_polygon_mode (cso->fill_ccw));
Signature · 1 line
1.6.3.3
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau