本文整理汇总了C++中pipe_sampler_view_reference函数的典型用法代码示例。如果您正苦于以下问题:C++ pipe_sampler_view_reference函数的具体用法?C++ pipe_sampler_view_reference怎么用?C++ pipe_sampler_view_reference使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pipe_sampler_view_reference函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: save_sampler_views
static void
save_sampler_views(struct cso_context *ctx,
struct sampler_info *info)
{
uint i;
info->nr_views_saved = info->nr_views;
for (i = 0; i < info->nr_views; i++) {
assert(!info->views_saved[i]);
pipe_sampler_view_reference(&info->views_saved[i], info->views[i]);
}
}
示例2: cso_save_fragment_sampler_views
static void
cso_save_fragment_sampler_views(struct cso_context *ctx)
{
unsigned i;
ctx->nr_fragment_views_saved = ctx->nr_fragment_views;
for (i = 0; i < ctx->nr_fragment_views; i++) {
assert(!ctx->fragment_views_saved[i]);
pipe_sampler_view_reference(&ctx->fragment_views_saved[i],
ctx->fragment_views[i]);
}
}
示例3: nv30_fragtex_set_sampler_views
static void
nv30_fragtex_set_sampler_views(struct pipe_context *pipe, unsigned nr,
struct pipe_sampler_view **views)
{
struct nv30_context *nv30 = nv30_context(pipe);
unsigned i;
for (i = 0; i < nr; i++) {
nouveau_bufctx_reset(nv30->bufctx, BUFCTX_FRAGTEX(i));
pipe_sampler_view_reference(&nv30->fragprog.textures[i], views[i]);
nv30->fragprog.dirty_samplers |= (1 << i);
}
for (; i < nv30->fragprog.num_textures; i++) {
nouveau_bufctx_reset(nv30->bufctx, BUFCTX_FRAGTEX(i));
pipe_sampler_view_reference(&nv30->fragprog.textures[i], NULL);
nv30->fragprog.dirty_samplers |= (1 << i);
}
nv30->fragprog.num_textures = nr;
nv30->dirty |= NV30_NEW_FRAGTEX;
}
示例4: cso_save_sampler_views
void
cso_save_sampler_views(struct cso_context *ctx, unsigned shader_stage)
{
struct sampler_info *info = &ctx->samplers[shader_stage];
unsigned i;
info->nr_views_saved = info->nr_views;
for (i = 0; i < info->nr_views; i++) {
assert(!info->views_saved[i]);
pipe_sampler_view_reference(&info->views_saved[i], info->views[i]);
}
}
示例5: r600_copy_first_sample
static void r600_copy_first_sample(struct pipe_context *ctx,
const struct pipe_resolve_info *info)
{
struct r600_context *rctx = (struct r600_context *)ctx;
struct r600_texture *rsrc = (struct r600_texture*)info->src.res;
struct pipe_surface *dst_view, dst_templ;
struct pipe_sampler_view src_templ, *src_view;
struct pipe_box box;
if (rsrc->is_depth && !rsrc->is_flushing_texture) {
if (!r600_init_flushed_depth_texture(ctx, info->src.res, NULL))
return; /* error */
/* Decompress the first sample only. */
r600_blit_decompress_depth(ctx, rsrc, NULL,
0, 0,
info->src.layer, info->src.layer,
0, 0);
}
if (rctx->chip_class != CAYMAN && rsrc->fmask_size && rsrc->cmask_size) {
r600_blit_decompress_color(ctx, rsrc,
0, 0,
info->src.layer, info->src.layer);
}
/* this is correct for upside-down blits too */
u_box_2d(info->src.x0,
info->src.y0,
info->src.x1 - info->src.x0,
info->src.y1 - info->src.y0, &box);
/* Initialize the surface. */
util_blitter_default_dst_texture(&dst_templ, info->dst.res,
info->dst.level, info->dst.layer, &box);
dst_view = ctx->create_surface(ctx, info->dst.res, &dst_templ);
/* Initialize the sampler view. */
util_blitter_default_src_texture(&src_templ, info->src.res, 0);
src_view = ctx->create_sampler_view(ctx, info->src.res, &src_templ);
/* Copy the first sample into dst. */
r600_blitter_begin(ctx, R600_COPY_TEXTURE);
util_blitter_copy_texture_view(rctx->blitter, dst_view, ~0, info->dst.x0,
info->dst.y0, src_view, 0, &box,
info->src.res->width0, info->src.res->height0,
info->mask);
r600_blitter_end(ctx);
pipe_surface_reference(&dst_view, NULL);
pipe_sampler_view_reference(&src_view, NULL);
}
示例6: st_flush_bitmap_cache
/**
* If there's anything in the bitmap cache, draw/flush it now.
*/
void
st_flush_bitmap_cache(struct st_context *st)
{
if (!st->bitmap.cache->empty) {
struct bitmap_cache *cache = st->bitmap.cache;
if (st->ctx->DrawBuffer) {
struct pipe_context *pipe = st->pipe;
struct pipe_sampler_view *sv;
assert(cache->xmin <= cache->xmax);
/* printf("flush size %d x %d at %d, %d\n",
cache->xmax - cache->xmin,
cache->ymax - cache->ymin,
cache->xpos, cache->ypos);
*/
/* The texture transfer has been mapped until now.
* So unmap and release the texture transfer before drawing.
*/
if (cache->trans) {
if (0)
print_cache(cache);
pipe_transfer_unmap(pipe, cache->trans);
cache->buffer = NULL;
pipe->transfer_destroy(pipe, cache->trans);
cache->trans = NULL;
}
sv = st_create_texture_sampler_view(st->pipe, cache->texture);
if (sv) {
draw_bitmap_quad(st->ctx,
cache->xpos,
cache->ypos,
cache->zpos,
BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT,
sv,
cache->color);
pipe_sampler_view_reference(&sv, NULL);
}
}
/* release/free the texture */
pipe_resource_reference(&cache->texture, NULL);
reset_cache(st);
}
}
示例7: vl_zscan_init_buffer
bool
vl_zscan_init_buffer(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer,
struct pipe_sampler_view *src, struct pipe_surface *dst)
{
struct pipe_resource res_tmpl, *res;
struct pipe_sampler_view sv_tmpl;
assert(zscan && buffer);
memset(buffer, 0, sizeof(struct vl_zscan_buffer));
pipe_sampler_view_reference(&buffer->src, src);
buffer->viewport.scale[0] = dst->width;
buffer->viewport.scale[1] = dst->height;
buffer->viewport.scale[2] = 1;
buffer->viewport.scale[3] = 1;
buffer->viewport.translate[0] = 0;
buffer->viewport.translate[1] = 0;
buffer->viewport.translate[2] = 0;
buffer->viewport.translate[3] = 0;
buffer->fb_state.width = dst->width;
buffer->fb_state.height = dst->height;
buffer->fb_state.nr_cbufs = 1;
pipe_surface_reference(&buffer->fb_state.cbufs[0], dst);
memset(&res_tmpl, 0, sizeof(res_tmpl));
res_tmpl.target = PIPE_TEXTURE_3D;
res_tmpl.format = PIPE_FORMAT_R8_UNORM;
res_tmpl.width0 = VL_BLOCK_WIDTH * zscan->blocks_per_line;
res_tmpl.height0 = VL_BLOCK_HEIGHT;
res_tmpl.depth0 = 2;
res_tmpl.array_size = 1;
res_tmpl.usage = PIPE_USAGE_IMMUTABLE;
res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW;
res = zscan->pipe->screen->resource_create(zscan->pipe->screen, &res_tmpl);
if (!res)
return false;
memset(&sv_tmpl, 0, sizeof(sv_tmpl));
u_sampler_view_default_template(&sv_tmpl, res, res->format);
sv_tmpl.swizzle_r = sv_tmpl.swizzle_g = sv_tmpl.swizzle_b = sv_tmpl.swizzle_a = TGSI_SWIZZLE_X;
buffer->quant = zscan->pipe->create_sampler_view(zscan->pipe, res, &sv_tmpl);
pipe_resource_reference(&res, NULL);
if (!buffer->quant)
return false;
return true;
}
示例8: restore_sampler_views
static void
restore_sampler_views(struct cso_context *ctx,
struct sampler_info *info,
void (*set_views)(struct pipe_context *,
unsigned num_views,
struct pipe_sampler_view **))
{
uint i;
for (i = 0; i < info->nr_views_saved; i++) {
pipe_sampler_view_reference(&info->views[i], info->views_saved[i]);
pipe_sampler_view_reference(&info->views_saved[i], NULL);
}
for (; i < info->nr_views; i++) {
pipe_sampler_view_reference(&info->views[i], NULL);
}
/* bind the old/saved sampler views */
set_views(ctx->pipe, info->nr_views_saved, info->views);
info->nr_views = info->nr_views_saved;
info->nr_views_saved = 0;
}
示例9: vl_idct_init_buffer
bool
vl_idct_init_buffer(struct vl_idct *idct, struct vl_idct_buffer *buffer,
struct pipe_sampler_view *source,
struct pipe_sampler_view *intermediate)
{
assert(buffer && idct);
assert(source && intermediate);
memset(buffer, 0, sizeof(struct vl_idct_buffer));
pipe_sampler_view_reference(&buffer->sampler_views.individual.matrix, idct->matrix);
pipe_sampler_view_reference(&buffer->sampler_views.individual.source, source);
pipe_sampler_view_reference(&buffer->sampler_views.individual.transpose, idct->transpose);
pipe_sampler_view_reference(&buffer->sampler_views.individual.intermediate, intermediate);
if (!init_source(idct, buffer))
return false;
if (!init_intermediate(idct, buffer))
return false;
return true;
}
示例10: ilo_state_vector_cleanup
void
ilo_state_vector_cleanup(struct ilo_state_vector *vec)
{
unsigned i, sh;
for (i = 0; i < Elements(vec->vb.states); i++) {
if (vec->vb.enabled_mask & (1 << i))
pipe_resource_reference(&vec->vb.states[i].buffer, NULL);
}
pipe_resource_reference(&vec->ib.buffer, NULL);
pipe_resource_reference(&vec->ib.hw_resource, NULL);
for (i = 0; i < vec->so.count; i++)
pipe_so_target_reference(&vec->so.states[i], NULL);
for (sh = 0; sh < PIPE_SHADER_TYPES; sh++) {
for (i = 0; i < vec->view[sh].count; i++) {
struct pipe_sampler_view *view = vec->view[sh].states[i];
pipe_sampler_view_reference(&view, NULL);
}
for (i = 0; i < Elements(vec->cbuf[sh].cso); i++) {
struct ilo_cbuf_cso *cbuf = &vec->cbuf[sh].cso[i];
pipe_resource_reference(&cbuf->resource, NULL);
}
}
for (i = 0; i < vec->resource.count; i++)
pipe_surface_reference(&vec->resource.states[i], NULL);
for (i = 0; i < vec->fb.state.nr_cbufs; i++)
pipe_surface_reference(&vec->fb.state.cbufs[i], NULL);
if (vec->fb.state.zsbuf)
pipe_surface_reference(&vec->fb.state.zsbuf, NULL);
for (i = 0; i < vec->cs_resource.count; i++)
pipe_surface_reference(&vec->cs_resource.states[i], NULL);
for (i = 0; i < vec->global_binding.count; i++) {
struct ilo_global_binding_cso *cso =
util_dynarray_element(&vec->global_binding.bindings,
struct ilo_global_binding_cso, i);
pipe_resource_reference(&cso->resource, NULL);
}
util_dynarray_fini(&vec->global_binding.bindings);
}
示例11: st_vdpau_unmap_surface
static void
st_vdpau_unmap_surface(struct gl_context *ctx, GLenum target, GLenum access,
GLboolean output, struct gl_texture_object *texObj,
struct gl_texture_image *texImage,
const GLvoid *vdpSurface, GLuint index)
{
struct st_texture_object *stObj = st_texture_object(texObj);
struct st_texture_image *stImage = st_texture_image(texImage);
pipe_resource_reference(&stObj->pt, NULL);
pipe_sampler_view_reference(&stObj->sampler_view, NULL);
pipe_resource_reference(&stImage->pt, NULL);
_mesa_dirty_texobj(ctx, texObj);
}
示例12: st_texture_release_sampler_view
void
st_texture_release_sampler_view(struct st_context *st,
struct st_texture_object *stObj)
{
GLuint i;
for (i = 0; i < stObj->num_sampler_views; ++i) {
struct pipe_sampler_view **sv = &stObj->sampler_views[i];
if (*sv && (*sv)->context == st->pipe) {
pipe_sampler_view_reference(sv, NULL);
break;
}
}
}
示例13: cso_set_sampler_views
void
cso_set_sampler_views(struct cso_context *ctx,
unsigned shader_stage,
unsigned count,
struct pipe_sampler_view **views)
{
struct sampler_info *info = &ctx->samplers[shader_stage];
unsigned i;
/* reference new views */
for (i = 0; i < count; i++) {
pipe_sampler_view_reference(&info->views[i], views[i]);
}
/* unref extra old views, if any */
for (; i < info->nr_views; i++) {
pipe_sampler_view_reference(&info->views[i], NULL);
}
info->nr_views = count;
/* bind the new sampler views */
ctx->pipe->set_sampler_views(ctx->pipe, shader_stage, 0, count,
info->views);
}
示例14: st_Bitmap
/**
* Called via ctx->Driver.Bitmap()
*/
static void
st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap )
{
struct st_context *st = st_context(ctx);
struct pipe_resource *pt;
if (width == 0 || height == 0)
return;
st_validate_state(st);
if (!st->bitmap.vs) {
/* create pass-through vertex shader now */
const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
TGSI_SEMANTIC_COLOR,
st->needs_texcoord_semantic ? TGSI_SEMANTIC_TEXCOORD :
TGSI_SEMANTIC_GENERIC };
const uint semantic_indexes[] = { 0, 0, 0 };
st->bitmap.vs = util_make_vertex_passthrough_shader(st->pipe, 3,
semantic_names,
semantic_indexes,
FALSE);
}
if (UseBitmapCache && accum_bitmap(ctx, x, y, width, height, unpack, bitmap))
return;
pt = make_bitmap_texture(ctx, width, height, unpack, bitmap);
if (pt) {
struct pipe_sampler_view *sv =
st_create_texture_sampler_view(st->pipe, pt);
assert(pt->target == PIPE_TEXTURE_2D || pt->target == PIPE_TEXTURE_RECT);
if (sv) {
draw_bitmap_quad(ctx, x, y, ctx->Current.RasterPos[2],
width, height, sv,
st->ctx->Current.RasterColor);
pipe_sampler_view_reference(&sv, NULL);
}
/* release/free the texture */
pipe_resource_reference(&pt, NULL);
}
}
示例15: st_Bitmap
/**
* Called via ctx->Driver.Bitmap()
*/
static void
st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap )
{
struct st_context *st = st_context(ctx);
struct pipe_resource *pt;
assert(width > 0);
assert(height > 0);
st_invalidate_readpix_cache(st);
if (!st->bitmap.cache) {
init_bitmap_state(st);
}
/* We only need to validate any non-ST_NEW_CONSTANTS state. The VS we use
* for bitmap drawing uses no constants and the FS constants are
* explicitly uploaded in the draw_bitmap_quad() function.
*/
if ((st->dirty | ctx->NewDriverState) & ~ST_NEW_CONSTANTS &
ST_PIPELINE_RENDER_STATE_MASK ||
st->gfx_shaders_may_be_dirty) {
st_validate_state(st, ST_PIPELINE_RENDER);
}
if (UseBitmapCache && accum_bitmap(ctx, x, y, width, height, unpack, bitmap))
return;
pt = make_bitmap_texture(ctx, width, height, unpack, bitmap);
if (pt) {
struct pipe_sampler_view *sv =
st_create_texture_sampler_view(st->pipe, pt);
assert(pt->target == PIPE_TEXTURE_2D || pt->target == PIPE_TEXTURE_RECT);
if (sv) {
draw_bitmap_quad(ctx, x, y, ctx->Current.RasterPos[2],
width, height, sv, ctx->Current.RasterColor);
pipe_sampler_view_reference(&sv, NULL);
}
/* release/free the texture */
pipe_resource_reference(&pt, NULL);
}
}