mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-30 09:20:23 +01:00
cell: send rasterizer state to SPUs in proper way, remove front_winding hack
This commit is contained in:
parent
8bf1059977
commit
ec7d6c6561
8 changed files with 34 additions and 9 deletions
|
|
@ -99,8 +99,9 @@
|
|||
#define CELL_CMD_STATE_FRAGMENT_PROGRAM 19
|
||||
#define CELL_CMD_STATE_ATTRIB_FETCH 20
|
||||
#define CELL_CMD_STATE_FS_CONSTANTS 21
|
||||
#define CELL_CMD_VS_EXECUTE 22
|
||||
#define CELL_CMD_FLUSH_BUFFER_RANGE 23
|
||||
#define CELL_CMD_STATE_RASTERIZER 22
|
||||
#define CELL_CMD_VS_EXECUTE 23
|
||||
#define CELL_CMD_FLUSH_BUFFER_RANGE 24
|
||||
|
||||
/** Command/batch buffers */
|
||||
#define CELL_NUM_BUFFERS 4
|
||||
|
|
@ -156,13 +157,23 @@ struct cell_command_fragment_program
|
|||
*/
|
||||
struct cell_command_framebuffer
|
||||
{
|
||||
uint64_t opcode; /**< CELL_CMD_FRAMEBUFFER */
|
||||
uint64_t opcode; /**< CELL_CMD_STATE_FRAMEBUFFER */
|
||||
int width, height;
|
||||
void *color_start, *depth_start;
|
||||
enum pipe_format color_format, depth_format;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Tell SPUs about rasterizer state.
|
||||
*/
|
||||
struct cell_command_rasterizer
|
||||
{
|
||||
uint64_t opcode; /**< CELL_CMD_STATE_RASTERIZER */
|
||||
struct pipe_rasterizer_state rasterizer;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Clear framebuffer to the given value/color.
|
||||
*/
|
||||
|
|
@ -238,7 +249,6 @@ struct cell_command_render
|
|||
float xmin, ymin, xmax, ymax; /* XXX another dummy field */
|
||||
uint min_index;
|
||||
boolean inline_verts;
|
||||
uint front_winding; /* the rasterizer needs to be able to determine facing to apply front/back-facing stencil */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -147,6 +147,13 @@ cell_emit_state(struct cell_context *cell)
|
|||
#endif
|
||||
}
|
||||
|
||||
if (cell->dirty & (CELL_NEW_RASTERIZER)) {
|
||||
struct cell_command_rasterizer *rast =
|
||||
cell_batch_alloc(cell, sizeof(*rast));
|
||||
rast->opcode = CELL_CMD_STATE_RASTERIZER;
|
||||
rast->rasterizer = *cell->rasterizer;
|
||||
}
|
||||
|
||||
if (cell->dirty & (CELL_NEW_FS)) {
|
||||
/* Send new fragment program to SPUs */
|
||||
struct cell_command_fragment_program *fp
|
||||
|
|
|
|||
|
|
@ -214,7 +214,6 @@ cell_vbuf_draw(struct vbuf_render *vbr,
|
|||
|
||||
render->opcode = CELL_CMD_RENDER;
|
||||
render->prim_type = cvbr->prim;
|
||||
render->front_winding = cell->rasterizer->front_winding;
|
||||
|
||||
render->num_indexes = nr_indices;
|
||||
render->min_index = min_index;
|
||||
|
|
|
|||
|
|
@ -583,6 +583,14 @@ cmd_batch(uint opcode)
|
|||
case CELL_CMD_STATE_FS_CONSTANTS:
|
||||
pos = cmd_state_fs_constants(buffer, pos);
|
||||
break;
|
||||
case CELL_CMD_STATE_RASTERIZER:
|
||||
{
|
||||
struct cell_command_rasterizer *rast =
|
||||
(struct cell_command_rasterizer *) &buffer[pos];
|
||||
spu.rasterizer = rast->rasterizer;
|
||||
pos += sizeof(*rast) / 8;
|
||||
}
|
||||
break;
|
||||
case CELL_CMD_STATE_SAMPLER:
|
||||
{
|
||||
struct cell_command_sampler *sampler
|
||||
|
|
|
|||
|
|
@ -153,6 +153,7 @@ struct spu_global
|
|||
struct pipe_blend_state blend;
|
||||
struct pipe_blend_color blend_color;
|
||||
struct pipe_sampler_state sampler[PIPE_MAX_SAMPLERS];
|
||||
struct pipe_rasterizer_state rasterizer;
|
||||
struct spu_texture texture[PIPE_MAX_SAMPLERS];
|
||||
struct vertex_info vertex_info;
|
||||
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ cmd_render(const struct cell_command_render *render, uint *pos_incr)
|
|||
v1 = (const float *) (vertices + indexes[j+1] * vertex_size);
|
||||
v2 = (const float *) (vertices + indexes[j+2] * vertex_size);
|
||||
|
||||
drawn += tri_draw(v0, v1, v2, tx, ty, render->front_winding);
|
||||
drawn += tri_draw(v0, v1, v2, tx, ty);
|
||||
}
|
||||
|
||||
//printf("SPU %u: drew %u of %u\n", spu.init.id, drawn, render->num_indexes/3);
|
||||
|
|
|
|||
|
|
@ -775,7 +775,7 @@ determinant(const float *v0, const float *v1, const float *v2)
|
|||
*/
|
||||
boolean
|
||||
tri_draw(const float *v0, const float *v1, const float *v2,
|
||||
uint tx, uint ty, uint front_winding)
|
||||
uint tx, uint ty)
|
||||
{
|
||||
setup.tx = tx;
|
||||
setup.ty = ty;
|
||||
|
|
@ -790,7 +790,7 @@ tri_draw(const float *v0, const float *v1, const float *v2,
|
|||
* which will be needed for front/back-face stencil application
|
||||
*/
|
||||
float det = determinant(v0, v1, v2);
|
||||
setup.facing = (det > 0.0) ^ (front_winding == PIPE_WINDING_CW);
|
||||
setup.facing = (det > 0.0) ^ (spu.rasterizer.front_winding == PIPE_WINDING_CW);
|
||||
|
||||
if (!setup_sort_vertices((struct vertex_header *) v0,
|
||||
(struct vertex_header *) v1,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
|
||||
extern boolean
|
||||
tri_draw(const float *v0, const float *v1, const float *v2, uint tx, uint ty, uint front_winding);
|
||||
tri_draw(const float *v0, const float *v1, const float *v2, uint tx, uint ty);
|
||||
|
||||
|
||||
#endif /* SPU_TRI_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue