2 * Copyright (C) 2019 Collabora, Ltd.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * Authors (Collabora):
24 * Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
31 #include "util/hash_table.h"
33 /* An internal blend shader descriptor, from the compiler */
35 struct panfrost_blend_shader
{
36 /* The compiled shader in GPU memory */
37 struct panfrost_transfer shader
;
39 /* Byte count of the shader */
42 /* Number of 128-bit work registers required by the shader */
45 /* Offset into the shader to patch constants. Zero to disable patching
46 * (it is illogical to have constants at offset 0). */
49 /* First instruction tag (for tagging the pointer) */
53 /* A blend shader descriptor ready for actual use */
55 struct panfrost_blend_shader_final
{
56 /* The upload, possibly to transient memory */
59 /* Same meaning as panfrost_blend_shader */
63 struct panfrost_blend_equation_final
{
64 struct mali_blend_equation
*equation
;
68 struct panfrost_blend_rt
{
69 /* If has_fixed_function is set, equation is the
70 * fixed-function configuration for this blend state */
72 bool has_fixed_function
;
73 struct mali_blend_equation equation
;
75 /* Mask of blend color components read */
76 unsigned constant_mask
;
78 /* Regardless of fixed-function blending, this is a map of pipe_format
79 * to panfrost_blend_shader */
81 struct hash_table_u64
*shaders
;
84 struct panfrost_blend_state
{
85 struct pipe_blend_state base
;
87 struct panfrost_blend_rt rt
[PIPE_MAX_COLOR_BUFS
];
90 /* Container for a final blend state, specialized to constants and a
91 * framebuffer formats. */
93 struct panfrost_blend_final
{
94 /* Set for a shader, clear for an equation */
98 struct panfrost_blend_shader_final shader
;
99 struct panfrost_blend_equation_final equation
;
104 panfrost_blend_context_init(struct pipe_context
*pipe
);
106 struct panfrost_blend_final
107 panfrost_get_blend_for_context(struct panfrost_context
*ctx
, unsigned rt
);