summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r600/r600_blit.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-08-26 14:55:48 +1000
committerJerome Glisse <jglisse@redhat.com>2010-08-30 15:00:55 -0400
commit69c30f5d6d429be4f7e211867984dab1a33da79c (patch)
treede0c6838b1977f7e273e8a6912c36812c43ec839 /src/gallium/drivers/r600/r600_blit.c
parent699c82e30ce78c3975b3ce1a6fba148c70a9a78a (diff)
r600g: fixup states generation in winsys.
The current states code had an unhealthy relationship between that had to somehow magically align themselves, editing either place meant renumbering all states after the one you were on, and it was pretty unapproachable code. This replaces the huge types structures with a simple type + sub type struct, which is keyed on an stype enum in radeon.h. Each stype can have a per-shader type subclassing (4 types supported, PS/VS/GS/FS), and also has a number of states per-subtype. So you have 256 constants per 4 shaders per one CONSTANT stype. The interface from the driver is changed to pass in the tuple, (stype, id, shader_type), and we look for this. If radeon_state_shader ever shows up on profile, it could use a hashtable based on stype/shader_type to speed things up. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/gallium/drivers/r600/r600_blit.c')
-rw-r--r--src/gallium/drivers/r600/r600_blit.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
index 72175fbbd5..6b8487695c 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -190,7 +190,7 @@ static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600
memcpy(bo->data, vbo, 128);
radeon_bo_unmap(rscreen->rw, bo);
- rstate = radeon_state(rscreen->rw, R600_VS_RESOURCE_TYPE, R600_VS_RESOURCE + 0);
+ rstate = radeon_state_shader(rscreen->rw, R600_STATE_RESOURCE, 0, R600_SHADER_VS);
if (rstate == NULL) {
radeon_bo_decref(rscreen->rw, bo);
return -ENOMEM;
@@ -215,7 +215,7 @@ static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600
}
bstates->vs_resource0 = rstate;
- rstate = radeon_state(rscreen->rw, R600_VS_RESOURCE_TYPE, R600_VS_RESOURCE + 1);
+ rstate = radeon_state_shader(rscreen->rw, R600_STATE_RESOURCE, 0, R600_SHADER_VS);
if (rstate == NULL) {
return -ENOMEM;
}
@@ -303,7 +303,7 @@ static struct radeon_state *r600_blit_state_vs_shader(struct r600_screen *rscree
}
radeon_bo_unmap(rscreen->rw, bo);
- rstate = radeon_state(rscreen->rw, R600_VS_SHADER_TYPE, R600_VS_SHADER);
+ rstate = radeon_state_shader(rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_VS);
if (rstate == NULL) {
radeon_bo_decref(rscreen->rw, bo);
return NULL;
@@ -374,7 +374,7 @@ static struct radeon_state *r600_blit_state_ps_shader(struct r600_screen *rscree
}
radeon_bo_unmap(rscreen->rw, bo);
- rstate = radeon_state(rscreen->rw, R600_PS_SHADER_TYPE, R600_PS_SHADER);
+ rstate = radeon_state_shader(rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS);
if (rstate == NULL) {
radeon_bo_decref(rscreen->rw, bo);
return NULL;
@@ -403,8 +403,7 @@ static struct radeon_state *r600_blit_state_vgt(struct r600_screen *rscreen)
{
struct radeon_state *rstate;
- rstate = radeon_state(rscreen->rw, R600_VGT_TYPE, R600_VGT);
- if (rstate == NULL)
+ rstate = radeon_state(rscreen->rw, R600_STATE_VGT, 0); if (rstate == NULL)
return NULL;
/* set states (most default value are 0 and struct already
@@ -425,7 +424,7 @@ static struct radeon_state *r600_blit_state_draw(struct r600_screen *rscreen)
{
struct radeon_state *rstate;
- rstate = radeon_state(rscreen->rw, R600_DRAW_TYPE, R600_DRAW);
+ rstate = radeon_state(rscreen->rw, R600_STATE_DRAW, 0);
if (rstate == NULL)
return NULL;
@@ -448,7 +447,7 @@ static struct radeon_state *r600_blit_state_vs_constant(struct r600_screen *rscr
{
struct radeon_state *rstate;
- rstate = radeon_state(rscreen->rw, R600_VS_CONSTANT_TYPE, R600_VS_CONSTANT + id);
+ rstate = radeon_state_shader(rscreen->rw, R600_STATE_CONSTANT, id, R600_SHADER_VS);
if (rstate == NULL)
return NULL;
@@ -471,7 +470,7 @@ static struct radeon_state *r600_blit_state_rasterizer(struct r600_screen *rscre
{
struct radeon_state *rstate;
- rstate = radeon_state(rscreen->rw, R600_RASTERIZER_TYPE, R600_RASTERIZER);
+ rstate = radeon_state(rscreen->rw, R600_STATE_RASTERIZER, 0);
if (rstate == NULL)
return NULL;
@@ -500,7 +499,7 @@ static struct radeon_state *r600_blit_state_dsa(struct r600_screen *rscreen)
{
struct radeon_state *rstate;
- rstate = radeon_state(rscreen->rw, R600_DSA_TYPE, R600_DSA);
+ rstate = radeon_state(rscreen->rw, R600_STATE_DSA, 0);
if (rstate == NULL)
return NULL;
@@ -524,7 +523,7 @@ static struct radeon_state *r600_blit_state_blend(struct r600_screen *rscreen)
{
struct radeon_state *rstate;
- rstate = radeon_state(rscreen->rw, R600_BLEND_TYPE, R600_BLEND);
+ rstate = radeon_state(rscreen->rw, R600_STATE_BLEND, 0);
if (rstate == NULL)
return NULL;
@@ -543,7 +542,7 @@ static struct radeon_state *r600_blit_state_cb_cntl(struct r600_screen *rscreen)
{
struct radeon_state *rstate;
- rstate = radeon_state(rscreen->rw, R600_CB_CNTL_TYPE, R600_CB_CNTL);
+ rstate = radeon_state(rscreen->rw, R600_STATE_CB_CNTL, 0);
if (rstate == NULL)
return NULL;