Our shader key includes a void pointer that we can't just memcmp,
so add helpers that allow us toget the 'static' portion and size
of a key. We will use this to fix up the shader cache in v3d in
a later patch.
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25418>
return slot.slot_and_component & 3;
}
+/* Given a v3d_key start address, skips over the 'void *'
+ * shader_state pointer to get the 'static' portion of the
+ * key.
+ */
+static inline uint8_t *
+v3d_key_static_addr(const void *key_addr)
+{
+ return ((uint8_t *)key_addr) + sizeof(void*);
+}
+
+/* Returns the size of the key adjusted to the static
+ * portion.
+ */
+static inline uint32_t
+v3d_key_static_size(uint32_t key_size)
+{
+ return key_size - sizeof(void *);
+}
+
struct v3d_key {
+ /* Keep this field first */
void *shader_state;
+
struct {
uint8_t swizzle[4];
} tex[V3D_MAX_TEXTURE_SAMPLERS];