nouveau: adapt drviers to blend changes
authorRoland Scheidegger <sroland@vmware.com>
Mon, 25 Jan 2010 15:38:32 +0000 (16:38 +0100)
committerRoland Scheidegger <sroland@vmware.com>
Mon, 25 Jan 2010 15:38:32 +0000 (16:38 +0100)
src/gallium/drivers/nv04/nv04_state.c
src/gallium/drivers/nv10/nv10_state.c
src/gallium/drivers/nv20/nv20_state.c
src/gallium/drivers/nv30/nv30_state.c
src/gallium/drivers/nv40/nv40_state.c
src/gallium/drivers/nv50/nv50_state.c

index b67f1e1..1fdb764 100644 (file)
@@ -17,11 +17,11 @@ nv04_blend_state_create(struct pipe_context *pipe,
 
        cb = MALLOC(sizeof(struct nv04_blend_state));
 
-       cb->b_enable = cso->blend_enable ? 1 : 0;
-       cb->b_src = ((nvgl_blend_func(cso->alpha_src_factor)<<16) |
-                        (nvgl_blend_func(cso->rgb_src_factor)));
-       cb->b_dst = ((nvgl_blend_func(cso->alpha_dst_factor)<<16) |
-                        (nvgl_blend_func(cso->rgb_dst_factor)));
+       cb->b_enable = cso->rt[0].blend_enable ? 1 : 0;
+       cb->b_src = ((nvgl_blend_func(cso->rt[0].alpha_src_factor)<<16) |
+                        (nvgl_blend_func(cso->rt[0].rgb_src_factor)));
+       cb->b_dst = ((nvgl_blend_func(cso->rt[0].alpha_dst_factor)<<16) |
+                        (nvgl_blend_func(cso->rt[0].rgb_dst_factor)));
        
 
        return (void *)cb;
index ad7def5..9aafc60 100644 (file)
@@ -17,16 +17,16 @@ nv10_blend_state_create(struct pipe_context *pipe,
 
        cb = MALLOC(sizeof(struct nv10_blend_state));
 
-       cb->b_enable = cso->blend_enable ? 1 : 0;
-       cb->b_srcfunc = ((nvgl_blend_func(cso->alpha_src_factor)<<16) |
-                        (nvgl_blend_func(cso->rgb_src_factor)));
-       cb->b_dstfunc = ((nvgl_blend_func(cso->alpha_dst_factor)<<16) |
-                        (nvgl_blend_func(cso->rgb_dst_factor)));
-
-       cb->c_mask = (((cso->colormask & PIPE_MASK_A) ? (0x01<<24) : 0) |
-                     ((cso->colormask & PIPE_MASK_R) ? (0x01<<16) : 0) |
-                     ((cso->colormask & PIPE_MASK_G) ? (0x01<< 8) : 0) |
-                     ((cso->colormask & PIPE_MASK_B) ? (0x01<< 0) : 0));
+       cb->b_enable = cso->rt[0].blend_enable ? 1 : 0;
+       cb->b_srcfunc = ((nvgl_blend_func(cso->rt[0].alpha_src_factor)<<16) |
+                        (nvgl_blend_func(cso->rt[0].rgb_src_factor)));
+       cb->b_dstfunc = ((nvgl_blend_func(cso->rt[0].alpha_dst_factor)<<16) |
+                        (nvgl_blend_func(cso->rt[0].rgb_dst_factor)));
+
+       cb->c_mask = (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01<<24) : 0) |
+                     ((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01<<16) : 0) |
+                     ((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01<< 8) : 0) |
+                     ((cso->rt[0].colormask & PIPE_MASK_B) ? (0x01<< 0) : 0));
 
        cb->d_enable = cso->dither ? 1 : 0;
 
index 45697a6..83335c7 100644 (file)
@@ -17,16 +17,16 @@ nv20_blend_state_create(struct pipe_context *pipe,
 
        cb = MALLOC(sizeof(struct nv20_blend_state));
 
-       cb->b_enable = cso->blend_enable ? 1 : 0;
-       cb->b_srcfunc = ((nvgl_blend_func(cso->alpha_src_factor)<<16) |
-                        (nvgl_blend_func(cso->rgb_src_factor)));
-       cb->b_dstfunc = ((nvgl_blend_func(cso->alpha_dst_factor)<<16) |
-                        (nvgl_blend_func(cso->rgb_dst_factor)));
-
-       cb->c_mask = (((cso->colormask & PIPE_MASK_A) ? (0x01<<24) : 0) |
-                     ((cso->colormask & PIPE_MASK_R) ? (0x01<<16) : 0) |
-                     ((cso->colormask & PIPE_MASK_G) ? (0x01<< 8) : 0) |
-                     ((cso->colormask & PIPE_MASK_B) ? (0x01<< 0) : 0));
+       cb->b_enable = cso->rt[0].blend_enable ? 1 : 0;
+       cb->b_srcfunc = ((nvgl_blend_func(cso->rt[0].alpha_src_factor)<<16) |
+                        (nvgl_blend_func(cso->rt[0].rgb_src_factor)));
+       cb->b_dstfunc = ((nvgl_blend_func(cso->rt[0].alpha_dst_factor)<<16) |
+                        (nvgl_blend_func(cso->rt[0].rgb_dst_factor)));
+
+       cb->c_mask = (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01<<24) : 0) |
+                     ((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01<<16) : 0) |
+                     ((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01<< 8) : 0) |
+                     ((cso->rt[0].colormask & PIPE_MASK_B) ? (0x01<< 0) : 0));
 
        cb->d_enable = cso->dither ? 1 : 0;
 
index 065c927..1f4c964 100644 (file)
@@ -16,27 +16,27 @@ nv30_blend_state_create(struct pipe_context *pipe,
        struct nv30_blend_state *bso = CALLOC(1, sizeof(*bso));
        struct nouveau_stateobj *so = so_new(5, 8, 0);
 
-       if (cso->blend_enable) {
+       if (cso->rt[0].blend_enable) {
                so_method(so, rankine, NV34TCL_BLEND_FUNC_ENABLE, 3);
                so_data  (so, 1);
-               so_data  (so, (nvgl_blend_func(cso->alpha_src_factor) << 16) |
-                              nvgl_blend_func(cso->rgb_src_factor));
-               so_data  (so, nvgl_blend_func(cso->alpha_dst_factor) << 16 |
-                             nvgl_blend_func(cso->rgb_dst_factor));
+               so_data  (so, (nvgl_blend_func(cso->rt[0].alpha_src_factor) << 16) |
+                              nvgl_blend_func(cso->rt[0].rgb_src_factor));
+               so_data  (so, nvgl_blend_func(cso->rt[0].alpha_dst_factor) << 16 |
+                             nvgl_blend_func(cso->rt[0].rgb_dst_factor));
                /* FIXME: Gallium assumes GL_EXT_blend_func_separate.
                   It is not the case for NV30 */
                so_method(so, rankine, NV34TCL_BLEND_EQUATION, 1);
-               so_data  (so, nvgl_blend_eqn(cso->rgb_func));
+               so_data  (so, nvgl_blend_eqn(cso->rt[0].rgb_func));
        } else {
                so_method(so, rankine, NV34TCL_BLEND_FUNC_ENABLE, 1);
                so_data  (so, 0);
        }
 
        so_method(so, rankine, NV34TCL_COLOR_MASK, 1);
-       so_data  (so, (((cso->colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) |
-                      ((cso->colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) |
-                      ((cso->colormask & PIPE_MASK_G) ? (0x01 <<  8) : 0) |
-                      ((cso->colormask & PIPE_MASK_B) ? (0x01 <<  0) : 0)));
+       so_data  (so, (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) |
+                      ((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) |
+                      ((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01 <<  8) : 0) |
+                      ((cso->rt[0].colormask & PIPE_MASK_B) ? (0x01 <<  0) : 0)));
 
        if (cso->logicop_enable) {
                so_method(so, rankine, NV34TCL_COLOR_LOGIC_OP_ENABLE, 2);
index 7d990f7..7a63fba 100644 (file)
@@ -18,26 +18,26 @@ nv40_blend_state_create(struct pipe_context *pipe,
        struct nv40_blend_state *bso = CALLOC(1, sizeof(*bso));
        struct nouveau_stateobj *so = so_new(5, 8, 0);
 
-       if (cso->blend_enable) {
+       if (cso->rt[0].blend_enable) {
                so_method(so, curie, NV40TCL_BLEND_ENABLE, 3);
                so_data  (so, 1);
-               so_data  (so, (nvgl_blend_func(cso->alpha_src_factor) << 16) |
-                              nvgl_blend_func(cso->rgb_src_factor));
-               so_data  (so, nvgl_blend_func(cso->alpha_dst_factor) << 16 |
-                             nvgl_blend_func(cso->rgb_dst_factor));
+               so_data  (so, (nvgl_blend_func(cso->rt[0].alpha_src_factor) << 16) |
+                              nvgl_blend_func(cso->rt[0].rgb_src_factor));
+               so_data  (so, nvgl_blend_func(cso->rt[0].alpha_dst_factor) << 16 |
+                             nvgl_blend_func(cso->rt[0].rgb_dst_factor));
                so_method(so, curie, NV40TCL_BLEND_EQUATION, 1);
-               so_data  (so, nvgl_blend_eqn(cso->alpha_func) << 16 |
-                             nvgl_blend_eqn(cso->rgb_func));
+               so_data  (so, nvgl_blend_eqn(cso->rt[0].alpha_func) << 16 |
+                             nvgl_blend_eqn(cso->rt[0].rgb_func));
        } else {
                so_method(so, curie, NV40TCL_BLEND_ENABLE, 1);
                so_data  (so, 0);
        }
 
        so_method(so, curie, NV40TCL_COLOR_MASK, 1);
-       so_data  (so, (((cso->colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) |
-                      ((cso->colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) |
-                      ((cso->colormask & PIPE_MASK_G) ? (0x01 <<  8) : 0) |
-                      ((cso->colormask & PIPE_MASK_B) ? (0x01 <<  0) : 0)));
+       so_data  (so, (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) |
+                      ((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) |
+                      ((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01 <<  8) : 0) |
+                      ((cso->rt[0].colormask & PIPE_MASK_B) ? (0x01 <<  0) : 0)));
 
        if (cso->logicop_enable) {
                so_method(so, curie, NV40TCL_COLOR_LOGIC_OP_ENABLE, 2);
index 6ab33be..815dfa4 100644 (file)
@@ -44,7 +44,7 @@ nv50_blend_state_create(struct pipe_context *pipe,
         *      - dither
         */
 
-       if (cso->blend_enable == 0) {
+       if (cso->rt[0].blend_enable == 0) {
                so_method(so, tesla, NV50TCL_BLEND_ENABLE(0), 8);
                for (i = 0; i < 8; i++)
                        so_data(so, 0);
@@ -53,13 +53,13 @@ nv50_blend_state_create(struct pipe_context *pipe,
                for (i = 0; i < 8; i++)
                        so_data(so, 1);
                so_method(so, tesla, NV50TCL_BLEND_EQUATION_RGB, 5);
-               so_data  (so, nvgl_blend_eqn(cso->rgb_func));
-               so_data  (so, 0x4000 | nvgl_blend_func(cso->rgb_src_factor));
-               so_data  (so, 0x4000 | nvgl_blend_func(cso->rgb_dst_factor));
-               so_data  (so, nvgl_blend_eqn(cso->alpha_func));
-               so_data  (so, 0x4000 | nvgl_blend_func(cso->alpha_src_factor));
+               so_data  (so, nvgl_blend_eqn(cso->rt[0].rgb_func));
+               so_data  (so, 0x4000 | nvgl_blend_func(cso->rt[0].rgb_src_factor));
+               so_data  (so, 0x4000 | nvgl_blend_func(cso->rt[0].rgb_dst_factor));
+               so_data  (so, nvgl_blend_eqn(cso->rt[0].alpha_func));
+               so_data  (so, 0x4000 | nvgl_blend_func(cso->rt[0].alpha_src_factor));
                so_method(so, tesla, NV50TCL_BLEND_FUNC_DST_ALPHA, 1);
-               so_data  (so, 0x4000 | nvgl_blend_func(cso->alpha_dst_factor));
+               so_data  (so, 0x4000 | nvgl_blend_func(cso->rt[0].alpha_dst_factor));
        }
 
        if (cso->logicop_enable == 0 ) {
@@ -71,13 +71,13 @@ nv50_blend_state_create(struct pipe_context *pipe,
                so_data  (so, nvgl_logicop_func(cso->logicop_func));
        }
 
-       if (cso->colormask & PIPE_MASK_R)
+       if (cso->rt[0].colormask & PIPE_MASK_R)
                cmask |= (1 << 0);
-       if (cso->colormask & PIPE_MASK_G)
+       if (cso->rt[0].colormask & PIPE_MASK_G)
                cmask |= (1 << 4);
-       if (cso->colormask & PIPE_MASK_B)
+       if (cso->rt[0].colormask & PIPE_MASK_B)
                cmask |= (1 << 8);
-       if (cso->colormask & PIPE_MASK_A)
+       if (cso->rt[0].colormask & PIPE_MASK_A)
                cmask |= (1 << 12);
        so_method(so, tesla, NV50TCL_COLOR_MASK(0), 8);
        for (i = 0; i < 8; i++)