48#define OFOG_WRITEMASK BWRITERSP_WRITEMASK_0
50#define OPTS_WRITEMASK BWRITERSP_WRITEMASK_1
71 TRACE(
"Finalizing shader\n");
75 if(!
This->shader)
return;
76 TRACE(
"Adding float constant %u at pos %u\n",
reg,
This->shader->num_cf);
77 TRACE_(parsed_shader)(
"def c%u, %f, %f, %f, %f\n",
reg,
x,
y,
z,
w);
79 ERR(
"Out of memory\n");
85 if(!
This->shader)
return;
86 TRACE(
"Adding boolean constant %u at pos %u\n",
reg,
This->shader->num_cb);
87 TRACE_(parsed_shader)(
"def b%u, %s\n",
reg,
x ?
"true" :
"false");
89 ERR(
"Out of memory\n");
95 if(!
This->shader)
return;
96 TRACE(
"Adding integer constant %u at pos %u\n",
reg,
This->shader->num_ci);
97 TRACE_(parsed_shader)(
"def i%u, %d, %d, %d, %d\n",
reg,
x,
y,
z,
w);
99 ERR(
"Out of memory\n");
106 if(!
This->shader)
return;
112 ERR(
"Out of memory\n");
127 if(!
This->shader)
return;
143 ERR(
"Out of memory\n");
152 if(!
This->shader)
return;
157 ERR(
"Out of memory\n");
171 unsigned int line_no) {
172 if(!
This->shader)
return;
182 ERR(
"Out of memory\n");
199 if(!srcs || srcs->
count != 3) {
207 ERR(
"Error allocating memory for the instruction\n");
218 This->funcs->srcreg(
This, instr, 0, &srcs->
reg[0]);
219 This->funcs->srcreg(
This, instr, 1, &srcs->
reg[1]);
220 This->funcs->srcreg(
This, instr, 2, &srcs->
reg[2]);
223 ERR(
"Out of memory\n");
235 switch(
reg->regnum) {
245 FIXME(
"Unexpected TEXTURE register t%u\n",
reg->regnum);
252 switch(
reg->regnum) {
258 FIXME(
"Unexpected TEXTURE register t%u\n",
reg->regnum);
267 default:
return *
reg;
284 ERR(
"Error allocating memory for the instruction\n");
303 ERR(
"Out of memory\n");
313 if(!srcs || srcs->
count != 1) {
321 ERR(
"Error allocating memory for the instruction\n");
333 This->funcs->srcreg(
This, instr, 0, &srcs->
reg[0]);
336 ERR(
"Out of memory\n");
346 ERR(
"Error allocating memory for the instruction\n");
367 ERR(
"Out of memory\n");
378 ERR(
"Error allocating memory for the instruction\n");
390 instr->
src[0] = *src0;
397 instr->
src[1].regnum =
dst->regnum;
403 ERR(
"Out of memory\n");
422 if(!srcs || srcs->
count != 1) {
430 ERR(
"Error allocating memory for the instruction\n");
444 This->funcs->srcreg(
This, instr, 0, &srcs->
reg[0]);
451 instr->
src[1].regnum =
dst->regnum;
457 ERR(
"Out of memory\n");
504 const struct src_regs *srcs,
int expectednsrcs)
509 unsigned int src_count = srcs ? srcs->
count : 0;
511 if(!
This->shader)
return;
521 for(
i = 0;
i < src_count;
i++) {
522 if(!firstreg)
TRACE_(parsed_shader)(
", ");
523 else firstreg =
FALSE;
526 TRACE_(parsed_shader)(
"\n");
563 if(src_count != expectednsrcs) {
587 ERR(
"Error allocating memory for the instruction\n");
597 for(
i = 0;
i < src_count;
i++) {
602 ERR(
"Out of memory\n");
613 switch(
reg->regnum) {
626 FIXME(
"Unhandled RASTOUT register %u\n",
reg->regnum);
634 switch(
reg->regnum) {
644 FIXME(
"Unhandled TEXCRDOUT regnum %u\n",
reg->regnum);
652 switch(
reg->regnum) {
656 FIXME(
"Unhandled ATTROUT regnum %u\n",
reg->regnum);
661 default:
return *
reg;
727 while(allowed[
i].
type != ~0
U) {
730 if(allowed[
i].reladdr)
1122 if(!
This->shader)
return;
1123 if(
This->shader->num_instrs == 0)
ERR(
"Predicate without an instruction\n");
1124 This->shader->instr[
This->shader->num_instrs - 1]->has_predicate =
TRUE;
1125 This->shader->instr[
This->shader->num_instrs - 1]->predicate = *predicate;
1136 if(!
This->shader)
return;
1137 if(
This->shader->num_instrs == 0){
1141 This->shader->instr[
This->shader->num_instrs-1]->coissue =
TRUE;
1348 TRACE_(parsed_shader)(
"vs_1_0\n");
1352 ERR(
"Failed to allocate memory for the shader\n");
1364 TRACE_(parsed_shader)(
"vs_1_1\n");
1368 ERR(
"Failed to allocate memory for the shader\n");
1380 TRACE_(parsed_shader)(
"vs_2_0\n");
1384 ERR(
"Failed to allocate memory for the shader\n");
1396 TRACE_(parsed_shader)(
"vs_2_x\n");
1400 ERR(
"Failed to allocate memory for the shader\n");
1412 TRACE_(parsed_shader)(
"vs_3_0\n");
1416 ERR(
"Failed to allocate memory for the shader\n");
1427 TRACE_(parsed_shader)(
"ps_1_0\n");
1431 ERR(
"Failed to allocate memory for the shader\n");
1443 TRACE_(parsed_shader)(
"ps_1_1\n");
1447 ERR(
"Failed to allocate memory for the shader\n");
1459 TRACE_(parsed_shader)(
"ps_1_2\n");
1463 ERR(
"Failed to allocate memory for the shader\n");
1475 TRACE_(parsed_shader)(
"ps_1_3\n");
1479 ERR(
"Failed to allocate memory for the shader\n");
1491 TRACE_(parsed_shader)(
"ps_1_4\n");
1495 ERR(
"Failed to allocate memory for the shader\n");
1507 TRACE_(parsed_shader)(
"ps_2_0\n");
1511 ERR(
"Failed to allocate memory for the shader\n");
1523 TRACE_(parsed_shader)(
"ps_2_x\n");
1527 ERR(
"Failed to allocate memory for the shader\n");
1539 TRACE_(parsed_shader)(
"ps_3_0\n");
1543 ERR(
"Failed to allocate memory for the shader\n");
std::map< E_MODULE, HMODULE > mod
static void asmparser_coissue_unsupported(struct asm_parser *This)
void create_vs11_parser(struct asm_parser *ret)
static void asmparser_dcl_input(struct asm_parser *This, DWORD usage, DWORD num, DWORD mod, const struct shader_reg *reg)
static void check_ps_dstmod(struct asm_parser *This, DWORD dstmod)
static const struct allowed_reg_type ps_3_reg_allowed[]
static const struct allowed_reg_type vs_1_reg_allowed[]
static void check_legacy_srcmod(struct asm_parser *This, DWORD srcmod)
void create_ps12_parser(struct asm_parser *ret)
static void asmparser_dstreg_vs_3(struct asm_parser *This, struct instruction *instr, const struct shader_reg *dst)
static const struct allowed_reg_type ps_1_4_reg_allowed[]
static void asmparser_dcl_input_unsupported(struct asm_parser *This, DWORD usage, DWORD num, DWORD mod, const struct shader_reg *reg)
static void asmparser_constI(struct asm_parser *This, DWORD reg, INT x, INT y, INT z, INT w)
void create_vs2x_parser(struct asm_parser *ret)
static const struct asmparser_backend parser_ps_1_0123
static void asmparser_dstreg_ps_1_0123(struct asm_parser *This, struct instruction *instr, const struct shader_reg *dst)
static struct shader_reg map_oldvs_register(const struct shader_reg *reg)
static const struct allowed_reg_type ps_1_0123_reg_allowed[]
static void asmparser_texhelper(struct asm_parser *This, DWORD mod, DWORD shift, const struct shader_reg *dst, const struct shader_reg *src0)
static void asmparser_dstreg_vs_2(struct asm_parser *This, struct instruction *instr, const struct shader_reg *dst)
static BOOL check_reg_type(const struct shader_reg *reg, const struct allowed_reg_type *allowed)
static void asmparser_dcl_output_unsupported(struct asm_parser *This, DWORD usage, DWORD num, const struct shader_reg *reg)
static const struct allowed_reg_type vs_3_reg_allowed[]
static const struct asmparser_backend parser_vs_1
static void asmparser_srcreg_ps_3(struct asm_parser *This, struct instruction *instr, int num, const struct shader_reg *src)
static void asmparser_end(struct asm_parser *This)
static void asmparser_dstreg_ps_2(struct asm_parser *This, struct instruction *instr, const struct shader_reg *dst)
static void asmparser_texreg2rgb(struct asm_parser *This, DWORD mod, DWORD shift, const struct shader_reg *dst, const struct shader_reg *src0)
static void gen_oldps_input(struct bwriter_shader *shader, DWORD texcoords)
static void check_shift_dstmod(struct asm_parser *This, DWORD shift)
void create_vs10_parser(struct asm_parser *ret)
static void gen_oldvs_output(struct bwriter_shader *shader)
static void asmparser_srcreg_ps_2(struct asm_parser *This, struct instruction *instr, int num, const struct shader_reg *src)
void create_ps30_parser(struct asm_parser *ret)
static void asmparser_dstreg_ps_2_x(struct asm_parser *This, struct instruction *instr, const struct shader_reg *dst)
static void asmparser_predicate_supported(struct asm_parser *This, const struct shader_reg *predicate)
static void asmparser_texcoord(struct asm_parser *This, DWORD mod, DWORD 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_srcreg_vs_2(struct asm_parser *This, struct instruction *instr, int num, const struct shader_reg *src)
static void asmparser_predicate_unsupported(struct asm_parser *This, const struct shader_reg *predicate)
static void asmparser_srcreg_vs_1(struct asm_parser *This, struct instruction *instr, int num, const struct shader_reg *src)
static const struct asmparser_backend parser_ps_2_x
static void asmparser_sincos(struct asm_parser *This, DWORD mod, DWORD shift, const struct shader_reg *dst, const struct src_regs *srcs)
static void asmparser_tex(struct asm_parser *This, DWORD mod, DWORD shift, const struct shader_reg *dst)
static void asmparser_texreg2gb(struct asm_parser *This, DWORD mod, DWORD shift, const struct shader_reg *dst, const struct shader_reg *src0)
static void asmparser_dcl_input_ps_2(struct asm_parser *This, DWORD usage, DWORD num, DWORD mod, const struct shader_reg *reg)
static void asmparser_dstreg_ps_3(struct asm_parser *This, struct instruction *instr, const struct shader_reg *dst)
void create_ps11_parser(struct asm_parser *ret)
static void asmparser_srcreg_vs_3(struct asm_parser *This, struct instruction *instr, int num, const struct shader_reg *src)
static void asmparser_dcl_output(struct asm_parser *This, DWORD usage, DWORD num, const struct shader_reg *reg)
void create_ps10_parser(struct asm_parser *ret)
static const struct allowed_reg_type ps_2_0_reg_allowed[]
static void asmparser_dcl_sampler_unsupported(struct asm_parser *This, DWORD samptype, DWORD mod, DWORD regnum, unsigned int line_no)
static void asmparser_texcrd(struct asm_parser *This, DWORD mod, DWORD shift, const struct shader_reg *dst, const struct src_regs *srcs)
static const struct allowed_reg_type vs_2_reg_allowed[]
static void asmparser_constB(struct asm_parser *This, DWORD reg, BOOL x)
static void asmparser_srcreg_ps_1_0123(struct asm_parser *This, struct instruction *instr, int num, const struct shader_reg *src)
static const struct asmparser_backend parser_vs_3
static void check_loop_swizzle(struct asm_parser *This, const struct shader_reg *src)
static void check_abs_srcmod(struct asm_parser *This, DWORD srcmod)
static void asmparser_coissue_supported(struct asm_parser *This)
void create_ps20_parser(struct asm_parser *ret)
static const struct asmparser_backend parser_ps_1_4
static void asmparser_srcreg_ps_1_4(struct asm_parser *This, struct instruction *instr, int num, const struct shader_reg *src)
void create_ps14_parser(struct asm_parser *ret)
static void asmparser_dstreg_ps_1_4(struct asm_parser *This, struct instruction *instr, const struct shader_reg *dst)
static void asmparser_texreg2ar(struct asm_parser *This, DWORD mod, DWORD shift, const struct shader_reg *dst, const struct shader_reg *src0)
static void asmparser_constF(struct asm_parser *This, DWORD reg, float x, float y, float z, float w)
static void asmparser_srcreg_ps_2_x(struct asm_parser *This, struct instruction *instr, int num, const struct shader_reg *src)
void create_vs30_parser(struct asm_parser *ret)
static void asmparser_dcl_sampler(struct asm_parser *This, DWORD samptype, DWORD mod, DWORD regnum, unsigned int line_no)
static void asmparser_dstreg_vs_1(struct asm_parser *This, struct instruction *instr, const struct shader_reg *dst)
static void asmparser_instr(struct asm_parser *This, DWORD opcode, DWORD mod, DWORD shift, enum bwriter_comparison_type comp, const struct shader_reg *dst, const struct src_regs *srcs, int expectednsrcs)
static const struct asmparser_backend parser_ps_2
static const struct asmparser_backend parser_vs_2
static const struct allowed_reg_type ps_2_x_reg_allowed[]
static void asmparser_texld14(struct asm_parser *This, DWORD mod, DWORD shift, const struct shader_reg *dst, const struct src_regs *srcs)
void create_vs20_parser(struct asm_parser *ret)
static void asmparser_texkill(struct asm_parser *This, const struct shader_reg *dst)
void create_ps13_parser(struct asm_parser *ret)
static const struct asmparser_backend parser_ps_3
void create_ps2x_parser(struct asm_parser *ret)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
BOOL add_constI(struct bwriter_shader *shader, DWORD reg, INT x, INT y, INT z, INT w)
BOOL record_declaration(struct bwriter_shader *shader, DWORD usage, DWORD usage_idx, DWORD mod, BOOL output, DWORD regnum, DWORD writemask, BOOL builtin)
BOOL add_constF(struct bwriter_shader *shader, DWORD reg, float x, float y, float z, float w)
BOOL record_sampler(struct bwriter_shader *shader, DWORD samptype, DWORD mod, DWORD regnum)
struct instruction * alloc_instr(unsigned int srcs)
BOOL add_constB(struct bwriter_shader *shader, DWORD reg, BOOL x)
BOOL add_instruction(struct bwriter_shader *shader, struct instruction *instr)
const char * debug_print_srcreg(const struct shader_reg *reg) DECLSPEC_HIDDEN
const char * debug_print_comp(DWORD comp) DECLSPEC_HIDDEN
@ BWRITERSPDM_PARTIALPRECISION
@ BWRITERSPDM_MSAMPCENTROID
const char * debug_print_opcode(DWORD opcode) DECLSPEC_HIDDEN
@ BWRITERDECLUSAGE_POSITION
@ BWRITERDECLUSAGE_TEXCOORD
#define BWRITERSP_WRITEMASK_ALL
static void set_parse_status(enum parse_status *current, enum parse_status update)
static void * d3dcompiler_alloc(SIZE_T size)
#define BWRITERPS_VERSION(major, minor)
const char * debug_print_shift(DWORD shift) DECLSPEC_HIDDEN
#define BWRITERVS_NOSWIZZLE
#define BWRITERVS_VERSION(major, minor)
const char * debug_print_srcmod(DWORD mod) DECLSPEC_HIDDEN
const char * debug_print_dstreg(const struct shader_reg *reg) DECLSPEC_HIDDEN
void WINAPIV asmparser_message(struct asm_parser *ctx, const char *fmt,...) PRINTF_ATTR(2
const char * debug_print_dstmod(DWORD mod) DECLSPEC_HIDDEN
#define WINE_DECLARE_DEBUG_CHANNEL(x)
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei GLenum type
GLint GLint GLint GLint GLint GLint y
GLubyte GLubyte GLubyte GLubyte w
GLsizeiptr const GLvoid GLenum usage
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
enum bwriter_comparison_type comptype
struct shader_reg reg[MAX_SRC_REGS]