ReactOS 0.4.17-dev-966-gf06eace
asmparser.c File Reference
#include "wine/debug.h"
#include "d3dcompiler_private.h"
Include dependency graph for asmparser.c:

Go to the source code of this file.

Classes

struct  allowed_reg_type
 

Macros

#define OT0_REG   0
 
#define OT1_REG   1
 
#define OT2_REG   2
 
#define OT3_REG   3
 
#define OT4_REG   4
 
#define OT5_REG   5
 
#define OT6_REG   6
 
#define OT7_REG   7
 
#define OPOS_REG   8
 
#define OFOG_REG   9
 
#define OFOG_WRITEMASK   BWRITERSP_WRITEMASK_0
 
#define OPTS_REG   9
 
#define OPTS_WRITEMASK   BWRITERSP_WRITEMASK_1
 
#define OD0_REG   10
 
#define OD1_REG   11
 
#define C0_VARYING   0
 
#define C1_VARYING   1
 
#define T0_VARYING   2
 
#define T1_VARYING   3
 
#define T2_VARYING   4
 
#define T3_VARYING   5
 
#define T4_VARYING   6
 
#define T5_VARYING   7
 
#define T6_VARYING   8
 
#define T7_VARYING   9
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (asmshader)
 
 WINE_DECLARE_DEBUG_CHANNEL (parsed_shader)
 
static void asmparser_end (struct asm_parser *This)
 
static void asmparser_constF (struct asm_parser *parser, uint32_t reg, float x, float y, float z, float w)
 
static void asmparser_constB (struct asm_parser *parser, uint32_t reg, BOOL x)
 
static void asmparser_constI (struct asm_parser *parser, uint32_t reg, int x, int y, int z, int w)
 
static void asmparser_dcl_output (struct asm_parser *parser, uint32_t usage, uint32_t num, const struct shader_reg *reg)
 
static void asmparser_dcl_output_unsupported (struct asm_parser *parser, uint32_t usage, uint32_t num, const struct shader_reg *reg)
 
static void asmparser_dcl_input (struct asm_parser *parser, uint32_t usage, uint32_t num, uint32_t mod, const struct shader_reg *reg)
 
static void asmparser_dcl_input_ps_2 (struct asm_parser *parser, uint32_t usage, uint32_t num, uint32_t mod, const struct shader_reg *reg)
 
static void asmparser_dcl_input_unsupported (struct asm_parser *parser, uint32_t usage, uint32_t num, uint32_t mod, const struct shader_reg *reg)
 
static void asmparser_dcl_sampler (struct asm_parser *parser, uint32_t samptype, uint32_t mod, uint32_t regnum, unsigned int line_no)
 
static void asmparser_dcl_sampler_unsupported (struct asm_parser *parser, uint32_t samptype, uint32_t mod, uint32_t regnum, unsigned int line_no)
 
static void asmparser_sincos (struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst, const struct src_regs *srcs)
 
static struct shader_reg map_oldps_register (const struct shader_reg *reg, BOOL tex_varying)
 
static void asmparser_texcoord (struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst, const struct src_regs *srcs)
 
static void asmparser_texcrd (struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst, const struct src_regs *srcs)
 
static void asmparser_texkill (struct asm_parser *parser, const struct shader_reg *dst)
 
static void asmparser_texhelper (struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst, const struct shader_reg *src0)
 
static void asmparser_tex (struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst)
 
static void asmparser_texld14 (struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst, const struct src_regs *srcs)
 
static void asmparser_texreg2ar (struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst, const struct shader_reg *src0)
 
static void asmparser_texreg2gb (struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst, const struct shader_reg *src0)
 
static void asmparser_texreg2rgb (struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst, const struct shader_reg *src0)
 
static void asmparser_instr (struct asm_parser *parser, uint32_t opcode, uint32_t mod, uint32_t shift, enum bwriter_comparison_type comp, const struct shader_reg *dst, const struct src_regs *srcs, int expectednsrcs)
 
static struct shader_reg map_oldvs_register (const struct shader_reg *reg)
 
static void check_legacy_srcmod (struct asm_parser *parser, uint32_t srcmod)
 
static void check_abs_srcmod (struct asm_parser *parser, uint32_t srcmod)
 
static void check_loop_swizzle (struct asm_parser *parser, const struct shader_reg *src)
 
static void check_shift_dstmod (struct asm_parser *parser, uint32_t shift)
 
static void check_ps_dstmod (struct asm_parser *parser, uint32_t dstmod)
 
static BOOL check_reg_type (const struct shader_reg *reg, const struct allowed_reg_type *allowed)
 
static void asmparser_srcreg_vs_1 (struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
 
static void asmparser_srcreg_vs_2 (struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
 
static void asmparser_srcreg_vs_3 (struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
 
static void asmparser_srcreg_ps_1_0123 (struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
 
static void asmparser_srcreg_ps_1_4 (struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
 
static void asmparser_srcreg_ps_2 (struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
 
static void asmparser_srcreg_ps_2_x (struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
 
static void asmparser_srcreg_ps_3 (struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
 
static void asmparser_dstreg_vs_1 (struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
 
static void asmparser_dstreg_vs_2 (struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
 
static void asmparser_dstreg_vs_3 (struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
 
static void asmparser_dstreg_ps_1_0123 (struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
 
static void asmparser_dstreg_ps_1_4 (struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
 
static void asmparser_dstreg_ps_2 (struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
 
static void asmparser_dstreg_ps_2_x (struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
 
static void asmparser_dstreg_ps_3 (struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
 
static void asmparser_predicate_supported (struct asm_parser *parser, const struct shader_reg *predicate)
 
static void asmparser_predicate_unsupported (struct asm_parser *parser, const struct shader_reg *predicate)
 
static void asmparser_coissue_supported (struct asm_parser *parser)
 
static void asmparser_coissue_unsupported (struct asm_parser *parser)
 
static void gen_oldvs_output (struct bwriter_shader *shader)
 
static void gen_oldps_input (struct bwriter_shader *shader, uint32_t texcoords)
 
void create_vs10_parser (struct asm_parser *ret)
 
void create_vs11_parser (struct asm_parser *ret)
 
void create_vs20_parser (struct asm_parser *ret)
 
void create_vs2x_parser (struct asm_parser *ret)
 
void create_vs30_parser (struct asm_parser *ret)
 
void create_ps10_parser (struct asm_parser *ret)
 
void create_ps11_parser (struct asm_parser *ret)
 
void create_ps12_parser (struct asm_parser *ret)
 
void create_ps13_parser (struct asm_parser *ret)
 
void create_ps14_parser (struct asm_parser *ret)
 
void create_ps20_parser (struct asm_parser *ret)
 
void create_ps2x_parser (struct asm_parser *ret)
 
void create_ps30_parser (struct asm_parser *ret)
 

Variables

static const struct allowed_reg_type vs_1_reg_allowed []
 
static const struct allowed_reg_type vs_2_reg_allowed []
 
static const struct allowed_reg_type vs_3_reg_allowed []
 
static const struct allowed_reg_type ps_1_0123_reg_allowed []
 
static const struct allowed_reg_type ps_1_4_reg_allowed []
 
static const struct allowed_reg_type ps_2_0_reg_allowed []
 
static const struct allowed_reg_type ps_2_x_reg_allowed []
 
static const struct allowed_reg_type ps_3_reg_allowed []
 
static const struct asmparser_backend parser_vs_1
 
static const struct asmparser_backend parser_vs_2
 
static const struct asmparser_backend parser_vs_3
 
static const struct asmparser_backend parser_ps_1_0123
 
static const struct asmparser_backend parser_ps_1_4
 
static const struct asmparser_backend parser_ps_2
 
static const struct asmparser_backend parser_ps_2_x
 
static const struct asmparser_backend parser_ps_3
 

Macro Definition Documentation

◆ C0_VARYING

#define C0_VARYING   0

Definition at line 55 of file asmparser.c.

◆ C1_VARYING

#define C1_VARYING   1

Definition at line 56 of file asmparser.c.

◆ OD0_REG

#define OD0_REG   10

Definition at line 51 of file asmparser.c.

◆ OD1_REG

#define OD1_REG   11

Definition at line 52 of file asmparser.c.

◆ OFOG_REG

#define OFOG_REG   9

Definition at line 47 of file asmparser.c.

◆ OFOG_WRITEMASK

#define OFOG_WRITEMASK   BWRITERSP_WRITEMASK_0

Definition at line 48 of file asmparser.c.

◆ OPOS_REG

#define OPOS_REG   8

Definition at line 46 of file asmparser.c.

◆ OPTS_REG

#define OPTS_REG   9

Definition at line 49 of file asmparser.c.

◆ OPTS_WRITEMASK

#define OPTS_WRITEMASK   BWRITERSP_WRITEMASK_1

Definition at line 50 of file asmparser.c.

◆ OT0_REG

#define OT0_REG   0

Definition at line 38 of file asmparser.c.

◆ OT1_REG

#define OT1_REG   1

Definition at line 39 of file asmparser.c.

◆ OT2_REG

#define OT2_REG   2

Definition at line 40 of file asmparser.c.

◆ OT3_REG

#define OT3_REG   3

Definition at line 41 of file asmparser.c.

◆ OT4_REG

#define OT4_REG   4

Definition at line 42 of file asmparser.c.

◆ OT5_REG

#define OT5_REG   5

Definition at line 43 of file asmparser.c.

◆ OT6_REG

#define OT6_REG   6

Definition at line 44 of file asmparser.c.

◆ OT7_REG

#define OT7_REG   7

Definition at line 45 of file asmparser.c.

◆ T0_VARYING

#define T0_VARYING   2

Definition at line 57 of file asmparser.c.

◆ T1_VARYING

#define T1_VARYING   3

Definition at line 58 of file asmparser.c.

◆ T2_VARYING

#define T2_VARYING   4

Definition at line 59 of file asmparser.c.

◆ T3_VARYING

#define T3_VARYING   5

Definition at line 60 of file asmparser.c.

◆ T4_VARYING

#define T4_VARYING   6

Definition at line 61 of file asmparser.c.

◆ T5_VARYING

#define T5_VARYING   7

Definition at line 62 of file asmparser.c.

◆ T6_VARYING

#define T6_VARYING   8

Definition at line 63 of file asmparser.c.

◆ T7_VARYING

#define T7_VARYING   9

Definition at line 64 of file asmparser.c.

Function Documentation

◆ asmparser_coissue_supported()

static void asmparser_coissue_supported ( struct asm_parser *  parser)
static

Definition at line 1213 of file asmparser.c.

1214{
1215 if (!parser->shader)
1216 return;
1217 if (parser->shader->num_instrs == 0)
1218 {
1219 asmparser_message(parser, "Line %u: Coissue flag on the first shader instruction\n", parser->line_no);
1221 }
1222 /* Set the coissue flag of the last instruction added to the shader. */
1223 parser->shader->instr[parser->shader->num_instrs - 1]->coissue = TRUE;
1224}
void WINAPIV static void set_parse_status(enum parse_status *current, enum parse_status update)
void WINAPIV asmparser_message(struct asm_parser *ctx, const char *fmt,...) PRINTF_ATTR(2
@ PARSE_ERR
#define TRUE
Definition: types.h:120
Definition: import.c:81

◆ asmparser_coissue_unsupported()

static void asmparser_coissue_unsupported ( struct asm_parser *  parser)
static

Definition at line 1226 of file asmparser.c.

1227{
1228 asmparser_message(parser, "Line %u: Coissue is only supported in pixel shaders versions <= 1.4\n", parser->line_no);
1230}

◆ asmparser_constB()

static void asmparser_constB ( struct asm_parser *  parser,
uint32_t  reg,
BOOL  x 
)
static

Definition at line 87 of file asmparser.c.

88{
89 if (!parser->shader)
90 return;
91 TRACE("Adding boolean constant %u at pos %u.\n", reg, parser->shader->num_cb);
92 TRACE_(parsed_shader)("def b%u, %s\n", reg, x ? "true" : "false");
93 if (!add_constB(parser->shader, reg, x))
94 {
95 ERR("Out of memory.\n");
97 }
98}
#define ERR(fmt,...)
Definition: precomp.h:57
BOOL add_constB(struct bwriter_shader *shader, uint32_t reg, BOOL x)
#define TRACE_(x)
Definition: compat.h:76
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static int reg
Definition: i386-dis.c:1290
#define TRACE(s)
Definition: solgame.cpp:4

◆ asmparser_constF()

static void asmparser_constF ( struct asm_parser *  parser,
uint32_t  reg,
float  x,
float  y,
float  z,
float  w 
)
static

Definition at line 74 of file asmparser.c.

75{
76 if (!parser->shader)
77 return;
78 TRACE("Adding float constant %u at pos %u.\n", reg, parser->shader->num_cf);
79 TRACE_(parsed_shader)("def c%u, %f, %f, %f, %f\n", reg, x, y, z, w);
80 if (!add_constF(parser->shader, reg, x, y, z, w))
81 {
82 ERR("Out of memory.\n");
84 }
85}
BOOL add_constF(struct bwriter_shader *shader, uint32_t reg, float x, float y, float z, float w)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLdouble GLdouble z
Definition: glext.h:5874

◆ asmparser_constI()

static void asmparser_constI ( struct asm_parser *  parser,
uint32_t  reg,
int  x,
int  y,
int  z,
int  w 
)
static

Definition at line 100 of file asmparser.c.

101{
102 if (!parser->shader)
103 return;
104 TRACE("Adding integer constant %u at pos %u.\n", reg, parser->shader->num_ci);
105 TRACE_(parsed_shader)("def i%u, %d, %d, %d, %d\n", reg, x, y, z, w);
106 if (!add_constI(parser->shader, reg, x, y, z, w))
107 {
108 ERR("Out of memory.\n");
110 }
111}
BOOL add_constI(struct bwriter_shader *shader, uint32_t reg, int x, int y, int z, int w)

◆ asmparser_dcl_input()

static void asmparser_dcl_input ( struct asm_parser *  parser,
uint32_t  usage,
uint32_t  num,
uint32_t  mod,
const struct shader_reg *  reg 
)
static

Definition at line 137 of file asmparser.c.

139{
140 struct instruction instr;
141
142 if (!parser->shader)
143 return;
144 if (mod && (parser->shader->type != ST_PIXEL || parser->shader->major_version != 3
146 {
147 asmparser_message(parser, "Line %u: Unsupported modifier in dcl instruction\n", parser->line_no);
149 return;
150 }
151
152 /* Check register type and modifiers */
153 instr.dstmod = mod;
154 instr.shift = 0;
155 parser->funcs->dstreg(parser, &instr, reg);
156
157 if (!record_declaration(parser->shader, usage, num, mod, FALSE, reg->regnum, reg->writemask, FALSE))
158 {
159 ERR("Out of memory\n");
161 }
162}
std::map< E_MODULE, HMODULE > mod
Definition: LocaleTests.cpp:68
BOOL record_declaration(struct bwriter_shader *shader, uint32_t usage, uint32_t usage_idx, uint32_t mod, BOOL output, uint32_t regnum, uint32_t writemask, BOOL builtin)
@ BWRITERSPDM_PARTIALPRECISION
@ BWRITERSPDM_MSAMPCENTROID
@ ST_PIXEL
#define FALSE
Definition: types.h:117
GLuint GLuint num
Definition: glext.h:9618
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919

◆ asmparser_dcl_input_ps_2()

static void asmparser_dcl_input_ps_2 ( struct asm_parser *  parser,
uint32_t  usage,
uint32_t  num,
uint32_t  mod,
const struct shader_reg *  reg 
)
static

Definition at line 164 of file asmparser.c.

166{
167 struct instruction instr;
168
169 if (!parser->shader)
170 return;
171 instr.dstmod = mod;
172 instr.shift = 0;
173 parser->funcs->dstreg(parser, &instr, reg);
174 if (!record_declaration(parser->shader, usage, num, mod, FALSE, instr.dst.regnum, instr.dst.writemask, FALSE))
175 {
176 ERR("Out of memory\n");
178 }
179}

◆ asmparser_dcl_input_unsupported()

static void asmparser_dcl_input_unsupported ( struct asm_parser *  parser,
uint32_t  usage,
uint32_t  num,
uint32_t  mod,
const struct shader_reg *  reg 
)
static

Definition at line 181 of file asmparser.c.

183{
184 asmparser_message(parser, "Line %u: Input declaration unsupported in this shader version\n", parser->line_no);
186}

◆ asmparser_dcl_output()

static void asmparser_dcl_output ( struct asm_parser *  parser,
uint32_t  usage,
uint32_t  num,
const struct shader_reg *  reg 
)
static

Definition at line 113 of file asmparser.c.

115{
116 if (!parser->shader)
117 return;
118 if (parser->shader->type == ST_PIXEL)
119 {
120 asmparser_message(parser, "Line %u: Output register declared in a pixel shader\n", parser->line_no);
122 }
123 if (!record_declaration(parser->shader, usage, num, 0, TRUE, reg->regnum, reg->writemask, FALSE))
124 {
125 ERR("Out of memory\n");
127 }
128}

◆ asmparser_dcl_output_unsupported()

static void asmparser_dcl_output_unsupported ( struct asm_parser *  parser,
uint32_t  usage,
uint32_t  num,
const struct shader_reg *  reg 
)
static

Definition at line 130 of file asmparser.c.

132{
133 asmparser_message(parser, "Line %u: Output declaration unsupported in this shader version\n", parser->line_no);
135}

◆ asmparser_dcl_sampler()

static void asmparser_dcl_sampler ( struct asm_parser *  parser,
uint32_t  samptype,
uint32_t  mod,
uint32_t  regnum,
unsigned int  line_no 
)
static

Definition at line 188 of file asmparser.c.

190{
191 if (!parser->shader)
192 return;
193 if (mod && (parser->shader->type != ST_PIXEL || parser->shader->major_version != 3
195 {
196 asmparser_message(parser, "Line %u: Unsupported modifier in dcl instruction\n", parser->line_no);
198 return;
199 }
200 if (!record_sampler(parser->shader, samptype, mod, regnum))
201 {
202 ERR("Out of memory\n");
204 }
205}
BOOL record_sampler(struct bwriter_shader *shader, uint32_t samptype, uint32_t mod, uint32_t regnum)

◆ asmparser_dcl_sampler_unsupported()

static void asmparser_dcl_sampler_unsupported ( struct asm_parser *  parser,
uint32_t  samptype,
uint32_t  mod,
uint32_t  regnum,
unsigned int  line_no 
)
static

Definition at line 207 of file asmparser.c.

209{
210 asmparser_message(parser, "Line %u: Sampler declaration unsupported in this shader version\n", parser->line_no);
212}

◆ asmparser_dstreg_ps_1_0123()

static void asmparser_dstreg_ps_1_0123 ( struct asm_parser *  parser,
struct instruction *  instr,
const struct shader_reg *  dst 
)
static

Definition at line 1116 of file asmparser.c.

1118{
1119 struct shader_reg reg;
1120
1122 {
1123 asmparser_message(parser, "Line %u: Destination register %s not supported in PS 1\n",
1124 parser->line_no, debug_print_dstreg(dst));
1126 }
1128 instr->dst = reg;
1129 instr->has_dst = TRUE;
1130}
static const struct allowed_reg_type ps_1_0123_reg_allowed[]
Definition: asmparser.c:920
static BOOL check_reg_type(const struct shader_reg *reg, const struct allowed_reg_type *allowed)
Definition: asmparser.c:788
static struct shader_reg map_oldps_register(const struct shader_reg *reg, BOOL tex_varying)
Definition: asmparser.c:251
const char * debug_print_dstreg(const struct shader_reg *reg)
Definition: utils.c:336
GLenum GLenum dst
Definition: glext.h:6340
struct shader_reg dst

◆ asmparser_dstreg_ps_1_4()

static void asmparser_dstreg_ps_1_4 ( struct asm_parser *  parser,
struct instruction *  instr,
const struct shader_reg *  dst 
)
static

Definition at line 1132 of file asmparser.c.

1134{
1135 struct shader_reg reg;
1136
1138 {
1139 asmparser_message(parser, "Line %u: Destination register %s not supported in PS 1\n",
1140 parser->line_no, debug_print_dstreg(dst));
1142 }
1144 instr->dst = reg;
1145 instr->has_dst = TRUE;
1146}
static const struct allowed_reg_type ps_1_4_reg_allowed[]
Definition: asmparser.c:945

◆ asmparser_dstreg_ps_2()

static void asmparser_dstreg_ps_2 ( struct asm_parser *  parser,
struct instruction *  instr,
const struct shader_reg *  dst 
)
static

Definition at line 1148 of file asmparser.c.

1150{
1151 struct shader_reg reg;
1152
1154 {
1155 asmparser_message(parser, "Line %u: Destination register %s not supported in PS 2.0\n",
1156 parser->line_no, debug_print_dstreg(dst));
1158 }
1161 instr->dst = reg;
1162 instr->has_dst = TRUE;
1163}
static void check_shift_dstmod(struct asm_parser *parser, uint32_t shift)
Definition: asmparser.c:762
static const struct allowed_reg_type ps_2_0_reg_allowed[]
Definition: asmparser.c:970

◆ asmparser_dstreg_ps_2_x()

static void asmparser_dstreg_ps_2_x ( struct asm_parser *  parser,
struct instruction *  instr,
const struct shader_reg *  dst 
)
static

Definition at line 1165 of file asmparser.c.

1167{
1168 struct shader_reg reg;
1169
1171 {
1172 asmparser_message(parser, "Line %u: Destination register %s not supported in PS 2.x\n",
1173 parser->line_no, debug_print_dstreg(dst));
1175 }
1178 instr->dst = reg;
1179 instr->has_dst = TRUE;
1180}
static const struct allowed_reg_type ps_2_x_reg_allowed[]
Definition: asmparser.c:1001

◆ asmparser_dstreg_ps_3()

static void asmparser_dstreg_ps_3 ( struct asm_parser *  parser,
struct instruction *  instr,
const struct shader_reg *  dst 
)
static

Definition at line 1182 of file asmparser.c.

1184{
1186 {
1187 asmparser_message(parser, "Line %u: Destination register %s not supported in PS 3.0\n",
1188 parser->line_no, debug_print_dstreg(dst));
1190 }
1192 instr->dst = *dst;
1193 instr->has_dst = TRUE;
1194}
static const struct allowed_reg_type ps_3_reg_allowed[]
Definition: asmparser.c:1034

◆ asmparser_dstreg_vs_1()

static void asmparser_dstreg_vs_1 ( struct asm_parser *  parser,
struct instruction *  instr,
const struct shader_reg *  dst 
)
static

Definition at line 1065 of file asmparser.c.

1067{
1068 struct shader_reg reg;
1069
1071 {
1072 asmparser_message(parser, "Line %u: Destination register %s not supported in VS 1\n",
1073 parser->line_no, debug_print_dstreg(dst));
1075 }
1076 check_ps_dstmod(parser, instr->dstmod);
1079 instr->dst = reg;
1080 instr->has_dst = TRUE;
1081}
static const struct allowed_reg_type vs_1_reg_allowed[]
Definition: asmparser.c:814
static struct shader_reg map_oldvs_register(const struct shader_reg *reg)
Definition: asmparser.c:661
static void check_ps_dstmod(struct asm_parser *parser, uint32_t dstmod)
Definition: asmparser.c:771

◆ asmparser_dstreg_vs_2()

static void asmparser_dstreg_vs_2 ( struct asm_parser *  parser,
struct instruction *  instr,
const struct shader_reg *  dst 
)
static

Definition at line 1083 of file asmparser.c.

1085{
1086 struct shader_reg reg;
1087
1089 {
1090 asmparser_message(parser, "Line %u: Destination register %s not supported in VS 2.0\n",
1091 parser->line_no, debug_print_dstreg(dst));
1093 }
1094 check_ps_dstmod(parser, instr->dstmod);
1097 instr->dst = reg;
1098 instr->has_dst = TRUE;
1099}
static const struct allowed_reg_type vs_2_reg_allowed[]
Definition: asmparser.c:855

◆ asmparser_dstreg_vs_3()

static void asmparser_dstreg_vs_3 ( struct asm_parser *  parser,
struct instruction *  instr,
const struct shader_reg *  dst 
)
static

Definition at line 1101 of file asmparser.c.

1103{
1105 {
1106 asmparser_message(parser, "Line %u: Destination register %s not supported in VS 3.0\n",
1107 parser->line_no, debug_print_dstreg(dst));
1109 }
1110 check_ps_dstmod(parser, instr->dstmod);
1112 instr->dst = *dst;
1113 instr->has_dst = TRUE;
1114}
static const struct allowed_reg_type vs_3_reg_allowed[]
Definition: asmparser.c:890

◆ asmparser_end()

static void asmparser_end ( struct asm_parser *  This)
static

Definition at line 70 of file asmparser.c.

70 {
71 TRACE("Finalizing shader\n");
72}

◆ asmparser_instr()

static void asmparser_instr ( struct asm_parser *  parser,
uint32_t  opcode,
uint32_t  mod,
uint32_t  shift,
enum bwriter_comparison_type  comp,
const struct shader_reg *  dst,
const struct src_regs *  srcs,
int  expectednsrcs 
)
static

Definition at line 546 of file asmparser.c.

549{
550 unsigned int src_count = srcs ? srcs->count : 0;
551 struct bwriter_shader *shader = parser->shader;
552 struct instruction *instr;
553 BOOL firstreg = TRUE;
554 unsigned int i;
555
556 if (!parser->shader)
557 return;
558
559 TRACE_(parsed_shader)("%s%s%s%s ", debug_print_opcode(opcode),
562 debug_print_comp(comp));
563 if (dst)
564 {
565 TRACE_(parsed_shader)("%s", debug_print_dstreg(dst));
566 firstreg = FALSE;
567 }
568 for (i = 0; i < src_count; i++)
569 {
570 if (!firstreg)
571 TRACE_(parsed_shader)(", ");
572 else firstreg = FALSE;
573 TRACE_(parsed_shader)("%s", debug_print_srcreg(&srcs->reg[i]));
574 }
575 TRACE_(parsed_shader)("\n");
576
577 /* Check for instructions with different syntaxes in different shader versions */
578 switch(opcode)
579 {
581 /* The syntax changes between vs 2 and the other shader versions */
582 if (parser->shader->type == ST_VERTEX && parser->shader->major_version == 2)
583 {
585 return;
586 }
587 /* Use the default handling */
588 break;
590 /* texcoord/texcrd are two instructions present only in PS <= 1.3 and PS 1.4 respectively */
591 if (shader->type == ST_PIXEL && shader->major_version == 1 && shader->minor_version == 4)
593 else
595 return;
596 case BWRITERSIO_TEX:
597 /* this encodes both the tex PS 1.x instruction and the
598 texld 1.4/2.0+ instruction */
599 if (shader->type == ST_PIXEL && shader->major_version == 1)
600 {
601 if (shader->minor_version < 4)
603 else
605 return;
606 }
607 /* else fallback to the standard behavior */
608 break;
609 }
610
611 if (src_count != expectednsrcs)
612 {
613 asmparser_message(parser, "Line %u: Wrong number of source registers\n", parser->line_no);
615 return;
616 }
617
618 /* Handle PS 1.x instructions, "regularizing" them */
619 switch(opcode)
620 {
623 return;
625 asmparser_texreg2ar(parser, mod, shift, dst, &srcs->reg[0]);
626 return;
628 asmparser_texreg2gb(parser, mod, shift, dst, &srcs->reg[0]);
629 return;
632 return;
633 }
634
635 instr = alloc_instr(src_count);
636 if (!instr)
637 {
638 ERR("Error allocating memory for the instruction\n");
640 return;
641 }
642
643 instr->opcode = opcode;
644 instr->dstmod = mod;
645 instr->shift = shift;
646 instr->comptype = comp;
647 if (dst)
648 parser->funcs->dstreg(parser, instr, dst);
649 for (i = 0; i < src_count; i++)
650 {
651 parser->funcs->srcreg(parser, instr, i, &srcs->reg[i]);
652 }
653
654 if (!add_instruction(parser->shader, instr))
655 {
656 ERR("Out of memory\n");
658 }
659}
static void asmparser_texreg2rgb(struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst, const struct shader_reg *src0)
Definition: asmparser.c:528
static void asmparser_texkill(struct asm_parser *parser, const struct shader_reg *dst)
Definition: asmparser.c:378
static void asmparser_texreg2gb(struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst, const struct shader_reg *src0)
Definition: asmparser.c:517
static void asmparser_texreg2ar(struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst, const struct shader_reg *src0)
Definition: asmparser.c:506
static void asmparser_texcrd(struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst, const struct src_regs *srcs)
Definition: asmparser.c:342
static void asmparser_tex(struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst)
Definition: asmparser.c:449
static void asmparser_texcoord(struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst, const struct src_regs *srcs)
Definition: asmparser.c:302
static void asmparser_sincos(struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst, const struct src_regs *srcs)
Definition: asmparser.c:214
static void asmparser_texld14(struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst, const struct src_regs *srcs)
Definition: asmparser.c:458
struct instruction * alloc_instr(unsigned int srcs)
BOOL add_instruction(struct bwriter_shader *shader, struct instruction *instr)
const char * debug_print_shift(uint32_t shift)
Definition: utils.c:184
const char * debug_print_comp(uint32_t comp)
Definition: utils.c:407
@ ST_VERTEX
const char * debug_print_dstmod(uint32_t mod)
Definition: utils.c:159
@ BWRITERSIO_TEX
@ BWRITERSIO_TEXREG2AR
@ BWRITERSIO_TEXCOORD
@ BWRITERSIO_TEXREG2RGB
@ BWRITERSIO_SINCOS
@ BWRITERSIO_TEXKILL
@ BWRITERSIO_TEXREG2GB
const char * debug_print_srcreg(const struct shader_reg *reg)
Definition: utils.c:343
const char * debug_print_opcode(uint32_t opcode)
Definition: utils.c:422
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint shader
Definition: glext.h:6030
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define shift
Definition: input.c:3280
enum bwriter_comparison_type comptype
unsigned int count
struct shader_reg reg[MAX_SRC_REGS]

◆ asmparser_predicate_supported()

static void asmparser_predicate_supported ( struct asm_parser *  parser,
const struct shader_reg *  predicate 
)
static

Definition at line 1196 of file asmparser.c.

1197{
1198 if (!parser->shader)
1199 return;
1200 if (parser->shader->num_instrs == 0)
1201 ERR("Predicate without an instruction.\n");
1202 /* Set the predicate of the last instruction added to the shader. */
1203 parser->shader->instr[parser->shader->num_instrs - 1]->has_predicate = TRUE;
1204 parser->shader->instr[parser->shader->num_instrs - 1]->predicate = *predicate;
1205}

◆ asmparser_predicate_unsupported()

static void asmparser_predicate_unsupported ( struct asm_parser *  parser,
const struct shader_reg *  predicate 
)
static

Definition at line 1207 of file asmparser.c.

1208{
1209 asmparser_message(parser, "Line %u: Predicate not supported in < VS 2.0 or PS 2.x\n", parser->line_no);
1211}

◆ asmparser_sincos()

static void asmparser_sincos ( struct asm_parser *  parser,
uint32_t  mod,
uint32_t  shift,
const struct shader_reg *  dst,
const struct src_regs *  srcs 
)
static

Definition at line 214 of file asmparser.c.

216{
217 struct instruction *instr;
218
219 if (!srcs || srcs->count != 3)
220 {
221 asmparser_message(parser, "Line %u: sincos (vs 2) has an incorrect number of source registers\n", parser->line_no);
223 return;
224 }
225
226 instr = alloc_instr(3);
227 if (!instr)
228 {
229 ERR("Error allocating memory for the instruction\n");
231 return;
232 }
233
234 instr->opcode = BWRITERSIO_SINCOS;
235 instr->dstmod = mod;
236 instr->shift = shift;
237 instr->comptype = 0;
238
239 parser->funcs->dstreg(parser, instr, dst);
240 parser->funcs->srcreg(parser, instr, 0, &srcs->reg[0]);
241 parser->funcs->srcreg(parser, instr, 1, &srcs->reg[1]);
242 parser->funcs->srcreg(parser, instr, 2, &srcs->reg[2]);
243
244 if (!add_instruction(parser->shader, instr))
245 {
246 ERR("Out of memory\n");
248 }
249}

Referenced by asmparser_instr().

◆ asmparser_srcreg_ps_1_0123()

static void asmparser_srcreg_ps_1_0123 ( struct asm_parser *  parser,
struct instruction *  instr,
int  num,
const struct shader_reg *  src 
)
static

Definition at line 929 of file asmparser.c.

931{
932 struct shader_reg reg;
933
935 {
936 asmparser_message(parser, "Line %u: Source register %s not supported in <== PS 1.3\n",
937 parser->line_no, debug_print_srcreg(src));
939 }
940 check_abs_srcmod(parser, src->srcmod);
942 instr->src[num] = reg;
943}
static void check_abs_srcmod(struct asm_parser *parser, uint32_t srcmod)
Definition: asmparser.c:741
GLenum src
Definition: glext.h:6340
struct shader_reg * src

◆ asmparser_srcreg_ps_1_4()

static void asmparser_srcreg_ps_1_4 ( struct asm_parser *  parser,
struct instruction *  instr,
int  num,
const struct shader_reg *  src 
)
static

Definition at line 954 of file asmparser.c.

956{
957 struct shader_reg reg;
958
960 {
961 asmparser_message(parser, "Line %u: Source register %s not supported in PS 1.4\n",
962 parser->line_no, debug_print_srcreg(src));
964 }
965 check_abs_srcmod(parser, src->srcmod);
967 instr->src[num] = reg;
968}

◆ asmparser_srcreg_ps_2()

static void asmparser_srcreg_ps_2 ( struct asm_parser *  parser,
struct instruction *  instr,
int  num,
const struct shader_reg *  src 
)
static

Definition at line 984 of file asmparser.c.

986{
987 struct shader_reg reg;
988
990 {
991 asmparser_message(parser, "Line %u: Source register %s not supported in PS 2.0\n",
992 parser->line_no, debug_print_srcreg(src));
994 }
996 check_abs_srcmod(parser, src->srcmod);
998 instr->src[num] = reg;
999}
static void check_legacy_srcmod(struct asm_parser *parser, uint32_t srcmod)
Definition: asmparser.c:727

◆ asmparser_srcreg_ps_2_x()

static void asmparser_srcreg_ps_2_x ( struct asm_parser *  parser,
struct instruction *  instr,
int  num,
const struct shader_reg *  src 
)
static

Definition at line 1017 of file asmparser.c.

1019{
1020 struct shader_reg reg;
1021
1023 {
1024 asmparser_message(parser, "Line %u: Source register %s not supported in PS 2.x\n",
1025 parser->line_no, debug_print_srcreg(src));
1027 }
1028 check_legacy_srcmod(parser, src->srcmod);
1029 check_abs_srcmod(parser, src->srcmod);
1031 instr->src[num] = reg;
1032}

◆ asmparser_srcreg_ps_3()

static void asmparser_srcreg_ps_3 ( struct asm_parser *  parser,
struct instruction *  instr,
int  num,
const struct shader_reg *  src 
)
static

Definition at line 1051 of file asmparser.c.

1053{
1055 {
1056 asmparser_message(parser, "Line %u: Source register %s not supported in PS 3.0\n",
1057 parser->line_no, debug_print_srcreg(src));
1059 }
1061 check_legacy_srcmod(parser, src->srcmod);
1062 instr->src[num] = *src;
1063}
static void check_loop_swizzle(struct asm_parser *parser, const struct shader_reg *src)
Definition: asmparser.c:751

◆ asmparser_srcreg_vs_1()

static void asmparser_srcreg_vs_1 ( struct asm_parser *  parser,
struct instruction *  instr,
int  num,
const struct shader_reg *  src 
)
static

Definition at line 838 of file asmparser.c.

840{
841 struct shader_reg reg;
842
844 {
845 asmparser_message(parser, "Line %u: Source register %s not supported in VS 1\n",
846 parser->line_no, debug_print_srcreg(src));
848 }
850 check_abs_srcmod(parser, src->srcmod);
852 instr->src[num] = reg;
853}

◆ asmparser_srcreg_vs_2()

static void asmparser_srcreg_vs_2 ( struct asm_parser *  parser,
struct instruction *  instr,
int  num,
const struct shader_reg *  src 
)
static

Definition at line 872 of file asmparser.c.

874{
875 struct shader_reg reg;
876
878 {
879 asmparser_message(parser, "Line %u: Source register %s not supported in VS 2\n",
880 parser->line_no, debug_print_srcreg(src));
882 }
885 check_abs_srcmod(parser, src->srcmod);
887 instr->src[num] = reg;
888}

◆ asmparser_srcreg_vs_3()

static void asmparser_srcreg_vs_3 ( struct asm_parser *  parser,
struct instruction *  instr,
int  num,
const struct shader_reg *  src 
)
static

Definition at line 906 of file asmparser.c.

908{
910 {
911 asmparser_message(parser, "Line %u: Source register %s not supported in VS 3.0\n",
912 parser->line_no, debug_print_srcreg(src));
914 }
917 instr->src[num] = *src;
918}

◆ asmparser_tex()

static void asmparser_tex ( struct asm_parser *  parser,
uint32_t  mod,
uint32_t  shift,
const struct shader_reg *  dst 
)
static

Definition at line 449 of file asmparser.c.

450{
451 struct shader_reg src;
452
453 /* The first source register is the varying containing the coordinate */
456}
static void asmparser_texhelper(struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst, const struct shader_reg *src0)
Definition: asmparser.c:411

Referenced by asmparser_instr().

◆ asmparser_texcoord()

static void asmparser_texcoord ( struct asm_parser *  parser,
uint32_t  mod,
uint32_t  shift,
const struct shader_reg *  dst,
const struct src_regs *  srcs 
)
static

Definition at line 302 of file asmparser.c.

304{
305 struct instruction *instr;
306
307 if (srcs)
308 {
309 asmparser_message(parser, "Line %u: Source registers in texcoord instruction\n", parser->line_no);
311 return;
312 }
313
314 instr = alloc_instr(1);
315 if (!instr)
316 {
317 ERR("Error allocating memory for the instruction\n");
319 return;
320 }
321
322 /* texcoord copies the texture coord data into a temporary register-like
323 * readable form. In newer shader models this equals a MOV from v0 to r0,
324 * record it as this.
325 */
326 instr->opcode = BWRITERSIO_MOV;
327 instr->dstmod = mod | BWRITERSPDM_SATURATE; /* texcoord clamps to [0;1] */
328 instr->shift = shift;
329 instr->comptype = 0;
330
331 parser->funcs->dstreg(parser, instr, dst);
332 /* The src reg needs special care */
333 instr->src[0] = map_oldps_register(dst, TRUE);
334
335 if (!add_instruction(parser->shader, instr))
336 {
337 ERR("Out of memory\n");
339 }
340}
@ BWRITERSPDM_SATURATE
@ BWRITERSIO_MOV

Referenced by asmparser_instr().

◆ asmparser_texcrd()

static void asmparser_texcrd ( struct asm_parser *  parser,
uint32_t  mod,
uint32_t  shift,
const struct shader_reg *  dst,
const struct src_regs *  srcs 
)
static

Definition at line 342 of file asmparser.c.

344{
345 struct instruction *instr;
346
347 if (!srcs || srcs->count != 1)
348 {
349 asmparser_message(parser, "Line %u: Wrong number of source registers in texcrd instruction\n", parser->line_no);
351 return;
352 }
353
354 instr = alloc_instr(1);
355 if (!instr)
356 {
357 ERR("Error allocating memory for the instruction\n");
359 return;
360 }
361
362 /* The job of texcrd is done by mov in later shader versions */
363 instr->opcode = BWRITERSIO_MOV;
364 instr->dstmod = mod;
365 instr->shift = shift;
366 instr->comptype = 0;
367
368 parser->funcs->dstreg(parser, instr, dst);
369 parser->funcs->srcreg(parser, instr, 0, &srcs->reg[0]);
370
371 if (!add_instruction(parser->shader, instr))
372 {
373 ERR("Out of memory\n");
375 }
376}

Referenced by asmparser_instr().

◆ asmparser_texhelper()

static void asmparser_texhelper ( struct asm_parser *  parser,
uint32_t  mod,
uint32_t  shift,
const struct shader_reg *  dst,
const struct shader_reg *  src0 
)
static

Definition at line 411 of file asmparser.c.

413{
414 struct instruction *instr = alloc_instr(2);
415
416 if (!instr)
417 {
418 ERR("Error allocating memory for the instruction\n");
420 return;
421 }
422
423 instr->opcode = BWRITERSIO_TEX;
424 instr->dstmod = mod;
425 instr->shift = shift;
426 instr->comptype = 0;
427 /* The dest register can be mapped normally to a temporary register */
428 parser->funcs->dstreg(parser, instr, dst);
429 /* Use the src passed as parameter by the specific instruction handler */
430 instr->src[0] = *src0;
431
432 /* The 2nd source register is the sampler register with the
433 * destination's regnum
434 */
435 ZeroMemory(&instr->src[1], sizeof(instr->src[1]));
436 instr->src[1].type = BWRITERSPR_SAMPLER;
437 instr->src[1].regnum = dst->regnum;
438 instr->src[1].swizzle = BWRITERVS_NOSWIZZLE;
439 instr->src[1].srcmod = BWRITERSPSM_NONE;
440 instr->src[1].rel_reg = NULL;
441
442 if (!add_instruction(parser->shader, instr))
443 {
444 ERR("Out of memory\n");
446 }
447}
@ BWRITERSPSM_NONE
#define BWRITERVS_NOSWIZZLE
@ BWRITERSPR_SAMPLER
#define NULL
Definition: types.h:112
#define ZeroMemory
Definition: minwinbase.h:31

Referenced by asmparser_tex(), asmparser_texreg2ar(), asmparser_texreg2gb(), and asmparser_texreg2rgb().

◆ asmparser_texkill()

static void asmparser_texkill ( struct asm_parser *  parser,
const struct shader_reg *  dst 
)
static

Definition at line 378 of file asmparser.c.

379{
380 struct instruction *instr = alloc_instr(0);
381
382 if (!instr)
383 {
384 ERR("Error allocating memory for the instruction\n");
386 return;
387 }
388
389 instr->opcode = BWRITERSIO_TEXKILL;
390 instr->dstmod = 0;
391 instr->shift = 0;
392 instr->comptype = 0;
393
394 /* Do not run the dst register through the normal
395 * register conversion. If used with ps_1_0 to ps_1_3
396 * the texture coordinate from that register is used,
397 * not the temporary register value. In ps_1_4 and
398 * ps_2_0 t0 is always a varying and temporaries can
399 * be used with texkill.
400 */
401 instr->dst = map_oldps_register(dst, TRUE);
402 instr->has_dst = TRUE;
403
404 if (!add_instruction(parser->shader, instr))
405 {
406 ERR("Out of memory\n");
408 }
409}

Referenced by asmparser_instr().

◆ asmparser_texld14()

static void asmparser_texld14 ( struct asm_parser *  parser,
uint32_t  mod,
uint32_t  shift,
const struct shader_reg *  dst,
const struct src_regs *  srcs 
)
static

Definition at line 458 of file asmparser.c.

460{
461 struct instruction *instr;
462
463 if (!srcs || srcs->count != 1)
464 {
465 asmparser_message(parser, "Line %u: texld (PS 1.4) has a wrong number of source registers\n", parser->line_no);
467 return;
468 }
469
470 instr = alloc_instr(2);
471 if (!instr)
472 {
473 ERR("Error allocating memory for the instruction\n");
475 return;
476 }
477
478 /* This code is recording a texld instruction, not tex. However,
479 * texld borrows the opcode of tex
480 */
481 instr->opcode = BWRITERSIO_TEX;
482 instr->dstmod = mod;
483 instr->shift = shift;
484 instr->comptype = 0;
485
486 parser->funcs->dstreg(parser, instr, dst);
487 parser->funcs->srcreg(parser, instr, 0, &srcs->reg[0]);
488
489 /* The 2nd source register is the sampler register with the
490 * destination's regnum
491 */
492 ZeroMemory(&instr->src[1], sizeof(instr->src[1]));
493 instr->src[1].type = BWRITERSPR_SAMPLER;
494 instr->src[1].regnum = dst->regnum;
495 instr->src[1].swizzle = BWRITERVS_NOSWIZZLE;
496 instr->src[1].srcmod = BWRITERSPSM_NONE;
497 instr->src[1].rel_reg = NULL;
498
499 if (!add_instruction(parser->shader, instr))
500 {
501 ERR("Out of memory\n");
503 }
504}

Referenced by asmparser_instr().

◆ asmparser_texreg2ar()

static void asmparser_texreg2ar ( struct asm_parser *  parser,
uint32_t  mod,
uint32_t  shift,
const struct shader_reg *  dst,
const struct shader_reg *  src0 
)
static

Definition at line 506 of file asmparser.c.

508{
509 struct shader_reg src;
510
512 /* Supply the correct swizzle */
515}
#define BWRITERVS_Y_X
#define BWRITERVS_W_X
#define BWRITERVS_Z_X
#define BWRITERVS_X_W

Referenced by asmparser_instr().

◆ asmparser_texreg2gb()

static void asmparser_texreg2gb ( struct asm_parser *  parser,
uint32_t  mod,
uint32_t  shift,
const struct shader_reg *  dst,
const struct shader_reg *  src0 
)
static

Definition at line 517 of file asmparser.c.

519{
520 struct shader_reg src;
521
523 /* Supply the correct swizzle */
526}
#define BWRITERVS_Z_Z
#define BWRITERVS_Y_Z
#define BWRITERVS_W_Z
#define BWRITERVS_X_Y

Referenced by asmparser_instr().

◆ asmparser_texreg2rgb()

static void asmparser_texreg2rgb ( struct asm_parser *  parser,
uint32_t  mod,
uint32_t  shift,
const struct shader_reg *  dst,
const struct shader_reg *  src0 
)
static

Definition at line 528 of file asmparser.c.

530{
531 struct shader_reg src;
532
534 /* Supply the correct swizzle */
537}
#define BWRITERVS_X_X
#define BWRITERVS_Y_Y

Referenced by asmparser_instr().

◆ check_abs_srcmod()

static void check_abs_srcmod ( struct asm_parser *  parser,
uint32_t  srcmod 
)
static

Definition at line 741 of file asmparser.c.

742{
743 if (srcmod == BWRITERSPSM_ABS || srcmod == BWRITERSPSM_ABSNEG)
744 {
745 asmparser_message(parser, "Line %u: Source modifier %s not supported in this shader version\n",
746 parser->line_no, debug_print_srcmod(srcmod));
748 }
749}
const char * debug_print_srcmod(uint32_t mod)
Definition: utils.c:134
@ BWRITERSPSM_ABS
@ BWRITERSPSM_ABSNEG

Referenced by asmparser_srcreg_ps_1_0123(), asmparser_srcreg_ps_1_4(), asmparser_srcreg_ps_2(), asmparser_srcreg_ps_2_x(), asmparser_srcreg_vs_1(), and asmparser_srcreg_vs_2().

◆ check_legacy_srcmod()

static void check_legacy_srcmod ( struct asm_parser *  parser,
uint32_t  srcmod 
)
static

Definition at line 727 of file asmparser.c.

728{
729 if (srcmod == BWRITERSPSM_BIAS || srcmod == BWRITERSPSM_BIASNEG ||
730 srcmod == BWRITERSPSM_SIGN || srcmod == BWRITERSPSM_SIGNNEG ||
731 srcmod == BWRITERSPSM_COMP || srcmod == BWRITERSPSM_X2 ||
732 srcmod == BWRITERSPSM_X2NEG || srcmod == BWRITERSPSM_DZ ||
733 srcmod == BWRITERSPSM_DW)
734 {
735 asmparser_message(parser, "Line %u: Source modifier %s not supported in this shader version\n",
736 parser->line_no, debug_print_srcmod(srcmod));
738 }
739}
@ BWRITERSPSM_COMP
@ BWRITERSPSM_X2
@ BWRITERSPSM_BIAS
@ BWRITERSPSM_X2NEG
@ BWRITERSPSM_SIGNNEG
@ BWRITERSPSM_BIASNEG
@ BWRITERSPSM_DZ
@ BWRITERSPSM_SIGN
@ BWRITERSPSM_DW

Referenced by asmparser_srcreg_ps_2(), asmparser_srcreg_ps_2_x(), asmparser_srcreg_ps_3(), asmparser_srcreg_vs_1(), asmparser_srcreg_vs_2(), and asmparser_srcreg_vs_3().

◆ check_loop_swizzle()

static void check_loop_swizzle ( struct asm_parser *  parser,
const struct shader_reg *  src 
)
static

Definition at line 751 of file asmparser.c.

752{
753 if ((src->type == BWRITERSPR_LOOP && src->swizzle != BWRITERVS_NOSWIZZLE)
754 || (src->rel_reg && src->rel_reg->type == BWRITERSPR_LOOP &&
755 src->rel_reg->swizzle != BWRITERVS_NOSWIZZLE))
756 {
757 asmparser_message(parser, "Line %u: Swizzle not allowed on aL register\n", parser->line_no);
759 }
760}
@ BWRITERSPR_LOOP

Referenced by asmparser_srcreg_ps_3(), asmparser_srcreg_vs_2(), and asmparser_srcreg_vs_3().

◆ check_ps_dstmod()

static void check_ps_dstmod ( struct asm_parser *  parser,
uint32_t  dstmod 
)
static

Definition at line 771 of file asmparser.c.

772{
774 {
775 asmparser_message(parser, "Line %u: Instruction modifier %s not supported in this shader version\n",
776 parser->line_no, debug_print_dstmod(dstmod));
778 }
779}

Referenced by asmparser_dstreg_vs_1(), asmparser_dstreg_vs_2(), and asmparser_dstreg_vs_3().

◆ check_reg_type()

static BOOL check_reg_type ( const struct shader_reg *  reg,
const struct allowed_reg_type *  allowed 
)
static

Definition at line 788 of file asmparser.c.

789{
790 unsigned int i = 0;
791
792 while (allowed[i].type != ~0u)
793 {
794 if (reg->type == allowed[i].type)
795 {
796 if (reg->rel_reg)
797 {
798 /* The relative addressing register can have a negative value,
799 * we can't check the register index. */
800 if (allowed[i].reladdr)
801 return TRUE;
802 return FALSE;
803 }
804 if (reg->regnum < allowed[i].count)
805 return TRUE;
806 return FALSE;
807 }
808 i++;
809 }
810 return FALSE;
811}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240

Referenced by asmparser_dstreg_ps_1_0123(), asmparser_dstreg_ps_1_4(), asmparser_dstreg_ps_2(), asmparser_dstreg_ps_2_x(), asmparser_dstreg_ps_3(), asmparser_dstreg_vs_1(), asmparser_dstreg_vs_2(), asmparser_dstreg_vs_3(), asmparser_srcreg_ps_1_0123(), asmparser_srcreg_ps_1_4(), asmparser_srcreg_ps_2(), asmparser_srcreg_ps_2_x(), asmparser_srcreg_ps_3(), asmparser_srcreg_vs_1(), asmparser_srcreg_vs_2(), and asmparser_srcreg_vs_3().

◆ check_shift_dstmod()

static void check_shift_dstmod ( struct asm_parser *  parser,
uint32_t  shift 
)
static

Definition at line 762 of file asmparser.c.

763{
764 if (shift != 0)
765 {
766 asmparser_message(parser, "Line %u: Shift modifiers not supported in this shader version\n", parser->line_no);
768 }
769}

Referenced by asmparser_dstreg_ps_2(), asmparser_dstreg_ps_2_x(), asmparser_dstreg_ps_3(), asmparser_dstreg_vs_1(), asmparser_dstreg_vs_2(), and asmparser_dstreg_vs_3().

◆ create_ps10_parser()

void create_ps10_parser ( struct asm_parser *  ret)

Definition at line 1516 of file asmparser.c.

1516 {
1517 TRACE_(parsed_shader)("ps_1_0\n");
1518
1519 ret->shader = calloc(1, sizeof(*ret->shader));
1520 if(!ret->shader) {
1521 ERR("Failed to allocate memory for the shader\n");
1522 set_parse_status(&ret->status, PARSE_ERR);
1523 return;
1524 }
1525
1526 ret->shader->type = ST_PIXEL;
1527 ret->shader->major_version = 1;
1528 ret->shader->minor_version = 0;
1529 ret->funcs = &parser_ps_1_0123;
1530 gen_oldps_input(ret->shader, 4);
1531}
static const struct asmparser_backend parser_ps_1_0123
Definition: asmparser.c:1292
static void gen_oldps_input(struct bwriter_shader *shader, uint32_t texcoords)
Definition: asmparser.c:1408
return ret
Definition: mutex.c:147
#define calloc
Definition: rosglue.h:14

◆ create_ps11_parser()

void create_ps11_parser ( struct asm_parser *  ret)

Definition at line 1533 of file asmparser.c.

1533 {
1534 TRACE_(parsed_shader)("ps_1_1\n");
1535
1536 ret->shader = calloc(1, sizeof(*ret->shader));
1537 if(!ret->shader) {
1538 ERR("Failed to allocate memory for the shader\n");
1539 set_parse_status(&ret->status, PARSE_ERR);
1540 return;
1541 }
1542
1543 ret->shader->type = ST_PIXEL;
1544 ret->shader->major_version = 1;
1545 ret->shader->minor_version = 1;
1546 ret->funcs = &parser_ps_1_0123;
1547 gen_oldps_input(ret->shader, 4);
1548}

◆ create_ps12_parser()

void create_ps12_parser ( struct asm_parser *  ret)

Definition at line 1550 of file asmparser.c.

1550 {
1551 TRACE_(parsed_shader)("ps_1_2\n");
1552
1553 ret->shader = calloc(1, sizeof(*ret->shader));
1554 if(!ret->shader) {
1555 ERR("Failed to allocate memory for the shader\n");
1556 set_parse_status(&ret->status, PARSE_ERR);
1557 return;
1558 }
1559
1560 ret->shader->type = ST_PIXEL;
1561 ret->shader->major_version = 1;
1562 ret->shader->minor_version = 2;
1563 ret->funcs = &parser_ps_1_0123;
1564 gen_oldps_input(ret->shader, 4);
1565}

◆ create_ps13_parser()

void create_ps13_parser ( struct asm_parser *  ret)

Definition at line 1567 of file asmparser.c.

1567 {
1568 TRACE_(parsed_shader)("ps_1_3\n");
1569
1570 ret->shader = calloc(1, sizeof(*ret->shader));
1571 if(!ret->shader) {
1572 ERR("Failed to allocate memory for the shader\n");
1573 set_parse_status(&ret->status, PARSE_ERR);
1574 return;
1575 }
1576
1577 ret->shader->type = ST_PIXEL;
1578 ret->shader->major_version = 1;
1579 ret->shader->minor_version = 3;
1580 ret->funcs = &parser_ps_1_0123;
1581 gen_oldps_input(ret->shader, 4);
1582}

◆ create_ps14_parser()

void create_ps14_parser ( struct asm_parser *  ret)

Definition at line 1584 of file asmparser.c.

1584 {
1585 TRACE_(parsed_shader)("ps_1_4\n");
1586
1587 ret->shader = calloc(1, sizeof(*ret->shader));
1588 if(!ret->shader) {
1589 ERR("Failed to allocate memory for the shader\n");
1590 set_parse_status(&ret->status, PARSE_ERR);
1591 return;
1592 }
1593
1594 ret->shader->type = ST_PIXEL;
1595 ret->shader->major_version = 1;
1596 ret->shader->minor_version = 4;
1597 ret->funcs = &parser_ps_1_4;
1598 gen_oldps_input(ret->shader, 6);
1599}
static const struct asmparser_backend parser_ps_1_4
Definition: asmparser.c:1312

◆ create_ps20_parser()

void create_ps20_parser ( struct asm_parser *  ret)

Definition at line 1601 of file asmparser.c.

1601 {
1602 TRACE_(parsed_shader)("ps_2_0\n");
1603
1604 ret->shader = calloc(1, sizeof(*ret->shader));
1605 if(!ret->shader) {
1606 ERR("Failed to allocate memory for the shader\n");
1607 set_parse_status(&ret->status, PARSE_ERR);
1608 return;
1609 }
1610
1611 ret->shader->type = ST_PIXEL;
1612 ret->shader->major_version = 2;
1613 ret->shader->minor_version = 0;
1614 ret->funcs = &parser_ps_2;
1615 gen_oldps_input(ret->shader, 8);
1616}
static const struct asmparser_backend parser_ps_2
Definition: asmparser.c:1332

◆ create_ps2x_parser()

void create_ps2x_parser ( struct asm_parser *  ret)

Definition at line 1618 of file asmparser.c.

1618 {
1619 TRACE_(parsed_shader)("ps_2_x\n");
1620
1621 ret->shader = calloc(1, sizeof(*ret->shader));
1622 if(!ret->shader) {
1623 ERR("Failed to allocate memory for the shader\n");
1624 set_parse_status(&ret->status, PARSE_ERR);
1625 return;
1626 }
1627
1628 ret->shader->type = ST_PIXEL;
1629 ret->shader->major_version = 2;
1630 ret->shader->minor_version = 1;
1631 ret->funcs = &parser_ps_2_x;
1632 gen_oldps_input(ret->shader, 8);
1633}
static const struct asmparser_backend parser_ps_2_x
Definition: asmparser.c:1352

◆ create_ps30_parser()

void create_ps30_parser ( struct asm_parser *  ret)

Definition at line 1635 of file asmparser.c.

1635 {
1636 TRACE_(parsed_shader)("ps_3_0\n");
1637
1638 ret->shader = calloc(1, sizeof(*ret->shader));
1639 if(!ret->shader) {
1640 ERR("Failed to allocate memory for the shader\n");
1641 set_parse_status(&ret->status, PARSE_ERR);
1642 return;
1643 }
1644
1645 ret->shader->type = ST_PIXEL;
1646 ret->shader->major_version = 3;
1647 ret->shader->minor_version = 0;
1648 ret->funcs = &parser_ps_3;
1649}
static const struct asmparser_backend parser_ps_3
Definition: asmparser.c:1372

◆ create_vs10_parser()

void create_vs10_parser ( struct asm_parser *  ret)

Definition at line 1432 of file asmparser.c.

1432 {
1433 TRACE_(parsed_shader)("vs_1_0\n");
1434
1435 ret->shader = calloc(1, sizeof(*ret->shader));
1436 if(!ret->shader) {
1437 ERR("Failed to allocate memory for the shader\n");
1438 set_parse_status(&ret->status, PARSE_ERR);
1439 return;
1440 }
1441
1442 ret->shader->type = ST_VERTEX;
1443 ret->shader->major_version = 1;
1444 ret->shader->minor_version = 0;
1445 ret->funcs = &parser_vs_1;
1446 gen_oldvs_output(ret->shader);
1447}
static const struct asmparser_backend parser_vs_1
Definition: asmparser.c:1232
static void gen_oldvs_output(struct bwriter_shader *shader)
Definition: asmparser.c:1392

◆ create_vs11_parser()

void create_vs11_parser ( struct asm_parser *  ret)

Definition at line 1449 of file asmparser.c.

1449 {
1450 TRACE_(parsed_shader)("vs_1_1\n");
1451
1452 ret->shader = calloc(1, sizeof(*ret->shader));
1453 if(!ret->shader) {
1454 ERR("Failed to allocate memory for the shader\n");
1455 set_parse_status(&ret->status, PARSE_ERR);
1456 return;
1457 }
1458
1459 ret->shader->type = ST_VERTEX;
1460 ret->shader->major_version = 1;
1461 ret->shader->minor_version = 1;
1462 ret->funcs = &parser_vs_1;
1463 gen_oldvs_output(ret->shader);
1464}

◆ create_vs20_parser()

void create_vs20_parser ( struct asm_parser *  ret)

Definition at line 1466 of file asmparser.c.

1466 {
1467 TRACE_(parsed_shader)("vs_2_0\n");
1468
1469 ret->shader = calloc(1, sizeof(*ret->shader));
1470 if(!ret->shader) {
1471 ERR("Failed to allocate memory for the shader\n");
1472 set_parse_status(&ret->status, PARSE_ERR);
1473 return;
1474 }
1475
1476 ret->shader->type = ST_VERTEX;
1477 ret->shader->major_version = 2;
1478 ret->shader->minor_version = 0;
1479 ret->funcs = &parser_vs_2;
1480 gen_oldvs_output(ret->shader);
1481}
static const struct asmparser_backend parser_vs_2
Definition: asmparser.c:1252

◆ create_vs2x_parser()

void create_vs2x_parser ( struct asm_parser *  ret)

Definition at line 1483 of file asmparser.c.

1483 {
1484 TRACE_(parsed_shader)("vs_2_x\n");
1485
1486 ret->shader = calloc(1, sizeof(*ret->shader));
1487 if(!ret->shader) {
1488 ERR("Failed to allocate memory for the shader\n");
1489 set_parse_status(&ret->status, PARSE_ERR);
1490 return;
1491 }
1492
1493 ret->shader->type = ST_VERTEX;
1494 ret->shader->major_version = 2;
1495 ret->shader->minor_version = 1;
1496 ret->funcs = &parser_vs_2;
1497 gen_oldvs_output(ret->shader);
1498}

◆ create_vs30_parser()

void create_vs30_parser ( struct asm_parser *  ret)

Definition at line 1500 of file asmparser.c.

1500 {
1501 TRACE_(parsed_shader)("vs_3_0\n");
1502
1503 ret->shader = calloc(1, sizeof(*ret->shader));
1504 if(!ret->shader) {
1505 ERR("Failed to allocate memory for the shader\n");
1506 set_parse_status(&ret->status, PARSE_ERR);
1507 return;
1508 }
1509
1510 ret->shader->type = ST_VERTEX;
1511 ret->shader->major_version = 3;
1512 ret->shader->minor_version = 0;
1513 ret->funcs = &parser_vs_3;
1514}
static const struct asmparser_backend parser_vs_3
Definition: asmparser.c:1272

◆ gen_oldps_input()

static void gen_oldps_input ( struct bwriter_shader *  shader,
uint32_t  texcoords 
)
static

Definition at line 1408 of file asmparser.c.

1409{
1410 switch(texcoords)
1411 {
1413 /* fall through */
1415 /* fall through */
1417 /* fall through */
1419 /* fall through */
1421 /* fall through */
1423 /* fall through */
1425 /* fall through */
1427 };
1430}
#define T5_VARYING
Definition: asmparser.c:62
#define T2_VARYING
Definition: asmparser.c:59
#define T1_VARYING
Definition: asmparser.c:58
#define T0_VARYING
Definition: asmparser.c:57
#define T7_VARYING
Definition: asmparser.c:64
#define C0_VARYING
Definition: asmparser.c:55
#define C1_VARYING
Definition: asmparser.c:56
#define T3_VARYING
Definition: asmparser.c:60
#define T4_VARYING
Definition: asmparser.c:61
#define T6_VARYING
Definition: asmparser.c:63
@ BWRITERDECLUSAGE_COLOR
@ BWRITERDECLUSAGE_TEXCOORD
#define BWRITERSP_WRITEMASK_ALL

Referenced by create_ps10_parser(), create_ps11_parser(), create_ps12_parser(), create_ps13_parser(), create_ps14_parser(), create_ps20_parser(), and create_ps2x_parser().

◆ gen_oldvs_output()

static void gen_oldvs_output ( struct bwriter_shader *  shader)
static

Definition at line 1392 of file asmparser.c.

1392 {
1406}
#define OT2_REG
Definition: asmparser.c:40
#define OT6_REG
Definition: asmparser.c:44
#define OT0_REG
Definition: asmparser.c:38
#define OPTS_WRITEMASK
Definition: asmparser.c:50
#define OD1_REG
Definition: asmparser.c:52
#define OFOG_WRITEMASK
Definition: asmparser.c:48
#define OPTS_REG
Definition: asmparser.c:49
#define OT4_REG
Definition: asmparser.c:42
#define OFOG_REG
Definition: asmparser.c:47
#define OD0_REG
Definition: asmparser.c:51
#define OT5_REG
Definition: asmparser.c:43
#define OPOS_REG
Definition: asmparser.c:46
#define OT1_REG
Definition: asmparser.c:39
#define OT7_REG
Definition: asmparser.c:45
#define OT3_REG
Definition: asmparser.c:41
@ BWRITERDECLUSAGE_FOG
@ BWRITERDECLUSAGE_PSIZE
@ BWRITERDECLUSAGE_POSITION

Referenced by create_vs10_parser(), create_vs11_parser(), create_vs20_parser(), and create_vs2x_parser().

◆ map_oldps_register()

static struct shader_reg map_oldps_register ( const struct shader_reg *  reg,
BOOL  tex_varying 
)
static

Definition at line 251 of file asmparser.c.

252{
253 struct shader_reg ret;
254
255 switch (reg->type)
256 {
258 if (tex_varying)
259 {
260 ret = *reg;
261 ret.type = BWRITERSPR_INPUT;
262 switch (reg->regnum)
263 {
264 case 0: ret.regnum = T0_VARYING; break;
265 case 1: ret.regnum = T1_VARYING; break;
266 case 2: ret.regnum = T2_VARYING; break;
267 case 3: ret.regnum = T3_VARYING; break;
268 case 4: ret.regnum = T4_VARYING; break;
269 case 5: ret.regnum = T5_VARYING; break;
270 case 6: ret.regnum = T6_VARYING; break;
271 case 7: ret.regnum = T7_VARYING; break;
272 default:
273 FIXME("Unexpected TEXTURE register t%u.\n", reg->regnum);
274 return *reg;
275 }
276 return ret;
277 }
278 else
279 {
280 ret = *reg;
281 ret.type = BWRITERSPR_TEMP;
282 switch(reg->regnum)
283 {
284 case 0: ret.regnum = T0_REG; break;
285 case 1: ret.regnum = T1_REG; break;
286 case 2: ret.regnum = T2_REG; break;
287 case 3: ret.regnum = T3_REG; break;
288 default:
289 FIXME("Unexpected TEXTURE register t%u.\n", reg->regnum);
290 return *reg;
291 }
292 return ret;
293 }
294
295 /* case BWRITERSPR_INPUT - Identical mapping of 1.x/2.0 color varyings
296 to 3.0 ones */
297
298 default: return *reg;
299 }
300}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define T3_REG
#define T1_REG
#define T0_REG
@ BWRITERSPR_TEXTURE
@ BWRITERSPR_TEMP
@ BWRITERSPR_INPUT
#define T2_REG

Referenced by asmparser_dstreg_ps_1_0123(), asmparser_dstreg_ps_1_4(), asmparser_dstreg_ps_2(), asmparser_dstreg_ps_2_x(), asmparser_srcreg_ps_1_0123(), asmparser_srcreg_ps_1_4(), asmparser_srcreg_ps_2(), asmparser_srcreg_ps_2_x(), asmparser_tex(), asmparser_texcoord(), asmparser_texkill(), asmparser_texreg2ar(), asmparser_texreg2gb(), and asmparser_texreg2rgb().

◆ map_oldvs_register()

static struct shader_reg map_oldvs_register ( const struct shader_reg *  reg)
static

Definition at line 661 of file asmparser.c.

662{
663 struct shader_reg ret;
664
665 switch(reg->type)
666 {
668 ret = *reg;
669 ret.type = BWRITERSPR_OUTPUT;
670 switch(reg->regnum)
671 {
673 ret.regnum = OPOS_REG;
674 break;
675 case BWRITERSRO_FOG:
676 ret.regnum = OFOG_REG;
677 ret.writemask = OFOG_WRITEMASK;
678 break;
680 ret.regnum = OPTS_REG;
681 ret.writemask = OPTS_WRITEMASK;
682 break;
683 default:
684 FIXME("Unhandled RASTOUT register %u.\n", reg->regnum);
685 return *reg;
686 }
687 return ret;
688
690 ret = *reg;
691 ret.type = BWRITERSPR_OUTPUT;
692 switch(reg->regnum)
693 {
694 case 0: ret.regnum = OT0_REG; break;
695 case 1: ret.regnum = OT1_REG; break;
696 case 2: ret.regnum = OT2_REG; break;
697 case 3: ret.regnum = OT3_REG; break;
698 case 4: ret.regnum = OT4_REG; break;
699 case 5: ret.regnum = OT5_REG; break;
700 case 6: ret.regnum = OT6_REG; break;
701 case 7: ret.regnum = OT7_REG; break;
702 default:
703 FIXME("Unhandled TEXCRDOUT regnum %u.\n", reg->regnum);
704 return *reg;
705 }
706 return ret;
707
709 ret = *reg;
710 ret.type = BWRITERSPR_OUTPUT;
711 switch(reg->regnum)
712 {
713 case 0: ret.regnum = OD0_REG; break;
714 case 1: ret.regnum = OD1_REG; break;
715 default:
716 FIXME("Unhandled ATTROUT regnum %u.\n", reg->regnum);
717 return *reg;
718 }
719 return ret;
720
721 default: return *reg;
722 }
723}
@ BWRITERSRO_POSITION
@ BWRITERSRO_FOG
@ BWRITERSRO_POINT_SIZE
@ BWRITERSPR_TEXCRDOUT
@ BWRITERSPR_RASTOUT
@ BWRITERSPR_ATTROUT
@ BWRITERSPR_OUTPUT

Referenced by asmparser_dstreg_vs_1(), asmparser_dstreg_vs_2(), asmparser_srcreg_vs_1(), and asmparser_srcreg_vs_2().

◆ WINE_DECLARE_DEBUG_CHANNEL()

WINE_DECLARE_DEBUG_CHANNEL ( parsed_shader  )

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( asmshader  )

Variable Documentation

◆ parser_ps_1_0123

const struct asmparser_backend parser_ps_1_0123
static
Initial value:
= {
}
static void asmparser_srcreg_ps_1_0123(struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
Definition: asmparser.c:929
static void asmparser_constB(struct asm_parser *parser, uint32_t reg, BOOL x)
Definition: asmparser.c:87
static void asmparser_instr(struct asm_parser *parser, uint32_t opcode, uint32_t mod, uint32_t shift, enum bwriter_comparison_type comp, const struct shader_reg *dst, const struct src_regs *srcs, int expectednsrcs)
Definition: asmparser.c:546
static void asmparser_dstreg_ps_1_0123(struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
Definition: asmparser.c:1116
static void asmparser_constI(struct asm_parser *parser, uint32_t reg, int x, int y, int z, int w)
Definition: asmparser.c:100
static void asmparser_dcl_input_unsupported(struct asm_parser *parser, uint32_t usage, uint32_t num, uint32_t mod, const struct shader_reg *reg)
Definition: asmparser.c:181
static void asmparser_end(struct asm_parser *This)
Definition: asmparser.c:70
static void asmparser_constF(struct asm_parser *parser, uint32_t reg, float x, float y, float z, float w)
Definition: asmparser.c:74
static void asmparser_dcl_sampler_unsupported(struct asm_parser *parser, uint32_t samptype, uint32_t mod, uint32_t regnum, unsigned int line_no)
Definition: asmparser.c:207
static void asmparser_dcl_output_unsupported(struct asm_parser *parser, uint32_t usage, uint32_t num, const struct shader_reg *reg)
Definition: asmparser.c:130
static void asmparser_predicate_unsupported(struct asm_parser *parser, const struct shader_reg *predicate)
Definition: asmparser.c:1207
static void asmparser_coissue_supported(struct asm_parser *parser)
Definition: asmparser.c:1213

Definition at line 1292 of file asmparser.c.

Referenced by create_ps10_parser(), create_ps11_parser(), create_ps12_parser(), and create_ps13_parser().

◆ parser_ps_1_4

const struct asmparser_backend parser_ps_1_4
static
Initial value:
= {
}
static void asmparser_dstreg_ps_1_4(struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
Definition: asmparser.c:1132
static void asmparser_srcreg_ps_1_4(struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
Definition: asmparser.c:954

Definition at line 1312 of file asmparser.c.

Referenced by create_ps14_parser().

◆ parser_ps_2

const struct asmparser_backend parser_ps_2
static
Initial value:
= {
}
static void asmparser_dcl_sampler(struct asm_parser *parser, uint32_t samptype, uint32_t mod, uint32_t regnum, unsigned int line_no)
Definition: asmparser.c:188
static void asmparser_dcl_input_ps_2(struct asm_parser *parser, uint32_t usage, uint32_t num, uint32_t mod, const struct shader_reg *reg)
Definition: asmparser.c:164
static void asmparser_coissue_unsupported(struct asm_parser *parser)
Definition: asmparser.c:1226
static void asmparser_dstreg_ps_2(struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
Definition: asmparser.c:1148
static void asmparser_srcreg_ps_2(struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
Definition: asmparser.c:984

Definition at line 1332 of file asmparser.c.

Referenced by create_ps20_parser().

◆ parser_ps_2_x

const struct asmparser_backend parser_ps_2_x
static
Initial value:
= {
}
static void asmparser_srcreg_ps_2_x(struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
Definition: asmparser.c:1017
static void asmparser_predicate_supported(struct asm_parser *parser, const struct shader_reg *predicate)
Definition: asmparser.c:1196
static void asmparser_dstreg_ps_2_x(struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
Definition: asmparser.c:1165

Definition at line 1352 of file asmparser.c.

Referenced by create_ps2x_parser().

◆ parser_ps_3

const struct asmparser_backend parser_ps_3
static
Initial value:
= {
}
static void asmparser_dcl_input(struct asm_parser *parser, uint32_t usage, uint32_t num, uint32_t mod, const struct shader_reg *reg)
Definition: asmparser.c:137
static void asmparser_srcreg_ps_3(struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
Definition: asmparser.c:1051
static void asmparser_dstreg_ps_3(struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
Definition: asmparser.c:1182

Definition at line 1372 of file asmparser.c.

Referenced by create_ps30_parser().

◆ parser_vs_1

const struct asmparser_backend parser_vs_1
static
Initial value:
= {
}
static void asmparser_dstreg_vs_1(struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
Definition: asmparser.c:1065
static void asmparser_srcreg_vs_1(struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
Definition: asmparser.c:838

Definition at line 1232 of file asmparser.c.

Referenced by create_vs10_parser(), and create_vs11_parser().

◆ parser_vs_2

const struct asmparser_backend parser_vs_2
static
Initial value:
= {
}
static void asmparser_srcreg_vs_2(struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
Definition: asmparser.c:872
static void asmparser_dstreg_vs_2(struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
Definition: asmparser.c:1083

Definition at line 1252 of file asmparser.c.

Referenced by create_vs20_parser(), and create_vs2x_parser().

◆ parser_vs_3

const struct asmparser_backend parser_vs_3
static
Initial value:
= {
}
static void asmparser_dcl_output(struct asm_parser *parser, uint32_t usage, uint32_t num, const struct shader_reg *reg)
Definition: asmparser.c:113
static void asmparser_dstreg_vs_3(struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
Definition: asmparser.c:1101
static void asmparser_srcreg_vs_3(struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
Definition: asmparser.c:906

Definition at line 1272 of file asmparser.c.

Referenced by create_vs30_parser().

◆ ps_1_0123_reg_allowed

const struct allowed_reg_type ps_1_0123_reg_allowed[]
static
Initial value:
=
{
{ ~0u, 0 }
}
@ BWRITERSPR_CONST

Definition at line 920 of file asmparser.c.

Referenced by asmparser_dstreg_ps_1_0123(), and asmparser_srcreg_ps_1_0123().

◆ ps_1_4_reg_allowed

const struct allowed_reg_type ps_1_4_reg_allowed[]
static
Initial value:
=
{
{ ~0u, 0 }
}

Definition at line 945 of file asmparser.c.

Referenced by asmparser_dstreg_ps_1_4(), and asmparser_srcreg_ps_1_4().

◆ ps_2_0_reg_allowed

const struct allowed_reg_type ps_2_0_reg_allowed[]
static
Initial value:
=
{
{ ~0u, 0 }
}
@ BWRITERSPR_CONSTINT
@ BWRITERSPR_CONSTBOOL
@ BWRITERSPR_COLOROUT
@ BWRITERSPR_DEPTHOUT

Definition at line 970 of file asmparser.c.

Referenced by asmparser_dstreg_ps_2(), and asmparser_srcreg_ps_2().

◆ ps_2_x_reg_allowed

const struct allowed_reg_type ps_2_x_reg_allowed[]
static
Initial value:

Definition at line 1001 of file asmparser.c.

Referenced by asmparser_dstreg_ps_2_x(), and asmparser_srcreg_ps_2_x().

◆ ps_3_reg_allowed

const struct allowed_reg_type ps_3_reg_allowed[]
static
Initial value:

Definition at line 1034 of file asmparser.c.

Referenced by asmparser_dstreg_ps_3(), and asmparser_srcreg_ps_3().

◆ vs_1_reg_allowed

const struct allowed_reg_type vs_1_reg_allowed[]
static
Initial value:

Definition at line 814 of file asmparser.c.

Referenced by asmparser_dstreg_vs_1(), and asmparser_srcreg_vs_1().

◆ vs_2_reg_allowed

const struct allowed_reg_type vs_2_reg_allowed[]
static
Initial value:

Definition at line 855 of file asmparser.c.

Referenced by asmparser_dstreg_vs_2(), and asmparser_srcreg_vs_2().

◆ vs_3_reg_allowed

const struct allowed_reg_type vs_3_reg_allowed[]
static
Initial value:

Definition at line 890 of file asmparser.c.

Referenced by asmparser_dstreg_vs_3(), and asmparser_srcreg_vs_3().