summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-09-23 13:17:45 +0200
committerLuca Barbieri <[email protected]>2010-09-23 16:06:02 +0200
commit75c29fe1c853d5d5e7be6af3187a4d4e36832f5b (patch)
tree48f7c28ccc85fccdfd9f7de56d40b428f80f00cd
parent22762012d1ab4060d8274c1007067c80bb8e806c (diff)
d3d1x: autogenerate shader enums and text from def files
This avoids the duplication in tpf.h and tpf_text.cpp
-rw-r--r--src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile6
-rw-r--r--src/gallium/state_trackers/d3d1x/d3d1xshader/defs/files.txt41
-rw-r--r--src/gallium/state_trackers/d3d1x/d3d1xshader/defs/interpolations.txt8
-rw-r--r--src/gallium/state_trackers/d3d1x/d3d1xshader/defs/opcodes.txt207
-rw-r--r--src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_compnums.txt5
-rw-r--r--src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_index_reprs.txt5
-rw-r--r--src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_modes.txt4
-rw-r--r--src/gallium/state_trackers/d3d1x/d3d1xshader/defs/shortfiles.txt41
-rw-r--r--src/gallium/state_trackers/d3d1x/d3d1xshader/defs/svs.txt23
-rw-r--r--src/gallium/state_trackers/d3d1x/d3d1xshader/defs/targets.txt13
-rw-r--r--src/gallium/state_trackers/d3d1x/d3d1xshader/defs/token_instruction_extended_types.txt4
-rw-r--r--src/gallium/state_trackers/d3d1x/d3d1xshader/defs/token_operand_extended_types.txt2
-rwxr-xr-xsrc/gallium/state_trackers/d3d1x/d3d1xshader/gen-header.sh13
-rwxr-xr-xsrc/gallium/state_trackers/d3d1x/d3d1xshader/gen-text.sh11
-rw-r--r--src/gallium/state_trackers/d3d1x/d3d1xshader/include/tpf.h404
-rw-r--r--src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_parse.cpp10
-rw-r--r--src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_text.cpp385
17 files changed, 390 insertions, 792 deletions
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile
index 8c8e2fb445f..866762e1bb4 100644
--- a/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/Makefile
@@ -5,3 +5,9 @@ PROGS=tools/fxdis
LIBS=libd3d1xshader.a
include ../Makefile.inc
+
+include/tpf_defs.h: $(wildcard defs/*.txt)
+ ./gen-header.sh $^ > $@
+
+src/tpf_text.cpp: $(wildcard defs/*.txt)
+ ./gen-text.sh $^ > $@
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/files.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/files.txt
new file mode 100644
index 00000000000..c44a46beed5
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/files.txt
@@ -0,0 +1,41 @@
+temp
+input
+output
+indexable_temp
+immediate32
+immediate64
+sampler
+resource
+constant_buffer
+immediate_constant_buffer
+label
+input_primitiveid
+output_depth
+null
+rasterizer
+output_coverage_mask
+stream
+function_body
+function_table
+interface
+function_input
+function_output
+output_control_point_id
+input_fork_instance_id
+input_join_instance_id
+input_control_point
+output_control_point
+input_patch_constant
+input_domain_point
+this_pointer
+unordered_access_view
+thread_group_shared_memory
+input_thread_id
+input_thread_group_id
+input_thread_id_in_group
+input_coverage_mask
+input_thread_id_in_group_flattened
+input_gs_instance_id
+output_depth_greater_equal
+output_depth_less_equal
+cycle_counter
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/interpolations.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/interpolations.txt
new file mode 100644
index 00000000000..4e52eec34f4
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/interpolations.txt
@@ -0,0 +1,8 @@
+undefined
+constant
+linear
+linear centroid
+linear noperspective
+linear noperspective centroid
+linear sample
+linear noperspective sample
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/opcodes.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/opcodes.txt
new file mode 100644
index 00000000000..46ff28d6f9c
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/opcodes.txt
@@ -0,0 +1,207 @@
+add
+and
+break
+breakc
+call
+callc
+case
+continue
+continuec
+cut
+default
+deriv_rtx
+deriv_rty
+discard
+div
+dp2
+dp3
+dp4
+else
+emit
+emitthencut
+endif
+endloop
+endswitch
+eq
+exp
+frc
+ftoi
+ftou
+ge
+iadd
+if
+ieq
+ige
+ilt
+imad
+imax
+imin
+imul
+ine
+ineg
+ishl
+ishr
+itof
+label
+ld
+ld_ms
+log
+loop
+lt
+mad
+min
+max
+customdata
+mov
+movc
+mul
+ne
+nop
+not
+or
+resinfo
+ret
+retc
+round_ne
+round_ni
+round_pi
+round_z
+rsq
+sample
+sample_c
+sample_c_lz
+sample_l
+sample_d
+sample_b
+sqrt
+switch
+sincos
+udiv
+ult
+uge
+umul
+umad
+umax
+umin
+ushr
+utof
+xor
+dcl_resource
+dcl_constant_buffer
+dcl_sampler
+dcl_index_range
+dcl_gs_output_primitive_topology
+dcl_gs_input_primitive
+dcl_max_output_vertex_count
+dcl_input
+dcl_input_sgv
+dcl_input_siv
+dcl_input_ps
+dcl_input_ps_sgv
+dcl_input_ps_siv
+dcl_output
+dcl_output_sgv
+dcl_output_siv
+dcl_temps
+dcl_indexable_temp
+dcl_global_flags
+d3d10_count
+lod
+gather4
+sample_pos
+sample_info
+d3d10_1_count
+hs_decls
+hs_control_point_phase
+hs_fork_phase
+hs_join_phase
+emit_stream
+cut_stream
+emitthencut_stream
+interface_call
+bufinfo
+deriv_rtx_coarse
+deriv_rtx_fine
+deriv_rty_coarse
+deriv_rty_fine
+gather4_c
+gather4_po
+gather4_po_c
+rcp
+f32tof16
+f16tof32
+uaddc
+usubb
+countbits
+firstbit_hi
+firstbit_lo
+firstbit_shi
+ubfe
+ibfe
+bfi
+bfrev
+swapc
+dcl_stream
+dcl_function_body
+dcl_function_table
+dcl_interface
+dcl_input_control_point_count
+dcl_output_control_point_count
+dcl_tess_domain
+dcl_tess_partitioning
+dcl_tess_output_primitive
+dcl_hs_max_tessfactor
+dcl_hs_fork_phase_instance_count
+dcl_hs_join_phase_instance_count
+dcl_thread_group
+dcl_unordered_access_view_typed
+dcl_unordered_access_view_raw
+dcl_unordered_access_view_structured
+dcl_thread_group_shared_memory_raw
+dcl_thread_group_shared_memory_structured
+dcl_resource_raw
+dcl_resource_structured
+ld_uav_typed
+store_uav_typed
+ld_raw
+store_raw
+ld_structured
+store_structured
+atomic_and
+atomic_or
+atomic_xor
+atomic_cmp_store
+atomic_iadd
+atomic_imax
+atomic_imin
+atomic_umax
+atomic_umin
+imm_atomic_alloc
+imm_atomic_consume
+imm_atomic_iadd
+imm_atomic_and
+imm_atomic_or
+imm_atomic_xor
+imm_atomic_exch
+imm_atomic_cmp_exch
+imm_atomic_imax
+imm_atomic_imin
+imm_atomic_umax
+imm_atomic_umin
+sync
+dadd
+dmax
+dmin
+dmul
+deq
+dge
+dlt
+dne
+dmov
+dmovc
+dtof
+ftod
+eval_snapped
+eval_sample_index
+eval_centroid
+dcl_gs_instance_count
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_compnums.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_compnums.txt
new file mode 100644
index 00000000000..887df2b141a
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_compnums.txt
@@ -0,0 +1,5 @@
+0
+1
+4
+n
+
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_index_reprs.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_index_reprs.txt
new file mode 100644
index 00000000000..f1ce172aaf1
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_index_reprs.txt
@@ -0,0 +1,5 @@
+imm32
+imm64
+reg
+reg_imm32
+reg_imm64
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_modes.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_modes.txt
new file mode 100644
index 00000000000..4088957e989
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/operand_modes.txt
@@ -0,0 +1,4 @@
+mask
+swizzle
+scalar
+
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/shortfiles.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/shortfiles.txt
new file mode 100644
index 00000000000..9e2d303ccd9
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/shortfiles.txt
@@ -0,0 +1,41 @@
+r
+v
+o
+x
+l
+d
+sampler
+resource
+cb
+icb
+label
+vPrim
+oDepth
+null
+rasterizer
+oMask
+stream
+function_body
+function_table
+interface
+function_input
+function_output
+vOutputControlPointID
+vForkInstanceID
+vJoinInstanceID
+vicp
+vocp
+input_patch_constant
+vDomain
+this
+u
+g
+vThreadID
+vThreadGrouID
+vThreadIDInGroup
+vCoverage
+vThreadIDInGroupFlattened
+vGSInstanceID
+oDepthGE
+oDepthLE
+vCycleCounter
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/svs.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/svs.txt
new file mode 100644
index 00000000000..c7148ec301a
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/svs.txt
@@ -0,0 +1,23 @@
+undefined
+position
+clip_distance
+cull_distance
+render_target_array_index
+viewport_array_index
+vertex_id
+primitive_id
+instance_id
+is_front_face
+sample_index
+final_quad_u_eq_0_edge_tessfactor
+final_quad_v_eq_0_edge_tessfactor
+final_quad_u_eq_1_edge_tessfactor
+final_quad_v_eq_1_edge_tessfactor
+final_quad_u_inside_tessfactor
+final_quad_v_inside_tessfactor
+final_tri_u_eq_0_edge_tessfactor
+final_tri_v_eq_0_edge_tessfactor
+final_tri_w_eq_0_edge_tessfactor
+final_tri_inside_tessfactor
+final_line_detail_tessfactor
+final_line_density_tessfactor
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/targets.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/targets.txt
new file mode 100644
index 00000000000..d3bc186c54d
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/targets.txt
@@ -0,0 +1,13 @@
+unknown
+buffer
+texture1d
+texture2d
+texture2dms
+texture3d
+texturecube
+texture1darray
+texture2darray
+texture2dmsarray
+texturecubearray
+raw_buffer
+structured_buffer
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/token_instruction_extended_types.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/token_instruction_extended_types.txt
new file mode 100644
index 00000000000..e8fd70c4808
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/token_instruction_extended_types.txt
@@ -0,0 +1,4 @@
+empty
+sample_controls
+resource_dim
+resource_return_type
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/token_operand_extended_types.txt b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/token_operand_extended_types.txt
new file mode 100644
index 00000000000..891fcafa67a
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/defs/token_operand_extended_types.txt
@@ -0,0 +1,2 @@
+empty
+modifier
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-header.sh b/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-header.sh
new file mode 100755
index 00000000000..558794f1d25
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-header.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+for i in "$@"; do
+ n=$(basename "$i" .txt|sed -e 's/s$//')
+ if test "$n" == "shortfile"; then continue; fi
+ echo "enum tpf_$n"
+ echo "{"
+ while read j; do
+ echo $'\t'"TPF_${n}_$j",
+ done < "$i" |tr '[a-z]' '[A-Z]'|tr ' ' '_'
+ echo $'\t'"TPF_${n}_COUNT"|tr '[a-z]' '[A-Z]'
+ echo "};"
+ echo
+done
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-text.sh b/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-text.sh
new file mode 100755
index 00000000000..b31e16e19c9
--- /dev/null
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/gen-text.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+for i in "$@"; do
+ n=$(basename "$i" .txt|sed -e 's/s$//')
+ echo "const char* tpf_${n}_names[] ="
+ echo "{"
+ while read j; do
+ echo $'\t'"\"$j\"",
+ done < "$i"
+ echo "};"
+ echo
+done
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_ */
+
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_parse.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_parse.cpp
index a4f6cc6b661..2dfb88e5beb 100644
--- a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_parse.cpp
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_parse.cpp
@@ -86,13 +86,13 @@ struct tpf_parser
op.mask = 0xf;
switch(optok.comps_enum)
{
- case TPF_OPERAND_COMPS_0:
+ case TPF_OPERAND_COMPNUM_0:
op.comps = 0;
break;
- case TPF_OPERAND_COMPS_1:
+ case TPF_OPERAND_COMPNUM_1:
op.comps = 1;
break;
- case TPF_OPERAND_COMPS_4:
+ case TPF_OPERAND_COMPNUM_4:
op.comps = 4;
op.mode = optok.mode;
switch(optok.mode)
@@ -111,7 +111,7 @@ struct tpf_parser
break;
}
break;
- case TPF_OPERAND_COMPS_N:
+ case TPF_OPERAND_COMPNUM_N:
fail("Unhandled operand component type");
}
op.file = (tpf_file)optok.file;
@@ -192,7 +192,7 @@ relative:
read_token(&insntok);
unsigned* insn_end = tokens - 1 + insntok.length;
tpf_opcode opcode = (tpf_opcode)insntok.opcode;
- check(opcode < TPF_OPCODE_D3D11_COUNT);
+ check(opcode < TPF_OPCODE_COUNT);
if(opcode == TPF_OPCODE_CUSTOMDATA)
{
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_text.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_text.cpp
deleted file mode 100644
index 94192c92792..00000000000
--- a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/tpf_text.cpp
+++ /dev/null
@@ -1,385 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 Luca Barbieri
- *
- * 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 the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, 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 NONINFRINGEMENT.
- * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS 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.
- *
- **************************************************************************/
-
-// generated with sed -re 's/TPF_WHATEVER_//; s/=.*//; s,//.*,,; s/,//; s/\s*//g;'|tr '[A-Z]' '[a-z]'|tr -s '\n'|sed -re 's/(.*)/\t"\1",/g'
-
-const char* tpf_opcode_names[] =
-{
- "add",
- "and",
- "break",
- "breakc",
- "call",
- "callc",
- "case",
- "continue",
- "continuec",
- "cut",
- "default",
- "deriv_rtx",
- "deriv_rty",
- "discard",
- "div",
- "dp2",
- "dp3",
- "dp4",
- "else",
- "emit",
- "emitthencut",
- "endif",
- "endloop",
- "endswitch",
- "eq",
- "exp",
- "frc",
- "ftoi",
- "ftou",
- "ge",
- "iadd",
- "if",
- "ieq",
- "ige",
- "ilt",
- "imad",
- "imax",
- "imin",
- "imul",
- "ine",
- "ineg",
- "ishl",
- "ishr",
- "itof",
- "label",
- "ld",
- "ld_ms",
- "log",
- "loop",
- "lt",
- "mad",
- "min",
- "max",
- "customdata",
- "mov",
- "movc",
- "mul",
- "ne",
- "nop",
- "not",
- "or",
- "resinfo",
- "ret",
- "retc",
- "round_ne",
- "round_ni",
- "round_pi",
- "round_z",
- "rsq",
- "sample",
- "sample_c",
- "sample_c_lz",
- "sample_l",
- "sample_d",
- "sample_b",
- "sqrt",
- "switch",
- "sincos",
- "udiv",
- "ult",
- "uge",
- "umul",
- "umad",
- "umax",
- "umin",
- "ushr",
- "utof",
- "xor",
- "dcl_resource",
- "dcl_constant_buffer",
- "dcl_sampler",
- "dcl_index_range",
- "dcl_gs_output_primitive_topology",
- "dcl_gs_input_primitive",
- "dcl_max_output_vertex_count",
- "dcl_input",
- "dcl_input_sgv",
- "dcl_input_siv",
- "dcl_input_ps",
- "dcl_input_ps_sgv",
- "dcl_input_ps_siv",
- "dcl_output",
- "dcl_output_sgv",
- "dcl_output_siv",
- "dcl_temps",
- "dcl_indexable_temp",
- "dcl_global_flags",
- "d3d10_count",
- "lod",
- "gather4",
- "sample_pos",
- "sample_info",
- "d3d10_1_count",
- "hs_decls",
- "hs_control_point_phase",
- "hs_fork_phase",
- "hs_join_phase",
- "emit_stream",
- "cut_stream",
- "emitthencut_stream",
- "interface_call",
- "bufinfo",
- "deriv_rtx_coarse",
- "deriv_rtx_fine",
- "deriv_rty_coarse",
- "deriv_rty_fine",
- "gather4_c",
- "gather4_po",
- "gather4_po_c",
- "rcp",
- "f32tof16",
- "f16tof32",
- "uaddc",
- "usubb",
- "countbits",
- "firstbit_hi",
- "firstbit_lo",
- "firstbit_shi",
- "ubfe",
- "ibfe",
- "bfi",
- "bfrev",
- "swapc",
- "dcl_stream",
- "dcl_function_body",
- "dcl_function_table",
- "dcl_interface",
- "dcl_input_control_point_count",
- "dcl_output_control_point_count",
- "dcl_tess_domain",
- "dcl_tess_partitioning",
- "dcl_tess_output_primitive",
- "dcl_hs_max_tessfactor",
- "dcl_hs_fork_phase_instance_count",
- "dcl_hs_join_phase_instance_count",
- "dcl_thread_group",
- "dcl_unordered_access_view_typed",
- "dcl_unordered_access_view_raw",
- "dcl_unordered_access_view_structured",
- "dcl_thread_group_shared_memory_raw",
- "dcl_thread_group_shared_memory_structured",
- "dcl_resource_raw",
- "dcl_resource_structured",
- "ld_uav_typed",
- "store_uav_typed",
- "ld_raw",
- "store_raw",
- "ld_structured",
- "store_structured",
- "atomic_and",
- "atomic_or",
- "atomic_xor",
- "atomic_cmp_store",
- "atomic_iadd",
- "atomic_imax",
- "atomic_imin",
- "atomic_umax",
- "atomic_umin",
- "imm_atomic_alloc",
- "imm_atomic_consume",
- "imm_atomic_iadd",
- "imm_atomic_and",
- "imm_atomic_or",
- "imm_atomic_xor",
- "imm_atomic_exch",
- "imm_atomic_cmp_exch",
- "imm_atomic_imax",
- "imm_atomic_imin",
- "imm_atomic_umax",
- "imm_atomic_umin",
- "sync",
- "dadd",
- "dmax",
- "dmin",
- "dmul",
- "deq",
- "dge",
- "dlt",
- "dne",
- "dmov",
- "dmovc",
- "dtof",
- "ftod",
- "eval_snapped",
- "eval_sample_index",
- "eval_centroid",
- "dcl_gs_instance_count",
- "d3d11_count",
-};
-
-const char* tpf_file_names[] =
-{
- "temp",
- "input",
- "output",
- "indexable_temp",
- "immediate32",
- "immediate64",
- "sampler",
- "resource",
- "constant_buffer",
- "immediate_constant_buffer",
- "label",
- "input_primitiveid",
- "output_depth",
- "null",
- "rasterizer",
- "output_coverage_mask",
- "stream",
- "function_body",
- "function_table",
- "interface",
- "function_input",
- "function_output",
- "output_control_point_id",
- "input_fork_instance_id",
- "input_join_instance_id",
- "input_control_point",
- "output_control_point",
- "input_patch_constant",
- "input_domain_point",
- "this_pointer",
- "unordered_access_view",
- "thread_group_shared_memory",
- "input_thread_id",
- "input_thread_group_id",
- "input_thread_id_in_group",
- "input_coverage_mask",
- "input_thread_id_in_group_flattened",
- "input_gs_instance_id",
- "output_depth_greater_equal",
- "output_depth_less_equal",
- "cycle_counter",
-};
-
-const char* tpf_file_ms_names[] =
-{
- "r",
- "v",
- "o",
- "x",
- "l",
- "d",
- "sampler",
- "resource",
- "cb",
- "icb",
- "label",
- "vPrim",
- "oDepth",
- "null",
- "rasterizer",
- "oMask",
- "stream",
- "function_body",
- "function_table",
- "interface",
- "function_input",
- "function_output",
- "vOutputControlPointID",
- "vForkInstanceID",
- "vJoinInstanceID",
- "vicp",
- "vocp",
- "input_patch_constant",
- "vDomain",
- "this",
- "u",
- "g",
- "vThreadID",
- "vThreadGrouID",
- "vThreadIDInGroup",
- "vCoverage",
- "vThreadIDInGroupFlattened",
- "vGSInstanceID",
- "oDepthGE",
- "oDepthLE",
- "vCycleCounter",
-};
-
-const char* tpf_target_names[] =
-{
- "unknown",
- "buffer",
- "texture1d",
- "texture2d",
- "texture2dms",
- "texture3d",
- "texturecube",
- "texture1darray",
- "texture2darray",
- "texture2dmsarray",
- "texturecubearray",
- "raw_buffer",
- "structured_buffer",
-};
-
-const char* tpf_interpolation_names[] =
-{
- "undefined",
- "constant",
- "linear",
- "linear centroid",
- "linear noperspective",
- "linear noperspective centroid",
- "linear sample",
- "linear noperspective sample",
-};
-
-const char* tpf_sv_names[] =
-{
- "undefined",
- "position",
- "clip_distance",
- "cull_distance",
- "render_target_array_index",
- "viewport_array_index",
- "vertex_id",
- "primitive_id",
- "instance_id",
- "is_front_face",
- "sample_index",
- "final_quad_u_eq_0_edge_tessfactor",
- "final_quad_v_eq_0_edge_tessfactor",
- "final_quad_u_eq_1_edge_tessfactor",
- "final_quad_v_eq_1_edge_tessfactor",
- "final_quad_u_inside_tessfactor",
- "final_quad_v_inside_tessfactor",
- "final_tri_u_eq_0_edge_tessfactor",
- "final_tri_v_eq_0_edge_tessfactor",
- "final_tri_w_eq_0_edge_tessfactor",
- "final_tri_inside_tessfactor",
- "final_line_detail_tessfactor",
- "final_line_density_tessfactor",
-};