Drivers that rely on swrast need to do this, as with swrast_texture_image.
(1 << 27) | /* tiled surface */
(BRW_SURFACE_2D << 29));
OUT_BATCH(0);
- OUT_BATCH(((stencil_irb->Base.Width - 1) << 6) |
- (stencil_irb->Base.Height - 1) << 19);
+ OUT_BATCH(((stencil_irb->Base.Base.Width - 1) << 6) |
+ (stencil_irb->Base.Base.Height - 1) << 19);
OUT_BATCH(0);
OUT_BATCH(0);
I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
offset);
OUT_BATCH((BRW_SURFACE_MIPMAPLAYOUT_BELOW << 1) |
- (((depth_irb->Base.Width + tile_x)- 1) << 6) |
- (((depth_irb->Base.Height + tile_y) - 1) << 19));
+ (((depth_irb->Base.Base.Width + tile_x) - 1) << 6) |
+ (((depth_irb->Base.Base.Height + tile_y) - 1) << 19));
OUT_BATCH(0);
if (intel->is_g4x || intel->gen >= 5)
/* 3DSTATE_STENCIL_BUFFER inherits surface type and dimensions. */
dw1 |= (BRW_SURFACE_2D << 29);
- dw3 = ((srb->Base.Width - 1) << 4) |
- ((srb->Base.Height - 1) << 18);
+ dw3 = ((srb->Base.Base.Width - 1) << 4) |
+ ((srb->Base.Base.Height - 1) << 18);
}
BEGIN_BATCH(7);
OUT_RELOC(region->bo,
I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
offset);
- OUT_BATCH((((drb->Base.Width + tile_x) - 1) << 4) |
- (((drb->Base.Height + tile_y) - 1) << 18));
+ OUT_BATCH((((drb->Base.Base.Width + tile_x) - 1) << 4) |
+ (((drb->Base.Base.Height + tile_y) - 1) << 18));
OUT_BATCH(0);
OUT_BATCH(tile_x | (tile_y << 16));
OUT_BATCH(0);
/* 2. Create new depth/stencil renderbuffer. */
struct intel_renderbuffer *depth_stencil_rb =
intel_create_renderbuffer(MESA_FORMAT_S8_Z24);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depth_stencil_rb->Base);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &depth_stencil_rb->Base);
+ _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depth_stencil_rb->Base.Base);
+ _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &depth_stencil_rb->Base.Base);
/* 3. Append DRI2BufferDepthStencil to attachment list. */
int old_count = *count;
void *map;
int stride;
- if (!irb && rb->Buffer) {
+ if (!irb && irb->Base.Buffer) {
/* this is a malloc'd renderbuffer (accum buffer) */
GLint bpp = _mesa_get_format_bytes(rb->Format);
- GLint rowStride = rb->RowStrideBytes;
- *out_map = (GLubyte *) rb->Buffer + y * rowStride + x * bpp;
+ GLint rowStride = irb->Base.RowStride;
+ *out_map = (GLubyte *) irb->Base.Buffer + y * rowStride + x * bpp;
*out_stride = rowStride;
return;
}
DBG("%s: rb %d (%s)\n", __FUNCTION__,
rb->Name, _mesa_get_format_name(rb->Format));
- if (!irb && rb->Buffer) {
+ if (!irb && irb->Base.Buffer) {
/* this is a malloc'd renderbuffer (accum buffer) */
/* nothing to do */
return;
struct intel_renderbuffer *
intel_create_renderbuffer(gl_format format)
{
- GET_CURRENT_CONTEXT(ctx);
-
struct intel_renderbuffer *irb;
+ struct gl_renderbuffer *rb;
+
+ GET_CURRENT_CONTEXT(ctx);
irb = CALLOC_STRUCT(intel_renderbuffer);
if (!irb) {
return NULL;
}
- _mesa_init_renderbuffer(&irb->Base, 0);
- irb->Base.ClassID = INTEL_RB_CLASS;
- irb->Base._BaseFormat = _mesa_get_format_base_format(format);
- irb->Base.Format = format;
- irb->Base.InternalFormat = irb->Base._BaseFormat;
+ rb = &irb->Base.Base;
+
+ _mesa_init_renderbuffer(rb, 0);
+ rb->ClassID = INTEL_RB_CLASS;
+ rb->_BaseFormat = _mesa_get_format_base_format(format);
+ rb->Format = format;
+ rb->InternalFormat = rb->_BaseFormat;
/* intel-specific methods */
- irb->Base.Delete = intel_delete_renderbuffer;
- irb->Base.AllocStorage = intel_alloc_window_storage;
+ rb->Delete = intel_delete_renderbuffer;
+ rb->AllocStorage = intel_alloc_window_storage;
return irb;
}
{
/*struct intel_context *intel = intel_context(ctx); */
struct intel_renderbuffer *irb;
+ struct gl_renderbuffer *rb;
irb = CALLOC_STRUCT(intel_renderbuffer);
if (!irb) {
return NULL;
}
- _mesa_init_renderbuffer(&irb->Base, name);
- irb->Base.ClassID = INTEL_RB_CLASS;
+ rb = &irb->Base.Base;
+
+ _mesa_init_renderbuffer(rb, name);
+ rb->ClassID = INTEL_RB_CLASS;
/* intel-specific methods */
- irb->Base.Delete = intel_delete_renderbuffer;
- irb->Base.AllocStorage = intel_alloc_renderbuffer_storage;
+ rb->Delete = intel_delete_renderbuffer;
+ rb->AllocStorage = intel_alloc_renderbuffer_storage;
/* span routines set in alloc_storage function */
- return &irb->Base;
+ return rb;
}
gl_format format,
GLenum internal_format)
{
- struct gl_renderbuffer *rb = &irb->Base;
+ struct gl_renderbuffer *rb = &irb->Base.Base;
rb->Format = format;
rb->InternalFormat = internal_format;
rb->Width = mt->level[level].width;
rb->Height = mt->level[level].height;
- irb->Base.Delete = intel_delete_renderbuffer;
- irb->Base.AllocStorage = intel_nop_alloc_storage;
+ rb->Delete = intel_delete_renderbuffer;
+ rb->AllocStorage = intel_nop_alloc_storage;
intel_miptree_check_level_layer(mt, level, layer);
irb->mt_level = level;
if (irb) {
/* bind the wrapper to the attachment point */
- _mesa_reference_renderbuffer(&att->Renderbuffer, &irb->Base);
+ _mesa_reference_renderbuffer(&att->Renderbuffer, &irb->Base.Base);
}
else {
/* fallback to software rendering */
DBG("Begin render %s texture tex=%u w=%d h=%d refcount=%d\n",
_mesa_get_format_name(image->TexFormat),
att->Texture->Name, image->Width, image->Height,
- irb->Base.RefCount);
+ irb->Base.Base.RefCount);
intel_image->used_as_render_target = true;
*/
struct intel_renderbuffer
{
- struct gl_renderbuffer Base;
+ struct swrast_renderbuffer Base;
struct intel_mipmap_tree *mt; /**< The renderbuffer storage. */
drm_intel_bo *map_bo;
intel_renderbuffer(struct gl_renderbuffer *rb)
{
struct intel_renderbuffer *irb = (struct intel_renderbuffer *) rb;
- if (irb && irb->Base.ClassID == INTEL_RB_CLASS) {
+ if (irb && irb->Base.Base.ClassID == INTEL_RB_CLASS) {
/*_mesa_warning(NULL, "Returning non-intel Rb\n");*/
return irb;
}
static INLINE gl_format
intel_rb_format(const struct intel_renderbuffer *rb)
{
- return rb->Base.Format;
+ return rb->Base.Base.Format;
}
/* setup the hardware-based renderbuffers */
rb = intel_create_renderbuffer(rgbFormat);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &rb->Base);
+ _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &rb->Base.Base);
if (mesaVis->doubleBufferMode) {
rb = intel_create_renderbuffer(rgbFormat);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &rb->Base);
+ _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &rb->Base.Base);
}
/*
* enum intel_dri2_has_hiz).
*/
rb = intel_create_renderbuffer(MESA_FORMAT_X8_Z24);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base);
+ _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base.Base);
rb = intel_create_renderbuffer(MESA_FORMAT_S8);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base);
+ _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base.Base);
} else {
/*
* Use combined depth/stencil. Note that the renderbuffer is
* attached to two attachment points.
*/
rb = intel_create_renderbuffer(MESA_FORMAT_S8_Z24);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base);
+ _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base.Base);
+ _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base.Base);
}
}
else if (mesaVis->depthBits == 16) {
/* just 16-bit depth buffer, no hw stencil */
struct intel_renderbuffer *depthRb
= intel_create_renderbuffer(MESA_FORMAT_Z16);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
+ _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base.Base);
}
else {
assert(mesaVis->depthBits == 0);
if (!irb)
return;
- if (rb->Map) {
+ if (irb->Base.Map) {
/* Renderbuffer is already mapped. This usually happens when a single
* buffer is attached to the framebuffer's depth and stencil attachment
* points.
ctx->Driver.MapRenderbuffer(ctx, rb, 0, 0, rb->Width, rb->Height,
GL_MAP_READ_BIT | GL_MAP_WRITE_BIT,
&map, &stride);
- rb->Map = map;
- rb->RowStrideBytes = stride;
+ irb->Base.Map = map;
+ irb->Base.RowStride = stride;
}
static void
if (!irb)
return;
- if (!rb->Map) {
+ if (!irb->Base.Map) {
/* Renderbuffer is already unmapped. This usually happens when a single
* buffer is attached to the framebuffer's depth and stencil attachment
* points.
ctx->Driver.UnmapRenderbuffer(ctx, rb);
- rb->Map = NULL;
- rb->RowStrideBytes = 0;
+ irb->Base.Map = NULL;
+ irb->Base.RowStride = 0;
}
static void