1 /* 2 * Copyright 2010 Jerome Glisse <[email protected]> 3 * SPDX-License-Identifier: MIT 4 */ 5 6 #ifndef R600_SHADER_H 7 #define R600_SHADER_H 8 9 #include "r600_pipe.h" 10 #include "r600_shader_common.h" 11 12 #include <assert.h> 13 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 static_assert( 20 R600_SHADER_MAX_INPUTS >= PIPE_MAX_SHADER_INPUTS, 21 "Assuming that all Gallium shader inputs can fit into r600_shader inputs"); 22 static_assert( 23 R600_SHADER_MAX_OUTPUTS >= PIPE_MAX_SHADER_OUTPUTS, 24 "Assuming that all Gallium shader outputs can fit into r600_shader outputs"); 25 26 struct r600_pipe_shader { 27 struct r600_pipe_shader_selector *selector; 28 struct r600_pipe_shader *next_variant; 29 /* for GS - corresponding copy shader (installed as VS) */ 30 struct r600_pipe_shader *gs_copy_shader; 31 struct r600_shader shader; 32 struct r600_command_buffer command_buffer; /* register writes */ 33 struct r600_resource *bo; 34 unsigned sprite_coord_enable; 35 unsigned flatshade; 36 unsigned msaa; 37 unsigned pa_cl_vs_out_cntl; 38 unsigned nr_ps_color_outputs; 39 unsigned ps_color_export_mask; 40 41 union r600_shader_key key; 42 unsigned db_shader_control; 43 unsigned ps_depth_export; 44 unsigned enabled_stream_buffers_mask; 45 unsigned scratch_space_needed; /* size of scratch space (if > 0) counted in vec4 */ 46 }; 47 48 void *r600_create_vertex_fetch_shader(struct pipe_context *ctx, 49 unsigned count, 50 const struct pipe_vertex_element *elements); 51 52 /* return the table index 0-5 for TGSI_INTERPOLATE_LINEAR/PERSPECTIVE and 53 TGSI_INTERPOLATE_LOC_CENTER/SAMPLE/COUNT. Other input values return -1. */ 54 int eg_get_interpolator_index(unsigned interpolate, unsigned location); 55 56 int r600_get_lds_unique_index(unsigned semantic_name, unsigned index); 57 58 int generate_gs_copy_shader(struct r600_context *rctx, 59 struct r600_pipe_shader *gs, 60 struct pipe_stream_output_info *so); 61 62 #ifdef __cplusplus 63 } // extern "C" 64 #endif 65 66 67 #endif 68