Commit Graph

258 Commits

Author SHA1 Message Date
Ian Romanick
7e4cb32d05 mesa/es: Validate FBO attachment enum in Mesa code rather than the ES wrapper
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-10-04 12:25:56 -07:00
Brian Paul
9520f483b8 mesa: s/INLINE/inline/
INLINE is still seen in some files (some generated files, etc) but this
is a good start.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2011-10-01 08:16:36 -06:00
Ian Romanick
55d232a815 mesa: Remove all mention of MESA_FORMAT_CI8
Nothing in Mesa supports color-index textures, and most of the other
infrastructure that could allow such support has already been removed.
This puts the final nail in the coffin.

Also clean out some GL_COLOR_INDEX comments in formats.c.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-08-29 11:07:49 -07:00
Brian Paul
3e9dc51f82 mesa: handle array textures in GenerateMipmap(), FramebufferTexture1/2D()
This was an unfinished to-do item before.
With this patch and the two preceeding patches, piglit's
fbo-generatemipmap-array test runs and passes instead of generating
a GL error and dying on an assertion.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-08-19 13:31:11 -06:00
Brian Paul
352cab498a mesa: restructure error checking in _mesa_FramebufferTexture1D/2DEXT()
In anticipation of adding more texture targets.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-08-19 13:31:10 -06:00
Brian Paul
ccecc08f79 mesa: fix incorrect error code in _mesa_FramebufferTexture1D/3DEXT()
The spec says GL_INVALID_OPERATION is generated when texture!=0 and
textarget is not a legal value.  We had this right for the 2D function.
2011-08-18 11:51:53 -06:00
Marek Olšák
000896c0bb mesa: GLES2 should return different error enums for invalid fbo queries
ES 2.0.25 page 127 says:

  If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is NONE, then
  querying any other pname will generate INVALID_ENUM.

See also:
b9e9df78a0

NOTE: This is a candidate for the 7.10 and 7.11 branches.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-07-21 14:16:43 +02:00
Marek Olšák
83478e5d59 mesa: return early if mask is cleared to zero in BlitFramebuffer
From ARB_framebuffer_object:
    If a buffer is specified in <mask> and does not exist in both the
    read and draw framebuffers, the corresponding bit is silently
    ignored.
2011-07-10 21:47:20 +02:00
Marek Olšák
1165280cbd mesa: initial ARB_depth_buffer_float support
Using GL_NONE as DataType of Z32_FLOAT_X24S8, not sure what I should put there.
The spec says the type is n/a.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-07-10 21:41:16 +02:00
Eric Anholt
6f998b58bc mesa: Fix render-to-texture regression.
Accidentally introduced in fc8c4a3a7b.
Fixes fbo-drawbuffers-maxtargets and friends.
2011-06-18 15:59:00 -07:00
Brian Paul
fc8c4a3a7b mesa: use helper functions to distinguish between user/winsys FBOs
And replace IS_CUBE_FACE() macro w/ inline function.
2011-06-16 07:31:58 -06:00
Ian Romanick
bb4758669c mesa: Ignore blits to/from missing buffers
The EXT_framebuffer_object spec (and later specs) say:

     "If a buffer is specified in <mask> and does not exist in both
     the read and draw framebuffers, the corresponding bit is silently
     ignored."

Check for color, depth, and stencil that the source and destination
FBOs have the specified buffers.  If the buffer is missing, remove the
bit from the blit request mask and continue.

Fixes the crash in piglit test 'fbo-missing-attachment-blit from', and
fixes 'fbo-missing-attachment-blit es2 from'.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37739
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>

NOTE: This is a candidate for the stable branches.
2011-06-07 18:29:52 -07:00
Marek Olšák
b9e9df78a0 mesa: queries of non-existent FBO attachments should return INVALID_OPERATION
OpenGL 4.0 Compatibility, page 449:

If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is NONE, no
framebuffer is bound to target. In this case querying pname FRAMEBUFFER_-
ATTACHMENT_OBJECT_NAME will return zero, and all other queries will generate
an INVALID_OPERATION error.

Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-06-01 16:07:58 +02:00
Eric Anholt
d3451f7f9c mesa: Allow NULL read/draw in complete FBOs in ARB_ES2_compatibility.
From the ARB_ES2_compatibility spec:

    "(8) How should we handle draw buffer completeness?

    RESOLVED: Remove draw/readbuffer completeness checks, and treat
    drawbuffers referring to missing attachments as if they were NONE."

Fixes arb_es2_compatibility-drawbuffers when the short-circuit for
ARB_ES2_compatibility in the previous commit is dropped.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-05-26 08:54:29 -07:00
Marek Olšák
a3ac28a736 mesa: make RGB9_E5 non-renderable on swrast again
_BaseFormat for RGB9_E5 is GL_RGBA due to the previous revert.
2011-05-17 00:13:43 +02:00
Marek Olšák
631d23daa9 mesa: implement EXT_packed_float
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-04-29 11:31:55 +02:00
Marek Olšák
9d7698c468 mesa: implement EXT_texture_shared_exponent
swrast support done.

There is no renderbuffer support in swrast, because it's not required
by the extension.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-04-29 11:31:55 +02:00
Marek Olšák
15f99d1362 mesa: finish up ARB_texture_float
Squashed commit of the following:

Author: Marek Olšák <maraeo@gmail.com>

    mesa: handle floating-point formats in _mesa_base_fbo_format
    mesa: add ARB/ATI_texture_float, remove MESAX_texture_float

commit 123bb110852739dffadcc81ad80b005b1c4f586d
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Wed Aug 25 01:35:42 2010 +0200

    mesa: compute floatMode for FBOs and return it on RGBA_FLOAT_MODE
2011-04-15 05:08:00 +02:00
Fabian Bieler
c7339d42c6 mesa: Guard against null pointer deref in fbo validation
This matches the behaviour below when numSamples is compared.

At least with the gallium state tracker this can actually occur if st_render_texture fails.

Signed-off-by: Brian Paul <brianp@vmware.com>
2011-04-05 07:51:01 -06:00
Brian Paul
db0f9e701d mesa: added _mesa_get_attachment_teximage() helpers 2011-04-05 07:51:01 -06:00
Marek Olšák
0be369975f mesa: initial EXT_texture_snorm support
The component ordering of some formats has been been reversed to match
Gallium types.
2011-03-29 12:04:55 +02:00
Vinson Lee
4f94e0b76a mesa: Add missing parentheses in glBlitFramebufferEXT error strings. 2011-03-28 20:32:01 -07:00
Marek Olšák
a674ef7814 mesa: return after invalidating renderbuffer 2011-03-07 23:33:36 +01:00
Marek Olšák
df818d572e mesa: invalidate framebuffer if internal format of renderbuffer is changed
RenderTexture doesn't have to be called in invalidate_rb, I guess.
2011-03-07 23:27:35 +01:00
Brian Paul
c6991433ef mesa: consolidate framebuffer target lookup code 2011-02-28 18:24:25 -07:00
Brian Paul
ca1b551562 mesa: s/mesaFormat/attFormat/ 2011-02-28 18:23:23 -07:00
Brian Paul
6364d75008 mesa: MESA_VERBOSE logging for glRead/Draw/CopyPixels, glBlitFramebuffer 2011-02-18 10:34:25 -07:00
Dave Airlie
88ffa9ce5b mesa/965: add support for GL_EXT_framebuffer_sRGB (v2)
This adds i965 support for GL_EXT_framebuffer_sRGB, it introduces a new
constant to say that the driver can support sRGB enabled FBOs since enabling
the extension doesn't mean the driver can actually support sRGB.

Also adds the suggested state flush in the core code suggested by Brian.

fix the ARB_fbo color encoding.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-05 17:06:30 +10:00
Brian Paul
b3cfcdf923 mesa: fix typo, wrap long line 2011-01-28 20:25:26 -07:00
Brian Paul
d30156525f mesa: add red, red/green formats in _mesa_base_fbo_format() 2011-01-24 19:38:52 -07:00
Brian Paul
62c66b3430 mesa: plug in fallback function for ctx->Driver.ValidateFramebuffer()
The software renderer doesn't support GL_ALPHA, GL_LUMINANCE, etc
so we should report GL_FRAMEBUFFER_UNSUPPORTED during FBO validation.
2011-01-24 19:38:52 -07:00
Brian Paul
976ea9d76b mesa: new cases in _mesa_base_fbo_format()
The set of internalFormat parameters accepted by glRenderBufferStorage
depends on the EXT vs. ARB version of framebuffer_object.  The later
added support for GL_ALPHA, GL_LUMINANCE, etc. formats.  Note that
these formats might be legal but might not be supported.  That should
be checked with glCheckFramebufferStatus().
2011-01-24 19:38:52 -07:00
Brian Paul
f41bbc7c44 Revert "mesa: Simplify _mesa_base_fbo_format by making it exceptions to teximages."
This reverts commit 65c41d55a0.

There really are quite a few differences in the set of internal
formats allowed by glTexImage and glRenderbufferStorage.
2011-01-24 19:38:52 -07:00
Marek Olšák
81ae8c6313 mesa: return GL_LINEAR for ..COLOR_ENCODING if framebuffer_sRGB is unsupported
Signed-off-by: Brian Paul <brianp@vmware.com>
2011-01-23 20:59:46 +01:00
Eric Anholt
65c41d55a0 mesa: Simplify _mesa_base_fbo_format by making it exceptions to teximages.
The comment of "this is just like teximages except for..." is a pretty
good clue that we're handling this wrong.  By just using the teximage
code, we catch a bunch of cases we'd missed, like GL_RED and GL_RG.
2011-01-14 13:57:15 -08:00
Dave Airlie
7f652fc523 srgb: fix fbo base format picking.
Pointed out by Brian.
2011-01-14 14:58:47 +10:00
Dave Airlie
8c8e26d66a mesa/fbo: prevent assert trigger on i965 with piglit fbo-srgb test. 2011-01-13 15:17:34 +10:00
Brian Paul
dd973cd9e8 mesa: check for dummy renderbuffer in _mesa_FramebufferRenderbufferEXT()
Fixes a failed assertion when a renderbuffer ID that was gen'd but not
previously bound was passed to glFramebufferRenderbuffer().  Generate
the same error that NVIDIA does.

NOTE: This is a candidate for the 7.9 and 7.10 branches.
2011-01-12 18:14:18 -07:00
Vinson Lee
db61b9ce39 mesa: Directly include mfeatures.h in files that perform feature tests. 2011-01-07 00:13:00 -08:00
Vinson Lee
0117da40cd mesa: Include mtypes.h in files that use gl_context struct.
Directly include mtypes.h if a file uses a gl_context struct. This
allows future removal of headers that are not strictly necessary but
indirectly include mtypes.h for a file.
2011-01-05 23:11:54 -08:00
Eric Anholt
5f13c39484 mesa: Also report the number of renderbuffer alpha bits for GL_LUMINANCE_ALPHA.
Noticed by code inspection.
2011-01-03 13:28:26 -08:00
Eric Anholt
f45aea0ec9 mesa: Also report renderbuffer red/green size for GL_RED and GL_RG.
Noticed by code inspection.
2011-01-03 13:28:26 -08:00
Eric Anholt
059cca92a8 mesa: Use the common logic for "is this baseformat a color format?"
When figuring out whether a renderbuffer should be used to set the
visual bits of an FBO, we were missing important baseformats like
GL_RED, GL_RG, and GL_LUMINANCE.
2011-01-03 13:28:24 -08:00
Eric Anholt
beac6ee62a mesa: Allow color renderbuffers besides just RGB and RGBA.
We did so already for textures to do ARB_fbo's
GL_ALPHA/GL_LUMINANCE/etc. support and for ARB_texture_rg's GL_RED and
GL_RG, but this path was missed.
2011-01-03 13:22:38 -08:00
Brian Paul
ecb7cc3319 mesa: test for cube map completeness in glGenerateMipmap()
The texture is not cube complete if the base level images aren't of
the same size and format.

NOTE: This is a candidate for the 7.9 branch.
2010-12-06 17:10:05 -07:00
Brian Paul
6d13ec7dc0 mesa: return GL_FRAMEBUFFER_DEFAULT as FBO attachment type
If querying the default/window-system FBO's attachment type, return
GL_FRAMEBUFFER_DEFAULT (per the GL_ARB_framebuffer_object spec).

See http://bugs.freedesktop.org/show_bug.cgi?id=31947

NOTE: This is a candidate for the 7.9 branch.
2010-12-03 08:32:29 -07:00
Brian Paul
20cf1851d8 mesa: fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME query
Return 0 instead of generating an error.

See http://bugs.freedesktop.org/show_bug.cgi?id=30993

Note that piglit fbo-getframebufferattachmentparameter-01 still does
not pass.  But Mesa behaves the same as the NVIDIA driver in this case.
Perhaps the test is incorrect.

NOTE: This is a candidate for the 7.9 branch.
2010-12-03 08:24:51 -07:00
Brian Paul
412b960883 mesa: rename function to _mesa_is_format_integer_color()
Be a bit more clear about its operation.
2010-10-26 20:30:42 -06:00
Marek Olšák
6e61853590 mesa: allow FBO attachments of formats LUMINANCE, LUMINANCE_ALPHA, and INTENSITY
As per the GL_ARB_framebuffer_object specification.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
2010-10-24 23:14:01 +02:00
Brian Paul
c7d18374dd mesa: compute _IntegerColor field in _mesa_test_framebuffer_completeness() 2010-10-23 10:19:30 -06:00