[Mesa-dev] Mesa (master): st/mesa: completely rewrite state atoms
Brian Paul
brianp at vmware.com
Mon Aug 8 22:34:54 UTC 2016
Marek,
I just found a problem with this patch series with MSVC.
The new enum type which defines the ST_NEW_ values uses bitshifts of
more than 32 bits. It looks like this overflows the 32-bit size of the
enum datatype:
c:\users\brian\projects\mesa\src\mesa\state_tracker\st_atom_list.h(43) :
warning
C4309: 'initializing' : truncation of constant value
c:\users\brian\projects\mesa\src\mesa\state_tracker\st_atom_list.h(44) :
warning
C4309: 'initializing' : truncation of constant value
...
I don't know of a way to specify a 64-bit enum. stackoverflow.com
offers a few ideas for C++, but they don't work for C.
My work-around is to create a 'static const uint64_t ST_NEW_foo = 1llu
<< ST_NEW_foo_INDEX;' for each flag, rather than an enum value.
I'll post a patch for this soon.
-Brian
On 07/30/2016 07:04 AM, Marek Olšák wrote:
> Module: Mesa
> Branch: master
> Commit: c8fe3b9dca73e3b91979d92ba4136b302001b3bb
> URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__cgit.freedesktop.org_mesa_mesa_commit_-3Fid-3Dc8fe3b9dca73e3b91979d92ba4136b302001b3bb&d=CwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=T0t4QG7chq2ZwJo6wilkFznRSFy-8uDKartPGbomVj8&m=lFYqYu7WLZRIthDamMpIHOysN7nmCAUk1RdZwZC7E44&s=a157hpIVAAqEFvga55qDUIH6SprwqXZ4BCoGVPCWfa4&e=
>
> Author: Marek Olšák <marek.olsak at amd.com>
> Date: Sun Jul 17 18:38:38 2016 +0200
>
> st/mesa: completely rewrite state atoms
>
> The goal is to do this in st_validate_state:
> while (dirty)
> atoms[u_bit_scan(&dirty)]->update(st);
>
> That implies that atoms can't specify which flags they consume.
> There is exactly one ST_NEW_* flag for each atom. (58 flags in total)
>
> There are macros that combine multiple flags into one for easier use.
>
> All _NEW_* flags are translated into ST_NEW_* flags in st_invalidate_state.
> st/mesa doesn't keep the _NEW_* flags after that.
>
> torcs is 2% faster between the previous patch and the end of this series.
>
> v2: - add st_atom_list.h to Makefile.sources
>
> Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> ---
>
> src/mesa/Makefile.sources | 1 +
> src/mesa/state_tracker/st_atom.c | 156 +++++-------------
> src/mesa/state_tracker/st_atom.h | 210 +++++++++++++++++--------
> src/mesa/state_tracker/st_atom_array.c | 4 -
> src/mesa/state_tracker/st_atom_atomicbuf.c | 24 ---
> src/mesa/state_tracker/st_atom_blend.c | 4 -
> src/mesa/state_tracker/st_atom_clip.c | 4 -
> src/mesa/state_tracker/st_atom_constbuf.c | 48 ------
> src/mesa/state_tracker/st_atom_depth.c | 4 -
> src/mesa/state_tracker/st_atom_framebuffer.c | 4 -
> src/mesa/state_tracker/st_atom_image.c | 24 ---
> src/mesa/state_tracker/st_atom_list.h | 75 +++++++++
> src/mesa/state_tracker/st_atom_msaa.c | 8 -
> src/mesa/state_tracker/st_atom_pixeltransfer.c | 4 -
> src/mesa/state_tracker/st_atom_rasterizer.c | 16 --
> src/mesa/state_tracker/st_atom_sampler.c | 4 -
> src/mesa/state_tracker/st_atom_scissor.c | 8 -
> src/mesa/state_tracker/st_atom_shader.c | 24 ---
> src/mesa/state_tracker/st_atom_stipple.c | 5 -
> src/mesa/state_tracker/st_atom_storagebuf.c | 24 ---
> src/mesa/state_tracker/st_atom_tess.c | 4 -
> src/mesa/state_tracker/st_atom_texture.c | 24 ---
> src/mesa/state_tracker/st_atom_viewport.c | 4 -
> src/mesa/state_tracker/st_cb_bitmap.c | 10 +-
> src/mesa/state_tracker/st_cb_bufferobjects.c | 10 +-
> src/mesa/state_tracker/st_cb_compute.c | 2 +-
> src/mesa/state_tracker/st_cb_feedback.c | 2 +-
> src/mesa/state_tracker/st_cb_program.c | 38 ++---
> src/mesa/state_tracker/st_cb_texture.c | 2 +-
> src/mesa/state_tracker/st_context.c | 100 ++++++++++--
> src/mesa/state_tracker/st_context.h | 42 +----
> src/mesa/state_tracker/st_draw.c | 4 +-
> src/mesa/state_tracker/st_manager.c | 4 +-
> 33 files changed, 381 insertions(+), 516 deletions(-)
>
> Diff: https://urldefense.proofpoint.com/v2/url?u=http-3A__cgit.freedesktop.org_mesa_mesa_diff_-3Fid-3Dc8fe3b9dca73e3b91979d92ba4136b302001b3bb&d=CwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=T0t4QG7chq2ZwJo6wilkFznRSFy-8uDKartPGbomVj8&m=lFYqYu7WLZRIthDamMpIHOysN7nmCAUk1RdZwZC7E44&s=LOlK4ENHEaa1JBlA0wq8I6GQWpROFYYDFo_2gyzhego&e=
> _______________________________________________
> mesa-commit mailing list
> mesa-commit at lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Dcommit&d=CwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=T0t4QG7chq2ZwJo6wilkFznRSFy-8uDKartPGbomVj8&m=lFYqYu7WLZRIthDamMpIHOysN7nmCAUk1RdZwZC7E44&s=S1tyA97XsiodjH7EOJ1M5vfEd5yiU4qcDicS1fayqdE&e=
>
More information about the mesa-dev
mailing list