mirror of https://gitlab.freedesktop.org/mesa/mesa
0c96b03fcf
How this works? First we check which immediates are used as vectors, i.e., have any reads that are using 2 or more channels. Such immdeiates will be places in a free slots (but only the specific channels that are used in the vector). This way we don't have to worry about swizzling restrictions. The remaining scalar immediates will be checked for duplicates and placed in free slots, including any empty slots in previously places vector immediates (any swizzle is valid for scalars). RV410: total instructions in shared programs: 98883 -> 98905 (0.02%) instructions in affected programs: 15414 -> 15436 (0.14%) helped: 100 HURT: 102 total presub in shared programs: 2235 -> 2235 (0.00%) presub in affected programs: 608 -> 608 (0.00%) helped: 51 HURT: 72 total omod in shared programs: 419 -> 418 (-0.24%) omod in affected programs: 15 -> 14 (-6.67%) helped: 3 HURT: 3 total temps in shared programs: 15698 -> 15692 (-0.04%) temps in affected programs: 952 -> 946 (-0.63%) helped: 46 HURT: 37 total consts in shared programs: 84458 -> 83856 (-0.71%) consts in affected programs: 14648 -> 14046 (-4.11%) helped: 499 HURT: 0 total cycles in shared programs: 156476 -> 156493 (0.01%) cycles in affected programs: 22532 -> 22549 (0.08%) helped: 100 HURT: 102 LOST: shaders/ck2/157.shader_test FS GAINED: shaders/ck2/160.shader_test FS GAINED: shaders/tesseract/395.shader_test FS RV530: total instructions in shared programs: 119543 -> 119612 (0.06%) instructions in affected programs: 27435 -> 27504 (0.25%) helped: 118 HURT: 183 total presub in shared programs: 7257 -> 7111 (-2.01%) presub in affected programs: 1856 -> 1710 (-7.87%) helped: 121 HURT: 48 total omod in shared programs: 426 -> 427 (0.23%) omod in affected programs: 5 -> 6 (20.00%) helped: 1 HURT: 2 total temps in shared programs: 16784 -> 16779 (-0.03%) temps in affected programs: 392 -> 387 (-1.28%) helped: 29 HURT: 17 total consts in shared programs: 93198 -> 92667 (-0.57%) consts in affected programs: 14577 -> 14046 (-3.64%) helped: 451 HURT: 0 total cycles in shared programs: 186649 -> 186590 (-0.03%) cycles in affected programs: 26306 -> 26247 (-0.22%) helped: 125 HURT: 111 Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com> Reviewed-by: Filip Gawin <filip.gawin@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28630> |
||
---|---|---|
.. | ||
auxiliary | ||
drivers | ||
frontends | ||
include | ||
targets | ||
tests | ||
tools | ||
winsys | ||
README.portability | ||
meson.build |
README.portability
CROSS-PLATFORM PORTABILITY GUIDELINES FOR GALLIUM3D = General Considerations = The frontend and winsys driver support a rather limited number of platforms. However, the pipe drivers are meant to run in a wide number of platforms. Hence the pipe drivers, the auxiliary modules, and all public headers in general, should strictly follow these guidelines to ensure = Compiler Support = * Include the util/compiler.h. * Cast explicitly when converting to integer types of smaller sizes. * Cast explicitly when converting between float, double and integral types. * Don't use named struct initializers. * Don't use variable number of macro arguments. Use static inline functions instead. * Don't use C99 features. = Standard Library = * Avoid including standard library headers. Most standard library functions are not available in Windows Kernel Mode. Use the appropriate p_*.h include. == Memory Allocation == * Use MALLOC, CALLOC, FREE instead of the malloc, calloc, free functions. * Use align_pointer() function defined in u_memory.h for aligning pointers in a portable way. == Debugging == * Use the functions/macros in p_debug.h. * Don't include assert.h, call abort, printf, etc. = Code Style = == Inherantice in C == The main thing we do is mimic inheritance by structure containment. Here's a silly made-up example: /* base class */ struct buffer { int size; void (*validate)(struct buffer *buf); }; /* sub-class of bufffer */ struct texture_buffer { struct buffer base; /* the base class, MUST COME FIRST! */ int format; int width, height; }; Then, we'll typically have cast-wrapper functions to convert base-class pointers to sub-class pointers where needed: static inline struct vertex_buffer *vertex_buffer(struct buffer *buf) { return (struct vertex_buffer *) buf; } To create/init a sub-classed object: struct buffer *create_texture_buffer(int w, int h, int format) { struct texture_buffer *t = malloc(sizeof(*t)); t->format = format; t->width = w; t->height = h; t->base.size = w * h; t->base.validate = tex_validate; return &t->base; } Example sub-class method: void tex_validate(struct buffer *buf) { struct texture_buffer *tb = texture_buffer(buf); assert(tb->format); assert(tb->width); assert(tb->height); } Note that we typically do not use typedefs to make "class names"; we use 'struct whatever' everywhere. Gallium's pipe_context and the subclassed psb_context, etc are prime examples of this. There's also many examples in Mesa and the Mesa state tracker.