diff options
Diffstat (limited to 'src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h')
-rw-r--r-- | src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h | 404 |
1 files changed, 2 insertions, 402 deletions
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h index 2761b794d59..6ab9b820e8f 100644 --- a/src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h +++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h @@ -36,376 +36,13 @@ #include <iostream> #include "le32.h" -/* This is an independent implementation of definitions and tools for the - * "tokenized program format" (TPF) bytecode documented in the - * d3d11TokenizedProgramFormat.hpp header in the Windows Driver Development kit - */ - -enum tpf_opcode { - // Shader Model 4.0 (Direct3D 10.0) - - TPF_OPCODE_ADD, - TPF_OPCODE_AND, - TPF_OPCODE_BREAK, - TPF_OPCODE_BREAKC, - TPF_OPCODE_CALL, - TPF_OPCODE_CALLC, - TPF_OPCODE_CASE, - TPF_OPCODE_CONTINUE, - TPF_OPCODE_CONTINUEC, - TPF_OPCODE_CUT, - TPF_OPCODE_DEFAULT, - TPF_OPCODE_DERIV_RTX, - TPF_OPCODE_DERIV_RTY, - TPF_OPCODE_DISCARD, - TPF_OPCODE_DIV, - TPF_OPCODE_DP2, - TPF_OPCODE_DP3, - TPF_OPCODE_DP4, - TPF_OPCODE_ELSE, - TPF_OPCODE_EMIT, - TPF_OPCODE_EMITTHENCUT, - TPF_OPCODE_ENDIF, - TPF_OPCODE_ENDLOOP, - TPF_OPCODE_ENDSWITCH, - TPF_OPCODE_EQ, - TPF_OPCODE_EXP, - TPF_OPCODE_FRC, - TPF_OPCODE_FTOI, - TPF_OPCODE_FTOU, - TPF_OPCODE_GE, - TPF_OPCODE_IADD, - TPF_OPCODE_IF, - TPF_OPCODE_IEQ, - TPF_OPCODE_IGE, - TPF_OPCODE_ILT, - TPF_OPCODE_IMAD, - TPF_OPCODE_IMAX, - TPF_OPCODE_IMIN, - TPF_OPCODE_IMUL, - TPF_OPCODE_INE, - TPF_OPCODE_INEG, - TPF_OPCODE_ISHL, - TPF_OPCODE_ISHR, - TPF_OPCODE_ITOF, - TPF_OPCODE_LABEL, - TPF_OPCODE_LD, - TPF_OPCODE_LD_MS, - TPF_OPCODE_LOG, - TPF_OPCODE_LOOP, - TPF_OPCODE_LT, - TPF_OPCODE_MAD, - TPF_OPCODE_MIN, - TPF_OPCODE_MAX, - TPF_OPCODE_CUSTOMDATA, - TPF_OPCODE_MOV, - TPF_OPCODE_MOVC, - TPF_OPCODE_MUL, - TPF_OPCODE_NE, - TPF_OPCODE_NOP, - TPF_OPCODE_NOT, - TPF_OPCODE_OR, - TPF_OPCODE_RESINFO, - TPF_OPCODE_RET, - TPF_OPCODE_RETC, - TPF_OPCODE_ROUND_NE, - TPF_OPCODE_ROUND_NI, - TPF_OPCODE_ROUND_PI, - TPF_OPCODE_ROUND_Z, - TPF_OPCODE_RSQ, - TPF_OPCODE_SAMPLE, - TPF_OPCODE_SAMPLE_C, - TPF_OPCODE_SAMPLE_C_LZ, - TPF_OPCODE_SAMPLE_L, - TPF_OPCODE_SAMPLE_D, - TPF_OPCODE_SAMPLE_B, - TPF_OPCODE_SQRT, - TPF_OPCODE_SWITCH, - TPF_OPCODE_SINCOS, - TPF_OPCODE_UDIV, - TPF_OPCODE_ULT, - TPF_OPCODE_UGE, - TPF_OPCODE_UMUL, - TPF_OPCODE_UMAD, - TPF_OPCODE_UMAX, - TPF_OPCODE_UMIN, - TPF_OPCODE_USHR, - TPF_OPCODE_UTOF, - TPF_OPCODE_XOR, - - // these have custom formats - TPF_OPCODE_DCL_RESOURCE, - TPF_OPCODE_DCL_CONSTANT_BUFFER, - TPF_OPCODE_DCL_SAMPLER, - TPF_OPCODE_DCL_INDEX_RANGE, - TPF_OPCODE_DCL_GS_OUTPUT_PRIMITIVE_TOPOLOGY, - TPF_OPCODE_DCL_GS_INPUT_PRIMITIVE, - TPF_OPCODE_DCL_MAX_OUTPUT_VERTEX_COUNT, - TPF_OPCODE_DCL_INPUT, - TPF_OPCODE_DCL_INPUT_SGV, - TPF_OPCODE_DCL_INPUT_SIV, - TPF_OPCODE_DCL_INPUT_PS, - TPF_OPCODE_DCL_INPUT_PS_SGV, - TPF_OPCODE_DCL_INPUT_PS_SIV, - TPF_OPCODE_DCL_OUTPUT, - TPF_OPCODE_DCL_OUTPUT_SGV, - TPF_OPCODE_DCL_OUTPUT_SIV, - TPF_OPCODE_DCL_TEMPS, - TPF_OPCODE_DCL_INDEXABLE_TEMP, - TPF_OPCODE_DCL_GLOBAL_FLAGS, - - TPF_OPCODE_D3D10_COUNT, // this is really a reserved opcode... - - // Shader Model 4.1 (Direct3D 10.1) - - TPF_OPCODE_LOD, - TPF_OPCODE_GATHER4, - TPF_OPCODE_SAMPLE_POS, - TPF_OPCODE_SAMPLE_INFO, - - TPF_OPCODE_D3D10_1_COUNT, // this is really a reserved opcode... - - // Shader Model 5.0 (Direct3D 11) - - // HS subshader beginning markers - TPF_OPCODE_HS_DECLS, - TPF_OPCODE_HS_CONTROL_POINT_PHASE, - TPF_OPCODE_HS_FORK_PHASE, - TPF_OPCODE_HS_JOIN_PHASE, - - TPF_OPCODE_EMIT_STREAM, - TPF_OPCODE_CUT_STREAM, - TPF_OPCODE_EMITTHENCUT_STREAM, - TPF_OPCODE_INTERFACE_CALL, - - TPF_OPCODE_BUFINFO, - TPF_OPCODE_DERIV_RTX_COARSE, - TPF_OPCODE_DERIV_RTX_FINE, - TPF_OPCODE_DERIV_RTY_COARSE, - TPF_OPCODE_DERIV_RTY_FINE, - TPF_OPCODE_GATHER4_C, - TPF_OPCODE_GATHER4_PO, - TPF_OPCODE_GATHER4_PO_C, - TPF_OPCODE_RCP, - TPF_OPCODE_F32TOF16, - TPF_OPCODE_F16TOF32, - TPF_OPCODE_UADDC, - TPF_OPCODE_USUBB, - TPF_OPCODE_COUNTBITS, - TPF_OPCODE_FIRSTBIT_HI, - TPF_OPCODE_FIRSTBIT_LO, - TPF_OPCODE_FIRSTBIT_SHI, - TPF_OPCODE_UBFE, - TPF_OPCODE_IBFE, - TPF_OPCODE_BFI, - TPF_OPCODE_BFREV, - TPF_OPCODE_SWAPC, - - // these have custom formats - TPF_OPCODE_DCL_STREAM, - TPF_OPCODE_DCL_FUNCTION_BODY, - TPF_OPCODE_DCL_FUNCTION_TABLE, - TPF_OPCODE_DCL_INTERFACE, - - // these have custom formats - TPF_OPCODE_DCL_INPUT_CONTROL_POINT_COUNT, - TPF_OPCODE_DCL_OUTPUT_CONTROL_POINT_COUNT, - TPF_OPCODE_DCL_TESS_DOMAIN, - TPF_OPCODE_DCL_TESS_PARTITIONING, - TPF_OPCODE_DCL_TESS_OUTPUT_PRIMITIVE, - TPF_OPCODE_DCL_HS_MAX_TESSFACTOR, - TPF_OPCODE_DCL_HS_FORK_PHASE_INSTANCE_COUNT, - TPF_OPCODE_DCL_HS_JOIN_PHASE_INSTANCE_COUNT, - - // these have custom formats - TPF_OPCODE_DCL_THREAD_GROUP, - TPF_OPCODE_DCL_UNORDERED_ACCESS_VIEW_TYPED, - TPF_OPCODE_DCL_UNORDERED_ACCESS_VIEW_RAW, - TPF_OPCODE_DCL_UNORDERED_ACCESS_VIEW_STRUCTURED, - TPF_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_RAW, - TPF_OPCODE_DCL_THREAD_GROUP_SHARED_MEMORY_STRUCTURED, - TPF_OPCODE_DCL_RESOURCE_RAW, - TPF_OPCODE_DCL_RESOURCE_STRUCTURED, - - TPF_OPCODE_LD_UAV_TYPED, - TPF_OPCODE_STORE_UAV_TYPED, - TPF_OPCODE_LD_RAW, - TPF_OPCODE_STORE_RAW, - TPF_OPCODE_LD_STRUCTURED, - TPF_OPCODE_STORE_STRUCTURED, - - TPF_OPCODE_ATOMIC_AND, - TPF_OPCODE_ATOMIC_OR, - TPF_OPCODE_ATOMIC_XOR, - TPF_OPCODE_ATOMIC_CMP_STORE, - TPF_OPCODE_ATOMIC_IADD, - TPF_OPCODE_ATOMIC_IMAX, - TPF_OPCODE_ATOMIC_IMIN, - TPF_OPCODE_ATOMIC_UMAX, - TPF_OPCODE_ATOMIC_UMIN, - - TPF_OPCODE_IMM_ATOMIC_ALLOC, - TPF_OPCODE_IMM_ATOMIC_CONSUME, - TPF_OPCODE_IMM_ATOMIC_IADD, - TPF_OPCODE_IMM_ATOMIC_AND, - TPF_OPCODE_IMM_ATOMIC_OR, - TPF_OPCODE_IMM_ATOMIC_XOR, - TPF_OPCODE_IMM_ATOMIC_EXCH, - TPF_OPCODE_IMM_ATOMIC_CMP_EXCH, - TPF_OPCODE_IMM_ATOMIC_IMAX, - TPF_OPCODE_IMM_ATOMIC_IMIN, - TPF_OPCODE_IMM_ATOMIC_UMAX, - TPF_OPCODE_IMM_ATOMIC_UMIN, - - TPF_OPCODE_SYNC, - - TPF_OPCODE_DADD, - TPF_OPCODE_DMAX, - TPF_OPCODE_DMIN, - TPF_OPCODE_DMUL, - TPF_OPCODE_DEQ, - TPF_OPCODE_DGE, - TPF_OPCODE_DLT, - TPF_OPCODE_DNE, - TPF_OPCODE_DMOV, - TPF_OPCODE_DMOVC, - - TPF_OPCODE_DTOF, - TPF_OPCODE_FTOD, - - TPF_OPCODE_EVAL_SNAPPED, - TPF_OPCODE_EVAL_SAMPLE_INDEX, - TPF_OPCODE_EVAL_CENTROID, - - TPF_OPCODE_DCL_GS_INSTANCE_COUNT, - - TPF_OPCODE_D3D11_COUNT -}; +#include "tpf_defs.h" extern const char* tpf_opcode_names[]; - -enum tpf_file -{ - TPF_FILE_TEMP = 0, - TPF_FILE_INPUT = 1, - TPF_FILE_OUTPUT = 2, - TPF_FILE_INDEXABLE_TEMP = 3, - TPF_FILE_IMMEDIATE32 = 4, // one 32-bit value for each component follows - TPF_FILE_IMMEDIATE64 = 5, // one 64-bit value for each component follows - TPF_FILE_SAMPLER = 6, - TPF_FILE_RESOURCE = 7, - TPF_FILE_CONSTANT_BUFFER= 8, - TPF_FILE_IMMEDIATE_CONSTANT_BUFFER= 9, - TPF_FILE_LABEL = 10, - TPF_FILE_INPUT_PRIMITIVEID = 11, - TPF_FILE_OUTPUT_DEPTH = 12, - TPF_FILE_NULL = 13, - - // Added in D3D10.1 - - TPF_FILE_RASTERIZER = 14, - TPF_FILE_OUTPUT_COVERAGE_MASK = 15, - - // Added in D3D11 - - TPF_FILE_STREAM = 16, - TPF_FILE_FUNCTION_BODY = 17, - TPF_FILE_FUNCTION_TABLE = 18, - TPF_FILE_INTERFACE = 19, - TPF_FILE_FUNCTION_INPUT = 20, - TPF_FILE_FUNCTION_OUTPUT = 21, - TPF_FILE_OUTPUT_CONTROL_POINT_ID = 22, - TPF_FILE_INPUT_FORK_INSTANCE_ID = 23, - TPF_FILE_INPUT_JOIN_INSTANCE_ID = 24, - TPF_FILE_INPUT_CONTROL_POINT = 25, - TPF_FILE_OUTPUT_CONTROL_POINT = 26, - TPF_FILE_INPUT_PATCH_CONSTANT = 27, - TPF_FILE_INPUT_DOMAIN_POINT = 28, - TPF_FILE_THIS_POINTER = 29, - TPF_FILE_UNORDERED_ACCESS_VIEW = 30, - TPF_FILE_THREAD_GROUP_SHARED_MEMORY = 31, - TPF_FILE_INPUT_THREAD_ID = 32, - TPF_FILE_INPUT_THREAD_GROUP_ID = 33, - TPF_FILE_INPUT_THREAD_ID_IN_GROUP = 34, - TPF_FILE_INPUT_COVERAGE_MASK = 35, - TPF_FILE_INPUT_THREAD_ID_IN_GROUP_FLATTENED = 36, - TPF_FILE_INPUT_GS_INSTANCE_ID = 37, - TPF_FILE_OUTPUT_DEPTH_GREATER_EQUAL = 38, - TPF_FILE_OUTPUT_DEPTH_LESS_EQUAL = 39, - TPF_FILE_CYCLE_COUNTER = 40, - - TPF_FILE_COUNT = 41, -}; - extern const char* tpf_file_names[]; extern const char* tpf_file_ms_names[]; - -enum tpf_target -{ - TPF_TARGET_UNKNOWN = 0, - TPF_TARGET_BUFFER = 1, - TPF_TARGET_TEXTURE1D = 2, - TPF_TARGET_TEXTURE2D = 3, - TPF_TARGET_TEXTURE2DMS = 4, - TPF_TARGET_TEXTURE3D = 5, - TPF_TARGET_TEXTURECUBE = 6, - TPF_TARGET_TEXTURE1DARRAY = 7, - TPF_TARGET_TEXTURE2DARRAY = 8, - TPF_TARGET_TEXTURE2DMSARRAY = 9, - TPF_TARGET_TEXTURECUBEARRAY = 10, - - // Added in D3D11 - TPF_TARGET_RAW_BUFFER = 11, - TPF_TARGET_STRUCTURED_BUFFER = 12, -}; - extern const char* tpf_target_names[]; - -enum tpf_interpolation -{ - TPF_INTERPOLATION_UNDEFINED = 0, - TPF_INTERPOLATION_CONSTANT = 1, - TPF_INTERPOLATION_LINEAR = 2, - TPF_INTERPOLATION_LINEAR_CENTROID = 3, - TPF_INTERPOLATION_LINEAR_NOPERSPECTIVE = 4, - TPF_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID = 5, - - // Added in D3D10.1 - TPF_INTERPOLATION_LINEAR_SAMPLE = 6, - TPF_INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE = 7, -}; - extern const char* tpf_interpolation_names[]; - -enum tpf_sv -{ - TPF_SV_UNDEFINED, - TPF_SV_POSITION, - TPF_SV_CLIP_DISTANCE, - TPF_SV_CULL_DISTANCE, - TPF_SV_RENDER_TARGET_ARRAY_INDEX, - TPF_SV_VIEWPORT_ARRAY_INDEX, - TPF_SV_VERTEX_ID, - TPF_SV_PRIMITIVE_ID, - TPF_SV_INSTANCE_ID, - TPF_SV_IS_FRONT_FACE, - TPF_SV_SAMPLE_INDEX, - - // Added in D3D11 - TPF_SV_FINAL_QUAD_U_EQ_0_EDGE_TESSFACTOR, - TPF_SV_FINAL_QUAD_V_EQ_0_EDGE_TESSFACTOR, - TPF_SV_FINAL_QUAD_U_EQ_1_EDGE_TESSFACTOR, - TPF_SV_FINAL_QUAD_V_EQ_1_EDGE_TESSFACTOR, - TPF_SV_FINAL_QUAD_U_INSIDE_TESSFACTOR, - TPF_SV_FINAL_QUAD_V_INSIDE_TESSFACTOR, - TPF_SV_FINAL_TRI_U_EQ_0_EDGE_TESSFACTOR, - TPF_SV_FINAL_TRI_V_EQ_0_EDGE_TESSFACTOR, - TPF_SV_FINAL_TRI_W_EQ_0_EDGE_TESSFACTOR, - TPF_SV_FINAL_TRI_INSIDE_TESSFACTOR, - TPF_SV_FINAL_LINE_DETAIL_TESSFACTOR, - TPF_SV_FINAL_LINE_DENSITY_TESSFACTOR, -}; - extern const char* tpf_sv_names[]; struct tpf_token_version @@ -518,14 +155,6 @@ struct tpf_token_instruction }; }; -enum tpf_token_instruction_extended_type -{ - TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_EMPTY = 0, - TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_SAMPLE_CONTROLS = 1, - TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_RESOURCE_DIM = 2, - TPF_TOKEN_INSTRUCTION_EXTENDED_TYPE_RESOURCE_RETURN_TYPE = 3, -}; - union tpf_token_instruction_extended { struct @@ -565,30 +194,6 @@ struct tpf_token_resource_return_type unsigned w : 4; }; -enum tpf_operand_comps -{ - TPF_OPERAND_COMPS_0 = 0, - TPF_OPERAND_COMPS_1 = 1, - TPF_OPERAND_COMPS_4 = 2, - TPF_OPERAND_COMPS_N = 3 -}; - -enum tpf_operand_mode -{ - TPF_OPERAND_MODE_MASK = 0, - TPF_OPERAND_MODE_SWIZZLE = 1, - TPF_OPERAND_MODE_SCALAR = 2 -}; - -enum tpf_operand_index_repr -{ - TPF_OPERAND_INDEX_REPR_IMM32 = 0, - TPF_OPERAND_INDEX_REPR_IMM64 = 1, - TPF_OPERAND_INDEX_REPR_REG = 2, - TPF_OPERAND_INDEX_REPR_REG_IMM32 = 3, - TPF_OPERAND_INDEX_REPR_REG_IMM64 = 4, -}; - struct tpf_token_operand { unsigned comps_enum : 2; /* tpf_operands_comps */ @@ -606,12 +211,6 @@ struct tpf_token_operand #define TPF_OPERAND_SEL_SWZ(sel, i) (((sel) >> ((i) * 2)) & 3) #define TPF_OPERAND_SEL_SCALAR(sel) ((sel) & 3) -enum tpf_token_operand_extended_type -{ - TPF_TOKEN_OPERAND_EXTENDED_TYPE_EMPTY = 0, - TPF_TOKEN_OPERAND_EXTENDED_TYPE_MODIFIER = 1, -}; - struct tpf_token_operand_extended { unsigned type : 6; @@ -806,3 +405,4 @@ bool tpf_find_labels(tpf_program& program); bool tpf_allocate_resource_sampler_pairs(tpf_program& program); #endif /* TPF_H_ */ + |