您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ st_renderbuffer函数代码示例

51自学网 2021-06-03 08:20:41
  C++
这篇教程C++ st_renderbuffer函数代码示例写得很实用,希望能帮到您。

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

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

示例1: check_clear_stencil_with_quad

/** * Determine if we need to clear the stencil buffer by drawing a quad. */static INLINE GLbooleancheck_clear_stencil_with_quad(struct gl_context *ctx, struct gl_renderbuffer *rb,                              boolean ds_separate){   const struct st_renderbuffer *strb = st_renderbuffer(rb);   const GLboolean isDS = util_format_is_depth_and_stencil(strb->surface->format);   const GLuint stencilMax = 0xff;   const GLboolean maskStencil      = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;   assert(_mesa_get_format_bits(rb->Format, GL_STENCIL_BITS) > 0);   if (maskStencil)       return GL_TRUE;   if (ctx->Scissor.Enabled &&       (ctx->Scissor.X != 0 ||        ctx->Scissor.Y != 0 ||        ctx->Scissor.Width < rb->Width ||        ctx->Scissor.Height < rb->Height))      return GL_TRUE;   /* This is correct, but it is necessary to look at the depth clear    * value held in the surface when it comes time to issue the clear,    * rather than taking depth and stencil clear values from the    * current state.    */   if (!ds_separate && isDS && ctx->DrawBuffer->Visual.depthBits > 0)      return GL_TRUE;   return GL_FALSE;}
开发者ID:UIKit0,项目名称:mesa,代码行数:35,


示例2: st_egl_image_target_renderbuffer_storage

static voidst_egl_image_target_renderbuffer_storage(struct gl_context *ctx,					 struct gl_renderbuffer *rb,					 GLeglImageOES image_handle){   struct st_context *st = st_context(ctx);   struct st_renderbuffer *strb = st_renderbuffer(rb);   struct pipe_surface *ps;   unsigned usage;   usage = PIPE_BIND_RENDER_TARGET;   ps = st_manager_get_egl_image_surface(st, (void *) image_handle, usage);   if (ps) {      strb->Base.Width = ps->width;      strb->Base.Height = ps->height;      strb->Base.Format = st_pipe_format_to_mesa_format(ps->format);      strb->Base.DataType = st_format_datatype(ps->format);      strb->Base._BaseFormat = st_pipe_format_to_base_format(ps->format);      strb->Base.InternalFormat = strb->Base._BaseFormat;      pipe_surface_reference(&strb->surface, ps);      pipe_resource_reference(&strb->texture, ps->texture);      pipe_surface_reference(&ps, NULL);   }}
开发者ID:GunioRobot,项目名称:mesa-7.10.2-PS3,代码行数:26,


示例3: st_release_teximage

/** Undo surface-to-texture binding */intst_release_teximage(struct st_framebuffer *stfb, uint surfIndex,                    int target, int format, int level){   GET_CURRENT_CONTEXT(ctx);   struct st_context *st = ctx->st;   struct st_renderbuffer *strb;   assert(surfIndex <= ST_SURFACE_DEPTH);   strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer);   if (!strb->texture_save || !strb->surface_save) {      /* Error! */      return 0;   }   st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);   /* free tex surface, restore original */   pipe_surface_reference(&strb->surface, strb->surface_save);   pipe_texture_reference(&strb->texture, strb->texture_save);   pipe_surface_reference(&strb->surface_save, NULL);   pipe_texture_reference(&strb->texture_save, NULL);   st->dirty.st |= ST_NEW_FRAMEBUFFER;   return 1;}
开发者ID:MttDs,项目名称:new-rexeno-tindpe,代码行数:31,


示例4: check_clear_stencil_with_quad

/** * Determine if we need to clear the stencil buffer by drawing a quad. */static INLINE GLbooleancheck_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb){   const struct st_renderbuffer *strb = st_renderbuffer(rb);   const GLboolean isDS = pf_is_depth_and_stencil(strb->surface->format);   const GLuint stencilMax = (1 << rb->StencilBits) - 1;   const GLboolean maskStencil      = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;   if (maskStencil)       return TRUE;   if (ctx->Scissor.Enabled)      return TRUE;   /* This is correct, but it is necessary to look at the depth clear    * value held in the surface when it comes time to issue the clear,    * rather than taking depth and stencil clear values from the    * current state.    */   if (isDS &&        ctx->DrawBuffer->Visual.depthBits > 0)      return TRUE;   return FALSE;}
开发者ID:aljen,项目名称:haiku-opengl,代码行数:29,


示例5: is_front_buffer_dirty

/** Check if we have a front color buffer and if it's been drawn to. */static INLINE GLbooleanis_front_buffer_dirty(struct st_context *st){   struct gl_framebuffer *fb = st->ctx->DrawBuffer;   struct st_renderbuffer *strb      = st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);   return strb && strb->defined;}
开发者ID:rich-hart,项目名称:InteractiveGraphicsAssignment1,代码行数:9,


示例6: st_renderbuffer_alloc_storage

/** * gl_renderbuffer::AllocStorage() * This is called to allocate the original drawing surface, and * during window resize. */static GLbooleanst_renderbuffer_alloc_storage(struct gl_context * ctx,                              struct gl_renderbuffer *rb,                              GLenum internalFormat,                              GLuint width, GLuint height){   struct st_context *st = st_context(ctx);   struct pipe_context *pipe = st->pipe;   struct pipe_screen *screen = st->pipe->screen;   struct st_renderbuffer *strb = st_renderbuffer(rb);   enum pipe_format format;   struct pipe_surface surf_tmpl;   format = st_choose_renderbuffer_format(screen, internalFormat,                                          rb->NumSamples);   if (format == PIPE_FORMAT_NONE) {      return FALSE;   }   /* init renderbuffer fields */   strb->Base.Width  = width;   strb->Base.Height = height;   strb->Base.Format = st_pipe_format_to_mesa_format(format);   strb->Base._BaseFormat = _mesa_base_fbo_format(ctx, internalFormat);   strb->Base.DataType = st_format_datatype(format);   strb->format = format;   strb->defined = GL_FALSE;  /* undefined contents now */   if (strb->software) {      size_t size;            free(strb->data);      assert(strb->format != PIPE_FORMAT_NONE);            strb->stride = util_format_get_stride(strb->format, width);      size = util_format_get_2d_size(strb->format, strb->stride, height);            strb->data = malloc(size);            return strb->data != NULL;   }   else {      struct pipe_resource template;          /* Free the old surface and texture       */      pipe_surface_reference( &strb->surface, NULL );      pipe_resource_reference( &strb->texture, NULL );      pipe_sampler_view_reference(&strb->sampler_view, NULL);      /* Setup new texture template.       */      memset(&template, 0, sizeof(template));
开发者ID:iquiw,项目名称:xsrc,代码行数:61,


示例7: st_renderbuffer_delete

/** * gl_renderbuffer::Delete() */static voidst_renderbuffer_delete(struct gl_renderbuffer *rb){   struct st_renderbuffer *strb = st_renderbuffer(rb);   ASSERT(strb);   pipe_surface_reference(&strb->surface, NULL);   pipe_resource_reference(&strb->texture, NULL);   free(strb->data);   _mesa_delete_renderbuffer(rb);}
开发者ID:stereotype441,项目名称:mesa,代码行数:13,


示例8: st_renderbuffer_delete

/** * gl_renderbuffer::Delete() */static voidst_renderbuffer_delete(struct gl_context *ctx, struct gl_renderbuffer *rb){   struct st_renderbuffer *strb = st_renderbuffer(rb);   if (ctx) {      struct st_context *st = st_context(ctx);      pipe_surface_release(st->pipe, &strb->surface);   }   pipe_resource_reference(&strb->texture, NULL);   free(strb->data);   _mesa_delete_renderbuffer(ctx, rb);}
开发者ID:austriancoder,项目名称:mesa-1,代码行数:15,


示例9: st_bind_teximage

/** Redirect rendering into stfb's surface to a texture image */intst_bind_teximage(struct st_framebuffer *stfb, uint surfIndex,                 int target, int format, int level){   GET_CURRENT_CONTEXT(ctx);   struct st_context *st = ctx->st;   struct pipe_context *pipe = st->pipe;   struct pipe_screen *screen = pipe->screen;   const GLuint unit = ctx->Texture.CurrentUnit;   struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];   struct gl_texture_object *texObj;   struct gl_texture_image *texImage;   struct st_texture_image *stImage;   struct st_renderbuffer *strb;   GLint face = 0, slice = 0;   assert(surfIndex <= ST_SURFACE_DEPTH);   strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer);   if (strb->texture_save || strb->surface_save) {      /* Error! */      return 0;   }   if (target == ST_TEXTURE_2D) {      texObj = texUnit->CurrentTex[TEXTURE_2D_INDEX];      texImage = _mesa_get_tex_image(ctx, texObj, GL_TEXTURE_2D, level);      stImage = st_texture_image(texImage);   }   else {      /* unsupported target */      return 0;   }   st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);   /* save the renderbuffer's surface/texture info */   pipe_texture_reference(&strb->texture_save, strb->texture);   pipe_surface_reference(&strb->surface_save, strb->surface);   /* plug in new surface/texture info */   pipe_texture_reference(&strb->texture, stImage->pt);   strb->surface = screen->get_tex_surface(screen, strb->texture,                                           face, level, slice,                                           (PIPE_BUFFER_USAGE_GPU_READ |                                            PIPE_BUFFER_USAGE_GPU_WRITE));   st->dirty.st |= ST_NEW_FRAMEBUFFER;   return 1;}
开发者ID:MttDs,项目名称:new-rexeno-tindpe,代码行数:53,


示例10: display_front_buffer

/** * Tell the screen to display the front color buffer on-screen. */static voiddisplay_front_buffer(struct st_context *st){   struct gl_framebuffer *fb = st->ctx->DrawBuffer;   struct st_renderbuffer *strb      = st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);   if (strb) {      /* Hook for copying "fake" frontbuffer if necessary:       */      st_manager_flush_frontbuffer(st);   }}
开发者ID:rich-hart,项目名称:InteractiveGraphicsAssignment1,代码行数:16,


示例11: is_front_buffer_dirty

/** Check if we have a front color buffer and if it's been drawn to. */static INLINE GLbooleanis_front_buffer_dirty(struct st_context *st){   if (st->frontbuffer_status == FRONT_STATUS_DIRTY) {      return GL_TRUE;   }   else {      GLframebuffer *fb = st->ctx->DrawBuffer;      struct st_renderbuffer *strb         = st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);      return strb && strb->defined;   }}
开发者ID:CPFDSoftware-Tony,项目名称:gmv,代码行数:14,


示例12: st_finish_render_texture

/** * Called via ctx->Driver.FinishRenderTexture. */static voidst_finish_render_texture(struct gl_context *ctx, struct gl_renderbuffer *rb){   struct st_renderbuffer *strb = st_renderbuffer(rb);   if (!strb)      return;   strb->is_rtt = FALSE;   /* restore previous framebuffer state */   st_invalidate_state(ctx, _NEW_BUFFERS);}
开发者ID:austriancoder,项目名称:mesa-1,代码行数:16,


示例13: st_finish_render_texture

/** * Called via ctx->Driver.FinishRenderTexture. */static voidst_finish_render_texture(struct gl_context *ctx,                         struct gl_renderbuffer_attachment *att){   struct st_renderbuffer *strb = st_renderbuffer(att->Renderbuffer);   if (!strb)      return;   strb->rtt = NULL;   /* restore previous framebuffer state */   st_invalidate_state(ctx, _NEW_BUFFERS);}
开发者ID:FASTCHIP,项目名称:kernel_3.4.67_lenovo_s939_mtk6592,代码行数:17,


示例14: st_renderbuffer_alloc_storage

/** * gl_renderbuffer::AllocStorage() * This is called to allocate the original drawing surface, and * during window resize. */static GLbooleanst_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,                              GLenum internalFormat,                              GLuint width, GLuint height){   struct pipe_context *pipe = ctx->st->pipe;   struct st_renderbuffer *strb = st_renderbuffer(rb);   enum pipe_format format;   if (strb->format != PIPE_FORMAT_NONE)      format = strb->format;   else      format = st_choose_renderbuffer_format(pipe->screen, internalFormat);         /* init renderbuffer fields */   strb->Base.Width  = width;   strb->Base.Height = height;   init_renderbuffer_bits(strb, format);   strb->defined = GL_FALSE;  /* undefined contents now */   if(strb->software) {      struct pipe_format_block block;      size_t size;            _mesa_free(strb->data);      assert(strb->format != PIPE_FORMAT_NONE);      pf_get_block(strb->format, &block);            strb->stride = pf_get_stride(&block, width);      size = pf_get_2d_size(&block, strb->stride, height);            strb->data = _mesa_malloc(size);            return strb->data != NULL;   }   else {      struct pipe_texture template;      unsigned surface_usage;          /* Free the old surface and texture       */      pipe_surface_reference( &strb->surface, NULL );      pipe_texture_reference( &strb->texture, NULL );      /* Setup new texture template.       */      memset(&template, 0, sizeof(template));
开发者ID:MttDs,项目名称:new-rexeno-tindpe,代码行数:54,


示例15: st_BlitFramebuffer

static voidst_BlitFramebuffer(GLcontext *ctx,                   GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,                   GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,                   GLbitfield mask, GLenum filter){   struct st_context *st = ctx->st;   const uint pFilter = ((filter == GL_NEAREST)                         ? PIPE_TEX_MIPFILTER_NEAREST                         : PIPE_TEX_MIPFILTER_LINEAR);   if (mask & GL_COLOR_BUFFER_BIT) {      struct st_renderbuffer *srcRb =          st_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer);      struct st_renderbuffer *dstRb =          st_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]);      struct pipe_surface *srcSurf = srcRb->surface;      struct pipe_surface *dstSurf = dstRb->surface;      if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {         /* invert Y */         srcY0 = srcRb->Base.Height - srcY0;         srcY1 = srcRb->Base.Height - srcY1;         dstY0 = dstRb->Base.Height - dstY0;         dstY1 = dstRb->Base.Height - dstY1;      }      util_blit_pixels(st->blit,                       srcSurf, srcX0, srcY0, srcX1, srcY1,                       dstSurf, dstX0, dstY0, dstX1, dstY1,                       0.0, pFilter);   }}
开发者ID:astrofimov,项目名称:vgallium,代码行数:36,


示例16: st_manager_flush_frontbuffer

/** * Flush the front buffer if the current context renders to the front buffer. */voidst_manager_flush_frontbuffer(struct st_context *st){   struct st_framebuffer *stfb = st_ws_framebuffer(st->ctx->DrawBuffer);   struct st_renderbuffer *strb = NULL;   if (stfb)      strb = st_renderbuffer(stfb->Base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer);   if (!strb)      return;   /* never a dummy fb */   assert(&stfb->Base != _mesa_get_incomplete_framebuffer());   stfb->iface->flush_front(stfb->iface, ST_ATTACHMENT_FRONT_LEFT);}
开发者ID:james026yeah,项目名称:mesa,代码行数:18,


示例17: check_clear_depth_with_quad

/** * Determine if we need to clear the depth buffer by drawing a quad. */static INLINE GLbooleancheck_clear_depth_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb){   const struct st_renderbuffer *strb = st_renderbuffer(rb);   const GLboolean isDS = pf_is_depth_and_stencil(strb->surface->format);   if (ctx->Scissor.Enabled)      return TRUE;   if (isDS &&        ctx->DrawBuffer->Visual.stencilBits > 0)      return TRUE;   return FALSE;}
开发者ID:aljen,项目名称:haiku-opengl,代码行数:18,


示例18: st_UnmapRenderbuffer

/** * Called via ctx->Driver.UnmapRenderbuffer. */static voidst_UnmapRenderbuffer(struct gl_context *ctx,                     struct gl_renderbuffer *rb){   struct st_context *st = st_context(ctx);   struct st_renderbuffer *strb = st_renderbuffer(rb);   struct pipe_context *pipe = st->pipe;   if (strb->software) {      /* software-allocated renderbuffer (probably an accum buffer) */      return;   }   pipe_transfer_unmap(pipe, strb->transfer);   strb->transfer = NULL;}
开发者ID:austriancoder,项目名称:mesa-1,代码行数:19,


示例19: st_renderbuffer_alloc_storage

/** * gl_renderbuffer::AllocStorage() * This is called to allocate the original drawing surface, and * during window resize. */static GLbooleanst_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,                              GLenum internalFormat,                              GLuint width, GLuint height){   struct pipe_context *pipe = ctx->st->pipe;   struct st_renderbuffer *strb = st_renderbuffer(rb);   struct pipe_texture template;   unsigned surface_usage;   /* Free the old surface and texture    */   pipe_surface_reference( &strb->surface, NULL );   pipe_texture_reference( &strb->texture, NULL );   memset(&template, 0, sizeof(template));
开发者ID:astrofimov,项目名称:vgallium,代码行数:22,


示例20: st_render_texture

/** * Called by ctx->Driver.RenderTexture */static voidst_render_texture(struct gl_context *ctx,                  struct gl_framebuffer *fb,                  struct gl_renderbuffer_attachment *att){   struct st_context *st = st_context(ctx);   struct pipe_context *pipe = st->pipe;   struct gl_renderbuffer *rb = att->Renderbuffer;   struct st_renderbuffer *strb = st_renderbuffer(rb);   struct pipe_resource *pt;   if (!st_finalize_texture(ctx, pipe, att->Texture))      return;   pt = st_get_texobj_resource(att->Texture);   assert(pt);   /* point renderbuffer at texobject */   strb->is_rtt = TRUE;   strb->rtt_face = att->CubeMapFace;   strb->rtt_slice = att->Zoffset;   strb->rtt_layered = att->Layered;   pipe_resource_reference(&strb->texture, pt);   pipe_surface_release(pipe, &strb->surface);   st_update_renderbuffer_surface(st, strb);   strb->Base.Format = st_pipe_format_to_mesa_format(pt->format);   /* Invalidate buffer state so that the pipe's framebuffer state    * gets updated.    * That's where the new renderbuffer (which we just created) gets    * passed to the pipe as a (color/depth) render target.    */   st_invalidate_state(ctx, _NEW_BUFFERS);   /* Need to trigger a call to update_framebuffer() since we just    * attached a new renderbuffer.    */   ctx->NewState |= _NEW_BUFFERS;}
开发者ID:austriancoder,项目名称:mesa-1,代码行数:46,


示例21: check_clear_depth_with_quad

/** * Determine if we need to clear the depth buffer by drawing a quad. */static INLINE GLbooleancheck_clear_depth_with_quad(struct gl_context *ctx, struct gl_renderbuffer *rb,                            boolean ds_separate){   const struct st_renderbuffer *strb = st_renderbuffer(rb);   const GLboolean isDS = util_format_is_depth_and_stencil(strb->surface->format);   if (ctx->Scissor.Enabled &&       (ctx->Scissor.X != 0 ||        ctx->Scissor.Y != 0 ||        ctx->Scissor.Width < rb->Width ||        ctx->Scissor.Height < rb->Height))      return GL_TRUE;   if (!ds_separate && isDS && ctx->DrawBuffer->Visual.stencilBits > 0)      return GL_TRUE;   return GL_FALSE;}
开发者ID:UIKit0,项目名称:mesa,代码行数:22,


示例22: st_egl_image_target_renderbuffer_storage

static voidst_egl_image_target_renderbuffer_storage(struct gl_context *ctx,					 struct gl_renderbuffer *rb,					 GLeglImageOES image_handle){   struct st_renderbuffer *strb = st_renderbuffer(rb);   struct st_egl_image stimg;   if (st_get_egl_image(ctx, image_handle, PIPE_BIND_RENDER_TARGET,                        "glEGLImageTargetRenderbufferStorage",                        &stimg)) {      struct pipe_context *pipe = st_context(ctx)->pipe;      struct pipe_surface *ps, surf_tmpl;      u_surface_default_template(&surf_tmpl, stimg.texture);      surf_tmpl.format = stimg.format;      surf_tmpl.u.tex.level = stimg.level;      surf_tmpl.u.tex.first_layer = stimg.layer;      surf_tmpl.u.tex.last_layer = stimg.layer;      ps = pipe->create_surface(pipe, stimg.texture, &surf_tmpl);      pipe_resource_reference(&stimg.texture, NULL);      if (!ps)         return;      strb->Base.Width = ps->width;      strb->Base.Height = ps->height;      strb->Base.Format = st_pipe_format_to_mesa_format(ps->format);      strb->Base._BaseFormat = st_pipe_format_to_base_format(ps->format);      strb->Base.InternalFormat = strb->Base._BaseFormat;      struct pipe_surface **psurf =         util_format_is_srgb(ps->format) ? &strb->surface_srgb :                                           &strb->surface_linear;      pipe_surface_reference(psurf, ps);      strb->surface = *psurf;      pipe_resource_reference(&strb->texture, ps->texture);      pipe_surface_reference(&ps, NULL);   }}
开发者ID:chemecse,项目名称:mesa,代码行数:42,


示例23: display_front_buffer

/** * Tell the screen to display the front color buffer on-screen. */static voiddisplay_front_buffer(struct st_context *st){   GLframebuffer *fb = st->ctx->DrawBuffer;   struct st_renderbuffer *strb      = st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);   if (strb) {      struct pipe_surface *front_surf = strb->surface;            /* Hook for copying "fake" frontbuffer if necessary:       */      st->pipe->screen->flush_frontbuffer( st->pipe->screen, front_surf,                                           st->pipe->priv );      /*        st->frontbuffer_status = FRONT_STATUS_UNDEFINED;      */   }}
开发者ID:CPFDSoftware-Tony,项目名称:gmv,代码行数:23,


示例24: st_framebuffer_update_attachments

/** * Update the attachments to validate by looping the existing renderbuffers. */static voidst_framebuffer_update_attachments(struct st_framebuffer *stfb){   gl_buffer_index idx;   stfb->num_statts = 0;   for (idx = 0; idx < BUFFER_COUNT; idx++) {      struct st_renderbuffer *strb;      enum st_attachment_type statt;      strb = st_renderbuffer(stfb->Base.Attachment[idx].Renderbuffer);      if (!strb || strb->software)         continue;      statt = buffer_index_to_attachment(idx);      if (statt != ST_ATTACHMENT_INVALID &&          st_visual_have_buffers(stfb->iface->visual, 1 << statt))         stfb->statts[stfb->num_statts++] = statt;   }   stfb->stamp++;}
开发者ID:james026yeah,项目名称:mesa,代码行数:24,


示例25: st_renderbuffer_alloc_sw_storage

static GLbooleanst_renderbuffer_alloc_sw_storage(struct gl_context * ctx,                                 struct gl_renderbuffer *rb,                                 GLenum internalFormat,                                 GLuint width, GLuint height){   struct st_context *st = st_context(ctx);   struct st_renderbuffer *strb = st_renderbuffer(rb);   enum pipe_format format;   size_t size;   free(strb->data);   strb->data = NULL;   if (internalFormat == GL_RGBA16_SNORM) {      /* Special case for software accum buffers.  Otherwise, if the       * call to st_choose_renderbuffer_format() fails (because the       * driver doesn't support signed 16-bit/channel colors) we'd       * just return without allocating the software accum buffer.       */      format = PIPE_FORMAT_R16G16B16A16_SNORM;   }   else {      format = st_choose_renderbuffer_format(st, internalFormat, 0);      /* Not setting gl_renderbuffer::Format here will cause       * FRAMEBUFFER_UNSUPPORTED and ValidateFramebuffer will not be called.       */      if (format == PIPE_FORMAT_NONE) {         return GL_TRUE;      }   }   strb->Base.Format = st_pipe_format_to_mesa_format(format);   size = _mesa_format_image_size(strb->Base.Format, width, height, 1);   strb->data = malloc(size);   return strb->data != NULL;}
开发者ID:austriancoder,项目名称:mesa-1,代码行数:39,


示例26: st_framebuffer_validate

/** * Validate a framebuffer to make sure up-to-date pipe_textures are used. * The context we need to pass in is s dummy context needed only to be * able to get a pipe context to create pipe surfaces, and to have a * context to call _mesa_resize_framebuffer(): * (That should probably be rethought, since those surfaces become * drawable state, not context state, and can be freed by another pipe * context). */static voidst_framebuffer_validate(struct st_framebuffer *stfb,                        struct st_context *st){   struct pipe_resource *textures[ST_ATTACHMENT_COUNT];   uint width, height;   unsigned i;   boolean changed = FALSE;   int32_t new_stamp = p_atomic_read(&stfb->iface->stamp);   if (stfb->iface_stamp == new_stamp)      return;   /* validate the fb */   do {      if (!stfb->iface->validate(stfb->iface, stfb->statts,				 stfb->num_statts, textures))	 return;      stfb->iface_stamp = new_stamp;      new_stamp = p_atomic_read(&stfb->iface->stamp);   } while(stfb->iface_stamp != new_stamp);   width = stfb->Base.Width;   height = stfb->Base.Height;   for (i = 0; i < stfb->num_statts; i++) {      struct st_renderbuffer *strb;      struct pipe_surface *ps, surf_tmpl;      gl_buffer_index idx;      if (!textures[i])         continue;      idx = attachment_to_buffer_index(stfb->statts[i]);      if (idx >= BUFFER_COUNT) {         pipe_resource_reference(&textures[i], NULL);         continue;      }      strb = st_renderbuffer(stfb->Base.Attachment[idx].Renderbuffer);      assert(strb);      if (strb->texture == textures[i]) {         pipe_resource_reference(&textures[i], NULL);         continue;      }      u_surface_default_template(&surf_tmpl, textures[i],                                 PIPE_BIND_RENDER_TARGET);      ps = st->pipe->create_surface(st->pipe, textures[i], &surf_tmpl);      if (ps) {         pipe_surface_reference(&strb->surface, ps);         pipe_resource_reference(&strb->texture, ps->texture);         /* ownership transfered */         pipe_surface_reference(&ps, NULL);         changed = TRUE;         strb->Base.Width = strb->surface->width;         strb->Base.Height = strb->surface->height;         width = strb->Base.Width;         height = strb->Base.Height;      }      pipe_resource_reference(&textures[i], NULL);   }   if (changed) {      ++stfb->stamp;      _mesa_resize_framebuffer(st->ctx, &stfb->Base, width, height);   }}
开发者ID:james026yeah,项目名称:mesa,代码行数:82,


示例27: st_readpixels

/** * This uses a blit to copy the read buffer to a texture format which matches * the format and type combo and then a fast read-back is done using memcpy. * We can do arbitrary X/Y/Z/W/0/1 swizzling here as long as there is * a format which matches the swizzling. * * If such a format isn't available, we fall back to _mesa_readpixels. * * NOTE: Some drivers use a blit to convert between tiled and linear *       texture layouts during texture uploads/downloads, so the blit *       we do here should be free in such cases. */static voidst_readpixels(struct gl_context *ctx, GLint x, GLint y,              GLsizei width, GLsizei height,              GLenum format, GLenum type,              const struct gl_pixelstore_attrib *pack,              GLvoid *pixels){   struct st_context *st = st_context(ctx);   struct gl_renderbuffer *rb =         _mesa_get_read_renderbuffer_for_format(ctx, format);   struct st_renderbuffer *strb = st_renderbuffer(rb);   struct pipe_context *pipe = st->pipe;   struct pipe_screen *screen = pipe->screen;   struct pipe_resource *src;   struct pipe_resource *dst = NULL;   struct pipe_resource dst_templ;   enum pipe_format dst_format, src_format;   struct pipe_blit_info blit;   unsigned bind = PIPE_BIND_TRANSFER_READ;   struct pipe_transfer *tex_xfer;   ubyte *map = NULL;   /* Validate state (to be sure we have up-to-date framebuffer surfaces)    * and flush the bitmap cache prior to reading. */   st_validate_state(st);   st_flush_bitmap_cache(st);   if (!st->prefer_blit_based_texture_transfer) {      goto fallback;   }   /* This must be done after state validation. */   src = strb->texture;   /* XXX Fallback for depth-stencil formats due to an incomplete    * stencil blit implementation in some drivers. */   if (format == GL_DEPTH_STENCIL) {      goto fallback;   }   /* We are creating a texture of the size of the region being read back.    * Need to check for NPOT texture support. */   if (!screen->get_param(screen, PIPE_CAP_NPOT_TEXTURES) &&       (!util_is_power_of_two(width) ||        !util_is_power_of_two(height))) {      goto fallback;   }   /* If the base internal format and the texture format don't match, we have    * to use the slow path. */   if (rb->_BaseFormat !=       _mesa_get_format_base_format(rb->Format)) {      goto fallback;   }   /* See if the texture format already matches the format and type,    * in which case the memcpy-based fast path will likely be used and    * we don't have to blit. */   if (_mesa_format_matches_format_and_type(rb->Format, format,                                            type, pack->SwapBytes)) {      goto fallback;   }   if (_mesa_readpixels_needs_slow_path(ctx, format, type, GL_TRUE)) {      goto fallback;   }   /* Convert the source format to what is expected by ReadPixels    * and see if it's supported. */   src_format = util_format_linear(src->format);   src_format = util_format_luminance_to_red(src_format);   src_format = util_format_intensity_to_red(src_format);   if (!src_format ||       !screen->is_format_supported(screen, src_format, src->target,                                    src->nr_samples,                                    PIPE_BIND_SAMPLER_VIEW)) {      goto fallback;   }   if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL)      bind |= PIPE_BIND_DEPTH_STENCIL;   else      bind |= PIPE_BIND_RENDER_TARGET;   /* Choose the destination format by finding the best match    * for the format+type combo. */   dst_format = st_choose_matching_format(screen, bind, format, type,//.........这里部分代码省略.........
开发者ID:Sheph,项目名称:mesa,代码行数:101,


示例28: st_BlitFramebuffer

//.........这里部分代码省略.........      blit.dst.box.y = dstY0;      blit.src.box.y = srcY0;      blit.dst.box.height = dstY1 - dstY0;      blit.src.box.height = srcY1 - srcY0;   } else {      blit.dst.box.y = dstY1;      blit.src.box.y = srcY1;      blit.dst.box.height = dstY0 - dstY1;      blit.src.box.height = srcY0 - srcY1;   }   if (drawFB != ctx->WinSysDrawBuffer)      st_window_rectangles_to_blit(ctx, &blit);   blit.filter = pFilter;   blit.render_condition_enable = TRUE;   blit.alpha_blend = FALSE;   if (mask & GL_COLOR_BUFFER_BIT) {      struct gl_renderbuffer_attachment *srcAtt =         &readFB->Attachment[readFB->_ColorReadBufferIndex];      blit.mask = PIPE_MASK_RGBA;      if (srcAtt->Type == GL_TEXTURE) {         struct st_texture_object *srcObj = st_texture_object(srcAtt->Texture);         GLuint i;         if (!srcObj || !srcObj->pt) {            return;         }         for (i = 0; i < drawFB->_NumColorDrawBuffers; i++) {            struct st_renderbuffer *dstRb =               st_renderbuffer(drawFB->_ColorDrawBuffers[i]);            if (dstRb) {               struct pipe_surface *dstSurf = dstRb->surface;               if (dstSurf) {                  blit.dst.resource = dstSurf->texture;                  blit.dst.level = dstSurf->u.tex.level;                  blit.dst.box.z = dstSurf->u.tex.first_layer;                  blit.dst.format = dstSurf->format;                  blit.src.resource = srcObj->pt;                  blit.src.level = srcAtt->TextureLevel;                  blit.src.box.z = srcAtt->Zoffset + srcAtt->CubeMapFace;                  blit.src.format = srcObj->pt->format;                  st_adjust_blit_for_srgb(&blit, ctx->Color.sRGBEnabled);                  st->pipe->blit(st->pipe, &blit);                  dstRb->defined = true; /* front buffer tracking */               }            }         }      }      else {         struct st_renderbuffer *srcRb =            st_renderbuffer(readFB->_ColorReadBuffer);         struct pipe_surface *srcSurf;         GLuint i;         if (!srcRb || !srcRb->surface) {            return;
开发者ID:Kalamatee,项目名称:mesa,代码行数:67,



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


C++ st_texture_object函数代码示例
C++ st_insert函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。