Home | History | Annotate | Download | only in svga

Lines Matching refs:emit

39 translate_vs_ps_semantic(struct svga_shader_emitter *emit,
67 *idx = svga_remap_generic_index(emit->key.generic_remap_table,
94 * Emit a PS input (or VS depth/fog output) register declaration.
96 * index = 3, we'll emit "dcl_texcoord3 v1".
99 emit_decl(struct svga_shader_emitter *emit,
120 return (emit_instruction(emit, opcode) &&
121 svga_shader_emit_dwords( emit, dcl.values, ARRAY_SIZE(dcl.values)));
126 * Emit declaration for PS front/back-face input register.
129 emit_vface_decl(struct svga_shader_emitter *emit)
131 if (!emit->emitted_vface) {
135 if (!emit_decl( emit, reg, 0, 0 ))
138 emit->emitted_vface = TRUE;
145 * Emit PS input register to pass depth/fog coordinates.
149 ps30_input_emit_depth_fog( struct svga_shader_emitter *emit,
154 if (emit->emitted_depth_fog) {
155 *out = emit->ps_depth_fog;
159 if (emit->ps30_input_count >= SVGA3D_INPUTREG_MAX)
163 emit->ps30_input_count++ );
165 *out = emit->ps_depth_fog = reg;
167 emit->emitted_depth_fog = TRUE;
169 return emit_decl( emit, dst( reg ), SVGA3D_DECLUSAGE_TEXCOORD, 0 );
175 * We'll emit a declaration like "dcl_texcoord1 v2"
178 ps30_input(struct svga_shader_emitter *emit,
187 emit->ps_true_pos = src_register( SVGA3DREG_MISCTYPE,
189 emit->ps_true_pos.base.swizzle = TRANSLATE_SWIZZLE( TGSI_SWIZZLE_X,
193 reg = writemask( dst(emit->ps_true_pos),
195 emit->ps_reads_pos = TRUE;
197 if (emit->info.reads_z) {
198 emit->ps_temp_pos = dst_register( SVGA3DREG_TEMP,
199 emit->nr_hw_temp );
201 emit->input_map[idx] = src_register( SVGA3DREG_TEMP,
202 emit->nr_hw_temp );
203 emit->nr_hw_temp++;
205 if (!ps30_input_emit_depth_fog( emit, &emit->ps_depth_pos ))
208 emit->ps_depth_pos.base.swizzle = TRANSLATE_SWIZZLE( TGSI_SWIZZLE_Z,
214 emit->input_map[idx] = emit->ps_true_pos;
217 return emit_decl( emit, reg, 0, 0 );
219 else if (emit->key.fs.light_twoside &&
222 if (!translate_vs_ps_semantic( emit, semantic, &usage, &index ))
225 emit->internal_color_idx[emit->internal_color_count] = idx;
226 emit->input_map[idx] = src_register( SVGA3DREG_INPUT, emit->ps30_input_count );
227 emit->ps30_input_count++;
228 emit->internal_color_count++;
230 reg = dst( emit->input_map[idx] );
232 if (!emit_decl( emit, reg, usage, index ))
236 if (!translate_vs_ps_semantic( emit, semantic, &usage, &index ))
239 if (emit->ps30_input_count >= SVGA3D_INPUTREG_MAX)
242 reg = dst_register( SVGA3DREG_INPUT, emit->ps30_input_count++ );
244 if (!emit_decl( emit, reg, usage, index ))
247 if (!emit_vface_decl( emit ))
253 if (!emit_vface_decl( emit ))
255 emit->emit_frontface = TRUE;
256 emit->internal_frontface_idx = idx;
263 if (!ps30_input_emit_depth_fog( emit, &emit->input_map[idx] ))
266 emit->input_map[idx].base.swizzle = TRANSLATE_SWIZZLE( TGSI_SWIZZLE_X,
275 if (!translate_vs_ps_semantic( emit, semantic, &usage, &index ))
278 if (emit->ps30_input_count >= SVGA3D_INPUTREG_MAX)
281 emit->input_map[idx] = src_register( SVGA3DREG_INPUT, emit->ps30_input_count++ );
282 reg = dst( emit->input_map[idx] );
284 if (!emit_decl( emit, reg, usage, index ))
288 emit->key.sprite_origin_lower_left &&
290 emit->key.tex[index - 1].sprite_texgen) {
297 emit->inverted_texcoords |= (1 << unit);
300 emit->ps_true_texcoord[unit] = emit->input_map[idx];
303 emit->ps_inverted_texcoord[unit] =
304 src_register(SVGA3DREG_TEMP, emit->nr_hw_temp);
305 emit->nr_hw_temp++;
307 emit->ps_inverted_texcoord_input[unit] = idx;
310 emit->input_map[idx] = emit->ps_inverted_texcoord[unit];
321 * Note that we don't actually emit a SVGA3DOpDcl for PS outputs.
325 ps30_output(struct svga_shader_emitter *emit,
331 if (emit->unit == PIPE_SHADER_FRAGMENT) {
332 if (emit->key.fs.white_fragments) {
334 emit->output_map[idx] = dst_register( SVGA3DREG_TEMP,
335 emit->nr_hw_temp++ );
336 emit->temp_color_output[idx] = emit->output_map[idx];
337 emit->true_color_output[idx] = dst_register(SVGA3DREG_COLOROUT,
340 else if (emit->key.fs.write_color0_to_n_cbufs) {
347 for (i = 0; i < emit->key.fs.write_color0_to_n_cbufs; i++) {
348 emit->output_map[idx+i] = dst_register(SVGA3DREG_TEMP,
349 emit->nr_hw_temp++);
350 emit->temp_color_output[i] = emit->output_map[idx+i];
351 emit->true_color_output[i] = dst_register(SVGA3DREG_COLOROUT,
357 emit->output_map[idx] =
362 emit->output_map[idx] = dst_register( SVGA3DREG_COLOROUT,
367 emit->output_map[idx] = dst_register( SVGA3DREG_TEMP,
368 emit->nr_hw_temp++ );
369 emit->temp_pos = emit->output_map[idx];
370 emit->true_pos = dst_register( SVGA3DREG_DEPTHOUT,
376 emit->output_map[idx] = dst_register( SVGA3DREG_COLOROUT, 0 );
389 vs30_input(struct svga_shader_emitter *emit,
401 emit->input_map[idx] = src_register( SVGA3DREG_INPUT, idx );
412 return (emit_instruction(emit, opcode) &&
413 svga_shader_emit_dwords( emit, dcl.values, ARRAY_SIZE(dcl.values)));
421 vs30_output_emit_depth_fog(struct svga_shader_emitter *emit,
426 if (emit->emitted_depth_fog) {
427 *out = emit->vs_depth_fog;
431 reg = dst_register( SVGA3DREG_OUTPUT, emit->vs30_output_count++ );
433 *out = emit->vs_depth_fog = reg;
435 emit->emitted_depth_fog = TRUE;
437 return emit_decl( emit, reg, SVGA3D_DECLUSAGE_TEXCOORD, 0 );
447 vs30_output(struct svga_shader_emitter *emit,
459 if (!translate_vs_ps_semantic( emit, semantic, &usage, &index ))
462 if (emit->vs30_output_count >= SVGA3D_OUTPUTREG_MAX)
465 dcl.dst = dst_register( SVGA3DREG_OUTPUT, emit->vs30_output_count++ );
472 emit->output_map[idx] = dst_register( SVGA3DREG_TEMP,
473 emit->nr_hw_temp++ );
474 emit->temp_pos = emit->output_map[idx];
475 emit->true_pos = dcl.dst;
478 if (!vs30_output_emit_depth_fog( emit, &emit->depth_pos ))
483 emit->output_map[idx] = dst_register( SVGA3DREG_TEMP,
484 emit->nr_hw_temp++ );
485 emit->temp_psiz = emit->output_map[idx];
490 if (!emit->key.vs.allow_psiz)
493 emit->true_psiz = dcl.dst;
500 emit->vs30_output_count--;
502 if (!vs30_output_emit_depth_fog( emit, &emit->output_map[idx] ))
508 emit->output_map[idx] = dcl.dst;
511 return (emit_instruction(emit, opcode) &&
512 svga_shader_emit_dwords( emit, dcl.values, ARRAY_SIZE(dcl.values)));
518 svga_tgsi_sampler_type(const struct svga_shader_emitter *emit, int idx)
520 switch (emit->sampler_target[idx]) {
537 emit,
548 dcl.type = svga_tgsi_sampler_type( emit, idx );
551 return (emit_instruction(emit, opcode) &&
552 svga_shader_emit_dwords( emit, dcl.values, ARRAY_SIZE(dcl.values)));
556 svga_shader_emit_samplers_decl( struct svga_shader_emitter *emit )
560 for (i = 0; i < emit->num_samplers; i++) {
561 if (!ps30_sampler(emit, i))
568 svga_translate_decl_sm30( struct svga_shader_emitter *emit,
580 assert (emit->unit == PIPE_SHADER_FRAGMENT);
582 * Will emit the declaration in the helpers function.
584 emit->num_samplers = MAX2(emit->num_samplers, decl->Range.Last + 1);
588 if (emit->unit == PIPE_SHADER_VERTEX)
589 ok = vs30_input( emit, decl->Semantic, idx );
591 ok = ps30_input( emit, decl->Semantic, idx );
595 if (emit->unit == PIPE_SHADER_VERTEX)
596 ok = vs30_output( emit, decl->Semantic, idx );
598 ok = ps30_output( emit, decl->Semantic, idx );
605 emit->sampler_target[unit] = decl->SamplerView.Resource;