Beispiel #1
0
boolean xorg_composite_bind_state(struct exa_context *exa,
                                  int op,
                                  PicturePtr pSrcPicture,
                                  PicturePtr pMaskPicture,
                                  PicturePtr pDstPicture,
                                  struct exa_pixmap_priv *pSrc,
                                  struct exa_pixmap_priv *pMask,
                                  struct exa_pixmap_priv *pDst)
{
   struct pipe_surface *dst_surf = xorg_gpu_surface(exa->pipe, pDst);

   renderer_bind_destination(exa->renderer, dst_surf,
                             pDst->width,
                             pDst->height);

   bind_blend_state(exa, op, pSrcPicture, pMaskPicture, pDstPicture);
   bind_shaders(exa, op, pSrcPicture, pMaskPicture, pDstPicture, pSrc, pMask);
   bind_samplers(exa, op, pSrcPicture, pMaskPicture,
                 pDstPicture, pSrc, pMask, pDst);

   setup_transforms(exa, pSrcPicture, pMaskPicture);

   if (exa->num_bound_samplers == 0 ) { /* solid fill */
      renderer_begin_solid(exa->renderer);
   } else {
      renderer_begin_textures(exa->renderer,
                              exa->num_bound_samplers);
   }


   pipe_surface_reference(&dst_surf, NULL);
   return TRUE;
}
XA_EXPORT int
xa_composite_prepare(struct xa_context *ctx,
		     const struct xa_composite *comp)
{
    struct xa_surface *dst_srf = comp->dst->srf;
    int ret;

    ret = xa_ctx_srf_create(ctx, dst_srf);
    if (ret != XA_ERR_NONE)
	return ret;

    ctx->dst = dst_srf;
    renderer_bind_destination(ctx, ctx->srf, ctx->srf->width,
			      ctx->srf->height);

    ret = bind_composite_blend_state(ctx, comp);
    if (ret != XA_ERR_NONE)
	return ret;
    ret = bind_shaders(ctx, comp);
    if (ret != XA_ERR_NONE)
	return ret;
    bind_samplers(ctx, comp);

    if (ctx->num_bound_samplers == 0 ) { /* solid fill */
	renderer_begin_solid(ctx);
    } else {
	renderer_begin_textures(ctx);
	ctx->comp = comp;
    }

    xa_ctx_srf_destroy(ctx);
    return XA_ERR_NONE;
}
void GLAPIENTRY
_mesa_BindSamplers(GLuint first, GLsizei count, const GLuint *samplers)
{
   GET_CURRENT_CONTEXT(ctx);

   /* The ARB_multi_bind spec says:
    *
    *   "An INVALID_OPERATION error is generated if <first> + <count> is
    *    greater than the number of texture image units supported by
    *    the implementation."
    */
   if (first + count > ctx->Const.MaxCombinedTextureImageUnits) {
      _mesa_error(ctx, GL_INVALID_OPERATION,
                  "glBindSamplers(first=%u + count=%d > the value of "
                  "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS=%u)",
                  first, count, ctx->Const.MaxCombinedTextureImageUnits);
      return;
   }

   bind_samplers(ctx, first, count, samplers, false);
}
void GLAPIENTRY
_mesa_BindSamplers_no_error(GLuint first, GLsizei count, const GLuint *samplers)
{
   GET_CURRENT_CONTEXT(ctx);
   bind_samplers(ctx, first, count, samplers, true);
}