1 /* 2 * Copyright 2010 Jerome Glisse <glisse@freedesktop.org> 3 * 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 * on the rights to use, copy, modify, merge, publish, distribute, sub 8 * license, and/or sell copies of the Software, and to permit persons to whom 9 * the Software is furnished to do so, subject to the following conditions: 10 * 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 13 * Software. 14 * 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 NON-INFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 21 * USE OR OTHER DEALINGS IN THE SOFTWARE. 22 */ 23 #ifndef R600_SHADER_H 24 #define R600_SHADER_H 25 26 #include "r600_pipe.h" 27 #include "r600_shader_common.h" 28 29 #include <assert.h> 30 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 static_assert( 37 R600_SHADER_MAX_INPUTS >= PIPE_MAX_SHADER_INPUTS, 38 "Assuming that all Gallium shader inputs can fit into r600_shader inputs"); 39 static_assert( 40 R600_SHADER_MAX_OUTPUTS >= PIPE_MAX_SHADER_OUTPUTS, 41 "Assuming that all Gallium shader outputs can fit into r600_shader outputs"); 42 43 struct r600_pipe_shader { 44 struct r600_pipe_shader_selector *selector; 45 struct r600_pipe_shader *next_variant; 46 /* for GS - corresponding copy shader (installed as VS) */ 47 struct r600_pipe_shader *gs_copy_shader; 48 struct r600_shader shader; 49 struct r600_command_buffer command_buffer; /* register writes */ 50 struct r600_resource *bo; 51 unsigned sprite_coord_enable; 52 unsigned flatshade; 53 unsigned msaa; 54 unsigned pa_cl_vs_out_cntl; 55 unsigned nr_ps_color_outputs; 56 unsigned ps_color_export_mask; 57 58 union r600_shader_key key; 59 unsigned db_shader_control; 60 unsigned ps_depth_export; 61 unsigned enabled_stream_buffers_mask; 62 unsigned scratch_space_needed; /* size of scratch space (if > 0) counted in vec4 */ 63 }; 64 65 void *r600_create_vertex_fetch_shader(struct pipe_context *ctx, 66 unsigned count, 67 const struct pipe_vertex_element *elements); 68 69 /* return the table index 0-5 for TGSI_INTERPOLATE_LINEAR/PERSPECTIVE and 70 TGSI_INTERPOLATE_LOC_CENTER/SAMPLE/COUNT. Other input values return -1. */ 71 int eg_get_interpolator_index(unsigned interpolate, unsigned location); 72 73 int r600_get_lds_unique_index(unsigned semantic_name, unsigned index); 74 75 int generate_gs_copy_shader(struct r600_context *rctx, 76 struct r600_pipe_shader *gs, 77 struct pipe_stream_output_info *so); 78 79 #ifdef __cplusplus 80 } // extern "C" 81 #endif 82 83 84 #endif 85