From bdbe77f9c6f06cfaa155f27c2ade3c523d7fbea7 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 24 Jan 2011 17:47:10 -0500 Subject: gallium: implement modern sampling scheme largely a merge of the previously discussed origin/gallium-resource-sampling but updated. the idea is to allow arbitrary binding of resources, the way opencl, new gl versions and dx10+ require, i.e. DCL RES[0], 2D, FLOAT LOAD DST[0], SRC[0], RES[0] SAMPLE DST[0], SRC[0], RES[0], SAMP[0] --- src/gallium/include/pipe/p_format.h | 10 ++++++++++ src/gallium/include/pipe/p_shader_tokens.h | 26 +++++++++++++++++++++++++- src/gallium/include/pipe/p_state.h | 1 + 3 files changed, 36 insertions(+), 1 deletion(-) (limited to 'src/gallium/include') diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index 74a9939df7..c8904d4f16 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -33,6 +33,16 @@ extern "C" { #endif + +enum pipe_type { + PIPE_TYPE_UNORM = 0, + PIPE_TYPE_SNORM, + PIPE_TYPE_SINT, + PIPE_TYPE_UINT, + PIPE_TYPE_FLOAT, + PIPE_TYPE_COUNT +}; + /** * Texture/surface image formats (preliminary) */ diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index 0a9e14154d..6e5a48b3a6 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -75,6 +75,7 @@ enum tgsi_file_type { TGSI_FILE_SYSTEM_VALUE =9, TGSI_FILE_IMMEDIATE_ARRAY =10, TGSI_FILE_TEMPORARY_ARRAY =11, + TGSI_FILE_RESOURCE =12, TGSI_FILE_COUNT /**< how many TGSI_FILE_ types */ }; @@ -153,6 +154,14 @@ struct tgsi_declaration_semantic unsigned Padding : 8; }; +struct tgsi_declaration_resource { + unsigned Resource : 8; /**< one of TGSI_TEXTURE_ */ + unsigned ReturnTypeX : 6; /**< one of enum pipe_type */ + unsigned ReturnTypeY : 6; /**< one of enum pipe_type */ + unsigned ReturnTypeZ : 6; /**< one of enum pipe_type */ + unsigned ReturnTypeW : 6; /**< one of enum pipe_type */ +}; + #define TGSI_IMM_FLOAT32 0 #define TGSI_IMM_UINT32 1 #define TGSI_IMM_INT32 2 @@ -339,7 +348,22 @@ struct tgsi_property_data { #define TGSI_OPCODE_CASE 142 #define TGSI_OPCODE_DEFAULT 143 #define TGSI_OPCODE_ENDSWITCH 144 -#define TGSI_OPCODE_LAST 145 + +/* resource related opcodes */ +#define TGSI_OPCODE_LOAD 145 +#define TGSI_OPCODE_LOAD_MS 146 +#define TGSI_OPCODE_SAMPLE 147 +#define TGSI_OPCODE_SAMPLE_B 148 +#define TGSI_OPCODE_SAMPLE_C 149 +#define TGSI_OPCODE_SAMPLE_C_LZ 150 +#define TGSI_OPCODE_SAMPLE_D 151 +#define TGSI_OPCODE_SAMPLE_L 152 +#define TGSI_OPCODE_GATHER4 153 +#define TGSI_OPCODE_RESINFO 154 +#define TGSI_OPCODE_SAMPLE_POS 155 +#define TGSI_OPCODE_SAMPLE_INFO 156 + +#define TGSI_OPCODE_LAST 157 #define TGSI_SAT_NONE 0 /* do not saturate */ #define TGSI_SAT_ZERO_ONE 1 /* clamp to [0,1] */ diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 226ae8667b..d5c767add6 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -62,6 +62,7 @@ extern "C" { #define PIPE_MAX_GEOMETRY_SAMPLERS 16 #define PIPE_MAX_SHADER_INPUTS 32 #define PIPE_MAX_SHADER_OUTPUTS 32 +#define PIPE_MAX_SHADER_RESOURCES 32 #define PIPE_MAX_TEXTURE_LEVELS 16 #define PIPE_MAX_SO_BUFFERS 4 -- cgit v1.2.3