コード例 #1
0
void
nv10_emit_blend_func(struct gl_context *ctx, int emit)
{
	struct nouveau_pushbuf *push = context_push(ctx);

	BEGIN_NV04(push, NV10_3D(BLEND_FUNC_SRC), 2);
	PUSH_DATA (push, nvgl_blend_func(ctx->Color.Blend[0].SrcRGB));
	PUSH_DATA (push, nvgl_blend_func(ctx->Color.Blend[0].DstRGB));
}
コード例 #2
0
ファイル: nv50_state.c プロジェクト: MttDs/new-rexeno-tindpe
static void *
nv50_blend_state_create(struct pipe_context *pipe,
			const struct pipe_blend_state *cso)
{
	struct nouveau_stateobj *so = so_new(64, 0);
	struct nouveau_grobj *tesla = nv50_context(pipe)->screen->tesla;
	struct nv50_blend_stateobj *bso = CALLOC_STRUCT(nv50_blend_stateobj);
	unsigned cmask = 0, i;

	/*XXX ignored:
	 * 	- dither
	 */

	if (cso->blend_enable == 0) {
		so_method(so, tesla, NV50TCL_BLEND_ENABLE(0), 8);
		for (i = 0; i < 8; i++)
			so_data(so, 0);
	} else {
		so_method(so, tesla, NV50TCL_BLEND_ENABLE(0), 8);
		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_method(so, tesla, NV50TCL_BLEND_FUNC_DST_ALPHA, 1);
		so_data  (so, 0x4000 | nvgl_blend_func(cso->alpha_dst_factor));
	}

	if (cso->logicop_enable == 0 ) {
		so_method(so, tesla, NV50TCL_LOGIC_OP_ENABLE, 1);
		so_data  (so, 0);
	} else {
		so_method(so, tesla, NV50TCL_LOGIC_OP_ENABLE, 2);
		so_data  (so, 1);
		so_data  (so, nvgl_logicop_func(cso->logicop_func));
	}

	if (cso->colormask & PIPE_MASK_R)
		cmask |= (1 << 0);
	if (cso->colormask & PIPE_MASK_G)
		cmask |= (1 << 4);
	if (cso->colormask & PIPE_MASK_B)
		cmask |= (1 << 8);
	if (cso->colormask & PIPE_MASK_A)
		cmask |= (1 << 12);
	so_method(so, tesla, NV50TCL_COLOR_MASK(0), 8);
	for (i = 0; i < 8; i++)
		so_data(so, cmask);

	bso->pipe = *cso;
	so_ref(so, &bso->so);
	so_ref(NULL, &so);
	return (void *)bso;
}
コード例 #3
0
ファイル: nv40_state.c プロジェクト: MttDs/new-rexeno-tindpe
static void *
nv40_blend_state_create(struct pipe_context *pipe,
			const struct pipe_blend_state *cso)
{
	struct nv40_context *nv40 = nv40_context(pipe);
	struct nouveau_grobj *curie = nv40->screen->curie;
	struct nv40_blend_state *bso = CALLOC(1, sizeof(*bso));
	struct nouveau_stateobj *so = so_new(16, 0);

	if (cso->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_method(so, curie, NV40TCL_BLEND_EQUATION, 1);
		so_data  (so, nvgl_blend_eqn(cso->alpha_func) << 16 |
			      nvgl_blend_eqn(cso->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)));

	if (cso->logicop_enable) {
		so_method(so, curie, NV40TCL_COLOR_LOGIC_OP_ENABLE, 2);
		so_data  (so, 1);
		so_data  (so, nvgl_logicop_func(cso->logicop_func));
	} else {
		so_method(so, curie, NV40TCL_COLOR_LOGIC_OP_ENABLE, 1);
		so_data  (so, 0);
	}

	so_method(so, curie, NV40TCL_DITHER_ENABLE, 1);
	so_data  (so, cso->dither ? 1 : 0);

	so_ref(so, &bso->so);
	so_ref(NULL, &so);
	bso->pipe = *cso;
	return (void *)bso;
}
コード例 #4
0
ファイル: nv50_state.c プロジェクト: CPFDSoftware-Tony/gmv
static void *
nv50_blend_state_create(struct pipe_context *pipe,
                        const struct pipe_blend_state *cso)
{
    struct nouveau_stateobj *so = so_new(5, 24, 0);
    struct nouveau_grobj *tesla = nv50_context(pipe)->screen->tesla;
    struct nv50_blend_stateobj *bso = CALLOC_STRUCT(nv50_blend_stateobj);
    unsigned i, blend_enabled = 0;

    /*XXX ignored:
     * 	- dither
     */

    so_method(so, tesla, NV50TCL_BLEND_ENABLE(0), 8);
    if (cso->independent_blend_enable) {
        for (i = 0; i < 8; ++i) {
            so_data(so, cso->rt[i].blend_enable);
            if (cso->rt[i].blend_enable)
                blend_enabled = 1;
        }
    } else if (cso->rt[0].blend_enable) {
        blend_enabled = 1;
        for (i = 0; i < 8; i++)
            so_data(so, 1);
    } else {
        for (i = 0; i < 8; i++)
            so_data(so, 0);
    }
    if (blend_enabled) {
        so_method(so, tesla, NV50TCL_BLEND_EQUATION_RGB, 5);
        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->rt[0].alpha_dst_factor));
    }

    if (cso->logicop_enable == 0 ) {
        so_method(so, tesla, NV50TCL_LOGIC_OP_ENABLE, 1);
        so_data  (so, 0);
    } else {
        so_method(so, tesla, NV50TCL_LOGIC_OP_ENABLE, 2);
        so_data  (so, 1);
        so_data  (so, nvgl_logicop_func(cso->logicop_func));
    }

    so_method(so, tesla, NV50TCL_COLOR_MASK(0), 8);
    if (cso->independent_blend_enable)
        for (i = 0; i < 8; ++i)
            so_data(so, nv50_colormask(cso->rt[i].colormask));
    else {
        uint32_t cmask = nv50_colormask(cso->rt[0].colormask);
        for (i = 0; i < 8; i++)
            so_data(so, cmask);
    }

    bso->pipe = *cso;
    so_ref(so, &bso->so);
    so_ref(NULL, &so);
    return (void *)bso;
}
コード例 #5
0
ファイル: nv30_state.c プロジェクト: Distrotech/Mesa
static void *
nv30_blend_state_create(struct pipe_context *pipe,
                        const struct pipe_blend_state *cso)
{
   struct nouveau_object *eng3d = nv30_context(pipe)->screen->eng3d;
   struct nv30_blend_stateobj *so;
   uint32_t blend[2], cmask[2];
   int i;

   so = CALLOC_STRUCT(nv30_blend_stateobj);
   if (!so)
      return NULL;
   so->pipe = *cso;

   if (cso->logicop_enable) {
      SB_MTHD30(so, COLOR_LOGIC_OP_ENABLE, 2);
      SB_DATA  (so, 1);
      SB_DATA  (so, nvgl_logicop_func(cso->logicop_func));
   } else {
      SB_MTHD30(so, COLOR_LOGIC_OP_ENABLE, 1);
      SB_DATA  (so, 0);
   }

   SB_MTHD30(so, DITHER_ENABLE, 1);
   SB_DATA  (so, cso->dither);

   blend[0] = cso->rt[0].blend_enable;
   cmask[0] = !!(cso->rt[0].colormask & PIPE_MASK_A) << 24 |
              !!(cso->rt[0].colormask & PIPE_MASK_R) << 16 |
              !!(cso->rt[0].colormask & PIPE_MASK_G) <<  8 |
              !!(cso->rt[0].colormask & PIPE_MASK_B);
   if (cso->independent_blend_enable) {
      blend[1] = 0;
      cmask[1] = 0;
      for (i = 1; i < 4; i++) {
         blend[1] |= cso->rt[i].blend_enable << i;
         cmask[1] |= !!(cso->rt[i].colormask & PIPE_MASK_A) << (0 + (i * 4)) |
                     !!(cso->rt[i].colormask & PIPE_MASK_R) << (1 + (i * 4)) |
                     !!(cso->rt[i].colormask & PIPE_MASK_G) << (2 + (i * 4)) |
                     !!(cso->rt[i].colormask & PIPE_MASK_B) << (3 + (i * 4));
      }
   } else {
      blend[1]  = 0x0000000e *   (blend[0] & 0x00000001);
      cmask[1]  = 0x00001110 * !!(cmask[0] & 0x01000000);
      cmask[1] |= 0x00002220 * !!(cmask[0] & 0x00010000);
      cmask[1] |= 0x00004440 * !!(cmask[0] & 0x00000100);
      cmask[1] |= 0x00008880 * !!(cmask[0] & 0x00000001);
   }

   if (eng3d->oclass >= NV40_3D_CLASS) {
      SB_MTHD40(so, MRT_BLEND_ENABLE, 2);
      SB_DATA  (so, blend[1]);
      SB_DATA  (so, cmask[1]);
   }

   if (blend[0] || blend[1]) {
      SB_MTHD30(so, BLEND_FUNC_ENABLE, 3);
      SB_DATA  (so, blend[0]);
      SB_DATA  (so, (nvgl_blend_func(cso->rt[0].alpha_src_factor) << 16) |
                     nvgl_blend_func(cso->rt[0].rgb_src_factor));
      SB_DATA  (so, (nvgl_blend_func(cso->rt[0].alpha_dst_factor) << 16) |
                     nvgl_blend_func(cso->rt[0].rgb_dst_factor));
      if (eng3d->oclass < NV40_3D_CLASS) {
         SB_MTHD30(so, BLEND_EQUATION, 1);
         SB_DATA  (so, nvgl_blend_eqn(cso->rt[0].rgb_func));
      } else {
         SB_MTHD40(so, BLEND_EQUATION, 1);
         SB_DATA  (so, (nvgl_blend_eqn(cso->rt[0].alpha_func) << 16) |
                        nvgl_blend_eqn(cso->rt[0].rgb_func));
      }
   } else {
      SB_MTHD30(so, BLEND_FUNC_ENABLE, 1);
      SB_DATA  (so, blend[0]);
   }

   SB_MTHD30(so, COLOR_MASK, 1);
   SB_DATA  (so, cmask[0]);
   return so;
}