summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
Commit message (Collapse)AuthorAgeFilesLines
* mesa: add DEBUG_INCOMPLETE_TEXTURE, DEBUG_INCOMPLETE_FBO flagsBrian Paul2012-05-114-24/+21
| | | | | | | Instead of having to hack the code to enable these debugging options, set them through the MESA_DEBUG env var. Reviewed-by: Eric Anholt <[email protected]>
* mesa: implement DEBUG_ALWAYS_FLUSH debug optionBrian Paul2012-05-111-0/+12
| | | | | | | | This flag has been around for a while but it wasn't actually used anywhere. Now, setting this flag causes a glFlush() to be issued after each drawing call (including glBegin/End, glDrawElements, glDrawArrays, glDrawPixels, glCopyPixels and glBitmap).
* mesa: define DEBUG_SILENT flag, use in output_if_debug()Brian Paul2012-05-113-12/+13
|
* mesa: clean-up the debug/verbose flag setup codeBrian Paul2012-05-111-26/+46
| | | | Split the verbose and debug flag setup code into separate functions.
* mesa: do FLUSH_VERTICES() in _mesa_flush/finish()Brian Paul2012-05-111-2/+4
| | | | | | | This was being done in the _mesa_Flush/Finish() calls but if there was an internal call to _mesa_flush/finish() the FLUSH_VERTICES() wouldn't happen. Looks like only the intel and radeon drivers made such calls in MakeCurrent().
* mesa: fix/add error check in _mesa_ColorMaterial()Brian Paul2012-05-111-0/+2
| | | | | | | _mesa_material_bitmask() will record a GL error and return 0 if face or mode are illegal. Return early in that case. NOTE: This is a candidate for the 8.0 branch.
* intel: Add extern "C" declarations to headersPaul Berry2012-05-101-0/+7
| | | | | | | | These declarations are necessary to allow C++ code to call C code without causing unresolved symbols (which would make the driver fail to load). Reviewed-by: Chad Versace <[email protected]>
* mesa: remove needless casts in save_EdgeFlag()Brian Paul2012-05-081-1/+1
|
* mesa: minor clean-ups in dlist material codeBrian Paul2012-05-081-7/+15
|
* mesa: fix error strings in dlist codeBrian Paul2012-05-081-4/+4
|
* mesa: add gl_context::NewDriverState and use it for vertex arraysMarek Olšák2012-05-082-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The vbo module recomputes its states if _NEW_ARRAY is set, so it shouldn't use the same flag to notify the driver. Since we've run out of bits in NewState and NewState is for core Mesa anyway, we need to find another way. This patch is the first to start decoupling the state flags meant only for core Mesa and those only for drivers. The idea is to have two flag sets: - gl_context::NewState - used by core Mesa only - gl_context::NewDriverState - used by drivers only (the flags are defined by the driver and opaque to core Mesa) It makes perfect sense to use NewState|=_NEW_ARRAY to notify the vbo module that the user changed vertex arrays, and the vbo module in turn sets a driver-specific flag to notify the driver that it should update its vertex array bindings. The driver decides which bits of NewDriverState should be set and stores them in gl_context::DriverFlags. Then, Core Mesa can do this: ctx->NewDriverState |= ctx->DriverFlags.NewArray; This patch implements this behavior and adapts st/mesa. DriverFlags.NewArray is set to ST_NEW_VERTEX_ARRAYS. Core Mesa only sets NewDriverState. It's the driver's responsibility to read it whenever it wants and reset it to 0. Reviewed-by: Brian Paul <[email protected]>
* mesa: move gl_client_array*[] from vbo_draw_func into gl_contextMarek Olšák2012-05-081-0/+5
| | | | | | | | | | | | | | | | | | In the future we'd like to treat vertex arrays as a state and not as a parameter to the draw function. This is the first step towards that goal. Part of the goal is to avoid array re-validation for every draw call. This commit adds: const struct gl_client_array **gl_context::Array::_DrawArrays. The pointer is changed in: * vbo_draw_method * vbo_rebase_prims - unused by gallium * vbo_split_prims - unused by gallium * st_RasterPos Reviewed-by: Brian Paul <[email protected]>
* fbo: Only reuse depth/stencil attachments if the parameters match.Paul Berry2012-05-071-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the user attaches a texture to one of the depth/stencil attachment points (GL_STENCIL_ATTACHMENT or GL_DEPTH_ATTACHMENT), we check to see if the same texture is also attached to the other attachment point, and if so, we re-use the existing texture attachment. This is necessary to ensure that if the user later queries what is attached to GL_DEPTH_STENCIL_ATTACHMENT, they will not receive an error. If, however, the user attaches buffers to the two different attachment points using different parameters (e.g. a different miplevel), then we can't re-use the existing texture attachment, because it is pointing to the wrong part of the texture. This might occur as a transitory condition if, for example, if the user attached miplevel zero of a texture to GL_STENCIL_ATTACHMENT and GL_DEPTH_ATTACHMENT, rendered to it, and then later attempted to attach miplevel one of the same texture to GL_STENCIL_ATTACHMENT and GL_DEPTH_ATTACHMENT. This patch causes Mesa to check that GL_STENCIL_ATTACHMENT and GL_DEPTH_ATTACHMENT use the same attachment parameters before attempting to share the texture attachment. On i965 Gen6, fixes piglit tests "texturing/depthstencil-render-miplevels 1024 depth_stencil_shared" and "texturing/depthstencil-render-miplevels 1024 stencil_depth_shared". Reviewed-by: Chad Versace <[email protected]>
* mesa: Add primitive restart support to glArrayElementJordan Justen2012-05-051-1/+9
| | | | | | | | | | When primitive restart is enabled, and glArrayElement is called with the restart index value, then call glPrimitiveRestartNV. NOTE: This is a candidate for the 8.0 branch. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Brian Paul<[email protected]>
* mesa: Prevent buffer underrun when handling MESA_GL_EXTENSION_OVERRIDE.Eric Anholt2012-05-041-1/+1
|
* mesa: do more teximage error checking for generic compressed formatsBrian Paul2012-05-041-2/+30
| | | | | | | | | | | | When glTexImage or glCopyTexImage is called with internalFormat being a generic compressed format (like GL_COMPRESSED_RGB) we need to do the same error checks as for specific compressed formats. In particular, check if the texture target is compatible with the format. None of the texture compression formats we support so far work with GL_TEXTURE_1D, for example. See also https://bugs.freedesktop.org/show_bug.cgi?id=49124 NOTE: This is a candidate for the 8.0 branch.
* mesa: add _mesa_shader_debug()Dylan Noblesmith2012-05-022-0/+46
| | | | | | | | | This should be the one entrypoint libglsl needs for GL_ARB_debug_output. v2: added comments. Reviewed-by: Brian Paul <[email protected]>
* mesa: reject immutable textures in glEGLImageTargetTexture2DOES()Dylan Noblesmith2012-04-301-0/+7
| | | | | | | | | | | | | | | | | | GL_ARB_texture_storage says: The commands eglBindTexImage, wglBindTexImageARB, glXBindTexImageEXT or EGLImageTargetTexture2DOES are not permitted on an immutable-format texture. They will generate the following errors: - EGLImageTargetTexture2DOES: INVALID_OPERATION - eglBindTexImage: EGL_BAD_MATCH - wglBindTexImage: ERROR_INVALID_OPERATION - glXBindTexImageEXT: BadMatch Fixing the EGL and GLX cases requires extending the DRI interface, since setTexBuffer2 doesn't currently return any error information. Reviewed-by: Brian Paul <[email protected]>
* mesa: require GL_MAX_SAMPLES >= 4 for GL 3.0Dylan Noblesmith2012-04-291-0/+1
| | | | | | | | | As noted in commit be4e46b21a60cfdc826bf89d1078df54966115b1, this was missing before. NOTE: This is a candidate for the 8.0 branch. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: move gl_array_attrib::NewState to gl_array_object::NewArraysBrian Paul2012-04-206-18/+10
| | | | | | | | The field wasn't actually used before and it's not used now either. But this is a more logical place for it and will hopefully allow doing smarter draw/array validation (per array object) in the future. Reviewed-by: Mathias Fröhlich <[email protected]>
* Revert "mesa: only update _MaxElement when we actually need it"Marek Olšák2012-04-191-3/+1
| | | | | | | This reverts commit 0de5a21470b3bff9b7c8714e5d960d5ed9d01b9c. I was wrong, we use it in the vbo module too. This fixes a performance regression in Nexuiz.
* mesa: move unrefs of array objects earlier in _mesa_free_context_data()Brian Paul2012-04-191-3/+3
| | | | | | | | | | If a non-default array object was bound at context destruction time we'd try to unreference the array object after it was already deleted in _mesa_free_varray_data(). Now do the unref first. Fixes a regression from commit 86f53e6d6bd07e2bc3ffcadeb9a4418fbae06e0b. Reviewed-by: José Fonseca <[email protected]>
* mesa: set _NEW_VARYING_VP_INPUTS flag only if fixed-func VP is enabled & validMarek Olšák2012-04-191-1/+10
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Mathias Fröhlich <[email protected]>
* mesa: add _NEW_VARYING_VP_INPUTS for gl_context::varying_vp_inputsMarek Olšák2012-04-193-6/+8
| | | | | | | | | This is a frequently-updated state and _NEW_ARRAY already causes revalidation of the vbo module. It's kinda counter-productive to recompute arrays in the vbo module if _NEW_ARRAY is set and then set _NEW_ARRAY again. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Mathias Fröhlich <[email protected]>
* mesa,vbo: properly detect when vertex arrays need to be recalculatedMarek Olšák2012-04-193-6/+0
| | | | | | | | | | | | | | | | | | | This moves the RebindArrays flag into the vbo module, consolidates the code, and adds missing vbo_draw_method calls. Also with this change, the vertex arrays are not needlessly recalculated twice. The issue with the old code was: - If recalculate_input_bindings updates vp_varying_inputs, _NEW_ARRAY is set. - _mesa_update_state is called and the vp_varying_inputs change causes regeneration of the fixed-function shaders, which also sets _NEW_PROGRAM. - The occurence of either _NEW_ARRAY or _NEW_PROGRAM sets the recalculate_inputs flag to TRUE again. - The new code sets the flag to FALSE after the second _mesa_update_state, because there can't possibly be any change which would require recalculating the arrays. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Mathias Fröhlich <[email protected]>
* mesa: only update _MaxElement when we actually need itMarek Olšák2012-04-191-1/+3
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Mathias Fröhlich <[email protected]>
* mesa: Use array object constructor.Mathias Fröhlich2012-04-182-2/+3
| | | | | | | | This change uses the array object factory for gl_array_objects. This prevents crashes when deriving from gl_array_object. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Froehlich <[email protected]>
* mesa: add a couple fast-paths to fast_read_rgba_pixels_memcpy()Brian Paul2012-04-171-7/+55
| | | | | | | | | | | | Accelerates a few glReadPixels cases for WebGL. See https://bugs.freedesktop.org/show_bug.cgi?id=48545 v2: Per Jose, use bit twiddling for the swizzle case instead of ubyte arrays (it's about 44% faster). Note: This is a candidate for the 8.0 branch. Reviewed-by: José Fonseca <[email protected]>
* mesa: Remove dead _mesa_sizeof_glsl_type().Eric Anholt2012-04-162-63/+0
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add a helper for generating temporary variables in ir_builder.Eric Anholt2012-04-131-31/+11
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add a helper for ir_builder to make dereferences for assignments.Eric Anholt2012-04-131-49/+17
| | | | | | v2: Fix writemask setup for non-vec4 assignments. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Make a little tracking class for emitting IR lists.Eric Anholt2012-04-131-50/+28
| | | | | | | This lets us significantly shorten p->instructions->push_tail(ir), and will be used in a few more places. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add common swizzles to ir_builder.Eric Anholt2012-04-131-48/+18
| | | | | | | | | | Now we can fold a bunch of our expression setup in ff_fragment_shader into single-line, parseable commits. v2: Make it actually work. I wasn't setting num_components in the mask structure, and not setting up a mask structure is way easier. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Let ir_builder expressions take un-dereferenced variables.Eric Anholt2012-04-131-13/+6
| | | | | | | | | | | Having to explicitly dereference is irritating and bloats the code, when the compiler can detect and do the right thing. v2: Use a little shim class to produce the automatic dereference generation at compile time as opposed to runtime, while also allowing compile-time type checking. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Create an ir_builder helper for hand-generating IR.Eric Anholt2012-04-131-82/+46
| | | | | | | | | | | | | | The C++ constructors with placement new, while functional, are extremely verbose, leading to generation of simple GLSL IR expressions like (a * b + c * d) expanding to many lines of code and using lots of temporary variables. By creating a new ir_builder.h that puts simple generators in our namespace and taking advantage of ralloc_parent(), we can generate much more compact code, at a minor runtime cost. v2: Replace ir_instruction usage with just ir_rvalue. v3: Drop remaining missed as_rvalue() in v2. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: add support for ARB_blend_func_extended (v4)Dave Airlie2012-04-138-6/+149
| | | | | | | | | | | | | | | | | | | | Add implementations of the two API functions, Add a new strings to uint mapping for index bindings Add the blending mode validation for SRC1 + SRC_ALPHA_SATURATE Add get for MAX_DUAL_SOURCE_DRAW_BUFFERS v2: Add check in valid_to_render to address case in spec ERRORS. v3: Add index to ir.h so this patch compiles on its own fixup comment v4: fixup Brian's comments The GLSL patch will setup the indices. Signed-off-by: Dave Airlie <[email protected]>
* mesa: fix truncated value warningDylan Noblesmith2012-04-131-1/+1
| | | | | | | | | | | | Silences a clang warning: format_pack.c:2546:30: warning: implicit conversion from 'int' to 'GLubyte' (aka 'unsigned char') changes value from 65535 to 255 [-Wconstant-conversion] d[i] = d[i] ? 0xffff : 0x0; ~ ^~~~~~ Reviewed-by: Brian Paul <[email protected]>
* mesa: don't cast away constDylan Noblesmith2012-04-131-1/+1
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: add _mesa_total_texture_memory() debug functionBrian Paul2012-04-112-0/+62
| | | | | This function can be called in gdb to find out how much memory is used by all texture objects.
* mesa: new _mesa_total_buffer_object_memory() debug functionBrian Paul2012-04-112-0/+32
| | | | | This function can be called in gdb to find out how much memory is used by buffer objects.
* main: Fix memory leak in _mesa_make_extension_string()Chad Versace2012-04-091-0/+2
| | | | | | | | | I forgot to free the string returned by strdup(). Note: This is a candidate for the stable branches. CC: Johannes Obermayr <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* mesa: Add support for the GL 3.1 R/RG formats in texture buffer objects.Eric Anholt2012-04-091-0/+54
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Track a gl_format for the texture buffer format.Eric Anholt2012-04-093-168/+76
| | | | | | | | | | | There was a function full of unused mappings from the GLenum to datatype/comps, but that wasn't all the information a driver would want, which includes the other fields that a gl_format has. Given that all the texture buffer formats were represented in gl_format, just use that as our description. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Handle updating texture state for buffer textures.Eric Anholt2012-04-092-0/+12
| | | | | | | | | We have to skip some work that wants to look at texture images, since buffer textures don't have any of that complexity. Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Create the default (name==0) buffer texture.Eric Anholt2012-04-091-0/+5
| | | | | | | | All that should be needed is that it exists. Fixes segfaults on first _mesa_update_context() with a samplerBuffer-using shader active but without a particular buffer texture enabled. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Set the correct initial value of the texture buffer object format.Eric Anholt2012-04-091-0/+1
| | | | | | | Fixes piglit GL_ARB_texture_buffer_object/get Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Set up glTexBuffer{,ARB} for display list compile.Eric Anholt2012-04-091-0/+3
| | | | | | | | We're supposed to just immediately call it. Fixes piglit GL_ARB_texture_buffer_object/dlist Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glapi: regen for TBO change.Eric Anholt2012-04-092-2890/+2872
|
* ff_fragment_shader: Remove some dead fields.Eric Anholt2012-04-091-11/+0
| | | | Reviewed-by: Brian Paul <[email protected]>
* Add support for GL_EXT_unpack_subimage on GLES2Neil Roberts2012-03-272-5/+22
| | | | | | This extension just permits GL_UNPACK_ROW_LENGTH, GL_UNPACK_SKIP_ROWS and GL_UNPACK_SKIP_PIXELS to be passed to glPixelStore on GLES2 so it is trivial to implement.