r600g/sb: initial commit of the optimizing shader backend
[mesa.git] / src / gallium / drivers / r600 / sb / sb_bc_decoder.cpp
1 /*
2 * Copyright 2013 Vadim Girlin <vadimgirlin@gmail.com>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE.
22 *
23 * Authors:
24 * Vadim Girlin
25 */
26
27 #include "sstream"
28
29 #include "sb_bc.h"
30
31 namespace r600_sb {
32
33 int bc_decoder::decode_cf(unsigned &i, bc_cf& bc) {
34 int r = 0;
35 uint32_t dw0 = dw[i];
36 uint32_t dw1 = dw[i+1];
37
38 if ((dw1 >> 29) & 1) { // CF_ALU
39 return decode_cf_alu(i, bc);
40 } else {
41 // CF_INST field encoding on cayman is the same as on evergreen
42 unsigned opcode = ctx.is_egcm() ?
43 CF_WORD1_EG(dw1).get_CF_INST() :
44 CF_WORD1_R6R7(dw1).get_CF_INST();
45
46 bc.set_op(r600_isa_cf_by_opcode(ctx.isa, opcode, 0));
47
48 if (bc.op_ptr->flags & CF_EXP) {
49 return decode_cf_exp(i, bc);
50 } else if (bc.op_ptr->flags & CF_MEM) {
51 return decode_cf_mem(i, bc);
52 }
53
54 if (ctx.is_egcm()) {
55 CF_WORD0_EGCM w0(dw0);
56 bc.addr = w0.get_ADDR();
57 bc.jumptable_sel = w0.get_JUMPTABLE_SEL();
58
59 if (ctx.is_evergreen()) {
60 CF_WORD1_EG w1(dw1);
61
62 bc.barrier = w1.get_BARRIER();
63 bc.cf_const = w1.get_CF_CONST();
64 bc.cond = w1.get_COND();
65 bc.count = w1.get_COUNT();
66 bc.end_of_program = w1.get_END_OF_PROGRAM();
67 bc.pop_count = w1.get_POP_COUNT();
68 bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE();
69 bc.whole_quad_mode = w1.get_WHOLE_QUAD_MODE();
70
71 } else { // cayman
72 CF_WORD1_CM w1(dw1);
73
74 bc.barrier = w1.get_BARRIER();
75 bc.cf_const = w1.get_CF_CONST();
76 bc.cond = w1.get_COND();
77 bc.count = w1.get_COUNT();
78 bc.pop_count = w1.get_POP_COUNT();
79 bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE();
80 }
81
82
83 } else {
84 CF_WORD0_R6R7 w0(dw0);
85 bc.addr = w0.get_ADDR();
86
87 CF_WORD1_R6R7 w1(dw1);
88 bc.barrier = w1.get_BARRIER();
89 bc.cf_const = w1.get_CF_CONST();
90 bc.cond = w1.get_COND();
91
92 if (ctx.is_r600())
93 bc.count = w1.get_COUNT();
94 else
95 bc.count = w1.get_COUNT() + (w1.get_COUNT_3() << 3);
96
97 bc.end_of_program = w1.get_END_OF_PROGRAM();
98 bc.pop_count = w1.get_POP_COUNT();
99 bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE();
100 bc.whole_quad_mode = w1.get_WHOLE_QUAD_MODE();
101 bc.call_count = w1.get_CALL_COUNT();
102 }
103 }
104
105 i += 2;
106
107 return r;
108 }
109
110 int bc_decoder::decode_cf_alu(unsigned & i, bc_cf& bc) {
111 int r = 0;
112 uint32_t dw0 = dw[i++];
113 uint32_t dw1 = dw[i++];
114
115 assert(i <= ndw);
116
117 CF_ALU_WORD0_ALL w0(dw0);
118
119 bc.kc[0].bank = w0.get_KCACHE_BANK0();
120 bc.kc[1].bank = w0.get_KCACHE_BANK1();
121 bc.kc[0].mode = w0.get_KCACHE_MODE0();
122
123 bc.addr = w0.get_ADDR();
124
125 if (ctx.is_r600()) {
126 CF_ALU_WORD1_R6 w1(dw1);
127
128 bc.set_op(r600_isa_cf_by_opcode(ctx.isa, w1.get_CF_INST(), 1));
129
130 bc.kc[0].addr = w1.get_KCACHE_ADDR0();
131 bc.kc[1].mode = w1.get_KCACHE_MODE1();
132 bc.kc[1].addr = w1.get_KCACHE_ADDR1();
133
134 bc.barrier = w1.get_BARRIER();
135 bc.count = w1.get_COUNT();
136 bc.whole_quad_mode = w1.get_WHOLE_QUAD_MODE();
137
138 bc.uses_waterfall = w1.get_USES_WATERFALL();
139 } else {
140 CF_ALU_WORD1_R7EGCM w1(dw1);
141
142 bc.set_op(r600_isa_cf_by_opcode(ctx.isa, w1.get_CF_INST(), 1));
143
144 if (bc.op == CF_OP_ALU_EXT) {
145 CF_ALU_WORD0_EXT_EGCM w0(dw0);
146 CF_ALU_WORD1_EXT_EGCM w1(dw1);
147
148 bc.kc[0].index_mode = w0.get_KCACHE_BANK_INDEX_MODE0();
149 bc.kc[1].index_mode = w0.get_KCACHE_BANK_INDEX_MODE1();
150 bc.kc[2].index_mode = w0.get_KCACHE_BANK_INDEX_MODE2();
151 bc.kc[3].index_mode = w0.get_KCACHE_BANK_INDEX_MODE3();
152 bc.kc[2].bank = w0.get_KCACHE_BANK2();
153 bc.kc[3].bank = w0.get_KCACHE_BANK3();
154 bc.kc[2].mode = w0.get_KCACHE_MODE2();
155 bc.kc[3].mode = w1.get_KCACHE_MODE3();
156 bc.kc[2].addr = w1.get_KCACHE_ADDR2();
157 bc.kc[3].addr = w1.get_KCACHE_ADDR3();
158
159 r = decode_cf_alu(i, bc);
160
161 } else {
162
163 bc.kc[0].addr = w1.get_KCACHE_ADDR0();
164 bc.kc[1].mode = w1.get_KCACHE_MODE1();
165 bc.kc[1].addr = w1.get_KCACHE_ADDR1();
166 bc.barrier = w1.get_BARRIER();
167 bc.count = w1.get_COUNT();
168 bc.whole_quad_mode = w1.get_WHOLE_QUAD_MODE();
169
170 bc.alt_const = w1.get_ALT_CONST();
171 }
172 }
173 return r;
174 }
175
176 int bc_decoder::decode_cf_exp(unsigned & i, bc_cf& bc) {
177 int r = 0;
178 uint32_t dw0 = dw[i++];
179 uint32_t dw1 = dw[i++];
180 assert(i <= ndw);
181
182 CF_ALLOC_EXPORT_WORD0_ALL w0(dw0);
183 bc.array_base = w0.get_ARRAY_BASE();
184 bc.elem_size = w0.get_ELEM_SIZE();
185 bc.index_gpr = w0.get_INDEX_GPR();
186 bc.rw_gpr = w0.get_RW_GPR();
187 bc.rw_rel = w0.get_RW_REL();
188 bc.type = w0.get_TYPE();
189
190 if (ctx.is_evergreen()) {
191 CF_ALLOC_EXPORT_WORD1_SWIZ_EG w1(dw1);
192 bc.barrier = w1.get_BARRIER();
193 bc.burst_count = w1.get_BURST_COUNT();
194 bc.end_of_program = w1.get_END_OF_PROGRAM();
195 bc.sel[0] = w1.get_SEL_X();
196 bc.sel[1] = w1.get_SEL_Y();
197 bc.sel[2] = w1.get_SEL_Z();
198 bc.sel[3] = w1.get_SEL_W();
199 bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE();
200 bc.mark = w1.get_MARK();
201
202 } else if (ctx.is_cayman()) {
203 CF_ALLOC_EXPORT_WORD1_SWIZ_CM w1(dw1);
204 bc.barrier = w1.get_BARRIER();
205 bc.burst_count = w1.get_BURST_COUNT();
206 bc.mark = w1.get_MARK();
207 bc.sel[0] = w1.get_SEL_X();
208 bc.sel[1] = w1.get_SEL_Y();
209 bc.sel[2] = w1.get_SEL_Z();
210 bc.sel[3] = w1.get_SEL_W();
211 bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE();
212
213 } else { // r67
214 CF_ALLOC_EXPORT_WORD1_SWIZ_R6R7 w1(dw1);
215 bc.barrier = w1.get_BARRIER();
216 bc.burst_count = w1.get_BURST_COUNT();
217 bc.end_of_program = w1.get_END_OF_PROGRAM();
218 bc.sel[0] = w1.get_SEL_X();
219 bc.sel[1] = w1.get_SEL_Y();
220 bc.sel[2] = w1.get_SEL_Z();
221 bc.sel[3] = w1.get_SEL_W();
222 bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE();
223 bc.whole_quad_mode = w1.get_WHOLE_QUAD_MODE();
224 }
225
226 return r;
227 }
228
229
230 int bc_decoder::decode_cf_mem(unsigned & i, bc_cf& bc) {
231 int r = 0;
232 uint32_t dw0 = dw[i++];
233 uint32_t dw1 = dw[i++];
234 assert(i <= ndw);
235
236 if (!(bc.op_ptr->flags & CF_RAT)) {
237 CF_ALLOC_EXPORT_WORD0_ALL w0(dw0);
238 bc.array_base = w0.get_ARRAY_BASE();
239 bc.elem_size = w0.get_ELEM_SIZE();
240 bc.index_gpr = w0.get_INDEX_GPR();
241 bc.rw_gpr = w0.get_RW_GPR();
242 bc.rw_rel = w0.get_RW_REL();
243 bc.type = w0.get_TYPE();
244 } else {
245 assert(ctx.is_egcm());
246 CF_ALLOC_EXPORT_WORD0_RAT_EGCM w0(dw0);
247 bc.elem_size = w0.get_ELEM_SIZE();
248 bc.index_gpr = w0.get_INDEX_GPR();
249 bc.rw_gpr = w0.get_RW_GPR();
250 bc.rw_rel = w0.get_RW_REL();
251 bc.type = w0.get_TYPE();
252 bc.rat_id = w0.get_RAT_ID();
253 bc.rat_inst = w0.get_RAT_INST();
254 bc.rat_index_mode = w0.get_RAT_INDEX_MODE();
255 }
256
257 if (ctx.is_evergreen()) {
258 CF_ALLOC_EXPORT_WORD1_BUF_EG w1(dw1);
259 bc.barrier = w1.get_BARRIER();
260 bc.burst_count = w1.get_BURST_COUNT();
261 bc.end_of_program = w1.get_END_OF_PROGRAM();
262 bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE();
263 bc.mark = w1.get_MARK();
264 bc.array_size = w1.get_ARRAY_SIZE();
265 bc.comp_mask = w1.get_COMP_MASK();
266
267 } else if (ctx.is_cayman()) {
268 CF_ALLOC_EXPORT_WORD1_BUF_CM w1(dw1);
269 bc.barrier = w1.get_BARRIER();
270 bc.burst_count = w1.get_BURST_COUNT();
271 bc.mark = w1.get_MARK();
272 bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE();
273 bc.array_size = w1.get_ARRAY_SIZE();
274 bc.comp_mask = w1.get_COMP_MASK();
275
276 } else { // r67
277 CF_ALLOC_EXPORT_WORD1_BUF_R6R7 w1(dw1);
278 bc.barrier = w1.get_BARRIER();
279 bc.burst_count = w1.get_BURST_COUNT();
280 bc.end_of_program = w1.get_END_OF_PROGRAM();
281 bc.valid_pixel_mode = w1.get_VALID_PIXEL_MODE();
282 bc.whole_quad_mode = w1.get_WHOLE_QUAD_MODE();
283 bc.array_size = w1.get_ARRAY_SIZE();
284 bc.comp_mask = w1.get_COMP_MASK();
285 bc.whole_quad_mode = w1.get_WHOLE_QUAD_MODE();
286 }
287
288 return r;
289 }
290
291 int bc_decoder::decode_alu(unsigned & i, bc_alu& bc) {
292 int r = 0;
293 uint32_t dw0 = dw[i++];
294 uint32_t dw1 = dw[i++];
295 assert(i <= ndw);
296
297 ALU_WORD0_ALL w0(dw0);
298 bc.index_mode = w0.get_INDEX_MODE();
299 bc.last = w0.get_LAST();
300 bc.pred_sel = w0.get_PRED_SEL();
301 bc.src[0].chan = w0.get_SRC0_CHAN();
302 bc.src[0].sel = w0.get_SRC0_SEL();
303 bc.src[0].neg = w0.get_SRC0_NEG();
304 bc.src[0].rel = w0.get_SRC0_REL();
305 bc.src[1].chan = w0.get_SRC1_CHAN();
306 bc.src[1].sel = w0.get_SRC1_SEL();
307 bc.src[1].neg = w0.get_SRC1_NEG();
308 bc.src[1].rel = w0.get_SRC1_REL();
309
310 if ((dw1 >> 15) & 7) { // op3
311 ALU_WORD1_OP3_ALL w1(dw1);
312 bc.set_op(r600_isa_alu_by_opcode(ctx.isa, w1.get_ALU_INST(), 1));
313
314 bc.bank_swizzle = w1.get_BANK_SWIZZLE();
315 bc.clamp = w1.get_CLAMP();
316 bc.dst_chan = w1.get_DST_CHAN();
317 bc.dst_gpr = w1.get_DST_GPR();
318 bc.dst_rel = w1.get_DST_REL();
319
320 bc.src[2].chan = w1.get_SRC2_CHAN();
321 bc.src[2].sel = w1.get_SRC2_SEL();
322 bc.src[2].neg = w1.get_SRC2_NEG();
323 bc.src[2].rel = w1.get_SRC2_REL();
324
325 } else { // op2
326 if (ctx.is_r600()) {
327 ALU_WORD1_OP2_R6 w1(dw1);
328 bc.set_op(r600_isa_alu_by_opcode(ctx.isa, w1.get_ALU_INST(), 0));
329
330 bc.bank_swizzle = w1.get_BANK_SWIZZLE();
331 bc.clamp = w1.get_CLAMP();
332 bc.dst_chan = w1.get_DST_CHAN();
333 bc.dst_gpr = w1.get_DST_GPR();
334 bc.dst_rel = w1.get_DST_REL();
335
336 bc.omod = w1.get_OMOD();
337 bc.src[0].abs = w1.get_SRC0_ABS();
338 bc.src[1].abs = w1.get_SRC1_ABS();
339 bc.write_mask = w1.get_WRITE_MASK();
340 bc.update_exec_mask = w1.get_UPDATE_EXEC_MASK();
341 bc.update_pred = w1.get_UPDATE_PRED();
342
343 bc.fog_merge = w1.get_FOG_MERGE();
344
345 } else {
346 ALU_WORD1_OP2_R7EGCM w1(dw1);
347 bc.set_op(r600_isa_alu_by_opcode(ctx.isa, w1.get_ALU_INST(), 0));
348
349 bc.bank_swizzle = w1.get_BANK_SWIZZLE();
350 bc.clamp = w1.get_CLAMP();
351 bc.dst_chan = w1.get_DST_CHAN();
352 bc.dst_gpr = w1.get_DST_GPR();
353 bc.dst_rel = w1.get_DST_REL();
354
355 bc.omod = w1.get_OMOD();
356 bc.src[0].abs = w1.get_SRC0_ABS();
357 bc.src[1].abs = w1.get_SRC1_ABS();
358 bc.write_mask = w1.get_WRITE_MASK();
359 bc.update_exec_mask = w1.get_UPDATE_EXEC_MASK();
360 bc.update_pred = w1.get_UPDATE_PRED();
361 }
362 }
363
364 bc.slot_flags = (alu_op_flags)bc.op_ptr->slots[ctx.isa->hw_class];
365 return r;
366 }
367
368 int bc_decoder::decode_fetch(unsigned & i, bc_fetch& bc) {
369 int r = 0;
370 uint32_t dw0 = dw[i];
371 uint32_t dw1 = dw[i+1];
372 uint32_t dw2 = dw[i+2];
373 assert(i + 4 <= ndw);
374
375 unsigned fetch_opcode = dw0 & 0x1F;
376
377 bc.set_op(r600_isa_fetch_by_opcode(ctx.isa, fetch_opcode));
378
379 if (bc.op_ptr->flags & FF_VTX)
380 return decode_fetch_vtx(i, bc);
381
382 // tex
383
384 if (ctx.is_r600()) {
385 TEX_WORD0_R6 w0(dw0);
386
387 bc.bc_frac_mode = w0.get_BC_FRAC_MODE();
388 bc.fetch_whole_quad = w0.get_FETCH_WHOLE_QUAD();
389 bc.resource_id = w0.get_RESOURCE_ID();
390 bc.src_gpr = w0.get_SRC_GPR();
391 bc.src_rel = w0.get_SRC_REL();
392
393 } else if (ctx.is_r600()) {
394 TEX_WORD0_R7 w0(dw0);
395
396 bc.bc_frac_mode = w0.get_BC_FRAC_MODE();
397 bc.fetch_whole_quad = w0.get_FETCH_WHOLE_QUAD();
398 bc.resource_id = w0.get_RESOURCE_ID();
399 bc.src_gpr = w0.get_SRC_GPR();
400 bc.src_rel = w0.get_SRC_REL();
401 bc.alt_const = w0.get_ALT_CONST();
402
403 } else { // eg/cm
404 TEX_WORD0_EGCM w0(dw0);
405
406 bc.fetch_whole_quad = w0.get_FETCH_WHOLE_QUAD();
407 bc.resource_id = w0.get_RESOURCE_ID();
408 bc.src_gpr = w0.get_SRC_GPR();
409 bc.src_rel = w0.get_SRC_REL();
410 bc.alt_const = w0.get_ALT_CONST();
411 bc.inst_mod = w0.get_INST_MOD();
412 bc.resource_index_mode = w0.get_RESOURCE_INDEX_MODE();
413 bc.sampler_index_mode = w0.get_SAMPLER_INDEX_MODE();
414 }
415
416 TEX_WORD1_ALL w1(dw1);
417 bc.coord_type[0] = w1.get_COORD_TYPE_X();
418 bc.coord_type[1] = w1.get_COORD_TYPE_Y();
419 bc.coord_type[2] = w1.get_COORD_TYPE_Z();
420 bc.coord_type[3] = w1.get_COORD_TYPE_W();
421 bc.dst_gpr = w1.get_DST_GPR();
422 bc.dst_rel = w1.get_DST_REL();
423 bc.dst_sel[0] = w1.get_DST_SEL_X();
424 bc.dst_sel[1] = w1.get_DST_SEL_Y();
425 bc.dst_sel[2] = w1.get_DST_SEL_Z();
426 bc.dst_sel[3] = w1.get_DST_SEL_W();
427 bc.lod_bias = w1.get_LOD_BIAS();
428
429 TEX_WORD2_ALL w2(dw2);
430 bc.offset[0] = w2.get_OFFSET_X();
431 bc.offset[1] = w2.get_OFFSET_Y();
432 bc.offset[2] = w2.get_OFFSET_Z();
433 bc.sampler_id = w2.get_SAMPLER_ID();
434 bc.src_sel[0] = w2.get_SRC_SEL_X();
435 bc.src_sel[1] = w2.get_SRC_SEL_Y();
436 bc.src_sel[2] = w2.get_SRC_SEL_Z();
437 bc.src_sel[3] = w2.get_SRC_SEL_W();
438
439 i += 4;
440 return r;
441 }
442
443 int bc_decoder::decode_fetch_vtx(unsigned & i, bc_fetch& bc) {
444 int r = 0;
445 uint32_t dw0 = dw[i];
446 uint32_t dw1 = dw[i+1];
447 uint32_t dw2 = dw[i+2];
448 i+= 4;
449 assert(i <= ndw);
450
451 if (ctx.is_cayman()) {
452 VTX_WORD0_CM w0(dw0);
453 bc.resource_id = w0.get_BUFFER_ID();
454 bc.fetch_type = w0.get_FETCH_TYPE();
455 bc.fetch_whole_quad = w0.get_FETCH_WHOLE_QUAD();
456 bc.src_gpr = w0.get_SRC_GPR();
457 bc.src_rel = w0.get_SRC_REL();
458 bc.src_sel[0] = w0.get_SRC_SEL_X();
459 bc.coalesced_read = w0.get_COALESCED_READ();
460 bc.lds_req = w0.get_LDS_REQ();
461 bc.structured_read = w0.get_STRUCTURED_READ();
462
463 } else {
464 VTX_WORD0_R6R7EG w0(dw0);
465 bc.resource_id = w0.get_BUFFER_ID();
466 bc.fetch_type = w0.get_FETCH_TYPE();
467 bc.fetch_whole_quad = w0.get_FETCH_WHOLE_QUAD();
468 bc.mega_fetch_count = w0.get_MEGA_FETCH_COUNT();
469 bc.src_gpr = w0.get_SRC_GPR();
470 bc.src_rel = w0.get_SRC_REL();
471 bc.src_sel[0] = w0.get_SRC_SEL_X();
472 }
473
474 if (bc.op == FETCH_OP_SEMFETCH) {
475 VTX_WORD1_SEM_ALL w1(dw1);
476 bc.data_format = w1.get_DATA_FORMAT();
477 bc.dst_sel[0] = w1.get_DST_SEL_X();
478 bc.dst_sel[1] = w1.get_DST_SEL_Y();
479 bc.dst_sel[2] = w1.get_DST_SEL_Z();
480 bc.dst_sel[3] = w1.get_DST_SEL_W();
481 bc.format_comp_all = w1.get_FORMAT_COMP_ALL();
482 bc.num_format_all = w1.get_NUM_FORMAT_ALL();
483 bc.srf_mode_all = w1.get_SRF_MODE_ALL();
484 bc.use_const_fields = w1.get_USE_CONST_FIELDS();
485
486 bc.semantic_id = w1.get_SEMANTIC_ID();
487
488 } else {
489 VTX_WORD1_GPR_ALL w1(dw1);
490 bc.data_format = w1.get_DATA_FORMAT();
491 bc.dst_sel[0] = w1.get_DST_SEL_X();
492 bc.dst_sel[1] = w1.get_DST_SEL_Y();
493 bc.dst_sel[2] = w1.get_DST_SEL_Z();
494 bc.dst_sel[3] = w1.get_DST_SEL_W();
495 bc.format_comp_all = w1.get_FORMAT_COMP_ALL();
496 bc.num_format_all = w1.get_NUM_FORMAT_ALL();
497 bc.srf_mode_all = w1.get_SRF_MODE_ALL();
498 bc.use_const_fields = w1.get_USE_CONST_FIELDS();
499
500 bc.dst_gpr = w1.get_DST_GPR();
501 bc.dst_rel = w1.get_DST_REL();
502 }
503
504 switch (ctx.hw_class) {
505 case HW_CLASS_R600:
506 {
507 VTX_WORD2_R6 w2(dw2);
508 bc.const_buf_no_stride = w2.get_CONST_BUF_NO_STRIDE();
509 bc.endian_swap = w2.get_ENDIAN_SWAP();
510 bc.mega_fetch = w2.get_MEGA_FETCH();
511 bc.offset[0] = w2.get_OFFSET();
512 break;
513 }
514 case HW_CLASS_R700:
515 {
516 VTX_WORD2_R7 w2(dw2);
517 bc.const_buf_no_stride = w2.get_CONST_BUF_NO_STRIDE();
518 bc.endian_swap = w2.get_ENDIAN_SWAP();
519 bc.mega_fetch = w2.get_MEGA_FETCH();
520 bc.offset[0] = w2.get_OFFSET();
521 bc.alt_const = w2.get_ALT_CONST();
522 break;
523 }
524 case HW_CLASS_EVERGREEN:
525 {
526 VTX_WORD2_EG w2(dw2);
527 bc.const_buf_no_stride = w2.get_CONST_BUF_NO_STRIDE();
528 bc.endian_swap = w2.get_ENDIAN_SWAP();
529 bc.mega_fetch = w2.get_MEGA_FETCH();
530 bc.offset[0] = w2.get_OFFSET();
531 bc.alt_const = w2.get_ALT_CONST();
532 bc.resource_index_mode = w2.get_BUFFER_INDEX_MODE();
533 break;
534 }
535 case HW_CLASS_CAYMAN:
536 {
537 VTX_WORD2_CM w2(dw2);
538 bc.const_buf_no_stride = w2.get_CONST_BUF_NO_STRIDE();
539 bc.endian_swap = w2.get_ENDIAN_SWAP();
540 bc.offset[0] = w2.get_OFFSET();
541 bc.alt_const = w2.get_ALT_CONST();
542 bc.resource_index_mode = w2.get_BUFFER_INDEX_MODE();
543 break;
544 }
545 default:
546 assert(!"unknown hw class");
547 return -1;
548 }
549
550 return r;
551 }
552
553 }