<div dir="ltr">On 4 February 2013 21:48, Chris Forbes <span dir="ltr"><<a href="mailto:chrisf@ijw.co.nz" target="_blank">chrisf@ijw.co.nz</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
- sample count must be the same on all attachments<br>
- fixedsamplepositions must be the same on all attachments<br>
(renderbuffers have fixedsamplepositions=true implicitly; only<br>
multisample textures can choose to have it false)<br>
- stencil-only formats become legal.<br></blockquote><div><br></div><div>Can you help me understand what aspect of ARB_texture_multisample causes stencil-only formats to become legal? I don't see anything in the extension spec that allows this, and I'm worried that we may make assumptions elsewhere in the driver that would be broken by stencil-only framebuffers.<br>
<br></div><div>Cc'ing Ken since he's currently working on a patch which I believe makes this assumption ("i965: Implement CopyTexSubImage2D via BLORP (and use it by default).").<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
V2: - fix wrapping to 80 columns, debug message, fix for state moving<br>
from texobj to image.<br>
- stencil texturing tweaks tidied up and folded in here.<br>
<br>
Signed-off-by: Chris Forbes <<a href="mailto:chrisf@ijw.co.nz">chrisf@ijw.co.nz</a>><br>
---<br>
src/mesa/main/fbobject.c | 50 ++++++++++++++++++++++++++++++++++++------------<br>
1 file changed, 38 insertions(+), 12 deletions(-)<br>
<br>
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c<br>
index d9fd78e..089fa84 100644<br>
--- a/src/mesa/main/fbobject.c<br>
+++ b/src/mesa/main/fbobject.c<br>
@@ -575,6 +575,7 @@ is_legal_depth_format(const struct gl_context *ctx, GLenum baseFormat)<br>
switch (baseFormat) {<br>
case GL_DEPTH_COMPONENT:<br>
case GL_DEPTH_STENCIL_EXT:<br>
+ case GL_STENCIL_INDEX:<br>
return GL_TRUE;<br>
default:<br>
return GL_FALSE;<br>
@@ -664,8 +665,11 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format,<br>
baseFormat == GL_DEPTH_STENCIL_EXT) {<br>
/* OK */<br>
}<br>
+ else if (ctx->Extensions.ARB_texture_multisample &&<br>
+ baseFormat == GL_STENCIL_INDEX) {<br>
+ /* OK */<br>
+ }<br>
else {<br>
- /* no such thing as stencil-only textures */<br>
att_incomplete("illegal stencil texture");<br>
att->Complete = GL_FALSE;<br>
return;<br>
@@ -745,6 +749,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,<br>
GLenum intFormat = GL_NONE; /* color buffers' internal format */<br>
GLuint minWidth = ~0, minHeight = ~0, maxWidth = 0, maxHeight = 0;<br>
GLint numSamples = -1;<br>
+ GLint fixedSampleLocations = -1;<br>
GLint i;<br>
GLuint j;<br>
<br>
@@ -766,6 +771,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,<br>
struct gl_renderbuffer_attachment *att;<br>
GLenum f;<br>
gl_format attFormat;<br>
+ struct gl_texture_image *texImg = NULL;<br>
<br>
/*<br>
* XXX for ARB_fbo, only check color buffers that are named by<br>
@@ -805,8 +811,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,<br>
/* get width, height, format of the renderbuffer/texture<br>
*/<br>
if (att->Type == GL_TEXTURE) {<br>
- const struct gl_texture_image *texImg =<br>
- _mesa_get_attachment_teximage(att);<br>
+ texImg = _mesa_get_attachment_teximage(att);<br>
minWidth = MIN2(minWidth, texImg->Width);<br>
maxWidth = MAX2(maxWidth, texImg->Width);<br>
minHeight = MIN2(minHeight, texImg->Height);<br>
@@ -814,12 +819,19 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,<br>
f = texImg->_BaseFormat;<br>
attFormat = texImg->TexFormat;<br>
numImages++;<br>
+<br>
if (!is_format_color_renderable(ctx, attFormat, texImg->InternalFormat) &&<br>
!is_legal_depth_format(ctx, f)) {<br>
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;<br>
fbo_incomplete("texture attachment incomplete", -1);<br>
return;<br>
}<br>
+<br>
+ if (numSamples < 0)<br>
+ numSamples = texImg->NumSamples;<br>
+<br>
+ if (fixedSampleLocations < 0)<br>
+ fixedSampleLocations = texImg->FixedSampleLocations;<br>
}<br>
else if (att->Type == GL_RENDERBUFFER_EXT) {<br>
minWidth = MIN2(minWidth, att->Renderbuffer->Width);<br>
@@ -829,21 +841,23 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,<br>
f = att->Renderbuffer->InternalFormat;<br>
attFormat = att->Renderbuffer->Format;<br>
numImages++;<br>
+<br>
+ if (numSamples < 0)<br>
+ numSamples = att->Renderbuffer->NumSamples;<br>
+<br>
+ /* RENDERBUFFER has fixedSampleLocations implicitly true */<br>
+ if (fixedSampleLocations < 0)<br>
+ fixedSampleLocations = GL_TRUE;<br>
}<br>
else {<br>
assert(att->Type == GL_NONE);<br>
continue;<br>
}<br>
<br>
- if (att->Renderbuffer && numSamples < 0) {<br>
- /* first buffer */<br>
- numSamples = att->Renderbuffer->NumSamples;<br>
- }<br>
-<br>
/* check if integer color */<br>
fb->_IntegerColor = _mesa_is_format_integer_color(attFormat);<br>
<br>
- /* Error-check width, height, format, samples<br>
+ /* Error-check width, height, format, samples, fixedSampleLocations<br>
*/<br>
if (numImages == 1) {<br>
/* save format, num samples */<br>
@@ -866,10 +880,22 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,<br>
return;<br>
}<br>
}<br>
- if (att->Renderbuffer &&<br>
- att->Renderbuffer->NumSamples != numSamples) {<br>
+<br>
+ if ((att->Type == GL_RENDERBUFFER &&<br>
+ att->Renderbuffer->NumSamples != numSamples) ||<br>
+ (att->Type == GL_TEXTURE &&<br>
+ texImg->NumSamples != numSamples)) {<br>
+ fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;<br>
+ fbo_incomplete("inconsistent number of samples", i);<br>
+ return;<br>
+ }<br>
+<br>
+ if ((att->Type == GL_RENDERBUFFER &&<br>
+ GL_TRUE != fixedSampleLocations) ||<br>
+ (att->Type == GL_TEXTURE &&<br>
+ texImg->FixedSampleLocations != fixedSampleLocations)) {<br>
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;<br>
- fbo_incomplete("inconsistant number of samples", i);<br>
+ fbo_incomplete("inconsistent fixed sample locations", i);<br>
return;<br>
}<br>
}<br>
<span class=""><font color="#888888">--<br>
1.8.1.2<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>