summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/fbobject.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: fix crash in driver_RenderTexture_is_safeMarek Olšák2016-05-311-1/+2
| | | | | | | | | This just fixed the crash with the apitrace in bug report. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95246 Cc: 11.1 11.2 12.0 <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: skip level checking for FramebufferTexture*D if texture is zeroMarek Olšák2016-05-291-3/+3
| | | | | | | | | | | | | From the OpenGL 4.5 core spec: "An INVALID_VALUE error is generated if texture is not zero and level is not a supported texture level for textarget, as described above." Other FramebufferTexture functions already do the right thing. This fixes the main menu in F1 2015. Cc: 11.1 11.2 <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* mesa: allow GL_FRAMEBUFFER_DEFAULT_LAYERS to be queried with ES geometryIlia Mirkin2016-05-231-2/+2
| | | | | | | When we have the geometry extensions, enable querying of the new param. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* mesa: Unlock mutex on error path.Matt Turner2016-05-221-0/+1
| | | | Caught by Coverity (CID 1362021). Caused by commit 015f2207c.
* mesa: Replace uses of Shared->Mutex with hash-table mutexesMatt Turner2016-05-201-13/+19
| | | | | | | | | | | | | | | We were locking the Shared->Mutex and then using calling functions like _mesa_HashInsert that do additional per-hash-table locking internally. Instead just lock each hash-table's mutex and use functions like _mesa_HashInsertLocked and the new _mesa_HashRemoveLocked. In order to do this, we need to remove the locking from _mesa_HashFindFreeKeyBlock since it will always be called with the per-hash-table lock taken. Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Add comment to framebuffer_parameteri()Edward O'Callaghan2016-04-071-0/+5
| | | | | | | | | V.2: Change 'N.B.,' to 'NOTE:'. Signed-off-by: Edward O'Callaghan <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* mesa: Disallow GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME on winsys FBO.Kenneth Graunke2016-03-191-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | Fixes: dEQP-GLES3.functional.negative_api.state.get_framebuffer_attachment_parameteriv Apparently, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME is not allowed when GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is GL_FRAMEBUFFER_DEFAULT, and is expected to result in a GL_INVALID_ENUM error. No GL specification actually defines what GL_FRAMEBUFFER_DEFAULT means. It probably means the window system FBO. It also doesn't mention the behavior of any queries for that type. Various ARB folks seem fairly confused about it too. For now, just do something vaguely like what dEQP expects. I think we probably need to check the visual bits against 0 for the attachment, but we haven't been doing that thusfar, and given how confusingly this is specified, I can't imagine anyone relying on it. v2: Improve comments, move error condition above the _mesa_get_fb0_attachment call, add forgotten "return" (all suggested/caught by Jordan Justen). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* mesa: Fix error code for GetFramebufferAttachmentParameter in ES 3.0+.Kenneth Graunke2016-03-081-2/+16
| | | | | | | | | | | | | | | | | | The ES 3.0+ specifications contain the exact same text as the OpenGL specification, which says that we should return GL_INVALID_OPERATION. ES 2.0 contains different text saying we should return GL_INVALID_ENUM. Previously, Mesa chose the error code based on API (GL vs. ES). This patch makes ES 3.0+ follow the GL behavior. ES 2 remains as is. Fixes dEQP-GLES3.functional.fbo.api.attachment_query_empty_fbo. However, breaks the dEQP-GLES2 variant of the same test for drivers which silently promote to ES 3.0. This can be worked around by exporting MESA_GLES_VERSION_OVERRIDE=2.0, but is a bug in dEQP-GLES2. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* main: call invalidate_framebuffer_storage() with driver's viewport limitsSamuel Iglesias Gonsálvez2016-03-021-2/+4
| | | | | | | Don't use hardcoded ones because the driver can set different ones. Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Refactor bind_framebuffer to make _mesa_bind_framebuffersIan Romanick2016-03-011-12/+21
| | | | | | | | | | Fixing dd_function_table::BindFramebuffer will come later because that change is probably not suitable for stable. v2: Fix whitespace issue noticed by Topi. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]>
* mesa/fbobject: propogate Layered when reusing attachments.Dave Airlie2016-03-011-0/+1
| | | | | | | | | | | | When reusing a depth attachment as a stencil, we need to propogate the layered bit, otherwise we fail to complete the framebuffer. discovered running ./bin/fbo-depth-array depth-layered-clear on virgl on haswell. Reviewed-by: Marek Olšák <[email protected]> Cc: "11.1 11.2" <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* mesa: check fbo completeness based on internal format, not driver formatIlia Mirkin2016-02-191-3/+2
| | | | | | | | | | | | The base format is a function of the user-requested format, while the driver format is not. So we should use the base format instead. The driver format can be anything. Specifically in the stencil-only case, it might be a depth/stencil format. However we still want to refuse such an attachment when bound to GL_DEPTH. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Refactor renderbuffer_storage to make _mesa_renderbuffer_storageIan Romanick2016-02-101-39/+58
| | | | | | | | | Pulls the parts of renderbuffer_storage that aren't just parameter validation out into a function that can be called from other parts of Mesa (e.g., meta). Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* mesa: Refactor _mesa_framebuffer_renderbufferIan Romanick2016-02-101-16/+26
| | | | | | | | | | | This function previously was only used in fbobject.c and contained a bunch of API validation. Split the function into framebuffer_renderbuffer that is static and contains the validation, and _mesa_framebuffer_renderbuffer that is suitable for calling from elsewhere in Mesa (e.g., meta). Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* mesa: invalidate framebuffer when changing parametersIlia Mirkin2016-02-021-0/+3
| | | | | | | | | | | | | This fixes dEQP-GLES31.functional.fbo.completeness.no_attachments When the width or height are 0, the framebuffer is incomplete. We may also not have been passing the new state down to the driver when the widths/heights/etc changed. Make sure to dirty the state so that the framebuffer state is revalidated at draw time. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* main: get rid of needless conditionalErik Faye-Lund2016-01-121-13/+12
| | | | | | | | We already check if the driver changed the completeness, we don't need to duplicate that check. Let's just early out there instead. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: Fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE for default framebuffer.Iago Toral Quiroga2015-09-231-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | From section 9.2. Binding and Managing Framebuffer Objects: "Upon successful return from Get*FramebufferAttachmentParameteriv, if pname is FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, then params will contain one of NONE, FRAMEBUFFER_DEFAULT, TEXTURE, or RENDERBUFFER, identifying the type of object which contains the attached image." And then it clarifies further: "If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is NONE, then either no framebuffer is bound to target; or the default framebuffer is bound, attachment is DEPTH or STENCIL, and the number of depth or stencil bits, respectively, is zero" Currently, if the default framebuffer is bound, we always return GL_FRAMEBUFFER_DEFAULT for FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, but according to the spec, when GL_DEPTH or GL_STENCIL attachments are the ones being queried, we should return GL_NONE if they don't exist. Fixes the following dEQP test: dEQP-GLES3.functional.state_query.fbo.framebuffer_attachment_x_size_initial Reviewed-by: Ian Romanick <[email protected]> Cc: "10.6" <[email protected]>
* mesa: Limit Framebuffer Parameter OpenGL ES 3.1 usageMarta Lofstedt2015-09-011-1/+17
| | | | | | | | | | | | | | | According to OpenGL ES 3.1 specification, section 9.2.1 for glFramebufferParameter and section 9.2.3 for glGetFramebufferParameteriv: "An INVALID_ENUM error is generated if pname is not FRAMEBUFFER_DEFAULT_WIDTH, FRAMEBUFFER_DEFAULT_HEIGHT, FRAMEBUFFER_DEFAULT_SAMPLES, or FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS." Therefore exclude OpenGL ES 3.1 from using the GL_FRAMEBUFFER_DEFAULT_LAYERS parameter. Signed-off-by: Marta Lofstedt <[email protected]> Reviewed-by: Kevin Rogovin <kevin.rogovin at intel.com>
* mesa: move non-generic samples validationTimothy Arceri2015-08-181-0/+10
| | | | | | | | | The previous patch replaces the other use case. V2: remove the validation from it old location. Cc: Tapani Pälli <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* mesa/es3.1: Allow Multisampled FrameBufferTexturesMarta Lofstedt2015-08-101-2/+3
| | | | | | | GLES 3.1 must be allowed to use multisampled framebuffer textures. Signed-off-by: Marta Lofstedt <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* mesa: initialize variables to silence compiler warningsBrian Paul2015-07-231-2/+2
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* mesa: Rename _mesa_lookup_enum_by_nr() to _mesa_enum_to_string().Kenneth Graunke2015-07-201-36/+36
| | | | | | | Generated by sed; no manual changes. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* PATCH 03/10] mesa: Complete ARB_framebuffer_no_attachments in Mesa coreKevin Rogovin2015-06-171-29/+182
| | | | | | | | | | Implement GL_ARB_framebuffer_no_attachments in Mesa core - changes to conditions for framebuffer completenss - implement set/get functions for framebuffers for new functions in GL_ARB_framebuffer_no_attachments Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Kevin Rogovin <[email protected]>
* mesa: Constants and functions for ARB_framebuffer_no_attachmentsKevin Rogovin2015-06-171-0/+28
| | | | | | | | Define the enumeration constants, function entry points and glGet for the GL_ARB_framebuffer_no_attachments. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Kevin Rogovin <[email protected]>
* mesa: Define infrastructure for ARB_framebuffer_no_attachmentsKevin Rogovin2015-06-171-0/+1
| | | | | | | | | Define the infrastructure for the extension GL_ARB_framebuffer_no_attachments: - extension table - additions to gl_framebuffer Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Kevin Rogovin <[email protected]>
* mesa: Use the profile instead of an extension bit to validate ↵Ian Romanick2015-05-281-3/+10
| | | | | | | | | | | GL_TEXTURE_CUBE_MAP The extension on which this depends will always be enabled in core profile, and the extension bit is about to be removed. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Fredrik Höglund <[email protected]> Cc: "10.6" <[email protected]>
* Revert "mesa: Add ARB_direct_state_access checks in FBO functions"Ian Romanick2015-05-281-67/+0
| | | | | | | This reverts commit 6ad0b7e07a0445e9e0f368e079c4f7b8a6757bb3. Acked-by: Fredrik Höglund <[email protected]> Cc: "10.6" <[email protected]>
* Revert "mesa: Add ARB_direct_state_access checks in renderbuffer functions"Ian Romanick2015-05-281-21/+0
| | | | | | | This reverts commit cb49940766b581c6656473d89c221653c69fa0f9. Acked-by: Fredrik Höglund <[email protected]> Cc: "10.6" <[email protected]>
* mesa: Check the lookup_framebuffer return value in NamedFramebufferRenderbufferFredrik Höglund2015-05-161-0/+2
| | | | | | | Found by Coverity. Reported-by: Ilia Mirkin <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* mesa: Add ARB_direct_state_access checks in renderbuffer functionsFredrik Höglund2015-05-141-0/+21
| | | | | Signed-off-by: Fredrik Höglund <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
* mesa: Add ARB_direct_state_access checks in FBO functionsFredrik Höglund2015-05-141-0/+67
| | | | | Signed-off-by: Fredrik Höglund <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
* mesa: Make GL_TEXTURE_CUBE_MAP valid in FramebufferTextureLayerFredrik Höglund2015-05-141-5/+31
| | | | | Signed-off-by: Fredrik Höglund <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
* main: Add stubs for [Get]NamedFramebufferParameteri[v].Laura Ekstrand2015-05-141-0/+32
| | | | | | | | | | | | | | The ARB_direct_state_access specification says (as of 2015.02.05): "Interactions with OpenGL 4.3 or ARB_framebuffer_no_attachments If neither OpenGL 4.3 nor ARB_framebuffer_no_attachments are supported, ignore the support for NamedFramebufferParameteri and GetNamedFramebufferParameteriv." This commit adds stubs for these entry points. Reviewed-by: Fredrik Höglund <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]>
* main: Add entry points for InvalidateNamedFramebuffer[Sub]Data.Laura Ekstrand2015-05-141-0/+69
| | | | | Reviewed-by: Fredrik Höglund <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]>
* main: Refactor invalidate_framebuffer_storage.Laura Ekstrand2015-05-141-11/+27
| | | | | Reviewed-by: Fredrik Höglund <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]>
* main: Complete error conditions for glInvalidate*Framebuffer.Laura Ekstrand2015-05-141-1/+19
| | | | | | | Signed-off-by: Fredrik Höglund <[email protected]> Reviewed-by: Fredrik Höglund <[email protected]> Reviewed-by: Adam Jackson <[email protected]> Cc: "10.4 10.5" <[email protected]>
* main: Add entry point GetNamedFramebufferAttachmentParameteriv.Laura Ekstrand2015-05-141-41/+83
| | | | | | | | | [Fredrik: - Update one of the error messages to reflect that the framebuffer might not be the bound framebuffer. - Whitespace fixes.] Reviewed-by: Fredrik Höglund <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]>
* main: Add entry point for CheckNamedFramebufferStatus.Laura Ekstrand2015-05-141-15/+64
| | | | | | | | [Fredrik: - Retain the debugging code in CheckFramebufferStatus. - Whitespace fixes.] Reviewed-by: Fredrik Höglund <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]>
* main: Fix indents in former get_texture_for_framebuffer functions.Laura Ekstrand2015-05-141-39/+39
| | | | | Reviewed-by: Fredrik Höglund <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]>
* main: Major refactor of get_texture_for_framebuffer.Laura Ekstrand2015-05-141-225/+265
| | | | | | | | | | | | | | | | | | | | | This splits off the (still) rather large chunk that is get_texture_for_framebuffer into lots of smaller functions specialized to service the wide variety of unique needs of *FramebufferTexture* entry points. The result is much cleaner because, rather than having a pile of branches and confusing conditions (like the boolean layered), the uniqueness is baked into the entry points. The entry points know whether or not they are layered or use a textarget. [Fredrik: - Mention the value of <textarget> in the error message. - Rename check_zoffset to check_layer, and zoffset to layer. The zoffset parameter was renamed to layer in ARB_framebuffer_object. - Make layered a GLboolean since the value is visible to the API. - Remove EXT suffixes in refactored code. - Whitespace fixes.] Reviewed-by: Fredrik Höglund <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]>
* main: Add entry points for glNamedFramebufferTexture[Layer].Laura Ekstrand2015-05-141-0/+64
| | | | | Reviewed-by: Fredrik Höglund <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]>
* main: Fix indentation in get_texture_for_framebuffer.Laura Ekstrand2015-05-141-85/+85
| | | | | Reviewed-by: Fredrik Höglund <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]>
* main: Refactor get_texture_for_framebuffer.Laura Ekstrand2015-05-141-22/+21
| | | | | | | | | | | | This moves a few blocks around so that the control flow is more obvious. If the texture is 0, just return true at the beginning of the function. Likewise, if the texObj is NULL, return true at the beginning of the function as well. [Fredrik: Fix the texObj NULL check] Reviewed-by: Fredrik Höglund <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]>
* main: Split framebuffer_texture.Laura Ekstrand2015-05-141-75/+190
| | | | | | | | | | | | | | | | Split apart utility function framebuffer_texture to better prepare for implementing NamedFramebufferTexture and NamedFramebufferTextureLayer. This should also pave the way for some future cleanup work. [Fredrik: - Mention which limit was exceeded when <layer> is out of range. - Update a comment to reflect that <fb> might not be the bound framebuffer. - Make it clear that the error message in glFramebufferTexture*D refers to the <textarget> parameter. - Remove EXT suffixes.] Reviewed-by: Fredrik Höglund <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]>
* main: Fix an error generated by FramebufferTextureLaura Ekstrand2015-05-141-4/+13
| | | | | | | | | | | | gl*FramebufferTexture should generate GL_INVALID_VALUE when the texture doesn't exist. [Fredrik: Split this change out from the next commit] Signed-off-by: Fredrik Höglund <[email protected]> Reviewed-by: Fredrik Höglund <[email protected]> Reviewed-by: Adam Jackson <[email protected]> Cc: "10.4 10.5" <[email protected]>
* mesa: Generate GL_INVALID_VALUE in framebuffer_texture when layer < 0Fredrik Höglund2015-05-141-0/+12
| | | | | | Signed-off-by: Fredrik Höglund <[email protected]> Reviewed-by: Adam Jackson <[email protected]> Cc: "10.4 10.5" <[email protected]>
* main: Require that the texture exists in framebuffer_textureFredrik Höglund2015-05-141-1/+1
| | | | | | | | Generate GL_INVALID_OPERATION if the texture hasn't been created. Signed-off-by: Fredrik Höglund <[email protected]> Reviewed-by: Adam Jackson <[email protected]> Cc: "10.4 10.5" <[email protected]>
* main: Fix the indentation in framebuffer_textureLaura Ekstrand2015-05-141-1/+2
| | | | | Reviewed-by: Fredrik Höglund <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]>
* main: Add entry point for NamedFramebufferRenderbuffer.Laura Ekstrand2015-05-141-44/+85
| | | | | | | | | | | | [Fredrik: - Remove the DummyRenderbuffer checks now that they are done in _mesa_lookup_renderbuffer_err. - Fix the <renderbuffertarget> name in error messages. - Make the error message in _mesa_framebuffer_renderbuffer reflect that <fb> might not be the bound framebuffer. - Remove EXT suffixes from GL tokens.] Reviewed-by: Fredrik Höglund <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]>
* main: Rename framebuffer renderbuffer software fallback.Laura Ekstrand2015-05-141-3/+4
| | | | | | | | | Rename _mesa_framebuffer_renderbuffer to _mesa_FramebufferRenderbuffer_sw in preparation for adding the ARB_direct_state_access backend function for FramebufferRenderbuffer and NamedFramebufferRenderbuffer to share. Reviewed-by: Fredrik Höglund <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]>