1 /**************************************************************************
3 * Copyright 2015 Advanced Micro Devices, Inc.
4 * Copyright 2008 VMware, Inc.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * on the rights to use, copy, modify, merge, publish, distribute, sub
11 * license, and/or sell copies of the Software, and to permit persons to whom
12 * the Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice (including the next
15 * paragraph) shall be included in all copies or substantial portions of the
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
31 #include "pipe/p_context.h"
32 #include "pipe/p_state.h"
33 #include "pipe/p_screen.h"
35 /* name of the directory in home */
36 #define DD_DIR "ddebug_dumps"
45 struct pipe_screen base
;
46 struct pipe_screen
*screen
;
55 struct pipe_query
*query
;
63 struct pipe_blend_state blend
;
64 struct pipe_depth_stencil_alpha_state dsa
;
65 struct pipe_rasterizer_state rs
;
66 struct pipe_sampler_state sampler
;
68 struct pipe_vertex_element velems
[PIPE_MAX_ATTRIBS
];
71 struct pipe_shader_state shader
;
77 struct pipe_context base
;
78 struct pipe_context
*pipe
;
81 struct dd_query
*query
;
86 struct pipe_index_buffer index_buffer
;
87 struct pipe_vertex_buffer vertex_buffers
[PIPE_MAX_ATTRIBS
];
89 unsigned num_so_targets
;
90 struct pipe_stream_output_target
*so_targets
[PIPE_MAX_SO_BUFFERS
];
91 unsigned so_offsets
[PIPE_MAX_SO_BUFFERS
];
93 struct dd_state
*shaders
[PIPE_SHADER_TYPES
];
94 struct pipe_constant_buffer constant_buffers
[PIPE_SHADER_TYPES
][PIPE_MAX_CONSTANT_BUFFERS
];
95 struct pipe_sampler_view
*sampler_views
[PIPE_SHADER_TYPES
][PIPE_MAX_SAMPLERS
];
96 struct dd_state
*sampler_states
[PIPE_SHADER_TYPES
][PIPE_MAX_SAMPLERS
];
97 struct pipe_image_view
*shader_images
[PIPE_SHADER_TYPES
][PIPE_MAX_SHADER_IMAGES
];
98 struct pipe_shader_buffer shader_buffers
[PIPE_SHADER_TYPES
][PIPE_MAX_SHADER_BUFFERS
];
100 struct dd_state
*velems
;
102 struct dd_state
*dsa
;
103 struct dd_state
*blend
;
105 struct pipe_blend_color blend_color
;
106 struct pipe_stencil_ref stencil_ref
;
107 unsigned sample_mask
;
108 unsigned min_samples
;
109 struct pipe_clip_state clip_state
;
110 struct pipe_framebuffer_state framebuffer_state
;
111 struct pipe_poly_stipple polygon_stipple
;
112 struct pipe_scissor_state scissors
[PIPE_MAX_VIEWPORTS
];
113 struct pipe_viewport_state viewports
[PIPE_MAX_VIEWPORTS
];
114 float tess_default_levels
[6];
118 struct pipe_context
*
119 dd_context_create(struct dd_screen
*dscreen
, struct pipe_context
*pipe
);
122 dd_init_draw_functions(struct dd_context
*dctx
);
125 static inline struct dd_context
*
126 dd_context(struct pipe_context
*pipe
)
128 return (struct dd_context
*)pipe
;
131 static inline struct dd_screen
*
132 dd_screen(struct pipe_screen
*screen
)
134 return (struct dd_screen
*)screen
;
138 #define CTX_INIT(_member) \
139 dctx->base._member = dctx->pipe->_member ? dd_context_##_member : NULL