This should decrease the size of some memory allocations.
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23487>
struct pipe_sampler_view **views,
unsigned num)
{
- assert(shader_stage < PIPE_SHADER_TYPES);
+ assert(shader_stage < DRAW_MAX_SHADER_STAGE);
assert(num <= PIPE_MAX_SHADER_SAMPLER_VIEWS);
draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE);
struct pipe_sampler_state **samplers,
unsigned num)
{
- assert(shader_stage < PIPE_SHADER_TYPES);
+ assert(shader_stage < DRAW_MAX_SHADER_STAGE);
assert(num <= PIPE_MAX_SAMPLERS);
draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE);
struct pipe_image_view *views,
unsigned num)
{
- assert(shader_stage < PIPE_SHADER_TYPES);
+ assert(shader_stage < DRAW_MAX_SHADER_STAGE);
assert(num <= PIPE_MAX_SHADER_IMAGES);
draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE);
{
struct lp_jit_texture *jit_tex;
- assert (shader_stage >= PIPE_SHADER_VERTEX &&
- shader_stage <= PIPE_SHADER_GEOMETRY);
+ assert(shader_stage < DRAW_MAX_SHADER_STAGE);
assert(sview_idx < ARRAY_SIZE(draw->llvm->jit_resources[shader_stage].textures));
jit_tex = &draw->llvm->jit_resources[shader_stage].textures[sview_idx];
{
struct lp_jit_image *jit_image;
- assert (shader_stage >= PIPE_SHADER_VERTEX &&
- shader_stage <= PIPE_SHADER_GEOMETRY);
+ assert(shader_stage < DRAW_MAX_SHADER_STAGE);
assert(idx < ARRAY_SIZE(draw->llvm->jit_resources[shader_stage].images));
jit_image = &draw->llvm->jit_resources[shader_stage].images[idx];
draw_llvm_set_sampler_state(struct draw_context *draw,
enum pipe_shader_type shader_type)
{
- assert (shader_type >= PIPE_SHADER_VERTEX &&
- shader_type <= PIPE_SHADER_GEOMETRY);
+ assert(shader_type < DRAW_MAX_SHADER_STAGE);
for (unsigned i = 0; i < draw->num_samplers[shader_type]; i++) {
struct lp_jit_sampler *jit_sam = &draw->llvm->jit_resources[shader_type].samplers[i];
struct draw_vs_jit_context vs_jit_context;
struct draw_gs_jit_context gs_jit_context;
- struct lp_jit_resources jit_resources[PIPE_SHADER_GEOMETRY + 1];
+ struct lp_jit_resources jit_resources[DRAW_MAX_SHADER_STAGE];
struct draw_llvm_variant_list_item vs_variants_list;
int nr_variants;
struct gallivm_state;
#endif
+/**
+ * The max stage the draw stores resources for.
+ * i.e. vs, tcs, tes, gs. no fs/cs/ms/ts.
+ */
+#define DRAW_MAX_SHADER_STAGE (PIPE_SHADER_GEOMETRY + 1)
/**
* The largest possible index of a vertex that can be fetched.
struct draw_vertex_buffer vbuffer[PIPE_MAX_ATTRIBS];
/** constant buffers for each shader stage */
- struct draw_buffer_info constants[PIPE_SHADER_GEOMETRY + 1][PIPE_MAX_CONSTANT_BUFFERS];
- struct draw_buffer_info ssbos[PIPE_SHADER_GEOMETRY + 1][PIPE_MAX_SHADER_BUFFERS];
+ struct draw_buffer_info constants[DRAW_MAX_SHADER_STAGE][PIPE_MAX_CONSTANT_BUFFERS];
+ struct draw_buffer_info ssbos[DRAW_MAX_SHADER_STAGE][PIPE_MAX_SHADER_BUFFERS];
/* pointer to planes */
float (*planes)[DRAW_TOTAL_CLIP_PLANES][4];
* we only handle vertex and geometry shaders in the draw module, but
* there may be more in the future (ex: hull and tessellation).
*/
- struct pipe_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_SAMPLER_VIEWS];
- unsigned num_sampler_views[PIPE_SHADER_TYPES];
- const struct pipe_sampler_state *samplers[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
- unsigned num_samplers[PIPE_SHADER_TYPES];
+ struct pipe_sampler_view *sampler_views[DRAW_MAX_SHADER_STAGE][PIPE_MAX_SHADER_SAMPLER_VIEWS];
+ unsigned num_sampler_views[DRAW_MAX_SHADER_STAGE];
+ const struct pipe_sampler_state *samplers[DRAW_MAX_SHADER_STAGE][PIPE_MAX_SAMPLERS];
+ unsigned num_samplers[DRAW_MAX_SHADER_STAGE];
- struct pipe_image_view *images[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_IMAGES];
- unsigned num_images[PIPE_SHADER_TYPES];
+ struct pipe_image_view *images[DRAW_MAX_SHADER_STAGE][PIPE_MAX_SHADER_IMAGES];
+ unsigned num_images[DRAW_MAX_SHADER_STAGE];
struct pipe_query_data_pipeline_statistics statistics;
boolean collect_statistics;