diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2010-08-23 13:16:27 -0400 |
---|---|---|
committer | Alex Deucher <alexdeucher@gmail.com> | 2010-08-23 13:16:27 -0400 |
commit | eede93b057bbdddcde5da3220a3f8c6f73784a7e (patch) | |
tree | c6fcb5564308c42485cdc776b7e76975c57c322d /src/radeon_vbo.h | |
parent | d8abf27dbd14f5eb746c5e8b8b1436ad292d8ec6 (diff) |
radeon: move vbo data to a separate struct
this way we can share the vbo code with const buffers
Diffstat (limited to 'src/radeon_vbo.h')
-rw-r--r-- | src/radeon_vbo.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/radeon_vbo.h b/src/radeon_vbo.h index b505f66b..21533c2e 100644 --- a/src/radeon_vbo.h +++ b/src/radeon_vbo.h @@ -2,39 +2,40 @@ #ifndef RADEON_VBO_H #define RADEON_VBO_H -extern void radeon_vb_no_space(ScrnInfoPtr pScrn, int vert_size); +extern void radeon_vb_no_space(ScrnInfoPtr pScrn, struct radeon_vbo_object *vbo, int vert_size); extern void radeon_vbo_init_lists(ScrnInfoPtr pScrn); extern void radeon_vbo_free_lists(ScrnInfoPtr pScrn); extern void radeon_vbo_flush_bos(ScrnInfoPtr pScrn); -extern void radeon_vbo_get(ScrnInfoPtr pScrn); -extern void radeon_vbo_put(ScrnInfoPtr pScrn); +extern void radeon_vbo_get(ScrnInfoPtr pScrn, struct radeon_vbo_object *vbo); +extern void radeon_vbo_put(ScrnInfoPtr pScrn, struct radeon_vbo_object *vbo); -static inline void radeon_vbo_check(ScrnInfoPtr pScrn, int vert_size) +static inline void radeon_vbo_check(ScrnInfoPtr pScrn, + struct radeon_vbo_object *vbo, + int vert_size) { - RADEONInfoPtr info = RADEONPTR(pScrn); - struct radeon_accel_state *accel_state = info->accel_state; - if ((accel_state->vb_offset + (accel_state->verts_per_op * vert_size)) > accel_state->vb_total) { - radeon_vb_no_space(pScrn, vert_size); + if ((vbo->vb_offset + (vbo->verts_per_op * vert_size)) > vbo->vb_total) { + radeon_vb_no_space(pScrn, vbo, vert_size); } } static inline void * -radeon_vbo_space(ScrnInfoPtr pScrn, int vert_size) +radeon_vbo_space(ScrnInfoPtr pScrn, + struct radeon_vbo_object *vbo, + int vert_size) { RADEONInfoPtr info = RADEONPTR(pScrn); - struct radeon_accel_state *accel_state = info->accel_state; void *vb; - + /* we've ran out of space in the vertex buffer - need to get a new one */ - radeon_vbo_check(pScrn, vert_size); + radeon_vbo_check(pScrn, vbo, vert_size); - accel_state->vb_op_vert_size = vert_size; + vbo->vb_op_vert_size = vert_size; #if defined(XF86DRM_MODE) if (info->cs) { int ret; - struct radeon_bo *bo = accel_state->vb_bo; + struct radeon_bo *bo = vbo->vb_bo; if (!bo->ptr) { ret = radeon_bo_map(bo, 1); @@ -43,19 +44,18 @@ radeon_vbo_space(ScrnInfoPtr pScrn, int vert_size) return NULL; } } - vb = (pointer)((char *)bo->ptr + accel_state->vb_offset); + vb = (pointer)((char *)bo->ptr + vbo->vb_offset); } else #endif - vb = (pointer)((char *)accel_state->vb_ptr + accel_state->vb_offset); + vb = (pointer)((char *)vbo->vb_ptr + vbo->vb_offset); return vb; } -static inline void radeon_vbo_commit(ScrnInfoPtr pScrn) +static inline void radeon_vbo_commit(ScrnInfoPtr pScrn, + struct radeon_vbo_object *vbo) { - RADEONInfoPtr info = RADEONPTR(pScrn); - struct radeon_accel_state *accel_state = info->accel_state; - accel_state->vb_offset += accel_state->verts_per_op * accel_state->vb_op_vert_size; + vbo->vb_offset += vbo->verts_per_op * vbo->vb_op_vert_size; } #endif |