summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c4
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.h2
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c18
3 files changed, 14 insertions, 10 deletions
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 1067caf9b3..7245798d0d 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -118,6 +118,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
template.height[0] = height;
template.depth[0] = 1;
template.last_level = 0;
+ template.nr_samples = rb->Samples;
if (pf_is_depth_stencil(template.format)) {
template.tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL;
@@ -249,7 +250,7 @@ st_new_renderbuffer(GLcontext *ctx, GLuint name)
* renderbuffer). The window system code determines the format.
*/
struct gl_renderbuffer *
-st_new_renderbuffer_fb(enum pipe_format format)
+st_new_renderbuffer_fb(enum pipe_format format, int samples)
{
struct st_renderbuffer *strb;
@@ -261,6 +262,7 @@ st_new_renderbuffer_fb(enum pipe_format format)
_mesa_init_renderbuffer(&strb->Base, 0);
strb->Base.ClassID = 0x4242; /* just a unique value */
+ strb->Base.Samples = samples;
strb->format = format;
switch (format) {
diff --git a/src/mesa/state_tracker/st_cb_fbo.h b/src/mesa/state_tracker/st_cb_fbo.h
index 87b0734a0c..ff56001a4e 100644
--- a/src/mesa/state_tracker/st_cb_fbo.h
+++ b/src/mesa/state_tracker/st_cb_fbo.h
@@ -58,7 +58,7 @@ st_renderbuffer(struct gl_renderbuffer *rb)
extern struct gl_renderbuffer *
-st_new_renderbuffer_fb(enum pipe_format format);
+st_new_renderbuffer_fb(enum pipe_format format, int samples);
extern void
st_init_fbo_functions(struct dd_function_table *functions);
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index 1b6e68c2a1..1994a1c826 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -51,27 +51,29 @@ st_create_framebuffer( const __GLcontextModes *visual,
{
struct st_framebuffer *stfb = CALLOC_STRUCT(st_framebuffer);
if (stfb) {
+ int samples = 0;
_mesa_initialize_framebuffer(&stfb->Base, visual);
+ if (visual->sampleBuffers) samples = visual->samples;
{
/* fake frontbuffer */
/* XXX allocation should only happen in the unusual case
it's actually needed */
struct gl_renderbuffer *rb
- = st_new_renderbuffer_fb(colorFormat);
+ = st_new_renderbuffer_fb(colorFormat, samples);
_mesa_add_renderbuffer(&stfb->Base, BUFFER_FRONT_LEFT, rb);
}
if (visual->doubleBufferMode) {
struct gl_renderbuffer *rb
- = st_new_renderbuffer_fb(colorFormat);
+ = st_new_renderbuffer_fb(colorFormat, samples);
_mesa_add_renderbuffer(&stfb->Base, BUFFER_BACK_LEFT, rb);
}
if (visual->depthBits == 24 && visual->stencilBits == 8) {
/* combined depth/stencil buffer */
struct gl_renderbuffer *depthStencilRb
- = st_new_renderbuffer_fb(depthFormat);
+ = st_new_renderbuffer_fb(depthFormat, samples);
/* note: bind RB to two attachment points */
_mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthStencilRb);
_mesa_add_renderbuffer(&stfb->Base, BUFFER_STENCIL, depthStencilRb);
@@ -82,26 +84,26 @@ st_create_framebuffer( const __GLcontextModes *visual,
if (visual->depthBits == 32) {
/* 32-bit depth buffer */
struct gl_renderbuffer *depthRb
- = st_new_renderbuffer_fb(depthFormat);
+ = st_new_renderbuffer_fb(depthFormat, samples);
_mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthRb);
}
else if (visual->depthBits == 24) {
/* 24-bit depth buffer, ignore stencil bits */
struct gl_renderbuffer *depthRb
- = st_new_renderbuffer_fb(depthFormat);
+ = st_new_renderbuffer_fb(depthFormat, samples);
_mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthRb);
}
else if (visual->depthBits > 0) {
/* 16-bit depth buffer */
struct gl_renderbuffer *depthRb
- = st_new_renderbuffer_fb(depthFormat);
+ = st_new_renderbuffer_fb(depthFormat, samples);
_mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthRb);
}
if (visual->stencilBits > 0) {
/* 8-bit stencil */
struct gl_renderbuffer *stencilRb
- = st_new_renderbuffer_fb(stencilFormat);
+ = st_new_renderbuffer_fb(stencilFormat, samples);
_mesa_add_renderbuffer(&stfb->Base, BUFFER_STENCIL, stencilRb);
}
}
@@ -109,7 +111,7 @@ st_create_framebuffer( const __GLcontextModes *visual,
if (visual->accumRedBits > 0) {
/* 16-bit/channel accum */
struct gl_renderbuffer *accumRb
- = st_new_renderbuffer_fb(DEFAULT_ACCUM_PIPE_FORMAT);
+ = st_new_renderbuffer_fb(DEFAULT_ACCUM_PIPE_FORMAT, 0); /* XXX accum isn't multisampled right? */
_mesa_add_renderbuffer(&stfb->Base, BUFFER_ACCUM, accumRb);
}