Lines Matching refs:shader

60 static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *shader)
63 struct r600_shader *rshader = &shader->shader;
67 /* copy new shader */
68 if (shader->bo == NULL) {
69 shader->bo = (struct r600_resource*)
71 if (shader->bo == NULL) {
74 ptr = (uint32_t*)rctx->ws->buffer_map(shader->bo->cs_buf, rctx->cs, PIPE_TRANSFER_WRITE);
82 rctx->ws->buffer_unmap(shader->bo->cs_buf);
88 evergreen_pipe_shader_vs(ctx, shader);
90 r600_pipe_shader_vs(ctx, shader);
95 evergreen_pipe_shader_ps(ctx, shader);
97 r600_pipe_shader_ps(ctx, shader);
108 int r600_pipe_shader_create(struct pipe_context *ctx, struct r600_pipe_shader *shader)
112 struct r600_pipe_shader_selector *sel = shader->selector;
139 r = r600_shader_from_tgsi(rctx, shader);
144 r = r600_bytecode_build(&shader->shader.bc);
150 r600_bytecode_dump(&shader->shader.bc);
153 return r600_pipe_shader(ctx, shader);
156 void r600_pipe_shader_destroy(struct pipe_context *ctx, struct r600_pipe_shader *shader)
158 pipe_resource_reference((struct pipe_resource**)&shader->bo, NULL);
159 r600_bytecode_clear(&shader->shader.bc);
163 * tgsi -> r600 shader
185 struct r600_shader *shader;
221 * bytestream -> r600 shader
343 ctx->shader->uses_kill = 1;
557 /* End bytestream -> r600 shader functions*/
601 if (ctx->shader->input[input].interpolate == TGSI_INTERPOLATE_PERSPECTIVE) {
603 if (ctx->shader->input[input].centroid)
605 } else if (ctx->shader->input[input].interpolate == TGSI_INTERPOLATE_LINEAR) {
614 if (ctx->shader->input[input].centroid)
631 alu.dst.sel = ctx->shader->input[input].gpr;
640 alu.src[1].sel = V_SQ_ALU_SRC_PARAM_BASE + ctx->shader->input[input].lds_pos;
662 alu.dst.sel = ctx->shader->input[input].gpr;
667 alu.src[0].sel = V_SQ_ALU_SRC_PARAM_BASE + ctx->shader->input[input].lds_pos;
682 * shader export ARRAY_BASE for EXPORT_POS:
698 * shader export ARRAY_BASE for EXPORT_PIXEL:
748 if (ctx->shader->input[index].spi_sid) {
749 ctx->shader->input[index].lds_pos = ctx->shader->nlds++;
750 if (ctx->shader->input[index].interpolate > 0) {
763 int gpr_front = ctx->shader->input[front].gpr;
764 int gpr_back = ctx->shader->input[back].gpr;
796 i = ctx->shader->ninput++;
797 ctx->shader->input[i].name = d->Semantic.Name;
798 ctx->shader->input[i].sid = d->Semantic.Index;
799 ctx->shader->input[i].spi_sid = r600_spi_sid(&ctx->shader->input[i]);
800 ctx->shader->input[i].interpolate = d->Interp.Interpolate;
801 ctx->shader->input[i].centroid = d->Interp.Centroid;
802 ctx->shader->input[i].gpr = ctx->file_offset[TGSI_FILE_INPUT] + d->Range.First;
804 switch (ctx->shader->input[i].name) {
806 ctx->face_gpr = ctx->shader->input[i].gpr;
822 i = ctx->shader->noutput++;
823 ctx->shader->output[i].name = d->Semantic.Name;
824 ctx->shader->output[i].sid = d->Semantic.Index;
825 ctx->shader->output[i].spi_sid = r600_spi_sid(&ctx->shader->output[i]);
826 ctx->shader->output[i].gpr = ctx->file_offset[TGSI_FILE_OUTPUT] + d->Range.First;
827 ctx->shader->output[i].interpolate = d->Interp.Interpolate;
828 ctx->shader->output[i].write_mask = d->Declaration.UsageMask;
832 ctx->shader->clip_dist_write |= d->Declaration.UsageMask << (d->Semantic.Index << 2);
835 ctx->shader->vs_out_misc_write = 1;
836 ctx->shader->vs_out_point_size = 1;
846 ctx->shader->nr_ps_max_color_exports++;
891 * for evergreen we need to scan the shader to find the number of GPRs we need to
1124 int i, r, count = ctx->shader->ninput;
1128 * reserve these gprs for the rest of the shader code and to adjust
1134 i = ctx->shader->ninput++;
1135 ctx->shader->input[i].name = TGSI_SEMANTIC_FACE;
1136 ctx->shader->input[i].spi_sid = 0;
1137 ctx->shader->input[i].gpr = gpr++;
1138 ctx->face_gpr = ctx->shader->input[i].gpr;
1142 if (ctx->shader->input[i].name == TGSI_SEMANTIC_COLOR) {
1143 int ni = ctx->shader->ninput++;
1144 memcpy(&ctx->shader->input[ni],&ctx->shader->input[i], sizeof(struct r600_shader_io));
1145 ctx->shader->input[ni].name = TGSI_SEMANTIC_BCOLOR;
1146 ctx->shader->input[ni].spi_sid = r600_spi_sid(&ctx->shader->input[ni]);
1147 ctx->shader->input[ni].gpr = gpr++;
1165 struct r600_shader *shader = &pipeshader->shader;
1184 ctx.bc = &shader->bc;
1185 ctx.shader = shader;
1193 shader->processor_type = ctx.type;
1194 ctx.bc->type = shader->processor_type;
1201 shader->nr_ps_color_exports = 0;
1202 shader->nr_ps_max_color_exports = 0;
1204 shader->two_side = (ctx.type == TGSI_PROCESSOR_FRAGMENT) && rctx->two_side;
1266 "shader. Falling back to TGSI\n");
1295 shader->fs_write_all = FALSE;
1324 shader->fs_write_all = TRUE;
1328 shader->vs_prohibit_ucps = TRUE;
1339 if (shader->fs_write_all && rctx->chip_class >= EVERGREEN)
1340 shader->nr_ps_max_color_exports = 8;
1348 alu.src[0].sel = shader->input[ctx.fragcoord_input].gpr;
1351 alu.dst.sel = shader->input[ctx.fragcoord_input].gpr;
1362 alu.src[0].sel = shader->input[ctx.fragcoord_input].gpr;
1365 alu.dst.sel = shader->input[ctx.fragcoord_input].gpr;
1374 if (shader->two_side && ctx.colors_used) {
1420 noutput = shader->noutput;
1426 memset(&shader->output[noutput], 0, 2*sizeof(struct r600_shader_io));
1427 shader->output[noutput].name = TGSI_SEMANTIC_CLIPDIST;
1428 shader->output[noutput].gpr = ctx.temp_reg;
1430 shader->output[noutput].name = TGSI_SEMANTIC_CLIPDIST;
1431 shader->output[noutput].gpr = ctx.temp_reg+1;
1435 shader->output[ctx.cv_output].spi_sid = 0;
1437 shader->clip_dist_write = 0xFF;
1447 alu.src[0].sel = shader->output[ctx.cv_output].gpr;
1484 output.gpr = shader->output[so.output[i].register_index].gpr;
1534 output[j].gpr = shader->output[i].gpr;
1546 switch (shader->output[i].name) {
1564 if (shader->output[i].spi_sid) {
1566 /* duplicate it as PARAM to pass to the pixel shader */
1580 if (shader->output[i].name == TGSI_SEMANTIC_COLOR) {
1590 shader->nr_ps_color_exports++;
1591 if (shader->fs_write_all && (rctx->chip_class >= EVERGREEN)) {
1595 output[j].gpr = shader->output[i].gpr;
1606 shader->nr_ps_color_exports++;
1609 } else if (shader->output[i].name == TGSI_SEMANTIC_POSITION) {
1615 } else if (shader->output[i].name == TGSI_SEMANTIC_STENCIL) {
1622 R600_ERR("unsupported fragment output name %d\n", shader->output[i].name);
1639 /* add fake param output for vertex shader if no param is exported */
1700 R600_ERR("GPR limit exceeded - shader requires %d registers\n", ctx.bc->ngpr);
2231 ctx->shader->uses_kill = TRUE;
5099 R600_ERR("if/endif unbalanced in shader\n");
5135 R600_ERR("loop/endloop in shader code are not paired.\n");