• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pipe_buffer_unmap函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pipe_buffer_unmap函数的典型用法代码示例。如果您正苦于以下问题:C++ pipe_buffer_unmap函数的具体用法?C++ pipe_buffer_unmap怎么用?C++ pipe_buffer_unmap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pipe_buffer_unmap函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: nv30_vbo_static_attrib

static boolean
nv30_vbo_static_attrib(struct nv30_context *nv30, struct nouveau_stateobj *so,
		       int attrib, struct pipe_vertex_element *ve,
		       struct pipe_vertex_buffer *vb)
{
	struct pipe_screen *pscreen = nv30->pipe.screen;
	struct nouveau_grobj *rankine = nv30->screen->rankine;
	unsigned type, ncomp;
	void *map;

	if (nv30_vbo_format_to_hw(ve->src_format, &type, &ncomp))
		return FALSE;

	map  = pipe_buffer_map(pscreen, vb->buffer, PIPE_BUFFER_USAGE_CPU_READ);
	map += vb->buffer_offset + ve->src_offset;

	switch (type) {
	case NV34TCL_VTXFMT_TYPE_FLOAT:
	{
		float *v = map;

		switch (ncomp) {
		case 4:
			so_method(so, rankine, NV34TCL_VTX_ATTR_4F_X(attrib), 4);
			so_data  (so, fui(v[0]));
			so_data  (so, fui(v[1]));
			so_data  (so, fui(v[2]));
			so_data  (so, fui(v[3]));
			break;
		case 3:
			so_method(so, rankine, NV34TCL_VTX_ATTR_3F_X(attrib), 3);
			so_data  (so, fui(v[0]));
			so_data  (so, fui(v[1]));
			so_data  (so, fui(v[2]));
			break;
		case 2:
			so_method(so, rankine, NV34TCL_VTX_ATTR_2F_X(attrib), 2);
			so_data  (so, fui(v[0]));
			so_data  (so, fui(v[1]));
			break;
		case 1:
			so_method(so, rankine, NV34TCL_VTX_ATTR_1F(attrib), 1);
			so_data  (so, fui(v[0]));
			break;
		default:
			pipe_buffer_unmap(pscreen, vb->buffer);
			return FALSE;
		}
	}
		break;
	default:
		pipe_buffer_unmap(pscreen, vb->buffer);
		return FALSE;
	}

	pipe_buffer_unmap(pscreen, vb->buffer);
	return TRUE;
}
开发者ID:MttDs,项目名称:new-rexeno-tindpe,代码行数:58,代码来源:nv30_vbo.c


示例2: r300_swtcl_draw_vbo

/* SW TCL elements, using Draw. */
static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
                                const struct pipe_draw_info *info)
{
    struct r300_context* r300 = r300_context(pipe);
    struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS];
    struct pipe_transfer *ib_transfer = NULL;
    int i;
    void *indices = NULL;
    boolean indexed = info->indexed && r300->vbuf_mgr->index_buffer.buffer;

    if (r300->skip_rendering) {
        return;
    }

    r300_update_derived_state(r300);

    r300_reserve_cs_dwords(r300,
            PREP_EMIT_STATES | PREP_EMIT_VARRAYS_SWTCL |
            (indexed ? PREP_INDEXED : 0),
            indexed ? 256 : 6);

    for (i = 0; i < r300->vbuf_mgr->nr_vertex_buffers; i++) {
        if (r300->vbuf_mgr->vertex_buffer[i].buffer) {
            void *buf = pipe_buffer_map(pipe,
                                  r300->vbuf_mgr->vertex_buffer[i].buffer,
                                  PIPE_TRANSFER_READ |
                                  PIPE_TRANSFER_UNSYNCHRONIZED,
                                  &vb_transfer[i]);
            draw_set_mapped_vertex_buffer(r300->draw, i, buf);
        }
    }

    if (indexed) {
        indices = pipe_buffer_map(pipe, r300->vbuf_mgr->index_buffer.buffer,
                                  PIPE_TRANSFER_READ |
                                  PIPE_TRANSFER_UNSYNCHRONIZED, &ib_transfer);
    }

    draw_set_mapped_index_buffer(r300->draw, indices);

    r300->draw_vbo_locked = TRUE;
    r300->draw_first_emitted = FALSE;
    draw_vbo(r300->draw, info);
    draw_flush(r300->draw);
    r300->draw_vbo_locked = FALSE;

    for (i = 0; i < r300->vbuf_mgr->nr_vertex_buffers; i++) {
        if (r300->vbuf_mgr->vertex_buffer[i].buffer) {
            pipe_buffer_unmap(pipe, vb_transfer[i]);
            draw_set_mapped_vertex_buffer(r300->draw, i, NULL);
        }
    }

    if (indexed) {
        pipe_buffer_unmap(pipe, ib_transfer);
        draw_set_mapped_index_buffer(r300->draw, NULL);
    }
}
开发者ID:ChillyWillyGuru,项目名称:RSXGL,代码行数:59,代码来源:r300_render.c


示例3: translate_indices

static enum pipe_error
translate_indices( struct svga_hwtnl *hwtnl,
                   struct pipe_resource *src,
                   unsigned offset,
                   unsigned nr,
                   unsigned index_size,
                   u_translate_func translate,
                   struct pipe_resource **out_buf )
{
   struct pipe_context *pipe = &hwtnl->svga->pipe;
   struct pipe_transfer *src_transfer = NULL;
   struct pipe_transfer *dst_transfer = NULL;
   unsigned size = index_size * nr;
   const void *src_map = NULL;
   struct pipe_resource *dst = NULL;
   void *dst_map = NULL;

   dst = pipe_buffer_create( pipe->screen,
			     PIPE_BIND_INDEX_BUFFER,
			     PIPE_USAGE_STATIC,
			     size );
   if (dst == NULL)
      goto fail;

   src_map = pipe_buffer_map( pipe, src, PIPE_TRANSFER_READ, &src_transfer );
   if (src_map == NULL)
      goto fail;

   dst_map = pipe_buffer_map( pipe, dst, PIPE_TRANSFER_WRITE, &dst_transfer );
   if (dst_map == NULL)
      goto fail;

   translate( (const char *)src_map + offset,
              nr,
              dst_map );

   pipe_buffer_unmap( pipe, src_transfer );
   pipe_buffer_unmap( pipe, dst_transfer );

   *out_buf = dst;
   return PIPE_OK;

fail:
   if (src_map)
      pipe_buffer_unmap( pipe, src_transfer );

   if (dst_map)
      pipe_buffer_unmap( pipe, dst_transfer );

   if (dst)
      pipe->screen->resource_destroy( pipe->screen, dst );

   return PIPE_ERROR_OUT_OF_MEMORY;
}
开发者ID:Bluerise,项目名称:bitrig-xenocara,代码行数:54,代码来源:svga_draw_elements.c


示例4: translate_indices

static enum pipe_error
translate_indices(struct svga_hwtnl *hwtnl, struct pipe_resource *src,
                  unsigned offset, unsigned prim, unsigned nr,
                  unsigned index_size,
                  u_translate_func translate, struct pipe_resource **out_buf)
{
   struct pipe_context *pipe = &hwtnl->svga->pipe;
   struct pipe_transfer *src_transfer = NULL;
   struct pipe_transfer *dst_transfer = NULL;
   unsigned size = index_size * nr;
   const void *src_map = NULL;
   struct pipe_resource *dst = NULL;
   void *dst_map = NULL;

   /* Need to trim vertex count to make sure we don't write too much data
    * to the dst buffer in the translate() call.
    */
   u_trim_pipe_prim(prim, &nr);

   size = index_size * nr;

   dst = pipe_buffer_create(pipe->screen,
                            PIPE_BIND_INDEX_BUFFER, PIPE_USAGE_DEFAULT, size);
   if (dst == NULL)
      goto fail;

   src_map = pipe_buffer_map(pipe, src, PIPE_TRANSFER_READ, &src_transfer);
   if (src_map == NULL)
      goto fail;

   dst_map = pipe_buffer_map(pipe, dst, PIPE_TRANSFER_WRITE, &dst_transfer);
   if (dst_map == NULL)
      goto fail;

   translate((const char *) src_map + offset, 0, 0, nr, 0, dst_map);

   pipe_buffer_unmap(pipe, src_transfer);
   pipe_buffer_unmap(pipe, dst_transfer);

   *out_buf = dst;
   return PIPE_OK;

 fail:
   if (src_map)
      pipe_buffer_unmap(pipe, src_transfer);

   if (dst_map)
      pipe_buffer_unmap(pipe, dst_transfer);

   if (dst)
      pipe->screen->resource_destroy(pipe->screen, dst);

   return PIPE_ERROR_OUT_OF_MEMORY;
}
开发者ID:jonasarrow,项目名称:mesa,代码行数:54,代码来源:svga_draw_elements.c


示例5: vl_vb_unmap

void
vl_vb_unmap(struct vl_vertex_buffer *buffer, struct pipe_context *pipe)
{
   unsigned i;

   assert(buffer && pipe);

   for (i = 0; i < VL_NUM_COMPONENTS; ++i) {
      pipe_buffer_unmap(pipe, buffer->ycbcr[i].transfer);
   }

   for (i = 0; i < VL_MAX_REF_FRAMES; ++i) {
      pipe_buffer_unmap(pipe, buffer->mv[i].transfer);
   }
}
开发者ID:Ponozhovshchina,项目名称:mesa,代码行数:15,代码来源:vl_vertex_buffers.c


示例6: r300_get_query_result

static boolean r300_get_query_result(struct pipe_context* pipe,
                                     struct pipe_query* query,
                                     boolean wait,
                                     uint64_t* result)
{
    struct r300_query* q = (struct r300_query*)query;
    uint32_t* map;
    uint32_t temp;

    if (wait) {
        /* Well, we're expected to just sit here and spin, so let's go ahead
         * and flush so we can be sure that the card's spinning... */
        /* XXX double-check these params */
        pipe->flush(pipe, 0, NULL);
    }

    map = pipe_buffer_map(pipe->screen, q->buf, PIPE_BUFFER_USAGE_CPU_READ);
    temp = *map;
    pipe_buffer_unmap(pipe->screen, q->buf);

    if (temp < 0) {
        /* Our results haven't been written yet... */
        return FALSE;
    }

    *result = temp;
    return TRUE;
}
开发者ID:toastpp,项目名称:toastpp,代码行数:28,代码来源:r300_query.c


示例7: fill_grid_size

static void
fill_grid_size(struct pipe_context *context,
               const struct pipe_grid_info *info,
               uint32_t grid_size[3])
{
   struct pipe_transfer *transfer;
   uint32_t *params;
   if (!info->indirect) {
      grid_size[0] = info->grid[0];
      grid_size[1] = info->grid[1];
      grid_size[2] = info->grid[2];
      return;
   }
   params = pipe_buffer_map_range(context, info->indirect,
                                  info->indirect_offset,
                                  3 * sizeof(uint32_t),
                                  PIPE_TRANSFER_READ,
                                  &transfer);

   if (!transfer)
      return;

   grid_size[0] = params[0];
   grid_size[1] = params[1];
   grid_size[2] = params[2];
   pipe_buffer_unmap(context, transfer);
}
开发者ID:MIPS,项目名称:external-mesa3d,代码行数:27,代码来源:sp_compute.c


示例8: u_upload_buffer

/* As above, but upload the full contents of a buffer.  Useful for
 * uploading user buffers, avoids generating an explosion of GPU
 * buffers if you have an app that does lots of small vertex buffer
 * renders or DrawElements calls.
 */
enum pipe_error u_upload_buffer( struct u_upload_mgr *upload,
                                 unsigned offset,
                                 unsigned size,
                                 struct pipe_buffer *inbuf,
                                 unsigned *out_offset,
                                 struct pipe_buffer **outbuf )
{
    enum pipe_error ret = PIPE_OK;
    const char *map = NULL;

    map = (const char *)pipe_buffer_map(
              upload->screen, inbuf, PIPE_BUFFER_USAGE_CPU_READ );

    if (map == NULL) {
        ret = PIPE_ERROR_OUT_OF_MEMORY;
        goto done;
    }

    if (0)
        debug_printf("upload ptr %p ofs %d sz %d\n", map, offset, size);

    ret = u_upload_data( upload,
                         size,
                         map + offset,
                         out_offset,
                         outbuf );
    if (ret)
        goto done;

done:
    if (map)
        pipe_buffer_unmap( upload->screen, inbuf );

    return ret;
}
开发者ID:CPFDSoftware-Tony,项目名称:gmv,代码行数:40,代码来源:u_upload_mgr.c


示例9: svga_vbuf_render_unmap_vertices

static void
svga_vbuf_render_unmap_vertices( struct vbuf_render *render,
                                 ushort min_index,
                                 ushort max_index )
{
   struct svga_vbuf_render *svga_render = svga_vbuf_render(render);
   struct svga_context *svga = svga_render->svga;
   unsigned offset, length;
   size_t used = svga_render->vertex_size * ((size_t)max_index + 1);

   offset = svga_render->vbuf_offset + svga_render->vertex_size * min_index;
   length = svga_render->vertex_size * (max_index + 1 - min_index);

   if (0) {
      /* dump vertex data */
      const float *f = (const float *) ((char *) svga_render->vbuf_ptr +
                                        svga_render->vbuf_offset);
      unsigned i;
      debug_printf("swtnl vertex data:\n");
      for (i = 0; i < length / 4; i += 4) {
         debug_printf("%u: %f %f %f %f\n", i, f[i], f[i+1], f[i+2], f[i+3]);
      }
   }

   pipe_buffer_flush_mapped_range(&svga->pipe,
				  svga_render->vbuf_transfer,
				  offset, length);
   pipe_buffer_unmap(&svga->pipe, svga_render->vbuf_transfer);
   svga_render->min_index = min_index;
   svga_render->max_index = max_index;
   svga_render->vbuf_used = MAX2(svga_render->vbuf_used, used);
}
开发者ID:BNieuwenhuizen,项目名称:mesa,代码行数:32,代码来源:svga_swtnl_backend.c


示例10: my_buffer_write

static INLINE enum pipe_error
my_buffer_write(struct pipe_screen *screen,
                struct pipe_buffer *buf,
                unsigned offset, unsigned size, unsigned dirty_size,
                const void *data)
{
    uint8_t *map;

    assert(offset < buf->size);
    assert(offset + size <= buf->size);
    assert(dirty_size >= size);
    assert(size);

    map = pipe_buffer_map_range(screen, buf, offset, size,
    PIPE_BUFFER_USAGE_CPU_WRITE |
    PIPE_BUFFER_USAGE_FLUSH_EXPLICIT |
    PIPE_BUFFER_USAGE_DISCARD |
    PIPE_BUFFER_USAGE_UNSYNCHRONIZED);
    if (map == NULL)
        return PIPE_ERROR_OUT_OF_MEMORY;

    memcpy(map + offset, data, size);
    pipe_buffer_flush_mapped_range(screen, buf, offset, dirty_size);
    pipe_buffer_unmap(screen, buf);

    return PIPE_OK;
}
开发者ID:CPFDSoftware-Tony,项目名称:gmv,代码行数:27,代码来源:u_upload_mgr.c


示例11: my_buffer_write

/* Slightly specialized version of buffer_write designed to maximize
 * chances of the driver consolidating successive writes into a single
 * upload.
 *
 * dirty_size may be slightly greater than size to cope with
 * alignment.  We don't want to leave holes between succesively mapped
 * regions as that may prevent the driver from consolidating uploads.
 * 
 * Note that the 'data' pointer has probably come from the application
 * and we cannot read even a byte past its end without risking
 * segfaults, or at least complaints from valgrind..
 */
static INLINE enum pipe_error
my_buffer_write(struct pipe_context *pipe,
                struct pipe_resource *buf,
                unsigned offset, unsigned size, unsigned dirty_size,
                const void *data)
{
   struct pipe_transfer *transfer = NULL;
   uint8_t *map;
   
   assert(offset < buf->width0);
   assert(offset + size <= buf->width0);
   assert(dirty_size >= size);
   assert(size);

   map = pipe_buffer_map_range(pipe, buf, offset, dirty_size,
                               PIPE_TRANSFER_WRITE |
                               PIPE_TRANSFER_FLUSH_EXPLICIT |
                               PIPE_TRANSFER_DISCARD |
                               PIPE_TRANSFER_UNSYNCHRONIZED,
			       &transfer);
   if (map == NULL) 
      return PIPE_ERROR_OUT_OF_MEMORY;

   memcpy(map + offset, data, size);
   pipe_buffer_flush_mapped_range(pipe, transfer, offset, dirty_size);
   pipe_buffer_unmap(pipe, buf, transfer);

   return PIPE_OK;
}
开发者ID:1065672644894730302,项目名称:Chromium,代码行数:41,代码来源:u_upload_mgr.c


示例12: nv30_fragprog_upload

static void
nv30_fragprog_upload(struct nv30_context *nv30)
{
   struct nouveau_context *nv = &nv30->base;
   struct nv30_fragprog *fp = nv30->fragprog.program;
   struct pipe_context *pipe = &nv30->base.pipe;

   if (unlikely(!fp->buffer))
      fp->buffer = pipe_buffer_create(pipe->screen, 0, 0, fp->insn_len * 4);

#ifndef PIPE_ARCH_BIG_ENDIAN
   pipe_buffer_write(pipe, fp->buffer, 0, fp->insn_len * 4, fp->insn);
#else
   {
      struct pipe_transfer *transfer;
      uint32_t *map;
      int i;

      map = pipe_buffer_map(pipe, fp->buffer,
                            PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE,
                            &transfer);
      for (i = 0; i < fp->insn_len; i++)
         *map++ = (fp->insn[i] >> 16) | (fp->insn[i] << 16);
      pipe_buffer_unmap(pipe, transfer);
   }
#endif

   if (nv04_resource(fp->buffer)->domain != NOUVEAU_BO_VRAM)
      nouveau_buffer_migrate(nv, nv04_resource(fp->buffer), NOUVEAU_BO_VRAM);
}
开发者ID:Distrotech,项目名称:Mesa,代码行数:30,代码来源:nv30_fragprog.c


示例13: nv30_render_unmap_vertices

static void
nv30_render_unmap_vertices(struct vbuf_render *render,
                           ushort min_index, ushort max_index)
{
   struct nv30_render *r = nv30_render(render);
   pipe_buffer_unmap(&r->nv30->base.pipe, r->transfer);
}
开发者ID:DirectFB,项目名称:mesa,代码行数:7,代码来源:nv30_draw.c


示例14: nv30_draw_elements_inline

static boolean
nv30_draw_elements_inline(struct pipe_context *pipe,
			  struct pipe_buffer *ib, unsigned ib_size,
			  unsigned mode, unsigned start, unsigned count)
{
	struct nv30_context *nv30 = nv30_context(pipe);
	struct pipe_screen *pscreen = pipe->screen;
	void *map;

	map = pipe_buffer_map(pscreen, ib, PIPE_BUFFER_USAGE_CPU_READ);
	if (!ib) {
		NOUVEAU_ERR("failed mapping ib\n");
		return FALSE;
	}

	switch (ib_size) {
	case 1:
		nv30_draw_elements_u08(nv30, map, mode, start, count);
		break;
	case 2:
		nv30_draw_elements_u16(nv30, map, mode, start, count);
		break;
	case 4:
		nv30_draw_elements_u32(nv30, map, mode, start, count);
		break;
	default:
		NOUVEAU_ERR("invalid idxbuf fmt %d\n", ib_size);
		break;
	}

	pipe_buffer_unmap(pscreen, ib);
	return TRUE;
}
开发者ID:MttDs,项目名称:new-rexeno-tindpe,代码行数:33,代码来源:nv30_vbo.c


示例15: nv30_transfer_rect_fragprog

static inline struct nv04_resource *
nv30_transfer_rect_fragprog(struct nv30_context *nv30)
{
   struct nv04_resource *fp = nv04_resource(nv30->blit_fp);
   struct pipe_context *pipe = &nv30->base.pipe;

   if (!fp) {
      nv30->blit_fp = pipe_buffer_create(pipe->screen, 0, 0, 12 * 4);
      if (nv30->blit_fp) {
         struct pipe_transfer *transfer;
         u32 *map = pipe_buffer_map(pipe, nv30->blit_fp,
                                    PIPE_TRANSFER_WRITE, &transfer);
         if (map) {
            map[0] = 0x17009e00; /* texr r0, i[tex0], texture[0]; end; */
            map[1] = 0x1c9dc801;
            map[2] = 0x0001c800;
            map[3] = 0x3fe1c800;
            map[4] = 0x01401e81; /* end; */
            map[5] = 0x1c9dc800;
            map[6] = 0x0001c800;
            map[7] = 0x0001c800;
            pipe_buffer_unmap(pipe, transfer);
         }

         fp = nv04_resource(nv30->blit_fp);
         nouveau_buffer_migrate(&nv30->base, fp, NOUVEAU_BO_VRAM);
      }
   }

   return fp;
}
开发者ID:jonasarrow,项目名称:mesa,代码行数:31,代码来源:nv30_transfer.c


示例16: vlVaUnmapBuffer

VAStatus
vlVaUnmapBuffer(VADriverContextP ctx, VABufferID buf_id)
{
   vlVaDriver *drv;
   vlVaBuffer *buf;

   if (!ctx)
      return VA_STATUS_ERROR_INVALID_CONTEXT;

   drv = VL_VA_DRIVER(ctx);
   if (!drv)
      return VA_STATUS_ERROR_INVALID_CONTEXT;

   buf = handle_table_get(drv->htab, buf_id);
   if (!buf)
      return VA_STATUS_ERROR_INVALID_BUFFER;

   if (buf->export_refcount > 0)
      return VA_STATUS_ERROR_INVALID_BUFFER;

   if (buf->derived_surface.resource) {
      if (!buf->derived_surface.transfer)
         return VA_STATUS_ERROR_INVALID_BUFFER;

      pipe_buffer_unmap(drv->pipe, buf->derived_surface.transfer);
      buf->derived_surface.transfer = NULL;
   }

   return VA_STATUS_SUCCESS;
}
开发者ID:cjp256,项目名称:mesa,代码行数:30,代码来源:buffer.c


示例17: r300_swtcl_draw_arrays

/* SW TCL arrays, using Draw. */
boolean r300_swtcl_draw_arrays(struct pipe_context* pipe,
                               unsigned mode,
                               unsigned start,
                               unsigned count)
{
    struct r300_context* r300 = r300_context(pipe);
    int i;

    if (!u_trim_pipe_prim(mode, &count)) {
        return FALSE;
    }

    for (i = 0; i < r300->vertex_buffer_count; i++) {
        void* buf = pipe_buffer_map(pipe->screen,
                                    r300->vertex_buffer[i].buffer,
                                    PIPE_BUFFER_USAGE_CPU_READ);
        draw_set_mapped_vertex_buffer(r300->draw, i, buf);
    }

    draw_set_mapped_element_buffer(r300->draw, 0, NULL);

    draw_set_mapped_constant_buffer(r300->draw,
            r300->shader_constants[PIPE_SHADER_VERTEX].constants,
            r300->shader_constants[PIPE_SHADER_VERTEX].count *
                (sizeof(float) * 4));

    draw_arrays(r300->draw, mode, start, count);

    for (i = 0; i < r300->vertex_buffer_count; i++) {
        pipe_buffer_unmap(pipe->screen, r300->vertex_buffer[i].buffer);
        draw_set_mapped_vertex_buffer(r300->draw, i, NULL);
    }

    return TRUE;
}
开发者ID:MttDs,项目名称:new-rexeno-tindpe,代码行数:36,代码来源:r300_render.c


示例18: main

int main(int argc, char **argv)
{
    struct fbdemos_scaffold *fbs = 0;
    fbdemo_init(&fbs);
    int width = fbs->width;
    int height = fbs->height;
    struct pipe_context *pipe = fbs->pipe;

    /* resources */
    struct pipe_resource *rt_resource = fbdemo_create_2d(fbs->screen, PIPE_BIND_RENDER_TARGET, PIPE_FORMAT_B8G8R8X8_UNORM, width, height, 0);
    struct pipe_resource *z_resource = fbdemo_create_2d(fbs->screen, PIPE_BIND_RENDER_TARGET, PIPE_FORMAT_Z16_UNORM, width, height, 0);

    /* bind render target to framebuffer */
    etna_fb_bind_resource(&fbs->fb, rt_resource);

    /* geometry */
    struct pipe_resource *vtx_resource = pipe_buffer_create(fbs->screen, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_IMMUTABLE, VERTEX_BUFFER_SIZE);

    struct pipe_transfer *transfer = 0;
    float *vtx_logical = pipe_buffer_map(pipe, vtx_resource, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_UNSYNCHRONIZED, &transfer);
    assert(vtx_logical);
    for(int vert=0; vert<NUM_VERTICES; ++vert)
    {
        int src_idx = vert * COMPONENTS_PER_VERTEX;
        int dest_idx = vert * COMPONENTS_PER_VERTEX * 3;
        for(int comp=0; comp<COMPONENTS_PER_VERTEX; ++comp)
        {
            ((float*)vtx_logical)[dest_idx+comp+0] = vVertices[src_idx + comp]; /* 0 */
            ((float*)vtx_logical)[dest_idx+comp+3] = vNormals[src_idx + comp]; /* 1 */
            ((float*)vtx_logical)[dest_idx+comp+6] = vColors[src_idx + comp]; /* 2 */
        }
    }
    pipe_buffer_unmap(pipe, transfer);

    struct pipe_vertex_buffer vertex_buffer_desc = {
            .stride = (3 + 3 + 3)*4,
            .buffer_offset = 0,
            .buffer = vtx_resource,
            .user_buffer = 0
            };
    struct pipe_vertex_element pipe_vertex_elements[] = {
        { /* positions */
            .src_offset = 0,
            .instance_divisor = 0,
            .vertex_buffer_index = 0,
            .src_format = PIPE_FORMAT_R32G32B32_FLOAT 
        },
        { /* normals */
            .src_offset = 0xc,
            .instance_divisor = 0,
            .vertex_buffer_index = 0,
            .src_format = PIPE_FORMAT_R32G32B32_FLOAT 
        },
        { /* texture coord */
            .src_offset = 0x18,
开发者ID:HibikiTaisuna,项目名称:etna_viv,代码行数:55,代码来源:rotate_cube.c


示例19: nv30_render_destroy

static void
nv30_render_destroy(struct vbuf_render *render)
{
   struct nv30_render *r = nv30_render(render);

   if (r->transfer)
      pipe_buffer_unmap(&r->nv30->base.pipe, r->transfer);
   pipe_resource_reference(&r->buffer, NULL);
   nouveau_heap_free(&r->vertprog);
   FREE(render);
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:11,代码来源:nv30_draw.c


示例20: softpipe_transfer_unmap

static void
softpipe_transfer_unmap(struct pipe_screen *screen,
                       struct pipe_transfer *transfer)
{
   struct softpipe_texture *spt;

   assert(transfer->texture);
   spt = softpipe_texture(transfer->texture);

   pipe_buffer_unmap( screen, spt->buffer );
}
开发者ID:aljen,项目名称:haiku-opengl,代码行数:11,代码来源:sp_texture.c



注:本文中的pipe_buffer_unmap函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pipe_mutex_destroy函数代码示例发布时间:2022-05-30
下一篇:
C++ pipe2函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap