aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
Commit message (Collapse)AuthorAgeFilesLines
* st/mesa/r200/i915/i965: move ARB program fields into a unionTimothy Arceri2016-11-173-11/+11
| | | | | | | | | | | It's common for games to compile 2000 programs or more so at 32bits x 2000 programs x 22 fields x 2 (at least) stages This should give us something like 352 kilobytes in savings once we add some more glsl only fields. Reviewed-by: Emil Velikov <[email protected]>
* st/mesa: stop initialing Instructions and NumInstructionsTimothy Arceri2016-11-172-6/+0
| | | | | | | Since gl_program is now created with rzalloc() they should already be initialised. Reviewed-by: Emil Velikov <[email protected]>
* mesa: if MESA_DEBUG=context, create a debug contextBrian Paul2016-11-161-0/+2
| | | | | | | | | | | | | | | | | | | A number of drivers report useful debug/perf information accessible through GL_ARB_debug_output and with debug contexts (i.e. setting the GLX_CONTEXT_DEBUG_BIT_ARB flag). But few applications actually use the GL_ARB_debug_output extension. This change lets one set the MESA_DEBUG env var to "context" to force-set a debug context and report debug/perf messages to stderr (or whatever file MESA_LOG_FILE is set to). This is a useful debugging tool. The small change in st_api_create_context() is needed so that st_update_debug_callback() gets called to hook up the driver debug callbacks when ST_CONTEXT_FLAG_DEBUG was not set, but MESA_DEBUG=context. v2: use %.*s format string instead of allocating temporary buffer. Reviewed-by: Nicolai Hähnle <[email protected]>
* st/mesa: swap bytes in the fallback format translation path of GetTexImageNicolai Hähnle2016-11-161-0/+6
| | | | | | | Fixes parts of GL45-CTS.gtf32.GL3Tests.packed_pixels.packed_pixels_pixelstore. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* st/mesa: simplify and fix st_GetTexSubImageNicolai Hähnle2016-11-161-49/+24
| | | | | | | | | | | | | | | By using _mesa_image_address, the code becomes simpler _and_ fixes the bug that GL_PACK_SKIP_IMAGES was applied even on non-3D textures. Also, converting a whole slice at a time simplifies the format translation fallback path. Fixes parts of GL45-CTS.gtf32.GL3Tests.packed_pixels.packed_pixels_pixelstore. v2: fix a silly mistake during code movement Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* st/mesa: fix SINT <-> UINT conversion during PBO upload / downloadNicolai Hähnle2016-11-165-22/+89
| | | | | | | | | | | This fixes use cases like glReadPixels from an RGBA8I framebuffer into a PBO with type GL_INT by clamping values appropriately when they fall outside the range of the destination format. Fixes parts of GL45-CTS.gtf32.GL3Tests.packed_pixels.packed_pixels_pbo. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* st/mesa: change st_pbo_create_upload_fs to st_pbo_get_upload_fsNicolai Hähnle2016-11-163-10/+11
| | | | | | | For consistency with st_pbo_get_download_fs. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* st/mesa: fix ReadPixels into packed formats with PBONicolai Hähnle2016-11-161-2/+1
| | | | | | | | | | | | When using the GPU download path, we bind the PBO as a buffer texture, so call is_format_supported accordingly. On radeonsi, this means that GPU downloads aren't used for UNSIGNED_SHORT_5_6_5 destinations, for example. Fixes parts of GL45-CTS.gtf32.GL3Tests.packed_pixels.packed_pixels_pbo. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* glsl_to_tgsi: lower small branches based on the CAPMarek Olšák2016-11-151-1/+4
| | | | Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl/lower_if: don't lower branches touching tess control outputsMarek Olšák2016-11-151-1/+2
| | | | Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: remove LowerShaderSharedVariablesMarek Olšák2016-11-101-3/+0
| | | | | | always true for compute shaders Reviewed-by: Kenneth Graunke <[email protected]>
* mesa/extensions: expose OES_vertex_half_float for ES2Kevin Strasser2016-11-091-2/+5
| | | | | | | | | Half float support already exists for desktop GL. Reuse the ARB_half_float_vertex enable bit and account for the different enum to enable the extension for ES2. Signed-off-by: Kevin Strasser <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* st/mesa: initialize members of glsl_to_tgsi_instruction in emit_asm()Brian Paul2016-11-051-0/+4
| | | | | | | | | | | | | | This fixes random crashes with MSVC release builds. It seems the members are implicitly initialized to zero with gcc, but not MSVC. In particular, the tex_offset_num_offset field was non-zero causing a loop over the NULL tex_offsets array to crash. Zero-init those fields and a few others to be safe. The regression began with acc23b04cfd64e "ralloc: remove memset from ralloc_size". Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: fix the layer of VDPAU surface samplersNicolai Hähnle2016-11-043-17/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A (latent) bug in VDPAU interop was exposed by commit e5cc84dd43be066c1dd418e32f5ad258e31a150a. Before that commit, the st_vdpau code created samplers with first_layer == last_layer == 1 that the general texture handling code would immediately delete and re-create, because the layer does not match the information in the GL texture object. This was correct behavior at least in the DMABUF case, because the imported resource is supposed to have the correct offset already applied. In the non-DMABUF case, this was just plain wrong but apparently nobody noticed. After that commit, the state tracker assumes that an existing sampler is correct at all times. Existing samplers are supposed to be deleted when they may become invalid, and they will be created on-demand. This meant that the sampler with first_layer == last_layer == 1 stuck around, leading to rendering artefacts (on radeonsi), command stream failures (on r600), and assertions (in debug builds everywhere). This patch fixes the problem by simply not creating a sampler at all in st_vdpau_map_surface. We rely on the generic texture code to do the right thing, adding the layer_override to make the non-DMABUF case work. v2: add the layer_override Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98512 Cc: 13.0 <[email protected]> Cc: Christian König <[email protected]> Cc: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]> (v1) Reviewed-by: Christian König <[email protected]>
* st/glsl_to_tgsi: fix dvec[34] loads from SSBONicolai Hähnle2016-11-041-6/+4
| | | | | | | | | | When splitting up loads, we have to add 16 bytes to the offset for the high components, just like already happens for stores. Fixes arb_gpu_shader_fp64@shader_storage@layout-std140-fp64-shader. Cc: 13.0 <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* st/mesa/r200/i915/i965: use rzalloc() to create gl_programTimothy Arceri2016-11-031-6/+12
| | | | | | | | | | | | | | | | | This allows us to use ralloc_parent() to see which data structure owns shader_info which allows us to fix a regression in nir_sweep(). This will also allow us to move some fields from gl_linked_shader to gl_program, which will allow us to do some clean-ups like storing gl_program directly in the CurrentProgram array in gl_pipeline_object enabling some small validation optimisations at draw time. Also it is error prone to depend on the gl_linked_shader for programs in current use because a failed linking attempt will free infomation about the current program. In i965 we could be trying to recompile a shader variant but may have lost some required fields. Reviewed-by: Eric Anholt <[email protected]>
* mesa: rename gl_client_array -> gl_vertex_arrayBrian Paul2016-10-286-20/+20
| | | | | | | | | | | The term "client array" is a legacy thing dating back to the pre-VBO era when _all_ vertex arrays lived in client memory. Nowadays, it only contains vertex array state which is derived from gl_array_attributes and gl_vertex_buffer_binding. It's used by the VBO module and some drivers. Reviewed-by: Anuj Phogat <[email protected]>
* st/mesa: set RobustAccess true when is supportedTapani Pälli2016-10-271-1/+3
| | | | | Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* st/mesa: allow multiple concurrent waiters in ClientWaitSyncMarek Olšák2016-10-261-4/+22
| | | | | | | | | | so->fence can be unreferenced by one thread while another thread is somewhere in ClientWaitSync and expecting so->fence to be non-NULL. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98172 Cc: 12.0 13.0 <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* st/mesa: unduplicate st_check_sync codeMarek Olšák2016-10-261-20/+6
| | | | | | | | It's the same as st_client_wait_sync. Discovered by Michel. This is needed to make the following fix simpler. Cc: 12.0 13.0 <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* nir: stop adjusting driver location for varying packingTimothy Arceri2016-10-261-3/+0
| | | | | | | | | | | | As of 59864e8e020 we just use the location assigned by the front-end and no longer need this for i965. Since there were some issues in the logic with assigning arrays the same driver location if they didn't start at the same location just remove it and let other drivers implement a solution if needed when they add ARB_enhanced_layouts support. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl/st/mesa: use common system values read fieldTimothy Arceri2016-10-262-3/+3
| | | | | | | | | And set system values read directly in shader_info. st/mesa changes where: Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* st/mesa: use common patch outputs written fieldTimothy Arceri2016-10-262-2/+2
| | | | Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: use common patch inputs read fieldTimothy Arceri2016-10-262-2/+2
| | | | Reviewed-by: Marek Olšák <[email protected]>
* r200/glsl/st/mesa: use common outputs written fieldTimothy Arceri2016-10-265-8/+11
| | | | | | | | | And set outputs written directly in shader_info. st/mesa changes where: Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* st/mesa: use common double inputs read fieldTimothy Arceri2016-10-263-3/+6
| | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* r200/i915/st/mesa/compiler: use common inputs read fieldTimothy Arceri2016-10-267-18/+18
| | | | | | | | | | | | And set set inputs_read directly in shader_info. To avoid regressions between changes this change is a squashed version of the following patches. st/mesa changes where: Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* st/mesa/r200/i915/i965: eliminate gl_fragment_programTimothy Arceri2016-10-2617-60/+50
| | | | | | | | | | Here we move OriginUpperLeft and PixelCenterInteger into gl_program all other fields have been replace by shader_info. V2: Don't use anonymous union/structs to hold vertex/fragment fields suggested by Ian. Reviewed-by: Jason Ekstrand <[email protected]>
* i965/mesa/st/swrast: set fs shader_info directly and switch to using itTimothy Arceri2016-10-261-2/+2
| | | | | | | Note we access shader_info from the program struct rather than the nir_shader pointer because shader cache won't create a nir_shader. Reviewed-by: Jason Ekstrand <[email protected]>
* st/mesa: get interpolation location at translation timeTimothy Arceri2016-10-263-15/+18
| | | | | | | | Rather then messing around creating bitfields and arrays to store the interpolation location just translate it on the fly. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* st/mesa: stop making use of InterpQualifier arrayTimothy Arceri2016-10-262-31/+41
| | | | | | | | | | | A following patch is going to merge the gl_fragment_program struct into a common gl_program and we want to avoid all stages having this array. V2: use TGSI_INTERPOLATE_COUNT as the temporary placeholder. Suggested by Marek. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965/mesa/st: eliminate gl_compute_programTimothy Arceri2016-10-268-12/+12
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* st/mesa: switch cs over to shared shader_infoTimothy Arceri2016-10-262-8/+5
| | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa/i965/i915/r200: eliminate gl_vertex_programTimothy Arceri2016-10-2611-35/+34
| | | | | | | Here we move the only field in gl_vertex_program to the ARB program fields in gl_program. Reviewed-by: Jason Ekstrand <[email protected]>
* i965/mesa/st: eliminate gl_geometry_programTimothy Arceri2016-10-269-19/+19
| | | | | | We now get all the gs metadata from shader_info. Reviewed-by: Jason Ekstrand <[email protected]>
* st/mesa: switch gs over to shared shader_infoTimothy Arceri2016-10-261-4/+7
| | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965/mesa/st: eliminate gl_tess_eval_programTimothy Arceri2016-10-269-19/+19
| | | | | | We now get all the tes metadata from shader_info. Reviewed-by: Jason Ekstrand <[email protected]>
* st/mesa: switch tes over to shared shader_infoTimothy Arceri2016-10-261-5/+7
| | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965/mesa/st: eliminate gl_tess_ctrl_programTimothy Arceri2016-10-268-16/+16
| | | | | | We now get all the tcs metadata from shader_info. Reviewed-by: Jason Ekstrand <[email protected]>
* st/mesa: switch tcs over to shared shader_infoTimothy Arceri2016-10-261-1/+1
| | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: add temporary copy_shader_info() functionTimothy Arceri2016-10-262-3/+3
| | | | | | | | | | | | | This function is added here to ease refactoring towards using the new shared shader_info. Once refactoring is complete and values are set directly it will be removed. We call it from _mesa_copy_linked_program_data() rather than glsl_to_nir() so that the values will be set for all drivers. In order to do this some calls need to be moved around so that we make sure to call do_set_program_inouts() before _mesa_copy_linked_program_data() Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: modify _mesa_copy_linked_program_data() to take gl_linked_shaderTimothy Arceri2016-10-262-6/+7
| | | | | | | | | | This allows us to do some small tidy ups, but will also allow us to call a new function that copies values to a shared shader info from here. In order to make this change this function now requires _mesa_reference_program() to have previously been called. Reviewed-by: Jason Ekstrand <[email protected]>
* st/mesa: cleanup and fix primitive restart for indirect drawsNicolai Hähnle2016-10-241-17/+28
| | | | | | | | | | | | | | | | There are three intended functional changes here: 1. OpenGL 4.5 clarifies that primitive restart should only apply with index buffers, so make that change explicit in the indirect draw path. 2. Make PrimitiveRestartFixedIndex work with indirect draws. 3. The change where primitive_restart is only set when the restart index can actually have an effect (based on the size of indices) is also applied for indirect draws. Cc: 13.0 <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* gallium: add PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERSIlia Mirkin2016-10-221-1/+1
| | | | | | | | | | | | | | This allows the driver to signal that it can't handle random interleaving of attributes across buffers. This is required for ARB_transform_feedback3, and it's initialized to whatever the previous value of PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME was except for nv50 where it is disabled. Note that the proprietary drivers never expose ARB_transform_feedback3 on any GT21x's (where nouveau previously did), and after some effort I was unable to get it to work. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: only set primitive_restart when the restart index is in rangeNicolai Hähnle2016-10-201-2/+13
| | | | | | | | | | | | | Even when enabled, primitive restart has no effect when the restart index is larger than the representable values in the index buffer. Fixes GL45-CTS.gtf31.GL3Tests.primitive_restart.primitive_restart_upconvert for radeonsi VI. v2: add an explanatory comment Cc: "12.0 13.0" <[email protected]> Reviewed-by: Marek Olšák <[email protected]> (v1)
* st/glsl_to_tgsi: sort input and output decls by TGSI indexNicolai Hähnle2016-10-201-0/+28
| | | | | | | | Fixes a regression introduced by commit 777dcf81b. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98307 Reviewed-by: Marek Olšák <[email protected]> Cc: 13.0 <[email protected]>
* st/glsl_to_tgsi: fix block copies of arrays of structsNicolai Hähnle2016-10-201-2/+4
| | | | | | | | | | Use a full writemask in this case. This is relevant e.g. when a function has an inout argument which is an array of structs. v2: use C-style comment (Timothy Arceri) Reviewed-by: Marek Olšák <[email protected]> (v1) Cc: 13.0 <[email protected]>
* st/glsl_to_tgsi: fix block copies of arrays of doublesNicolai Hähnle2016-10-201-0/+1
| | | | | | | | | Set the type of the left-hand side to the same as the right-hand side, so that when the base type is double, the writemask of the MOV instruction is properly fixed up. Reviewed-by: Marek Olšák <[email protected]> Cc: 13.0 <[email protected]>
* st/mesa: disable alpha-test, alpha-to-coverage, alpha-to-one for integer FBsMarek Olšák2016-10-192-2/+4
| | | | | | v2: rebased Reviewed-by: Brian Paul <[email protected]>
* mesa: remove gl_shader_compiler_options::EmitNoNoiseMarek Olšák2016-10-191-2/+0
| | | | | | | it's always true Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>