summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/common/meta.h
Commit message (Collapse)AuthorAgeFilesLines
* meta: Export _mesa_meta_drawbuffers_from_bitfield()Kristian Høgsberg2014-08-151-0/+3
| | | | | | | We'll use this in the i965 fast clear implementation. Signed-off-by: Kristian Høgsberg <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* mesa/meta: Support decompressing floating-point formatsNeil Roberts2014-08-121-2/+12
| | | | | | | | | | | | | Previously the Meta implementation of glGetTexImage would fall back to _mesa_get_teximage if the texturing is not using an unsigned normalised format. However in order to support the half-float formats of BPTC textures we can make it render to a floating-point renderbuffer instead. This patch makes decompression_state have two FBOs, one for the GL_RGBA format and one for GL_RGBA32F. If a floating-point texture is encountered it will try setting up a floating-point FBO. It will now also check the status of the FBO and fall back to _mesa_get_teximage if the FBO is not complete. Reviewed-by: Ian Romanick <[email protected]>
* mesa/meta: Add a partial implementation of CopyImageSubDataJason Ekstrand2014-08-111-0/+8
| | | | | | | | | | | | | | | | This provides an implementation of CopyImageSubData that works if both textures are uncompressed. This implementation works by using a combination of texture views and BlitFramebuffer. If one of the textures is compressed, it returns false and the driver is expected to provide a fallback. v2: Don't leak fbo's Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Neil Roberts <[email protected]> v3: Change glGen/DeleteTextures to _mesa_Gen/DeleteTextures
* mesa/meta: Make _mesa_meta_bind_fbo_image also take a framebuffer targetJason Ekstrand2014-08-111-1/+1
| | | | | | Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Neil Roberts <[email protected]>
* meta: Add a meta implementation of GL_ARB_clear_textureNeil Roberts2014-07-231-0/+7
| | | | | | | | | | | | | | | | | | | | Adds an implementation of the ClearTexSubImage driver entry point that tries to set up an FBO to render to the texture and then calls glClearBuffer with a scissor to perform the actual clear. If an FBO can't be created for the texture then it will fall back to using _mesa_store_ClearTexSubImage. When used in combination with _mesa_store_ClearTexSubImage this should provide an implementation that works for all DRI-based drivers. However as this has only been tested with the i965 driver it is currently only enabled there. v2: Only enable the extension for the i965 driver instead of all DRI drivers. Remove an unnecessary goto. Don't require GL_ARB_framebuffer_object. Add some more comments. v3: Use glClearBuffer* to avoid having to modify glClearColor and friends. Handle sRGB textures. Explicitly disable dithering. Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
* meta: Add a state flag for the GL_DITHERNeil Roberts2014-07-231-0/+4
| | | | | | | | | The Meta implementation of glClearTexSubImage is going to want to ensure that dithering is disabled so that it can get a consistent color across the whole texture when clearing. This adds a state flag to easily save it and set it to the default value when performing meta operations. Reviewed-by: Topi Pohjolainen <[email protected]>
* meta/blit: Add stencil texturing mode save and restoreTopi Pohjolainen2014-05-271-2/+2
| | | | | | | | v2 (Ken): Only restore the mode if it has changed. Signed-off-by: Topi Pohjolainen <[email protected]> Cc: "10.2" <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* meta: Split _swrast_BlitFramebuffer out of the meta blit path.Kenneth Graunke2014-05-191-1/+9
| | | | | | | | | | | | | | | | | | Separating the software fallbacks from the rest of the meta path (which is usually hardware accelerated) gives callers better control over their blitting options. For example, i965 might want to try meta blit, hardware blits, then swrast as a last resort. Splitting it makes that possible. This updates all callers to maintain the existing behavior (even in the few cases where it isn't desirable behavior - later patches can change that). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Chris Forbes <[email protected]> Cc: "10.2" <[email protected]>
* meta: Refactor state save/restore for framebuffer texture blitsTopi Pohjolainen2014-05-131-0/+15
| | | | | Signed-off-by: Topi Pohjolainen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* meta: Refactor configuration of renderbuffer samplingTopi Pohjolainen2014-05-121-0/+5
| | | | | | Cc: "10.2" <[email protected]> Signed-off-by: Topi Pohjolainen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* meta: Refactor binding of renderbuffer as texture imageTopi Pohjolainen2014-05-121-0/+7
| | | | | | Cc: "10.2" <[email protected]> Signed-off-by: Topi Pohjolainen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* meta: Merge compiling and linking of blit programTopi Pohjolainen2014-05-121-0/+7
| | | | | | Cc: "10.2" <[email protected]> Signed-off-by: Topi Pohjolainen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* meta: Add infrastructure for saving/restoring the DrawBuffers state.Kenneth Graunke2014-05-061-0/+3
| | | | | | | | | | Sometimes we need to configure what draw buffers we render to, without creating a new FBO. This path will make that possible. Cc: "10.2" <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta: Add a new MESA_META_DRAW_BUFFERS bit.Kenneth Graunke2014-05-061-0/+1
| | | | | | | | | | | This will be used for saving/restoring the glDrawBuffers state. For now, make sure that existing users of MESA_META_ALL don't get the new bit, since they probably won't want it. Cc: "10.2" <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta: Fix saving the program pipeline stateIan Romanick2014-05-021-1/+0
| | | | | | | | | | | | | | | | | | This code was broken in some odd ways before. Too much state was being saved, it was being restored in the wrong order, and in the wrong way. The biggest problem was that the pipeline object was restored before restoring the programs attached to the default pipeline. Fixes a regression in the glean texgen test. v3: Fairly significant re-write. I think it's much cleaner now, and it avoids a bug with some meta ops that use shaders (reported by Chia-I). v4: Check Pipeline.Current against NULL instead of Pipeline.Default. Suggested by Chia-I. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Chia-I Wu <[email protected]>
* meta: Add support for MSAA resolves from 2D_MS_ARRAY textures.Eric Anholt2014-04-151-0/+8
| | | | | | | | | We don't have any piglit tests for this currently. v2: Use vec3s for the texcoords so it has some hope of working. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* meta: Add an accelerated glCopyTexSubImage using glBlitFramebuffer.Eric Anholt2014-04-151-1/+3
| | | | | | | | | | | | | | | You'll note from the previous commits that there's something of a loop here: You call CTSI, which calls BlitFB, then if things go wrong that falls back to CTSI. As a result, meta CTSI reaches over into blitfb to tell it "no, don't try that fallback". v2: Drop the _mesa_update_state(), which was only necessary due to use of _mesa_clip_blit() in _mesa_meta_BlitFramebuffer() in another patch series. v3: Drop an _EXT suffix I copy-and-pasted. Reviewed-by: Ian Romanick <[email protected]> (v2) Reviewed-by: Kenneth Graunke <[email protected]>
* meta: Infer bind_fbo_image parameters from an incoming image.Eric Anholt2014-04-151-2/+1
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* meta: Move bind_fbo_image() code back to meta.c, to reuse it elsewhere.Eric Anholt2014-04-151-0/+4
| | | | | | | | | I need to do the same code again for CopyTexSubImage(). v2: Drop incorrect, not-terribly-useful comment (review by Ken) Reviewed-by: Ian Romanick <[email protected]> (v1) Reviewed-by: Kenneth Graunke <[email protected]>
* meta: Refactor the BlitFramebuffer depth CopyTexImage fallback.Eric Anholt2014-04-151-1/+0
| | | | | | | | | This avoids a ReadPixels() if there's accelerated CopyTexImage present. It now requires GLSL as opposed to just fragment programs, but we don't have any drivers that do ARB_fp but not GLSL. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* meta/sso: Update meta to save and restore SSO state.Gregory Hainaut2014-03-251-0/+2
| | | | | | | | | | | | | | | save and restore _Shader/Pipeline binding point. Rational we don't want any conflict when the program will be unattached. V2: formatting improvement V3 (idr): * Build fix. The original patch added calls to _mesa_use_shader_program with 4 parameters, but the fourth parameter isn't added to that function until a much later patch. Just drop that parameter for now. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta: Always restore the framebuffers and current renderbuffer.Eric Anholt2014-03-111-0/+2
| | | | | | | | The few paths that were playing with framebuffers and renderbuffer were saving and restoring them. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* meta: Make _mesa_meta_check_generate_mipmap_fallback static.Kenneth Graunke2014-03-071-4/+0
| | | | | | | | | | This was only ever used in one place; there's no reason for it to be non-static. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* meta: Split GenerateMipmap() into its own file.Kenneth Graunke2014-03-071-0/+3
| | | | | | | | | | Putting the implementation of each GL function in its own file makes it much easier not to get lost. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* meta: De-static setup_texture_coords().Kenneth Graunke2014-03-071-0/+11
| | | | | | | | | This will be used in multiple files soon. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* meta: Add support for integer blits.Eric Anholt2014-02-211-0/+10
| | | | | | | | Compared to i965, the code generated doesn't use the AVG instruction. But I'm not sure that multisampled integer resolves are really that important to worry about. Reviewed-by: Kenneth Graunke <[email protected]>
* meta: Add support for doing MSAA to MSAA blits.Eric Anholt2014-02-211-2/+4
| | | | | | | These are non-stretched, non-resolving blits, so it's just a matter of sampling once from our gl_SampleID and storing that to our color/depth. Reviewed-by: Kenneth Graunke <[email protected]>
* meta: Save and restore a bunch of MSAA state.Eric Anholt2014-02-211-1/+1
| | | | | | | | | | We're disabling GL_MULTISAMPLE, so we didn't need to worry about a lot of that state. But to do MSAA to MSAA blits, we need to start handling more state. v2: Fix pasteo caught by Kenneth. Reviewed-by: Kenneth Graunke <[email protected]>
* meta: Add support for doing multisample resolves.Eric Anholt2014-02-211-0/+7
| | | | | | | | | Note that this doesn't handle GL_EXT_multisample_scaled_blit yet. The i965 code for that extension bakes in knowledge of the sample positions (well, knowledge of the sample positions aligned to a lower-resolution grid), which we would have to do at runtime somehow for meta. Reviewed-by: Kenneth Graunke <[email protected]>
* meta: Push into desktop GL mode when doing meta operations.Eric Anholt2014-02-181-0/+3
| | | | | | | | This lets us simplify our shaders, and rely on GLES-prohibited functionality (like ARB_texture_multisample) when writing these driver-internal functions. Reviewed-by: Kenneth Graunke <[email protected]>
* meta: De-static some of meta's functions.Eric Anholt2014-02-121-0/+56
| | | | | | | | | | | I want split some meta.c code off to a separate file, so these functions can't be static any more. v2: Rebase on idr's changes, also expose setup_blit_shader, blit_shader_table_cleanup, setup_vertex_objects, setup_ff_tnl_for_blit. Reviewed-by: Kenneth Graunke <[email protected]> (v1)
* meta: Move the meta structures to the meta header.Eric Anholt2014-02-121-0/+283
| | | | | | | | | I'd like to split some of our code to separate files, since 4k lines and growing is pretty unreasonable for all these separate operations. v2: Rebase on idr's changes. Reviewed-by: Kenneth Graunke <[email protected]> (v1)
* mesa: Hide weirdness of 1D_ARRAY textures from Driver.CopyTexSubImage().Eric Anholt2013-06-171-1/+1
| | | | | | | | | | | | | | | | | Intel had brokenness here, and I'd like to continue moving Mesa toward hiding 1D_ARRAY's ridiculousness inside of the core, like we did with MapTextureImage. Fixes copyteximage 1D_ARRAY on intel. There's still an impedance mismatch in meta when falling back to read and texsubimage, since texsubimage expects coordinates into 1D_ARRAY as (width, slice, 0) instead of (width, 0, slice). v2: Fix offset of scanline reads from the source. (Thanks Brian!), replace dd.h comment with Paul's text and replace early exit with an assert. Reviewed-by: Brian Paul <[email protected]> (v1) Reviewed-by: Kenneth Graunke <[email protected]> (v1) Reviewed-by: Paul Berry <[email protected]> (v1)
* mesa: remove outdated version lines in commentsRico Schüller2013-06-051-1/+0
| | | | Signed-off-by: Brian Paul <[email protected]>
* mesa: Restore 78-column wrapping of license text in C-style comments.Kenneth Graunke2013-04-231-3/+4
| | | | | | | | | | | | | | The previous commit introduced extra words, breaking the formatting. This text transformation was done automatically via the following shell command: $ git grep 'THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY' | sed 's/:.*$//' | xargs -I {} sh -c 'vim -e -s {} < vimscript where 'vimscript' is a file containing: /THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY/;/\*\// !fmt -w 78 -p ' * ' :wq Reviewed-by: Brian Paul <[email protected]>
* mesa: Add "OR COPYRIGHT HOLDERS" to license text disclaiming liability.Kenneth Graunke2013-04-231-1/+1
| | | | | | | | | | | | | | | This brings the license text in line with the MIT License as published on the Open Source Initiative website: http://opensource.org/licenses/mit-license.php Generated automatically be the following shell command: $ git grep 'THE AUTHORS BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \ sed -i 's/THE AUTHORS/THE AUTHORS OR COPYRIGHT HOLDERS/' {} This introduces some wrapping issues, to be fixed in the next commit. Reviewed-by: Brian Paul <[email protected]>
* mesa: Change "BRIAN PAUL" to "THE AUTHORS" in license text.Kenneth Graunke2013-04-231-1/+1
| | | | | | | | | | | | | | | | Generated automatically be the following shell command: $ git grep 'BRIAN PAUL BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \ sed -i 's/BRIAN PAUL/THE AUTHORS/' {} The intention here is to protect all authors, not just Brian Paul. I believe that was already the sensible interpretation, but spelling it out is probably better. More practically, it also prevents people from accidentally copy & pasting the license into a new file which says Brian is not liable when he isn't even one of the authors. Reviewed-by: Brian Paul <[email protected]>
* meta: Allow meta operations to pause/resume an active occlusion queryCarl Worth2013-01-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This allows for avoiding the occlusion query erroneously accumulating results during the meta operation. This functionality is made conditional on a new MESA_META_OCCLUSION_QUERY bit so that meta-operations which should generate fragments can continue to get the current behavior. The implementation of glClear is specifically augmented to request the flag since glClear is specified to not generate fragments. This fixes the following es3conform tests: occlusion_query_draw_occluded.test occlusion_query_clear occlusion_query_custom_framebuffer occlusion_query_stencil_test occlusion_query_discarded_fragments As well as the following piglit test: occlusion_query_meta_no_fragments Reviewed-by: Ian Romanick <[email protected]>
* meta: Properly save/restore GL_FRAMEBUFFER_SRGB in Meta.Paul Berry2012-09-251-0/+1
| | | | | | | | | | | | | | | | | | | Previously, meta logic was saving and restoring the value of GL_FRAMEBUFFER_SRGB in an ad-hoc fashion. As a result, it was not properly disabled and/or restored for some meta operations. This patch causes GL_FRAMEBUFFER_SRGB to be saved/restored in the conventional way of meta-ops (using _mesa_meta_begin() and _mesa_meta_end()). It is now reliably saved/restored for _mesa_meta_BlitFramebuffer, _mesa_meta_GenerateMipmap, and decompress_texture_image, and preserved for all other meta ops. Fixes piglit tests "ARB_framebuffer_sRGB/blit renderbuffer {linear_to_srgb,srgb} scaled {disabled,enabled}". Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* meta: make mem_ctx non-global.Dave Airlie2012-09-151-2/+0
| | | | | | | I can't see any external users, and this is a global symbol, Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* _mesa_meta_GenerateMipmap: Support all texture targets by generating shaders ↵Anuj Phogat2012-09-141-0/+2
| | | | | | | | | | | | | | | | | | at runtime glsl path of _mesa_meta_GenerateMipmap() function would require different fragment shaders depending on the texture target. This patch adds the code to generate appropriate fragment shader programs at run time. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=54296 V2: Removed the code for integer textures as ARB is planning to disallow automatic mipmap generation for integer textures. Now using ralloc_asprintf in setup_glsl_generate_mipmap(). NOTE: This is a candidate for stable branches. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* msaa: Make meta-ops save and restore state of GL_MULTISAMPLE.Paul Berry2012-07-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | The meta-ops _mesa_meta_Clear() and _mesa_meta_glsl_Clear() need to ignore the state of GL_SAMPLE_ALPHA_TO_COVERAGE, GL_SAMPLE_ALPHA_TO_ONE, GL_SAMPLE_COVERAGE, GL_SAMPLE_COVERAGE_VALUE, and GL_SAMPLE_COVERAGE_INVERT when clearing multisampled buffers. The easiest way to accomplish this is to disable GL_MULTISAMPLE during the clear meta-ops. Note: this patch also causes GL_MULTISAMPLE to be disabled during _mesa_meta_GenerateMipmap() and _mesa_meta_GetTexImage() (since those two meta-ops use MESA_META_ALL). Arguably this isn't strictly necessary, since those meta-ops use their own non-MSAA fbo's, but it shouldn't do any harm. Fixes Piglit tests "EXT_framebuffer_multisample/clear {2,4} {color,stencil}" on i965. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* mesa: consolidate internal glCopyTexSubImage1/2/3D codeBrian Paul2012-06-061-21/+6
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: rework ctx->Driver.CopyTexSubImage() parametersBrian Paul2012-01-071-3/+9
| | | | | | | | | | | Replace target, level parameters with gl_texture_image. Add gl_renderbuffer parameter to indicate source buffer for the copy. This removes some redundant code in the drivers to find the source renderbuffer and the destination texture image (which we already had in _mesa_CopyTexSubImage). Signed-off-by: Brian Paul <[email protected]>
* mesa: Add a function to query whether a meta-op is in progress.Paul Berry2011-12-201-0/+3
| | | | | | | This is needed by i965 to ensure that transform feedback counters are not incremented during meta-ops. Reviewed-by: Kenneth Graunke <[email protected]>
* meta: add _mesa_meta_DrawTex()Chia-I Wu2011-10-301-0/+3
| | | | | | | | It is set to dd->DrawTex. Reviewed-by: Brian Paul <[email protected]> [olv: set dd->DrawTex in _mesa_init_driver_functions]
* meta: Add flag MESA_META_SELECT_FEEDBACKChad Versace2011-10-181-0/+1
| | | | | | | | | | | If this flag is set, then _mesa_meta_begin/end will save/restore the state of GL_SELECT and GL_FEEDBACK render modes. Intel's future buffer resolve meta-ops will require this, since buffer resolves may occur when the GL_RENDER_MODE is GL_SELECT. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* mesa: simplify parameters to GetTexImage() driver hookBrian Paul2011-09-301-2/+1
| | | | | | | The target, level and texObj can be obtained through the texImage parameter. We could make similar changes for the TexImage() hooks too. Reviewed-by: Eric Anholt <[email protected]>
* mesa: Add missing includes to meta.hChad Versace2011-09-231-0/+2
| | | | | | Include mtypes.h. Signed-off-by: Chad Versace <[email protected]>
* meta: added _mesa_meta_GetTexImage()Brian Paul2011-09-081-0/+7
| | | | | If the texture is compressed, call the meta decompress_texture_image() function. Otherwise, call the core _mesa_get_teximage() function.