48#define OFOG_WRITEMASK BWRITERSP_WRITEMASK_0
50#define OPTS_WRITEMASK BWRITERSP_WRITEMASK_1
71 TRACE(
"Finalizing shader\n");
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);
82 ERR(
"Out of memory.\n");
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");
95 ERR(
"Out of memory.\n");
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);
108 ERR(
"Out of memory.\n");
125 ERR(
"Out of memory\n");
159 ERR(
"Out of memory\n");
176 ERR(
"Out of memory\n");
189 unsigned int line_no)
202 ERR(
"Out of memory\n");
208 uint32_t regnum,
unsigned int line_no)
219 if (!srcs || srcs->
count != 3)
229 ERR(
"Error allocating memory for the instruction\n");
246 ERR(
"Out of memory\n");
273 FIXME(
"Unexpected TEXTURE register t%u.\n",
reg->regnum);
289 FIXME(
"Unexpected TEXTURE register t%u.\n",
reg->regnum);
298 default:
return *
reg;
317 ERR(
"Error allocating memory for the instruction\n");
337 ERR(
"Out of memory\n");
347 if (!srcs || srcs->
count != 1)
357 ERR(
"Error allocating memory for the instruction\n");
373 ERR(
"Out of memory\n");
384 ERR(
"Error allocating memory for the instruction\n");
406 ERR(
"Out of memory\n");
418 ERR(
"Error allocating memory for the instruction\n");
430 instr->
src[0] = *src0;
437 instr->
src[1].regnum =
dst->regnum;
444 ERR(
"Out of memory\n");
463 if (!srcs || srcs->
count != 1)
473 ERR(
"Error allocating memory for the instruction\n");
494 instr->
src[1].regnum =
dst->regnum;
501 ERR(
"Out of memory\n");
548 const struct src_regs *srcs,
int expectednsrcs)
550 unsigned int src_count = srcs ? srcs->
count : 0;
568 for (
i = 0;
i < src_count;
i++)
571 TRACE_(parsed_shader)(
", ");
572 else firstreg =
FALSE;
575 TRACE_(parsed_shader)(
"\n");
601 if (
shader->minor_version < 4)
611 if (src_count != expectednsrcs)
638 ERR(
"Error allocating memory for the instruction\n");
649 for (
i = 0;
i < src_count;
i++)
656 ERR(
"Out of memory\n");
684 FIXME(
"Unhandled RASTOUT register %u.\n",
reg->regnum);
703 FIXME(
"Unhandled TEXCRDOUT regnum %u.\n",
reg->regnum);
716 FIXME(
"Unhandled ATTROUT regnum %u.\n",
reg->regnum);
721 default:
return *
reg;
792 while (allowed[
i].
type != ~0
u)
800 if (allowed[
i].reladdr)
1200 if (
parser->shader->num_instrs == 0)
1201 ERR(
"Predicate without an instruction.\n");
1203 parser->shader->instr[
parser->shader->num_instrs - 1]->has_predicate =
TRUE;
1204 parser->shader->instr[
parser->shader->num_instrs - 1]->predicate = *predicate;
1217 if (
parser->shader->num_instrs == 0)
1433 TRACE_(parsed_shader)(
"vs_1_0\n");
1437 ERR(
"Failed to allocate memory for the shader\n");
1443 ret->shader->major_version = 1;
1444 ret->shader->minor_version = 0;
1450 TRACE_(parsed_shader)(
"vs_1_1\n");
1454 ERR(
"Failed to allocate memory for the shader\n");
1460 ret->shader->major_version = 1;
1461 ret->shader->minor_version = 1;
1467 TRACE_(parsed_shader)(
"vs_2_0\n");
1471 ERR(
"Failed to allocate memory for the shader\n");
1477 ret->shader->major_version = 2;
1478 ret->shader->minor_version = 0;
1484 TRACE_(parsed_shader)(
"vs_2_x\n");
1488 ERR(
"Failed to allocate memory for the shader\n");
1494 ret->shader->major_version = 2;
1495 ret->shader->minor_version = 1;
1501 TRACE_(parsed_shader)(
"vs_3_0\n");
1505 ERR(
"Failed to allocate memory for the shader\n");
1511 ret->shader->major_version = 3;
1512 ret->shader->minor_version = 0;
1517 TRACE_(parsed_shader)(
"ps_1_0\n");
1521 ERR(
"Failed to allocate memory for the shader\n");
1527 ret->shader->major_version = 1;
1528 ret->shader->minor_version = 0;
1534 TRACE_(parsed_shader)(
"ps_1_1\n");
1538 ERR(
"Failed to allocate memory for the shader\n");
1544 ret->shader->major_version = 1;
1545 ret->shader->minor_version = 1;
1551 TRACE_(parsed_shader)(
"ps_1_2\n");
1555 ERR(
"Failed to allocate memory for the shader\n");
1561 ret->shader->major_version = 1;
1562 ret->shader->minor_version = 2;
1568 TRACE_(parsed_shader)(
"ps_1_3\n");
1572 ERR(
"Failed to allocate memory for the shader\n");
1578 ret->shader->major_version = 1;
1579 ret->shader->minor_version = 3;
1585 TRACE_(parsed_shader)(
"ps_1_4\n");
1589 ERR(
"Failed to allocate memory for the shader\n");
1595 ret->shader->major_version = 1;
1596 ret->shader->minor_version = 4;
1602 TRACE_(parsed_shader)(
"ps_2_0\n");
1606 ERR(
"Failed to allocate memory for the shader\n");
1612 ret->shader->major_version = 2;
1613 ret->shader->minor_version = 0;
1619 TRACE_(parsed_shader)(
"ps_2_x\n");
1623 ERR(
"Failed to allocate memory for the shader\n");
1629 ret->shader->major_version = 2;
1630 ret->shader->minor_version = 1;
1636 TRACE_(parsed_shader)(
"ps_3_0\n");
1640 ERR(
"Failed to allocate memory for the shader\n");
1646 ret->shader->major_version = 3;
1647 ret->shader->minor_version = 0;
std::map< E_MODULE, HMODULE > mod
static void asmparser_srcreg_ps_1_0123(struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
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 check_shift_dstmod(struct asm_parser *parser, uint32_t shift)
void create_vs11_parser(struct asm_parser *ret)
static const struct allowed_reg_type ps_3_reg_allowed[]
static const struct allowed_reg_type vs_1_reg_allowed[]
static void asmparser_srcreg_ps_2_x(struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
void create_ps12_parser(struct asm_parser *ret)
static const struct allowed_reg_type ps_1_4_reg_allowed[]
static void asmparser_constB(struct asm_parser *parser, uint32_t reg, BOOL x)
void create_vs2x_parser(struct asm_parser *ret)
static const struct asmparser_backend parser_ps_1_0123
static void check_legacy_srcmod(struct asm_parser *parser, uint32_t srcmod)
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_dcl_input(struct asm_parser *parser, uint32_t usage, uint32_t num, uint32_t mod, const struct shader_reg *reg)
static void asmparser_dstreg_vs_1(struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
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 void asmparser_dstreg_ps_1_0123(struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
static void asmparser_texkill(struct asm_parser *parser, const struct shader_reg *dst)
static void asmparser_dcl_output(struct asm_parser *parser, uint32_t usage, uint32_t num, const struct shader_reg *reg)
static void asmparser_constI(struct asm_parser *parser, uint32_t reg, int x, int y, int z, int w)
static BOOL check_reg_type(const struct shader_reg *reg, const struct allowed_reg_type *allowed)
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 const struct allowed_reg_type vs_3_reg_allowed[]
static const struct asmparser_backend parser_vs_1
static void asmparser_end(struct asm_parser *This)
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 check_abs_srcmod(struct asm_parser *parser, uint32_t srcmod)
static void asmparser_dstreg_ps_1_4(struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
void create_vs10_parser(struct asm_parser *ret)
static void gen_oldvs_output(struct bwriter_shader *shader)
static void asmparser_predicate_supported(struct asm_parser *parser, const struct shader_reg *predicate)
void create_ps30_parser(struct asm_parser *ret)
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_constF(struct asm_parser *parser, uint32_t reg, float x, float y, float z, float w)
static struct shader_reg map_oldps_register(const struct shader_reg *reg, BOOL tex_varying)
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_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_texcrd(struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst, const struct src_regs *srcs)
static void asmparser_tex(struct asm_parser *parser, uint32_t mod, uint32_t shift, const struct shader_reg *dst)
static const struct asmparser_backend parser_ps_2_x
static void asmparser_dcl_output_unsupported(struct asm_parser *parser, uint32_t usage, uint32_t num, const struct shader_reg *reg)
static void asmparser_srcreg_vs_1(struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
static void asmparser_dstreg_vs_3(struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
void create_ps11_parser(struct asm_parser *ret)
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_srcreg_vs_2(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)
void create_ps10_parser(struct asm_parser *ret)
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 const struct allowed_reg_type ps_2_0_reg_allowed[]
static const struct allowed_reg_type vs_2_reg_allowed[]
static void check_ps_dstmod(struct asm_parser *parser, uint32_t dstmod)
static const struct asmparser_backend parser_vs_3
static void asmparser_predicate_unsupported(struct asm_parser *parser, const struct shader_reg *predicate)
static void asmparser_dstreg_ps_2_x(struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
static void asmparser_srcreg_vs_3(struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
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)
void create_ps20_parser(struct asm_parser *ret)
static void asmparser_coissue_supported(struct asm_parser *parser)
static const struct asmparser_backend parser_ps_1_4
void create_ps14_parser(struct asm_parser *ret)
void create_vs30_parser(struct asm_parser *ret)
static void asmparser_dstreg_vs_2(struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
static void check_loop_swizzle(struct asm_parser *parser, const struct shader_reg *src)
static const struct asmparser_backend parser_ps_2
static void gen_oldps_input(struct bwriter_shader *shader, uint32_t texcoords)
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 const struct asmparser_backend parser_vs_2
static const struct allowed_reg_type ps_2_x_reg_allowed[]
static void asmparser_coissue_unsupported(struct asm_parser *parser)
void create_vs20_parser(struct asm_parser *ret)
static void asmparser_dstreg_ps_2(struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
void create_ps13_parser(struct asm_parser *ret)
static const struct asmparser_backend parser_ps_3
static void asmparser_dstreg_ps_3(struct asm_parser *parser, struct instruction *instr, const struct shader_reg *dst)
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_1_4(struct asm_parser *parser, struct instruction *instr, int num, const struct shader_reg *src)
void create_ps2x_parser(struct asm_parser *ret)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
BOOL add_constB(struct bwriter_shader *shader, uint32_t reg, BOOL x)
BOOL add_constF(struct bwriter_shader *shader, uint32_t reg, float x, float y, float z, float w)
BOOL record_sampler(struct bwriter_shader *shader, uint32_t samptype, uint32_t mod, uint32_t regnum)
struct instruction * alloc_instr(unsigned int srcs)
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)
BOOL add_constI(struct bwriter_shader *shader, uint32_t reg, int x, int y, int z, int w)
BOOL add_instruction(struct bwriter_shader *shader, struct instruction *instr)
const char * debug_print_srcmod(uint32_t mod)
@ BWRITERSPDM_PARTIALPRECISION
@ BWRITERSPDM_MSAMPCENTROID
@ BWRITERDECLUSAGE_POSITION
@ BWRITERDECLUSAGE_TEXCOORD
const char * debug_print_shift(uint32_t shift)
const char * debug_print_comp(uint32_t comp)
#define BWRITERSP_WRITEMASK_ALL
void WINAPIV static void set_parse_status(enum parse_status *current, enum parse_status update)
#define BWRITERVS_NOSWIZZLE
const char * debug_print_dstreg(const struct shader_reg *reg)
const char * debug_print_dstmod(uint32_t mod)
void WINAPIV asmparser_message(struct asm_parser *ctx, const char *fmt,...) PRINTF_ATTR(2
const char * debug_print_srcreg(const struct shader_reg *reg)
const char * debug_print_opcode(uint32_t opcode)
#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
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
enum bwriter_comparison_type comptype
struct shader_reg reg[MAX_SRC_REGS]