summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Use shared code for converting shader targets to short strings.Eric Anholt2013-06-211-5/+2
| | | | | | | | We were duplicating this code all over the place, and they all would need updating for the next set of shader targets. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Remove ir_print_visitor.h includes and usageEric Anholt2013-06-211-3/+2
| | | | | | | | | | | | | We have ir->print() to do the old declaration of a visitor and having the IR accept the visitor (yuck!). And now you can call _mesa_print_ir() safely anywhere that you know what an ir_instruction is. A couple of missing printf("\n")s are added in error paths -- when an expression is handed to the visitor, it doesn't print '\n' (since it might be a step in printing a whole expression tree). Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* gallium: add condition parameter to render_conditionRoland Scheidegger2013-06-181-3/+3
| | | | | | | | | | | | | For conditional rendering this makes it possible to skip rendering if either the predicate is true or false, as supported by d3d10 (in fact previously it was sort of implied skip rendering if predicate is false for occlusion predicate, and true for so_overflow predicate). There's no cap bit for this as presumably all drivers could do it trivially (but this patch does not implement it for the drivers using true hw predicates, nvxx, r600, radeonsi, no change is expected for OpenGL functionality). Reviewed-by: Jose Fonseca <[email protected]>
* mesa: Hide weirdness of 1D_ARRAY textures from Driver.CopyTexSubImage().Eric Anholt2013-06-171-36/+7
| | | | | | | | | | | | | | | | | 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)
* st/mesa: fix temp texture bindings in st_CopyPixels()Chia-I Wu2013-06-141-17/+13
| | | | | | | | The temporary texture should have either PIPE_BIND_RENDER_TARGET or PIPE_BIND_DEPTH_STENCIL set in addition to PIPE_BIND_SAMPLER_VIEW. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: make generic CopyPixels path work with MSAA visualsMarek Olšák2013-06-131-92/+70
| | | | | | | | | | | | | | We have to use pipe->blit, not resource_copy_region, so that the read buffer is resolved if it's multisampled. I also removed the CPU-based copying, which just did format conversion (obsoleted by the blit). Also, the layer/slice/face of the read buffer is taken into account (this was ignored). Last but not least, the format choosing is improved to take float and integer read buffers into account. Reviewed-by: Brian Paul <[email protected]>
* st/mesa: don't use blit_copy_pixels if an occlusion query is activeMarek Olšák2013-06-131-1/+2
| | | | | | | CopyPixels, just as DrawPixels, should count the samples that passed depth test. Reviewed-by: Brian Paul <[email protected]>
* st/mesa: rework blit_copy_pixels to use pipe->blitMarek Olšák2013-06-131-35/+79
| | | | | | | | | | | | | | | There were 2 issues with it: - resource_copy_region doesn't allow different sample counts of both src and dst, which can occur if we blit between a window and a FBO, and the window has an MSAA colorbuffer and the FBO doesn't. (this was the main motivation for using pipe->blit) - blitting from or to a non-zero layer/slice/face was broken, because rtt_face and rtt_slice were ignored. blit_copy_pixels is now used even if the formats and orientation of framebuffers don't match. Reviewed-by: Brian Paul <[email protected]>
* gallium/util: make WRITES_ALL_CBUFS optional in the passthrough fragment shaderMarek Olšák2013-06-132-2/+4
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: fix OES_EGL_image_external being partially allowed in the core profileMarek Olšák2013-06-131-2/+1
| | | | Reviewed-by: Chad Versace <[email protected]>
* glsl: Add a gl_shader_program parameter to ↵Ian Romanick2013-06-121-1/+1
| | | | | | | | | | | | _mesa_uniform_{merge,split}_location_offset This will be used in the next commit. NOTE: This is a candidate for stable release branches. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-and-tested-by: Chad Versace <[email protected]>
* gallium: Remove draw_arrays() and draw_arrays_instanced() functionsArnas Milasevicius2013-06-071-0/+22
| | | | | | | | Moved draw_arrays() to st_draw_feedback.c and removed draw_arrays_instanced(). draw_arrays() was used by nobody else. Now there's just one "draw" entrypoint into the draw module. Signed-off-by: Brian Paul <[email protected]>
* mesa: remove outdated version lines in commentsRico Schüller2013-06-054-4/+0
| | | | Signed-off-by: Brian Paul <[email protected]>
* mesa: change MAX_PROGRAM_ADDRESS_REGS to 1, clamp to it in state trackerBrian Paul2013-06-041-1/+2
| | | | | | | | | | | | | We've never properly supported more than one address register. There isn't even a field in prog_src_register or prog_dst_register to indicate which address register to use if RelAddr!=0. In the state tracker, clamp MaxAddressRegs against MAX_PROGRAM_ADDRESS_REGS since many gallium drivers do support more. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65226 Reviewed-by: Jose Fonseca <[email protected]>
* gallium: Add support for multiple viewportsZack Rusin2013-05-252-2/+2
| | | | | | | | | | | | Gallium supported only a single viewport/scissor combination. This commit changes the interface to allow us to add support for multiple viewports/scissors. Signed-off-by: Zack Rusin <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: José Fonseca<[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* st/mesa: Go back to using ctx->Array.RestartIndex, not _RestartIndex.Kenneth Graunke2013-05-291-1/+1
| | | | | | | | | | | | | The derived _RestartIndex field is an attempt to support both GL_PRIMITIVE_RESTART and GL_PRIMITIVE_RESTART_FIXED_INDEX (part of ES 3.0). Gallium drivers don't appear to support ES 3.0 yet, so they don't need to use it. Plus, it's broken and going to go away soon. NOTE: This is a candidate for the 9.1 branch. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: declare UniformBufferBindings as an array with a static sizeMarek Olšák2013-05-281-5/+2
| | | | | | | | Some Gallium drivers were crashing, because the array was not large enough. v2: clamp the per-shader maximum in st/mesa, then sum them all up NOTE: This is a candidate for the stable branches.
* st/mesa: add switch cases for new IR enums to silence warningsBrian Paul2013-05-241-0/+2
|
* st/mesa: fix weird UCMP opcode use for bool ubo loadRoland Scheidegger2013-05-181-4/+2
| | | | | | | | | | I don't know what this code was trying to do but whatever it was it couldn't have worked since negation of integer boolean inputs while not specified as outright illegal (not yet at least) won't do anything since it doesn't affect the result of comparison with zero at all. In fact it looks like the whole instruction can just be omitted. Reviewed-by: Marek Olšák <[email protected]>
* mesa: Make FinishRenderTexture just take the renderbuffer being finished.Eric Anholt2013-05-171-3/+2
| | | | | | | Now that the rb has a reference to the teximage, we didn't need anything else out of the attachment. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Track the TexImage being rendered to in the gl_renderbuffer.Eric Anholt2013-05-171-5/+1
| | | | | | | | | We keep having to pass the attachments around with our gl_renderbuffers because that's the only way to find what the gl_renderbuffer actually refers to. This is a step toward removing that (though drivers still need the Zoffset as well). Reviewed-by: Kenneth Graunke <[email protected]>
* st/mesa: handle texture_from_pixmap and other surface-based textures correctlyMarek Olšák2013-05-157-63/+22
| | | | | | | | | | | | | | | | | | | | | There were 2 issues with it: 1) The texture format which should be used for texturing was only set in gl_texture_image::TexFormat, which wasn't used for sampler views. 2) Textures are sometimes reallocated under some circumstances in st_finalize_texture, which is unacceptable if the texture comes from a window system. The issues are resolved as follows: 1) If surface_based is true (texture_from_pixmap, etc.), store the format in a new variable st_texture_object::surface_format. 2) Don't reallocate a surface-based texture in st_finalize_texture. Also don't use st_ChooseTextureFormat is st_context_teximage, because the format is dictated by the caller. This fixes the glx-tfp piglit test. Reviewed-by: Adam Jackson <[email protected]>
* st: Use accessor for stencil reference valuesChris Forbes2013-05-151-2/+5
| | | | | | | | | NOTE: This is a candidate for stable branches. Signed-off-by: Chris Forbes <[email protected]> Acked-by: Paul Berry <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* draw: try to prevent overflows on index buffersZack Rusin2013-05-141-2/+2
| | | | | | | | | | | | Pass in the size of the index buffer, when available, and use it to handle out of bounds conditions. The behavior in the case of an overflow needs to be the same as with other overflows in the vertex processing pipeline meaning that a vertex should still be generated but all attributes in it set to zero. Signed-off-by: Zack Rusin <[email protected]> Reviewed-by: José Fonseca <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* draw: don't crash on vertex buffer overflowZack Rusin2013-05-141-3/+5
| | | | | | | | | | | | | | We would crash when stride was bigger than the size of the buffer. The correct behavior is to just fetch zero's in this case. Unfortunatly with user_buffer's there's no way to validate the size because currently we're just not getting it. Adjust the draw interface to pass the size along the mapped buffer, which works perfectly for buffer backed vertex_buffers and, in future, it will allow us to plumb user_buffer sizes through the same interface. Signed-off-by: Zack Rusin <[email protected]> Reviewed-by: José Fonseca <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* mesa/st: Temporary workaround for fdo bug 64568.José Fonseca2013-05-141-0/+5
| | | | | Effectively reverting the problematic hunk of commit 614ee25077b7ffafeb87b22563d01856824fb4bc
* glsl: Add lowering pass for ir_triop_vector_insertIan Romanick2013-05-131-0/+1
| | | | | | | | | | | | | | | | | | This will eventually replace do_vec_index_to_cond_assign. This lowering pass is called in all the places where do_vec_index_to_cond_assign or do_vec_index_to_swizzle is called. v2: Use WRITEMASK_* instead of integer literals. Use a more concise method of generating broadcast_index. Both suggested by Eric. v3: Use a series of scalar compares instead of a single vector compare. Suggested by Eric and Ken. It still uses 'if (cond) v.x = y;' instead of conditional assignments because ir_builder doesn't do conditional assignments, and I'd rather keep the code simple. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Move the mvp_with_dp4 flag to ShaderCompilerOptions.Kenneth Graunke2013-05-121-1/+1
| | | | | | | | | | | | | | | This flag essentially tells the compiler whether it prefers dot products or multiply/adds for matrix operations. As such, ShaderCompilerOptions seems like the right place for it. This also lets us specify it on a per-stage basis. This patch makes all existing users set the flag for the Vertex Shader stage only, as it's currently only used for fixed-function vertex programs. That will change soon, and I wanted to preserve the existing behavior. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Pass struct shader_compiler_options into do_common_optimization.Kenneth Graunke2013-05-121-1/+1
| | | | | | | | | | | | | do_common_optimization may need to make choices about whether to emit certain kinds of instructions. gl_context::ShaderCompilerOptions contains exactly that information, so it makes sense to pass it in. Rather than passing the whole array, pass the structure for the stage that's currently being worked on. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* st/mesa: remove dependency on _NEW_BUFFER_OBJECT for vertex arraysMarek Olšák2013-05-112-3/+3
| | | | | | | _NEW_BUFFER_OBJECT means glBufferData was called. We can just set our own flag in BufferData. Reviewed-by: Brian Paul <[email protected]>
* st/mesa: don't check for _NEW_PROGRAM when binding UBOsMarek Olšák2013-05-111-2/+2
| | | | | | Probably copied from i965. However st/mesa has its flags ST_NEW_xxx_PROGRAM. Reviewed-by: Brian Paul <[email protected]>
* st/mesa: fix a couple of issues in st_bind_ubosMarek Olšák2013-05-111-4/+16
| | | | | | | | | | | | - don't reference a buffer for a local variable (that's never useful unless it can be the only reference to the buffer) - check if the buffer is not NULL - set buffer_size as specified with BindBufferRange NOTE: This is a candidate for the 9.1 branch. Reviewed-by: Fredrik Höglund <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* st/mesa: restore the transfer_inline_write path for BufferDataMarek Olšák2013-05-111-0/+15
| | | | | | Version 2 that shouldn't crash. Reviewed-by: Brian Paul <[email protected]>
* st/mesa: initialize Const.MaxColorAttachmentsMarek Olšák2013-05-111-7/+3
| | | | | | NOTE: This is a candidate for the stable branches. Reviewed-by: Brian Paul <[email protected]>
* gallium: add PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE for GLMarek Olšák2013-05-111-1/+4
| | | | | | v2: fix typo 65535 -> 65536 Reviewed-by: Brian Paul <[email protected]>
* st/mesa: consolidate setting MaxTextureImageUnitsMarek Olšák2013-05-111-15/+11
| | | | Reviewed-by: Brian Paul <[email protected]>
* st/mesa: initialize all program constants and UBO limitsMarek Olšák2013-05-111-21/+43
| | | | | | | | Also simplify UBO support checking. NOTE: This is a candidate for the 9.1 branch. Reviewed-by: Brian Paul <[email protected]>
* mesa: add & use a new driver flag for UBO updates instead of _NEW_BUFFER_OBJECTMarek Olšák2013-05-114-6/+9
| | | | | | | v2: move the flagging from intel_bufferobj_data to intel_bufferobj_alloc_buffer Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: unify MaxVertexVaryingComponents and MaxGeometryVaryingComponentsMarek Olšák2013-05-111-0/+1
| | | | | | | | | The limits should not be different and OpenGL requires both to be at least 32, which is also the maximum limit on radeon. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: move max texture image unit constants to gl_program_constantsMarek Olšák2013-05-115-13/+13
| | | | | | | | | | Const.MaxTextureImageUnits -> Const.FragmentProgram.MaxTextureImageUnits Const.MaxVertexTextureImageUnits -> Const.VertexProgram.MaxTextureImageUnits etc. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: consolidate definitions of max texture image unitsMarek Olšák2013-05-111-1/+1
| | | | | | | Shaders are unified on most hardware (= same limits in all stages). Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* st/mesa: generate GL_OUT_OF_MEMORY if we can't create the index bufferBrian Paul2013-05-091-1/+1
| | | | | | | | | | | Before, if we failed to allocate the index buffer we'd silently return from st_draw_vbo() without drawing anything. We should raise GL_OUT_OF_MEMORY to give some indication that something went wrong. Note: This is a candidate for the stable branches. Reviewed-by: Marek Olšák <[email protected]>
* mesa/st: Don't copy propagate from swizzles.Fabian Bieler2013-05-081-0/+2
| | | | | | | | | | | | | | | | | | | | Do not propagate a copy if source and destination are identical. Otherwise code like MOV TEMP[0].xyzw, TEMP[0].wzyx MOV TEMP[1].xyzw, TEMP[0].xyzw is changed to MOV TEMP[0].xyzw, TEMP[0].wzyx MOV TEMP[1].xyzw, TEMP[0].wzyx This fixes Piglit test shaders/glsl-copy-propagation-self-2 for gallium drivers. NOTE: This is a candidate for the stable branches. Signed-off-by: Fabian Bieler <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Make Mesa core set up wrapped texture renderbuffer state.Eric Anholt2013-05-061-5/+0
| | | | | | | | | | Everyone was doing effectively the same thing, except for some funky code reuse in Intel, and swrast mistakenly recomputing _BaseFormat instead of using the texture's _BaseFormat. swrast's sRGB handling is left in place, though it should be done by using _mesa_get_render_format() at render time instead (as-is, it will miss updates to GL_FRAMEBUFFER_SRGB). Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Make core Mesa allocate the texture renderbuffer wrapper.Eric Anholt2013-05-061-20/+2
| | | | | | Every driver did the same thing. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add a pass to lower bitfield-insert into bfm+bfi.Matt Turner2013-05-061-0/+2
| | | | | | | | | | i965/Gen7+ and Radeon/Evergreen+ have bfm/bfi instructions to implement bitfieldInsert() from ARB_gpu_shader5. v2: Add ir_binop_bfm and ir_triop_bfi to st_glsl_to_tgsi.cpp. Remove spurious temporary assignment and dereference. Reviewed-by: Chris Forbes <[email protected]>
* glsl: Add support for new bit built-ins in ARB_gpu_shader5.Matt Turner2013-05-061-0/+6
| | | | | | v2: Move use of ir_binop_bfm and ir_triop_bfi to a later patch. Reviewed-by: Chris Forbes <[email protected]>
* gallium: fix type of flags in pipe_context::flush()Chia-I Wu2013-05-043-3/+3
| | | | | | | | | | | | | | | | It should be unsigned, not enum pipe_flush_flags. Fixed a build error: src/gallium/state_trackers/egl/android/native_android.cpp:426:29: error: invalid conversion from 'int' to 'pipe_flush_flags' [-fpermissive] v2: replace all occurrences of enum pipe_flush_flags by unsigned Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Marek Olšák <[email protected]> [olv: document the parameter now that the type is unsigned]
* Revert "st/mesa: add a simple path to BufferData if it only discards buffer ↵José Fonseca2013-04-291-14/+0
| | | | | | | | contents" This reverts commit 5649f886f76023532538b8792605a3578cec1ed1. It causes segfaults when size is zero.
* mesa: remove unused opcodes AND, DP2A, NOT, NRM3, NRM4, OR, PRINT, XORMarek Olšák2013-04-241-6/+0
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>