2010-05-08 21:09:24 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
|
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
|
|
|
|
* license, and/or sell copies of the Software, and to permit persons to whom
|
|
|
|
|
* the Software is furnished to do so, subject to the following conditions:
|
|
|
|
|
*
|
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
|
* Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
|
* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
|
|
|
|
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
|
|
|
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
|
|
|
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
#ifndef R600_SHADER_H
|
|
|
|
|
#define R600_SHADER_H
|
|
|
|
|
|
2010-07-23 17:32:32 -04:00
|
|
|
#include "r600_asm.h"
|
2010-05-08 21:09:24 +01:00
|
|
|
|
|
|
|
|
struct r600_shader_io {
|
2010-07-23 17:32:32 -04:00
|
|
|
unsigned name;
|
|
|
|
|
unsigned gpr;
|
2010-08-06 16:10:25 -04:00
|
|
|
unsigned done;
|
2010-07-23 17:32:32 -04:00
|
|
|
int sid;
|
2011-11-05 08:48:02 +04:00
|
|
|
int spi_sid;
|
2010-07-28 19:59:38 -04:00
|
|
|
unsigned interpolate;
|
2013-01-23 21:30:02 +01:00
|
|
|
unsigned ij_index;
|
2010-10-14 13:29:11 +10:00
|
|
|
boolean centroid;
|
2010-10-14 14:40:51 +10:00
|
|
|
unsigned lds_pos; /* for evergreen */
|
2013-01-23 21:30:02 +01:00
|
|
|
unsigned back_color_input;
|
2012-01-15 09:29:50 -05:00
|
|
|
unsigned write_mask;
|
2013-08-02 06:38:23 +04:00
|
|
|
int ring_offset;
|
2010-05-08 21:09:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct r600_shader {
|
2010-07-23 17:32:32 -04:00
|
|
|
unsigned processor_type;
|
2011-08-16 19:35:10 +02:00
|
|
|
struct r600_bytecode bc;
|
2010-07-23 17:32:32 -04:00
|
|
|
unsigned ninput;
|
|
|
|
|
unsigned noutput;
|
2010-10-14 14:40:51 +10:00
|
|
|
unsigned nlds;
|
2013-05-02 05:08:08 +02:00
|
|
|
struct r600_shader_io input[40];
|
|
|
|
|
struct r600_shader_io output[40];
|
2010-09-15 11:47:32 -04:00
|
|
|
boolean uses_kill;
|
2011-01-31 10:01:06 +10:00
|
|
|
boolean fs_write_all;
|
2012-01-06 08:13:18 +04:00
|
|
|
boolean two_side;
|
2012-06-26 22:47:27 +04:00
|
|
|
/* Number of color outputs in the TGSI shader,
|
|
|
|
|
* sometimes it could be higher than nr_cbufs (bug?).
|
|
|
|
|
* Also with writes_all property on eg+ it will be set to max CB number */
|
|
|
|
|
unsigned nr_ps_max_color_exports;
|
|
|
|
|
/* Real number of ps color exports compiled in the bytecode */
|
|
|
|
|
unsigned nr_ps_color_exports;
|
2012-01-15 09:29:50 -05:00
|
|
|
/* bit n is set if the shader writes gl_ClipDistance[n] */
|
|
|
|
|
unsigned clip_dist_write;
|
|
|
|
|
/* flag is set if the shader writes VS_OUT_MISC_VEC (e.g. for PSIZE) */
|
|
|
|
|
boolean vs_out_misc_write;
|
2012-01-28 15:05:06 +01:00
|
|
|
boolean vs_out_point_size;
|
2014-01-28 13:04:00 +10:00
|
|
|
boolean vs_out_layer;
|
2014-01-31 08:06:25 +00:00
|
|
|
boolean vs_out_viewport;
|
2014-03-03 02:20:45 +01:00
|
|
|
boolean vs_out_edgeflag;
|
2012-11-03 20:53:33 +10:00
|
|
|
boolean has_txq_cube_array_z_comp;
|
2012-12-16 10:31:32 +00:00
|
|
|
boolean uses_tex_buffers;
|
2013-12-23 01:30:03 +00:00
|
|
|
boolean gs_prim_id_input;
|
2013-04-30 20:53:15 +04:00
|
|
|
|
2013-08-02 06:38:23 +04:00
|
|
|
/* geometry shader properties */
|
|
|
|
|
unsigned gs_input_prim;
|
|
|
|
|
unsigned gs_output_prim;
|
|
|
|
|
unsigned gs_max_out_vertices;
|
|
|
|
|
/* size in bytes of a data item in the ring (single vertex data) */
|
|
|
|
|
unsigned ring_item_size;
|
|
|
|
|
|
2013-04-30 20:53:15 +04:00
|
|
|
unsigned indirect_files;
|
|
|
|
|
unsigned max_arrays;
|
|
|
|
|
unsigned num_arrays;
|
2013-08-02 06:38:23 +04:00
|
|
|
unsigned vs_as_es;
|
2013-04-30 20:53:15 +04:00
|
|
|
struct r600_shader_array * arrays;
|
2010-05-08 21:09:24 +01:00
|
|
|
};
|
|
|
|
|
|
2012-10-12 18:30:51 +02:00
|
|
|
struct r600_shader_key {
|
|
|
|
|
unsigned color_two_side:1;
|
|
|
|
|
unsigned alpha_to_one:1;
|
|
|
|
|
unsigned nr_cbufs:4;
|
2013-08-02 06:38:23 +04:00
|
|
|
unsigned vs_as_es:1;
|
2012-10-12 18:30:51 +02:00
|
|
|
};
|
|
|
|
|
|
2013-04-30 20:53:15 +04:00
|
|
|
struct r600_shader_array {
|
|
|
|
|
unsigned gpr_start;
|
|
|
|
|
unsigned gpr_count;
|
|
|
|
|
unsigned comp_mask;
|
|
|
|
|
};
|
|
|
|
|
|
2012-10-12 18:30:51 +02:00
|
|
|
struct r600_pipe_shader {
|
|
|
|
|
struct r600_pipe_shader_selector *selector;
|
|
|
|
|
struct r600_pipe_shader *next_variant;
|
2013-08-02 06:38:23 +04:00
|
|
|
/* for GS - corresponding copy shader (installed as VS) */
|
|
|
|
|
struct r600_pipe_shader *gs_copy_shader;
|
2012-10-12 18:30:51 +02:00
|
|
|
struct r600_shader shader;
|
2013-02-28 17:27:36 +01:00
|
|
|
struct r600_command_buffer command_buffer; /* register writes */
|
2012-10-12 18:30:51 +02:00
|
|
|
struct r600_resource *bo;
|
|
|
|
|
unsigned sprite_coord_enable;
|
|
|
|
|
unsigned flatshade;
|
|
|
|
|
unsigned pa_cl_vs_out_cntl;
|
|
|
|
|
unsigned nr_ps_color_outputs;
|
|
|
|
|
struct r600_shader_key key;
|
|
|
|
|
unsigned db_shader_control;
|
|
|
|
|
unsigned ps_depth_export;
|
|
|
|
|
};
|
|
|
|
|
|
2010-05-08 21:09:24 +01:00
|
|
|
#endif
|