Marek Olšák
f6f6d3c0e7
mesa: optimize out no-op calls in glPopAttrib
...
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:11 +00:00
Marek Olšák
27b981352a
mesa: skip _mesa_set_enable in glPopAttrib if there are no changes
...
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:11 +00:00
Marek Olšák
b4bf872585
mesa: reduce the size of gl_texture_attrib_node::Texture by about 90%
...
Let's get rid of the big memcpy.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:11 +00:00
Marek Olšák
d0e18550e2
mesa: optimize saving/restoring bound textures for glPush/PopAttrib
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:11 +00:00
Marek Olšák
9a8b54285d
mesa: reorganize gl_texture and sampler structures for glPush/PopAttrib
...
Put the fields saved by glPush/PopAttrib into the sub-structure declared
as Attrib. This will make glPush/PopAttrib much faster because it will
only save and restore that structure.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:11 +00:00
Marek Olšák
7fa9d9d06c
mesa: add a fast path for restoring light attributes in glPopAttrib
...
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:11 +00:00
Marek Olšák
734af61353
mesa: add a fast path for restoring fixed-func tex state in glPopAttrib
...
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:11 +00:00
Marek Olšák
3be42f9ca1
mesa: rewrite glPushAttrib/glPopAttrib to get rid of malloc
...
This was inevitable. This gets rid of the malloc/free calls and chaining
each push group in a linked list. Now the whole attribute stack is declared
statically in gl_context.
Yes, this improves performance a lot.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
e08b3b74e7
mesa: treat glPopMatrix as a no-op state change if it doesn't change the matrix
...
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
0d7347105f
mesa: memset matrices at initialization to enable memcpy on it
...
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
019f131601
mesa: canonicalize matrix in glPushMatrix to make glPopMatrix possibly a no-op
...
If there are no changes to the matrix, we can move pop the stack but not
update any state constants.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
f5d17070be
mesa: consider glPushMatrix a no-op change from the driver perspective
...
It doesn't change any states.
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
b1982fd3d2
mesa: skip glMultMatrix if the matrix is identity
...
This happens a lot with viewperf and it causes unnecessary constant buffer
updates.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
7b50332aef
mesa: fix crashes in the no_error case of invalid glUniform calls
...
I copied error conditions from validate_uniform_parameters.
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
f94c190581
st/mesa: replace st_context::state::constants with a mask
...
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
96fc1ab647
st/mesa: add a faster path for uploading state parameters into constant buffers
...
The old path copies state parameters into the parameter list, and then
the driver copies them into a buffer.
The optional new path loads state parameters into a buffer directly.
This increases performance by 5% in one subtest of viewperf.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
9b1f091bd9
gallium: add PIPE_CAP_PREFER_REAL_BUFFER_IN_CONSTBUF0
...
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
b8423c2eee
mesa: add helpers for drivers to load state parameters into buffers
...
Drivers should upload only UniformBytes of uniforms and constants,
and then use _mesa_upload_state_parameters to upload state parameters.
This allows removing one copy of state parameters.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
7fe4a830fb
mesa: merge light state parameters for faster uploads (disabled)
...
Disabled because of CI failures.
Invoke fetch_state only once for all lights in the best case instead
of 8*8 times.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
0d6d66d516
mesa: merge matrix state parameters for faster uploads (disabled)
...
Disabled because of CI failures.
Instead of separate state vars for each row and invoking fetch_state 4x:
state.matrix.modelview.row[0]
state.matrix.modelview.row[1]
state.matrix.modelview.row[2]
state.matrix.modelview.row[3]
The rows are now merged and fetch_state is invoked once:
state.matrix.modelview.row[0..3]
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
63f7d7dd0a
mesa: take advantage of sorted parameters in _mesa_load_state_parameters
...
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
b9bff76b63
mesa: put constants before state vars for ARB programs
...
This moves state vars to the end of the parameter list, so that state vars
can be loaded directly into a buffer instead of loaded into the parameter list.
Also, state vars don't need to be searched in the parameter list anymore,
because we will know their index range. (this will make gallium faster)
This commit just wraps a for loop around the existing code.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
06a141469b
mesa: put constants before state vars for ffvp
...
This moves state vars to the end of the parameter list, so that state vars
can be loaded directly into a buffer instead of loaded into the parameter list.
Also, state vars don't need to be searched in the parameter list anymore,
because we will know their index range. (this will make gallium faster)
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
8cb0229f26
mesa: restructure gl_light vars to match the layout of gl_LightSource uniforms
...
this will make uploads faster
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
51ce2f6c8d
mesa: optimize setting gl_Light state parameters
...
The order of enums is a preparation for a future commit, but if you are
guessing that I just want to copy all light params into a constant buffer
with one memcpy, you are right.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
cc4afb2101
mesa: demystify material_attrib()
...
the next commit would break this magic math
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
fc31d9b733
mesa: allow multi-slot program parameters
...
also the removed comment was incorrect.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
71504008c7
mesa: fix printing state parameters
...
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
2770a4bc63
mesa: remove redundant _math_matrix_analyse calls in fetch_state
...
Only program matrices needed this. Other matrices are updated in
_mesa_update_state_locked.
Acked-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
2ca6c99604
mesa: rework matrix statevar enums to remove excessive branching in fetch_state
...
Instead of having $matrix and $modifier as separate enums, combine them
to 1 enum $matrix_$modifier.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
3175b63a0d
mesa: don't allocate matrices with malloc
...
There is no reason for it. This removes a pointer indirection.
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com >
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
9c84ca574d
util: add a common ALIGN16 macro for m_matrix and u_threaded_context
...
to prevent conflicts in the next commit
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
14a2117fc8
mesa: replace _mesa_problem with unreachable in fetch_state
...
let's get this out of release builds
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com >
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
4035a19320
mesa: don't read from destination memory when computing state parameter values
...
The destination memory can be uncached, e.g. a buffer object.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
bde7fa0cb3
mesa: skip redundant uniform updates for glUniformHandle
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
b32e20e630
mesa: skip redundant uniform updates for glUniformMatrix
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
736f1f70ab
mesa: skip redundant uniform updates for glUniform
...
Viewperf does a lot of redundant uniform updates - 60-80% in some tests.
Those are sometimes the only state changes between draw calls.
This improves performance by 33% in one viewperf subtest.
If you are worried about CPU overhead in the non-redundant case,
glthread is the solution.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
d0c66c167d
mesa: move sampler condition for flushing into mesa_flush_vertices_for_uniforms
...
This is just a code consolidation. It might fix something, not sure.
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
0a2117bc9e
mesa: call FLUSH_VERTICES before changing sampler uniforms
...
Fixes: 9545139ce5
"mesa: skip FLUSH_VERTICES() if no samplers were changed"
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
9281dfca3f
mesa: don't print GL errors in release builds if MESA_DEBUG=silent
...
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com >
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
eda37fb269
mesa: properly disallow param list reallocation
...
This can more easily detect shader variants adding too many state
parameters and causing a reallocation.
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
158351007e
mesa: track ParameterValues size separately
...
This is needed for multi-slot parameters.
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Marek Olšák
25e242155b
mesa: don't duplicate allocation code in _mesa_new_parameter_list_sized
...
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946 >
2020-12-01 11:52:10 +00:00
Indrajit Kumar Das
5d14562da8
radeonsi/gfx10: fix overflow and primitive queries
...
This aligns the offsets to match the memory layout of the query buffer
defined by gfx10_sh_query_buffer_mem and calls si_launch_grid_internal
to flush caches and wait for completion of shaders prior to retrieving
results.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7181 >
2020-12-01 11:34:16 +00:00
Iago Toral Quiroga
fd4016f978
v3dv: ignore filter in TFU blit path
...
The filter is only relevant to handle blits that invole scaling, but
our TFU path doesn't handle any kind of scaling so we can safely
ignore it.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7845 >
2020-12-01 11:24:17 +00:00
Iago Toral Quiroga
eb75a67bd6
v3dv: add a helper to choose a compatible TFU format
...
We are now doing this in 3 different places so it makes sense.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7845 >
2020-12-01 11:24:17 +00:00
Iago Toral Quiroga
329afedd8b
v3dv: handle Z mirroring in the TFU blit path
...
The TFU path only activates for blits that are really copies
(no linear filtering, no scaling, same pixel format, etc.), and
we do it slice by slice, so we can easily handle mirroring of the
Z coordinate for 3D images by reversing the order of the layers
as we copy them.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7845 >
2020-12-01 11:24:17 +00:00
Iago Toral Quiroga
29f62061d9
v3dv: expand the formats that can be handled in the TFU blit path
...
Same as with other TFU paths, we only handle exact copies without
conversion, so we can rewrite the format to use a compatible TFU format
based on its texel size, which allows us to use this path with more
formats.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7845 >
2020-12-01 11:24:17 +00:00
James Park
cc62a0dfe4
aco: Avoid extra bitfield padding
...
MSVC may insert padding for data type switches.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7785 >
2020-12-01 11:08:21 +00:00
James Park
44f05d6b74
aco: Stub sections that don't have _WIN32 support
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7785 >
2020-12-01 11:08:21 +00:00