aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/common/meta.c
Commit message (Collapse)AuthorAgeFilesLines
* meta: Merge compiling and linking of blit programTopi Pohjolainen2014-05-121-16/+29
| | | | | | Cc: "10.2" <[email protected]> Signed-off-by: Topi Pohjolainen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* meta: Only clear the requested color buffers.Kenneth Graunke2014-05-061-2/+49
| | | | | | | | | | | | | | | | | | | | | This path is used to implement both glClear and glClearBuffer; the latter is only supposed to clear particular buffers. Core Mesa provides us that information in the buffers bitmask; we must only clear buffers mentioned there. To accomplish this, we save/restore the color draw buffers state, and use glDrawBuffers to restrict drawing to the relevant buffers. Fixes Piglit's spec/!OpenGL 3.0/clearbuffer-mixed-formats and spec/ARB_framebuffer_object/fbo-drawbuffers-none glClearBuffer tests for drivers using meta clears (such as Broadwell). Cc: "10.2" <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77852 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77856 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta: Add infrastructure for saving/restoring the DrawBuffers state.Kenneth Graunke2014-05-061-0/+39
| | | | | | | | | | 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-2/+3
| | | | | | | | | | | 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: Unify the GLSL and fixed-function clear paths.Kenneth Graunke2014-05-061-102/+51
| | | | | | | | | | | | | The majority of _mesa_meta_Clear and _mesa_meta_glsl_Clear was the same; adding a boolean for whether to use GLSL allows us to share most of it without polluting either path too much. Tested for regressions by hacking i965 to always use the non-GLSL path. Cc: "10.2" <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa/sso: Enable GL_ARB_separate_shader_objects by defaultIan Romanick2014-05-021-6/+4
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta: Fix saving the program pipeline stateIan Romanick2014-05-021-33/+53
| | | | | | | | | | | | | | | | | | 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]>
* mesa: Replace use of _ReallyEnabled as a boolean with use of _Current.Eric Anholt2014-04-301-1/+1
| | | | | | | | | | | | | I'm probably not the only person that has tried to kill _ReallyEnabled. This does the mechanical part of the work, and cleans _ReallyEnabled from i965. I think that using _Current makes texture management clearer: You can't have multiple targets in use in the same texture image unit at the same time, because there's just that one pointer. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Drop _EnabledUnits.Eric Anholt2014-04-301-1/+1
| | | | | | | | | | | The field wasn't really valid, since we've got more than 32 units now. It turns out it was mostly just used for checking != 0, or checking for fixed function coordinates, though. v2: Fix mis-conversion in xm_line.c (caught by Ken). Reviewed-by: Matt Turner <[email protected]> (v1) Reviewed-by: Kenneth Graunke <[email protected]>
* meta: Clip src/dest rects in BlitFramebuffer, using the scissorChris Forbes2014-04-171-0/+7
| | | | | | | | | | | | | | | | | Fixes piglit's fbo-blit-stretch test on drivers which use the meta path. (i965: should fix Broadwell, but also fixes Sandybridge/Ivybridge/Haswell since this test falls off the blorp path now due to format conversion) V2: Use scissor instead of just mangling the rects, to avoid texcoord rounding problems. (Thanks Marek) V3: Rebase on Eric's CTSI meta changes; re-add _mesa_update_state in the CTSI path so that _mesa_clip_blit sees the correct bounds. Signed-off-by: Chris Forbes <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77414 Reviewed-by: Anuj Phogat <[email protected]> Tested-by: Anuj Phogat <[email protected]>
* meta: Add an accelerated glCopyTexSubImage using glBlitFramebuffer.Eric Anholt2014-04-151-9/+86
| | | | | | | | | | | | | | | 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: Add support for CUBE_MAP_ARRAY to generatemipmap.Eric Anholt2014-04-151-0/+4
| | | | | | | | | | I added support to bind_fbo_image in the process of building meta CopyTexSubImage, and found that it broke generatemipmap because previously we would just throw a GL error there and then end up with an incomplete FBO and fallback. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* meta: Infer bind_fbo_image parameters from an incoming image.Eric Anholt2014-04-151-2/+8
| | | | | 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/+30
| | | | | | | | | 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]>
* mesa/sso: Add gl_pipeline_object parameter to _mesa_use_shader_programGregory Hainaut2014-03-251-3/+6
| | | | | | | | | | | | | Extend use_shader_program to support a different target. Allow to reuse the function to update the pipeline state. Note I bypass the flush when target isn't current. Maybe it would be better to create a new UseProgramStages driver function This was originally included in another patch, but it was split out by Ian Romanick. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta/sso: Update meta to save and restore SSO state.Gregory Hainaut2014-03-251-0/+18
| | | | | | | | | | | | | | | 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]>
* mesa/sso: rename Shader to the pointer _ShaderGregory Hainaut2014-03-251-3/+3
| | | | | | | | | | | | | | | | Basically a sed but shaderapi.c and get.c. get.c => GL_CURRENT_PROGAM always refer to the "old" UseProgram behavior shaderapi.c => the old api stil update the Shader object directly V2: formatting improvement V3 (idr): * Rebase fixes after a block of code was moved from ir_to_mesa.cpp to shaderapi.c. * Trivial reformatting. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta: Always restore the framebuffers and current renderbuffer.Eric Anholt2014-03-111-18/+15
| | | | | | | | 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: use non-ARB shader/program create/delete functionsBrian Paul2014-03-101-27/+27
| | | | | | | The non-ARB versions take GLuint ids, not GLhandleARB. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* meta: Split GenerateMipmap() into its own file.Kenneth Graunke2014-03-071-337/+1
| | | | | | | | | | 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-23/+23
| | | | | | | | | 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: Drop ctx->API checks.Kenneth Graunke2014-02-271-90/+49
| | | | | | | | | | | | | API is always API_OPENGL_COMPAT (since commit 4e4a537ad55f61a25, "meta: Push into desktop GL mode when doing meta operations."), so most of these checks do nothing. We could instead check save->API to only bother setting/restoring relevant GL state, but I'm not sure saving a few _mesa_set_enable calls is worth the complexity. My understanding is the point of the ctx->API guards was to avoid raising GL errors. Signed-off-by: Kenneth Graunke <[email protected]>
* meta: Restore API at the end of _mesa_meta_end(), not the start.Kenneth Graunke2014-02-271-2/+2
| | | | | | | | | | | In _mesa_meta_begin(), we switch to API_OPENGL_COMPAT, then munge a lot of state (including some that doesn't exist in the actual API - like PolygonStipple in API_OPENGL_CORE). It seems reasonable that in _mesa_meta_end(), we should restore it, then switch back to the original API. This at least makes it symmetric. Signed-off-by: Kenneth Graunke <[email protected]>
* meta: Set some object labels on our meta shaders.Eric Anholt2014-02-221-0/+6
| | | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* meta: Save and restore a bunch of MSAA state.Eric Anholt2014-02-211-3/+37
| | | | | | | | | | 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: Push into desktop GL mode when doing meta operations.Eric Anholt2014-02-181-23/+16
| | | | | | | | 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: Fix blit shader compile on non-glsl-130 drivers.Eric Anholt2014-02-181-1/+1
| | | | | | | | | | Compare this VS to the one for the post-130 case. Fixes piglit glsl-lod-bias, and presumably tons of other code (I haven't done a full piglit run on swrast). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74911 Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* meta: Move glBlitFramebuffer() to a separate file.Eric Anholt2014-02-121-420/+0
| | | | | | | v2: Drop a bunch of unnecessary includes (by Kenneth), rebase on idr's changes. Reviewed-by: Kenneth Graunke <[email protected]> (v1)
* meta: De-static some of meta's functions.Eric Anholt2014-02-121-96/+103
| | | | | | | | | | | 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-283/+0
| | | | | | | | | 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)
* meta: Fold the texture setup into setup_copypix_texture().Eric Anholt2014-02-121-11/+9
| | | | | | | | | There was this funny argument passed to setup for "did alloc decide we need to allocate new texture storage?", which goes away if we don't have the caller do alloc as a separate step. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* meta: Drop the src == dst restriction on meta glBlitFramebuffer().Eric Anholt2014-02-121-20/+0
| | | | | | | | | | | | | | From the GL_ARB_fbo spec: If the source and destination buffers are identical, and the source and destination rectangles overlap, the result of the blit operation is undefined. As far as I know, that's the only thing that would have been of concern for this. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* meta: Rename the "sampler" stuff to "blit shader".Eric Anholt2014-02-121-41/+40
| | | | | | | | | While these structs are generated per GLSL sampler type, they're structs of data-about-shaders (notably, the ID of a shader program), not data-about-samplers. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* meta: Drop a now-trivial helper function.Eric Anholt2014-02-121-12/+3
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* meta: Fold the glUseProgram() into the blit program generator.Eric Anholt2014-02-121-22/+8
| | | | | | | | Everyone was just immediately calling it and doing nothing else with the shader program id. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* meta: Simplify the blit shader setup steps.Eric Anholt2014-02-121-22/+11
| | | | | | | | The only thing that wants to track the glsl_sampler structure is the shader string generator. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* meta: Enable cubemap array texture support to decompress_texture_imageIan Romanick2014-02-111-7/+8
| | | | | | | | Fixed piglit test getteximage-targets S3TC CUBE_ARRAY on systems that don't have libtxc_dxtn installed. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta: Add cubemap array support to generic blit shader codeIan Romanick2014-02-111-0/+12
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta: Get the correct info logIan Romanick2014-02-111-1/+1
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta: Expand texture coordinate from vec3 to vec4Ian Romanick2014-02-111-8/+8
| | | | | | | | This will be necessary to support cubemap array textures because they use all four components. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta: Use GLSL to decompress 2D-array texturesIan Romanick2014-02-111-5/+30
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72582 Reviewed-by: Eric Anholt <[email protected]>
* meta: Use common GLSL code for blitsIan Romanick2014-02-111-95/+13
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta: Improve GLSL version checkIan Romanick2014-02-111-1/+6
| | | | | | | We want to use the GLSL 1.30-ish path for OpenGL ES 3.0. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta: Add rectangle textures to the shader-per-sampler-type tableIan Romanick2014-02-111-0/+8
| | | | | | | | | | Rectangle textures were not necessary for mipmap generation (because they cannot have mipmaps), but all of the future users of this common code will need to support rectangle textures. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta: Refactor shader generation code out of mipmap generation pathIan Romanick2014-02-111-78/+91
| | | | | | | | | This is quite like code we want for blits. Pull it out so that it can be shared by other paths. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta: Refactor the table of glsl_sampler structuresIan Romanick2014-02-111-56/+72
| | | | | | | | | | | | | This will allow the same table of shader-per-sampler-type to be used for paths in meta other than just mipmap generation. This is also the reason the declarations of the structures was moved towards the top of the file. v2: Code formatting change suggested by Brian. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta: Use common vertex setup code for _mesa_meta_Bitmap tooIan Romanick2014-02-111-36/+12
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta: Add storage to the vertex structure for R, G, B, and AIan Romanick2014-02-111-9/+6
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* meta: Use common routine to configure fixed-function TNL stateIan Romanick2014-02-111-23/+8
| | | | | | | | | | | | | Also... glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0) *is* the identity matrix, so drop the unnecessary call to _mesa_Ortho. v2: Rename setup_ff_TNL_for_blit() to setup_ff_tnl_for_blit(). Seems silly to capitalize one out of two to three acronyms in the name (change by anholt, acked by idr). Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> (v1) Reviewed-by: Eric Anholt <[email protected]>
* meta: Silence unused parameter warning in _mesa_meta_CopyTexSubImageIan Romanick2014-02-111-0/+6
| | | | | | | | | | | drivers/common/meta.c: In function '_mesa_meta_CopyTexSubImage': drivers/common/meta.c:3744:52: warning: unused parameter 'rb' [-Wunused-parameter] Unfortunately, the parameter can't just be removed because it is part of the dd_function_table::CopyTexSubImage interface. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>