static void r300PrepareVertices(GLcontext *ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); GLuint InputsRead, OutputsWritten; radeon_print(RADEON_SWRENDER, RADEON_TRACE, "%s\n", __func__); r300ChooseSwtclVertexFormat(ctx, &InputsRead, &OutputsWritten); r300SetupVAP(ctx, InputsRead, OutputsWritten); rmesa->radeon.swtcl.vertex_size = _tnl_install_attrs( ctx, rmesa->radeon.swtcl.vertex_attrs, rmesa->radeon.swtcl.vertex_attr_count, NULL, 0 ); rmesa->radeon.swtcl.vertex_size /= 4; }
static GLboolean r300TryDrawPrims(GLcontext *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLuint min_index, GLuint max_index ) { struct r300_context *r300 = R300_CONTEXT(ctx); GLuint i; radeon_print(RADEON_RENDER, RADEON_NORMAL, "%s: %u (%d-%d) cs begin at %d\n", __FUNCTION__, nr_prims, min_index, max_index, r300->radeon.cmdbuf.cs->cdw ); if (ctx->NewState) _mesa_update_state( ctx ); if (r300->options.hw_tcl_enabled) _tnl_UpdateFixedFunctionProgram(ctx); r300UpdateShaders(r300); r300SwitchFallback(ctx, R300_FALLBACK_INVALID_BUFFERS, !r300ValidateBuffers(ctx)); r300SetVertexFormat(ctx, arrays, max_index + 1); if (r300->fallback) return GL_FALSE; r300SetupVAP(ctx, r300->selected_vp->code.InputsRead, r300->selected_vp->code.OutputsWritten); r300UpdateShaderStates(r300); /* ensure we have the cmd buf space in advance to cover * the state + DMA AOS pointers */ GLuint emit_end = r300PredictTryDrawPrimsSize(ctx, nr_prims, prim) + r300->radeon.cmdbuf.cs->cdw; r300SetupIndexBuffer(ctx, ib); r300AllocDmaRegions(ctx, arrays, max_index + 1); if (r300->fallback) return GL_FALSE; r300EmitCacheFlush(r300); radeonEmitState(&r300->radeon); for (i = 0; i < nr_prims; ++i) { r300RunRenderPrimitive(ctx, prim[i].start, prim[i].start + prim[i].count, prim[i].mode); } r300EmitCacheFlush(r300); r300FreeData(ctx); radeon_print(RADEON_RENDER, RADEON_VERBOSE, "%s: %u (%d-%d) cs ending at %d\n", __FUNCTION__, nr_prims, min_index, max_index, r300->radeon.cmdbuf.cs->cdw ); if (emit_end < r300->radeon.cmdbuf.cs->cdw) WARN_ONCE("Rendering was %d commands larger than predicted size." " We might overflow command buffer.\n", r300->radeon.cmdbuf.cs->cdw - emit_end); return GL_TRUE; }