d3dcompiler: Use more consistent integer data types.
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f94d378236
commit
c4273f0bbe
File diff suppressed because it is too large
Load Diff
|
@ -54,7 +54,7 @@ static void set_rel_reg(struct shader_reg *reg, struct rel_reg *rel) {
|
|||
return;
|
||||
}
|
||||
reg->rel_reg->type = rel->type;
|
||||
reg->rel_reg->u.swizzle = rel->swizzle;
|
||||
reg->rel_reg->swizzle = rel->swizzle;
|
||||
reg->rel_reg->regnum = rel->rel_regnum;
|
||||
}
|
||||
}
|
||||
|
@ -75,26 +75,26 @@ int asmshader_lex(void);
|
|||
BOOL immbool;
|
||||
unsigned int regnum;
|
||||
struct shader_reg reg;
|
||||
DWORD srcmod;
|
||||
DWORD writemask;
|
||||
uint32_t srcmod;
|
||||
uint32_t writemask;
|
||||
struct {
|
||||
DWORD writemask;
|
||||
DWORD idx;
|
||||
DWORD last;
|
||||
uint32_t writemask;
|
||||
uint32_t idx;
|
||||
uint32_t last;
|
||||
} wm_components;
|
||||
DWORD swizzle;
|
||||
uint32_t swizzle;
|
||||
struct {
|
||||
DWORD swizzle;
|
||||
DWORD idx;
|
||||
uint32_t swizzle;
|
||||
uint32_t idx;
|
||||
} sw_components;
|
||||
DWORD component;
|
||||
uint32_t component;
|
||||
struct {
|
||||
DWORD mod;
|
||||
DWORD shift;
|
||||
uint32_t mod;
|
||||
uint32_t shift;
|
||||
} modshift;
|
||||
enum bwriter_comparison_type comptype;
|
||||
struct {
|
||||
DWORD dclusage;
|
||||
uint32_t dclusage;
|
||||
unsigned int regnum;
|
||||
} declaration;
|
||||
enum bwritersampler_texture_type samplertype;
|
||||
|
@ -569,7 +569,7 @@ instruction: INSTR_ADD omods dreg ',' sregs
|
|||
reg.regnum = $3;
|
||||
reg.rel_reg = NULL;
|
||||
reg.srcmod = 0;
|
||||
reg.u.writemask = BWRITERSP_WRITEMASK_ALL;
|
||||
reg.writemask = BWRITERSP_WRITEMASK_ALL;
|
||||
asm_ctx.funcs->dcl_output(&asm_ctx, $2.dclusage, $2.regnum, ®);
|
||||
}
|
||||
| INSTR_DCL dclusage REG_OUTPUT writemask
|
||||
|
@ -581,7 +581,7 @@ instruction: INSTR_ADD omods dreg ',' sregs
|
|||
reg.regnum = $3;
|
||||
reg.rel_reg = NULL;
|
||||
reg.srcmod = 0;
|
||||
reg.u.writemask = $4;
|
||||
reg.writemask = $4;
|
||||
asm_ctx.funcs->dcl_output(&asm_ctx, $2.dclusage, $2.regnum, ®);
|
||||
}
|
||||
| INSTR_DCL dclusage omods dcl_inputreg
|
||||
|
@ -604,7 +604,7 @@ instruction: INSTR_ADD omods dreg ',' sregs
|
|||
reg.regnum = $4.regnum;
|
||||
reg.rel_reg = NULL;
|
||||
reg.srcmod = 0;
|
||||
reg.u.writemask = BWRITERSP_WRITEMASK_ALL;
|
||||
reg.writemask = BWRITERSP_WRITEMASK_ALL;
|
||||
asm_ctx.funcs->dcl_input(&asm_ctx, $2.dclusage, $2.regnum, $3.mod, ®);
|
||||
}
|
||||
| INSTR_DCL dclusage omods dcl_inputreg writemask
|
||||
|
@ -627,7 +627,7 @@ instruction: INSTR_ADD omods dreg ',' sregs
|
|||
reg.regnum = $4.regnum;
|
||||
reg.rel_reg = NULL;
|
||||
reg.srcmod = 0;
|
||||
reg.u.writemask = $5;
|
||||
reg.writemask = $5;
|
||||
asm_ctx.funcs->dcl_input(&asm_ctx, $2.dclusage, $2.regnum, $3.mod, ®);
|
||||
}
|
||||
| INSTR_DCL omods dcl_inputreg
|
||||
|
@ -649,7 +649,7 @@ instruction: INSTR_ADD omods dreg ',' sregs
|
|||
reg.regnum = $3.regnum;
|
||||
reg.rel_reg = NULL;
|
||||
reg.srcmod = 0;
|
||||
reg.u.writemask = BWRITERSP_WRITEMASK_ALL;
|
||||
reg.writemask = BWRITERSP_WRITEMASK_ALL;
|
||||
asm_ctx.funcs->dcl_input(&asm_ctx, 0, 0, $2.mod, ®);
|
||||
}
|
||||
| INSTR_DCL omods dcl_inputreg writemask
|
||||
|
@ -671,7 +671,7 @@ instruction: INSTR_ADD omods dreg ',' sregs
|
|||
reg.regnum = $3.regnum;
|
||||
reg.rel_reg = NULL;
|
||||
reg.srcmod = 0;
|
||||
reg.u.writemask = $4;
|
||||
reg.writemask = $4;
|
||||
asm_ctx.funcs->dcl_input(&asm_ctx, 0, 0, $2.mod, ®);
|
||||
}
|
||||
| INSTR_DCL sampdcl omods REG_SAMPLER
|
||||
|
@ -988,7 +988,7 @@ dreg: dreg_name rel_reg
|
|||
{
|
||||
$$.regnum = $1.regnum;
|
||||
$$.type = $1.type;
|
||||
$$.u.writemask = BWRITERSP_WRITEMASK_ALL;
|
||||
$$.writemask = BWRITERSP_WRITEMASK_ALL;
|
||||
$$.srcmod = BWRITERSPSM_NONE;
|
||||
set_rel_reg(&$$, &$2);
|
||||
}
|
||||
|
@ -996,7 +996,7 @@ dreg: dreg_name rel_reg
|
|||
{
|
||||
$$.regnum = $1.regnum;
|
||||
$$.type = $1.type;
|
||||
$$.u.writemask = $2;
|
||||
$$.writemask = $2;
|
||||
$$.srcmod = BWRITERSPSM_NONE;
|
||||
$$.rel_reg = NULL;
|
||||
}
|
||||
|
@ -1108,7 +1108,7 @@ writemask: '.' wm_components
|
|||
}
|
||||
else {
|
||||
$$ = $2.writemask;
|
||||
TRACE("Writemask: %lx\n", $$);
|
||||
TRACE("Writemask: %x\n", $$);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1136,7 +1136,7 @@ wm_components: COMPONENT
|
|||
swizzle: /* empty */
|
||||
{
|
||||
$$ = BWRITERVS_NOSWIZZLE;
|
||||
TRACE("Default swizzle: %08lx\n", $$);
|
||||
TRACE("Default swizzle: %08x\n", $$);
|
||||
}
|
||||
| '.' sw_components
|
||||
{
|
||||
|
@ -1148,7 +1148,7 @@ swizzle: /* empty */
|
|||
$$ = BWRITERVS_NOSWIZZLE;
|
||||
}
|
||||
else {
|
||||
DWORD last, i;
|
||||
uint32_t last, i;
|
||||
|
||||
$$ = $2.swizzle;
|
||||
/* Fill the swizzle by extending the last component */
|
||||
|
@ -1156,7 +1156,7 @@ swizzle: /* empty */
|
|||
for(i = $2.idx; i < 4; i++){
|
||||
$$ |= last << (2 * i);
|
||||
}
|
||||
TRACE("Got a swizzle: %08lx\n", $$);
|
||||
TRACE("Got a swizzle: %08x\n", $$);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1262,7 +1262,7 @@ sreg: sreg_name rel_reg swizzle
|
|||
{
|
||||
$$.type = $1.type;
|
||||
$$.regnum = $1.regnum;
|
||||
$$.u.swizzle = $3;
|
||||
$$.swizzle = $3;
|
||||
$$.srcmod = BWRITERSPSM_NONE;
|
||||
set_rel_reg(&$$, &$2);
|
||||
}
|
||||
|
@ -1272,7 +1272,7 @@ sreg: sreg_name rel_reg swizzle
|
|||
$$.regnum = $1.regnum;
|
||||
set_rel_reg(&$$, &$2);
|
||||
$$.srcmod = $3;
|
||||
$$.u.swizzle = $4;
|
||||
$$.swizzle = $4;
|
||||
}
|
||||
| '-' sreg_name rel_reg swizzle
|
||||
{
|
||||
|
@ -1280,7 +1280,7 @@ sreg: sreg_name rel_reg swizzle
|
|||
$$.regnum = $2.regnum;
|
||||
$$.srcmod = BWRITERSPSM_NEG;
|
||||
set_rel_reg(&$$, &$3);
|
||||
$$.u.swizzle = $4;
|
||||
$$.swizzle = $4;
|
||||
}
|
||||
| '-' sreg_name rel_reg smod swizzle
|
||||
{
|
||||
|
@ -1303,9 +1303,9 @@ sreg: sreg_name rel_reg swizzle
|
|||
set_parse_status(&asm_ctx.status, PARSE_ERR);
|
||||
break;
|
||||
default:
|
||||
FIXME("Unhandled combination of NEGATE and %lu\n", $4);
|
||||
FIXME("Unhandled combination of NEGATE and %u\n", $4);
|
||||
}
|
||||
$$.u.swizzle = $5;
|
||||
$$.swizzle = $5;
|
||||
}
|
||||
| IMMVAL '-' sreg_name rel_reg swizzle
|
||||
{
|
||||
|
@ -1319,7 +1319,7 @@ sreg: sreg_name rel_reg swizzle
|
|||
$$.regnum = $3.regnum;
|
||||
$$.srcmod = BWRITERSPSM_COMP;
|
||||
set_rel_reg(&$$, &$4);
|
||||
$$.u.swizzle = $5;
|
||||
$$.swizzle = $5;
|
||||
}
|
||||
| IMMVAL '-' sreg_name rel_reg smod swizzle
|
||||
{
|
||||
|
@ -1341,7 +1341,7 @@ sreg: sreg_name rel_reg swizzle
|
|||
$$.regnum = $2.regnum;
|
||||
$$.rel_reg = NULL;
|
||||
$$.srcmod = BWRITERSPSM_NOT;
|
||||
$$.u.swizzle = $3;
|
||||
$$.swizzle = $3;
|
||||
}
|
||||
|
||||
rel_reg: /* empty */
|
||||
|
@ -1659,7 +1659,7 @@ predicate: '(' REG_PREDICATE swizzle ')'
|
|||
$$.regnum = 0;
|
||||
$$.rel_reg = NULL;
|
||||
$$.srcmod = BWRITERSPSM_NONE;
|
||||
$$.u.swizzle = $3;
|
||||
$$.swizzle = $3;
|
||||
}
|
||||
| '(' SMOD_NOT REG_PREDICATE swizzle ')'
|
||||
{
|
||||
|
@ -1667,7 +1667,7 @@ predicate: '(' REG_PREDICATE swizzle ')'
|
|||
$$.regnum = 0;
|
||||
$$.rel_reg = NULL;
|
||||
$$.srcmod = BWRITERSPSM_NOT;
|
||||
$$.u.swizzle = $4;
|
||||
$$.swizzle = $4;
|
||||
}
|
||||
|
||||
%%
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -633,14 +633,13 @@ cleanup:
|
|||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT assemble_shader(const char *preproc_shader,
|
||||
ID3DBlob **shader_blob, ID3DBlob **error_messages)
|
||||
static HRESULT assemble_shader(const char *preproc_shader, ID3DBlob **shader_blob, ID3DBlob **error_messages)
|
||||
{
|
||||
struct bwriter_shader *shader;
|
||||
char *messages = NULL;
|
||||
HRESULT hr;
|
||||
DWORD *res, size;
|
||||
uint32_t *res, size;
|
||||
ID3DBlob *buffer;
|
||||
HRESULT hr;
|
||||
char *pos;
|
||||
|
||||
shader = SlAssembleShader(preproc_shader, &messages);
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "d3dcompiler.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* This doesn't belong here, but for some functions it is possible to return that value,
|
||||
|
@ -66,31 +67,36 @@ enum bwriter_comparison_type
|
|||
BWRITER_COMPARISON_LE
|
||||
};
|
||||
|
||||
struct constant {
|
||||
DWORD regnum;
|
||||
union {
|
||||
struct constant
|
||||
{
|
||||
unsigned int regnum;
|
||||
union
|
||||
{
|
||||
float f;
|
||||
INT i;
|
||||
int i;
|
||||
BOOL b;
|
||||
DWORD d;
|
||||
} value[4];
|
||||
uint32_t d;
|
||||
} value[4];
|
||||
};
|
||||
|
||||
struct shader_reg {
|
||||
DWORD type;
|
||||
DWORD regnum;
|
||||
struct shader_reg *rel_reg;
|
||||
DWORD srcmod;
|
||||
union {
|
||||
DWORD swizzle;
|
||||
DWORD writemask;
|
||||
} u;
|
||||
struct shader_reg
|
||||
{
|
||||
uint32_t type;
|
||||
unsigned int regnum;
|
||||
struct shader_reg *rel_reg;
|
||||
uint32_t srcmod;
|
||||
union
|
||||
{
|
||||
uint32_t swizzle;
|
||||
uint32_t writemask;
|
||||
};
|
||||
};
|
||||
|
||||
struct instruction {
|
||||
DWORD opcode;
|
||||
DWORD dstmod;
|
||||
DWORD shift;
|
||||
struct instruction
|
||||
{
|
||||
uint32_t opcode;
|
||||
uint32_t dstmod;
|
||||
uint32_t shift;
|
||||
enum bwriter_comparison_type comptype;
|
||||
BOOL has_dst;
|
||||
struct shader_reg dst;
|
||||
|
@ -101,21 +107,24 @@ struct instruction {
|
|||
BOOL coissue;
|
||||
};
|
||||
|
||||
struct declaration {
|
||||
DWORD usage, usage_idx;
|
||||
DWORD regnum;
|
||||
DWORD mod;
|
||||
DWORD writemask;
|
||||
struct declaration
|
||||
{
|
||||
uint32_t usage, usage_idx;
|
||||
uint32_t regnum;
|
||||
uint32_t mod;
|
||||
uint32_t writemask;
|
||||
BOOL builtin;
|
||||
};
|
||||
|
||||
struct samplerdecl {
|
||||
DWORD type;
|
||||
DWORD regnum;
|
||||
DWORD mod;
|
||||
struct samplerdecl
|
||||
{
|
||||
uint32_t type;
|
||||
uint32_t regnum;
|
||||
uint32_t mod;
|
||||
};
|
||||
|
||||
struct bwriter_shader {
|
||||
struct bwriter_shader
|
||||
{
|
||||
enum shader_type type;
|
||||
unsigned char major_version, minor_version;
|
||||
|
||||
|
@ -163,25 +172,28 @@ struct asm_parser;
|
|||
/* This structure is only used in asmshader.y, but since the .l file accesses the semantic types
|
||||
* too it has to know it as well
|
||||
*/
|
||||
struct rel_reg {
|
||||
struct rel_reg
|
||||
{
|
||||
BOOL has_rel_reg;
|
||||
DWORD type;
|
||||
DWORD additional_offset;
|
||||
DWORD rel_regnum;
|
||||
DWORD swizzle;
|
||||
uint32_t type;
|
||||
uint32_t additional_offset;
|
||||
uint32_t rel_regnum;
|
||||
uint32_t swizzle;
|
||||
};
|
||||
|
||||
#define MAX_SRC_REGS 4
|
||||
|
||||
struct src_regs {
|
||||
struct src_regs
|
||||
{
|
||||
struct shader_reg reg[MAX_SRC_REGS];
|
||||
unsigned int count;
|
||||
};
|
||||
|
||||
struct asmparser_backend {
|
||||
void (*constF)(struct asm_parser *This, DWORD reg, float x, float y, float z, float w);
|
||||
void (*constI)(struct asm_parser *This, DWORD reg, INT x, INT y, INT z, INT w);
|
||||
void (*constB)(struct asm_parser *This, DWORD reg, BOOL x);
|
||||
struct asmparser_backend
|
||||
{
|
||||
void (*constF)(struct asm_parser *This, uint32_t reg, float x, float y, float z, float w);
|
||||
void (*constI)(struct asm_parser *This, uint32_t reg, int x, int y, int z, int w);
|
||||
void (*constB)(struct asm_parser *This, uint32_t reg, BOOL x);
|
||||
|
||||
void (*dstreg)(struct asm_parser *This, struct instruction *instr,
|
||||
const struct shader_reg *dst);
|
||||
|
@ -192,28 +204,28 @@ struct asmparser_backend {
|
|||
const struct shader_reg *predicate);
|
||||
void (*coissue)(struct asm_parser *This);
|
||||
|
||||
void (*dcl_output)(struct asm_parser *This, DWORD usage, DWORD num,
|
||||
void (*dcl_output)(struct asm_parser *This, uint32_t usage, uint32_t num,
|
||||
const struct shader_reg *reg);
|
||||
void (*dcl_input)(struct asm_parser *This, DWORD usage, DWORD num,
|
||||
DWORD mod, const struct shader_reg *reg);
|
||||
void (*dcl_sampler)(struct asm_parser *This, DWORD samptype, DWORD mod,
|
||||
DWORD regnum, unsigned int line_no);
|
||||
void (*dcl_input)(struct asm_parser *This, uint32_t usage, uint32_t num,
|
||||
uint32_t mod, const struct shader_reg *reg);
|
||||
void (*dcl_sampler)(struct asm_parser *This, uint32_t samptype, uint32_t mod,
|
||||
uint32_t regnum, unsigned int line_no);
|
||||
|
||||
void (*end)(struct asm_parser *This);
|
||||
|
||||
void (*instr)(struct asm_parser *parser, DWORD opcode, DWORD mod, DWORD shift,
|
||||
void (*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);
|
||||
};
|
||||
|
||||
struct instruction *alloc_instr(unsigned int srcs) DECLSPEC_HIDDEN;
|
||||
BOOL add_instruction(struct bwriter_shader *shader, struct instruction *instr) DECLSPEC_HIDDEN;
|
||||
BOOL add_constF(struct bwriter_shader *shader, DWORD reg, float x, float y, float z, float w) DECLSPEC_HIDDEN;
|
||||
BOOL add_constI(struct bwriter_shader *shader, DWORD reg, INT x, INT y, INT z, INT w) DECLSPEC_HIDDEN;
|
||||
BOOL add_constB(struct bwriter_shader *shader, DWORD reg, BOOL x) DECLSPEC_HIDDEN;
|
||||
BOOL record_declaration(struct bwriter_shader *shader, DWORD usage, DWORD usage_idx,
|
||||
DWORD mod, BOOL output, DWORD regnum, DWORD writemask, BOOL builtin) DECLSPEC_HIDDEN;
|
||||
BOOL record_sampler(struct bwriter_shader *shader, DWORD samptype, DWORD mod, DWORD regnum) DECLSPEC_HIDDEN;
|
||||
BOOL add_constF(struct bwriter_shader *shader, uint32_t reg, float x, float y, float z, float w) DECLSPEC_HIDDEN;
|
||||
BOOL add_constI(struct bwriter_shader *shader, uint32_t reg, int x, int y, int z, int w) DECLSPEC_HIDDEN;
|
||||
BOOL add_constB(struct bwriter_shader *shader, uint32_t reg, BOOL x) DECLSPEC_HIDDEN;
|
||||
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) DECLSPEC_HIDDEN;
|
||||
BOOL record_sampler(struct bwriter_shader *shader, uint32_t samptype, uint32_t mod, uint32_t regnum) DECLSPEC_HIDDEN;
|
||||
|
||||
#define MESSAGEBUFFER_INITIAL_SIZE 256
|
||||
|
||||
|
@ -280,13 +292,13 @@ static inline void set_parse_status(enum parse_status *current, enum parse_statu
|
|||
}
|
||||
|
||||
/* Debug utility routines */
|
||||
const char *debug_print_srcmod(DWORD mod) DECLSPEC_HIDDEN;
|
||||
const char *debug_print_dstmod(DWORD mod) DECLSPEC_HIDDEN;
|
||||
const char *debug_print_shift(DWORD shift) DECLSPEC_HIDDEN;
|
||||
const char *debug_print_srcmod(uint32_t mod) DECLSPEC_HIDDEN;
|
||||
const char *debug_print_dstmod(uint32_t mod) DECLSPEC_HIDDEN;
|
||||
const char *debug_print_shift(uint32_t shift) DECLSPEC_HIDDEN;
|
||||
const char *debug_print_dstreg(const struct shader_reg *reg) DECLSPEC_HIDDEN;
|
||||
const char *debug_print_srcreg(const struct shader_reg *reg) DECLSPEC_HIDDEN;
|
||||
const char *debug_print_comp(DWORD comp) DECLSPEC_HIDDEN;
|
||||
const char *debug_print_opcode(DWORD opcode) DECLSPEC_HIDDEN;
|
||||
const char *debug_print_comp(uint32_t comp) DECLSPEC_HIDDEN;
|
||||
const char *debug_print_opcode(uint32_t opcode) DECLSPEC_HIDDEN;
|
||||
|
||||
/* Used to signal an incorrect swizzle/writemask */
|
||||
#define SWIZZLE_ERR ~0U
|
||||
|
@ -516,7 +528,7 @@ enum bwriterdeclusage
|
|||
#define T3_REG 5
|
||||
|
||||
struct bwriter_shader *SlAssembleShader(const char *text, char **messages) DECLSPEC_HIDDEN;
|
||||
HRESULT shader_write_bytecode(const struct bwriter_shader *shader, DWORD **result, DWORD *size) DECLSPEC_HIDDEN;
|
||||
HRESULT shader_write_bytecode(const struct bwriter_shader *shader, uint32_t **result, uint32_t *size) DECLSPEC_HIDDEN;
|
||||
void SlDeleteShader(struct bwriter_shader *shader) DECLSPEC_HIDDEN;
|
||||
|
||||
#define MAKE_TAG(ch0, ch1, ch2, ch3) \
|
||||
|
@ -553,23 +565,24 @@ struct dxbc
|
|||
HRESULT dxbc_write_blob(struct dxbc *dxbc, ID3DBlob **blob) DECLSPEC_HIDDEN;
|
||||
void dxbc_destroy(struct dxbc *dxbc) DECLSPEC_HIDDEN;
|
||||
HRESULT dxbc_parse(const char *data, SIZE_T data_size, struct dxbc *dxbc) DECLSPEC_HIDDEN;
|
||||
HRESULT dxbc_add_section(struct dxbc *dxbc, DWORD tag, const char *data, DWORD data_size) DECLSPEC_HIDDEN;
|
||||
HRESULT dxbc_add_section(struct dxbc *dxbc, DWORD tag, const char *data, size_t data_size) DECLSPEC_HIDDEN;
|
||||
HRESULT dxbc_init(struct dxbc *dxbc, unsigned int size) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline DWORD read_dword(const char **ptr)
|
||||
static inline uint32_t read_u32(const char **ptr)
|
||||
{
|
||||
DWORD r;
|
||||
uint32_t r;
|
||||
|
||||
memcpy(&r, *ptr, sizeof(r));
|
||||
*ptr += sizeof(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline void write_dword(char **ptr, DWORD d)
|
||||
static inline void write_u32(char **ptr, uint32_t u32)
|
||||
{
|
||||
memcpy(*ptr, &d, sizeof(d));
|
||||
*ptr += sizeof(d);
|
||||
memcpy(*ptr, &u32, sizeof(u32));
|
||||
*ptr += sizeof(u32);
|
||||
}
|
||||
|
||||
void skip_dword_unknown(const char **ptr, unsigned int count) DECLSPEC_HIDDEN;
|
||||
void skip_u32_unknown(const char **ptr, unsigned int count) DECLSPEC_HIDDEN;
|
||||
|
||||
#endif /* __WINE_D3DCOMPILER_PRIVATE_H */
|
||||
|
|
|
@ -36,7 +36,7 @@ enum D3DCOMPILER_SIGNATURE_ELEMENT_SIZE
|
|||
struct d3dcompiler_shader_signature
|
||||
{
|
||||
D3D11_SIGNATURE_PARAMETER_DESC *elements;
|
||||
UINT element_count;
|
||||
unsigned int element_count;
|
||||
char *string_data;
|
||||
};
|
||||
|
||||
|
@ -45,7 +45,7 @@ struct d3dcompiler_shader_reflection_type
|
|||
ID3D11ShaderReflectionType ID3D11ShaderReflectionType_iface;
|
||||
ID3D10ShaderReflectionType ID3D10ShaderReflectionType_iface;
|
||||
|
||||
DWORD id;
|
||||
uint32_t id;
|
||||
struct wine_rb_entry entry;
|
||||
|
||||
struct d3dcompiler_shader_reflection *reflection;
|
||||
|
@ -58,7 +58,7 @@ struct d3dcompiler_shader_reflection_type
|
|||
struct d3dcompiler_shader_reflection_type_member
|
||||
{
|
||||
char *name;
|
||||
DWORD offset;
|
||||
uint32_t offset;
|
||||
struct d3dcompiler_shader_reflection_type *type;
|
||||
};
|
||||
|
||||
|
@ -109,7 +109,7 @@ struct d3dcompiler_shader_reflection
|
|||
|
||||
enum D3DCOMPILER_REFLECTION_VERSION interface_version;
|
||||
|
||||
DWORD target;
|
||||
uint32_t target;
|
||||
char *creator;
|
||||
UINT flags;
|
||||
UINT version;
|
||||
|
@ -154,7 +154,7 @@ struct d3dcompiler_shader_reflection
|
|||
struct wine_rb_tree types;
|
||||
};
|
||||
|
||||
static struct d3dcompiler_shader_reflection_type *get_reflection_type(struct d3dcompiler_shader_reflection *reflection, const char *data, DWORD offset);
|
||||
static struct d3dcompiler_shader_reflection_type *get_reflection_type(struct d3dcompiler_shader_reflection *reflection, const char *data, uint32_t offset);
|
||||
|
||||
static const struct ID3D11ShaderReflectionConstantBufferVtbl d3dcompiler_shader_reflection_constant_buffer_vtbl;
|
||||
static const struct ID3D11ShaderReflectionVariableVtbl d3dcompiler_shader_reflection_variable_vtbl;
|
||||
|
@ -207,7 +207,7 @@ static BOOL copy_name(const char *ptr, char **name)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL copy_value(const char *ptr, void **value, DWORD size)
|
||||
static BOOL copy_value(const char *ptr, void **value, uint32_t size)
|
||||
{
|
||||
if (!ptr || !size) return TRUE;
|
||||
|
||||
|
@ -226,7 +226,7 @@ static BOOL copy_value(const char *ptr, void **value, DWORD size)
|
|||
static int d3dcompiler_shader_reflection_type_compare(const void *key, const struct wine_rb_entry *entry)
|
||||
{
|
||||
const struct d3dcompiler_shader_reflection_type *t = WINE_RB_ENTRY_VALUE(entry, const struct d3dcompiler_shader_reflection_type, entry);
|
||||
const DWORD *id = key;
|
||||
const uint32_t *id = key;
|
||||
|
||||
return *id - t->id;
|
||||
}
|
||||
|
@ -1087,119 +1087,119 @@ static const struct ID3D11ShaderReflectionTypeVtbl d3dcompiler_shader_reflection
|
|||
d3dcompiler_shader_reflection_type_ImplementsInterface,
|
||||
};
|
||||
|
||||
static HRESULT d3dcompiler_parse_stat(struct d3dcompiler_shader_reflection *r, const char *data, DWORD data_size)
|
||||
static HRESULT d3dcompiler_parse_stat(struct d3dcompiler_shader_reflection *r, const char *data, size_t data_size)
|
||||
{
|
||||
const char *ptr = data;
|
||||
DWORD size = data_size >> 2;
|
||||
size_t size = data_size >> 2;
|
||||
|
||||
TRACE("Size %lu\n", size);
|
||||
TRACE("Size %Iu.\n", size);
|
||||
|
||||
r->instruction_count = read_dword(&ptr);
|
||||
TRACE("InstructionCount: %u\n", r->instruction_count);
|
||||
r->instruction_count = read_u32(&ptr);
|
||||
TRACE("InstructionCount: %u.\n", r->instruction_count);
|
||||
|
||||
r->temp_register_count = read_dword(&ptr);
|
||||
TRACE("TempRegisterCount: %u\n", r->temp_register_count);
|
||||
r->temp_register_count = read_u32(&ptr);
|
||||
TRACE("TempRegisterCount: %u.\n", r->temp_register_count);
|
||||
|
||||
r->def_count = read_dword(&ptr);
|
||||
TRACE("DefCount: %u\n", r->def_count);
|
||||
r->def_count = read_u32(&ptr);
|
||||
TRACE("DefCount: %u.\n", r->def_count);
|
||||
|
||||
r->dcl_count = read_dword(&ptr);
|
||||
TRACE("DclCount: %u\n", r->dcl_count);
|
||||
r->dcl_count = read_u32(&ptr);
|
||||
TRACE("DclCount: %u.\n", r->dcl_count);
|
||||
|
||||
r->float_instruction_count = read_dword(&ptr);
|
||||
TRACE("FloatInstructionCount: %u\n", r->float_instruction_count);
|
||||
r->float_instruction_count = read_u32(&ptr);
|
||||
TRACE("FloatInstructionCount: %u.\n", r->float_instruction_count);
|
||||
|
||||
r->int_instruction_count = read_dword(&ptr);
|
||||
TRACE("IntInstructionCount: %u\n", r->int_instruction_count);
|
||||
r->int_instruction_count = read_u32(&ptr);
|
||||
TRACE("IntInstructionCount: %u.\n", r->int_instruction_count);
|
||||
|
||||
r->uint_instruction_count = read_dword(&ptr);
|
||||
TRACE("UintInstructionCount: %u\n", r->uint_instruction_count);
|
||||
r->uint_instruction_count = read_u32(&ptr);
|
||||
TRACE("UintInstructionCount: %u.\n", r->uint_instruction_count);
|
||||
|
||||
r->static_flow_control_count = read_dword(&ptr);
|
||||
TRACE("StaticFlowControlCount: %u\n", r->static_flow_control_count);
|
||||
r->static_flow_control_count = read_u32(&ptr);
|
||||
TRACE("StaticFlowControlCount: %u.\n", r->static_flow_control_count);
|
||||
|
||||
r->dynamic_flow_control_count = read_dword(&ptr);
|
||||
TRACE("DynamicFlowControlCount: %u\n", r->dynamic_flow_control_count);
|
||||
r->dynamic_flow_control_count = read_u32(&ptr);
|
||||
TRACE("DynamicFlowControlCount: %u.\n", r->dynamic_flow_control_count);
|
||||
|
||||
r->macro_instruction_count = read_dword(&ptr);
|
||||
TRACE("MacroInstructionCount: %u\n", r->macro_instruction_count);
|
||||
r->macro_instruction_count = read_u32(&ptr);
|
||||
TRACE("MacroInstructionCount: %u.\n", r->macro_instruction_count);
|
||||
|
||||
r->temp_array_count = read_dword(&ptr);
|
||||
TRACE("TempArrayCount: %u\n", r->temp_array_count);
|
||||
r->temp_array_count = read_u32(&ptr);
|
||||
TRACE("TempArrayCount: %u.\n", r->temp_array_count);
|
||||
|
||||
r->array_instruction_count = read_dword(&ptr);
|
||||
TRACE("ArrayInstructionCount: %u\n", r->array_instruction_count);
|
||||
r->array_instruction_count = read_u32(&ptr);
|
||||
TRACE("ArrayInstructionCount: %u.\n", r->array_instruction_count);
|
||||
|
||||
r->cut_instruction_count = read_dword(&ptr);
|
||||
TRACE("CutInstructionCount: %u\n", r->cut_instruction_count);
|
||||
r->cut_instruction_count = read_u32(&ptr);
|
||||
TRACE("CutInstructionCount: %u.\n", r->cut_instruction_count);
|
||||
|
||||
r->emit_instruction_count = read_dword(&ptr);
|
||||
TRACE("EmitInstructionCount: %u\n", r->emit_instruction_count);
|
||||
r->emit_instruction_count = read_u32(&ptr);
|
||||
TRACE("EmitInstructionCount: %u.\n", r->emit_instruction_count);
|
||||
|
||||
r->texture_normal_instructions = read_dword(&ptr);
|
||||
TRACE("TextureNormalInstructions: %u\n", r->texture_normal_instructions);
|
||||
r->texture_normal_instructions = read_u32(&ptr);
|
||||
TRACE("TextureNormalInstructions: %u.\n", r->texture_normal_instructions);
|
||||
|
||||
r->texture_load_instructions = read_dword(&ptr);
|
||||
TRACE("TextureLoadInstructions: %u\n", r->texture_load_instructions);
|
||||
r->texture_load_instructions = read_u32(&ptr);
|
||||
TRACE("TextureLoadInstructions: %u.\n", r->texture_load_instructions);
|
||||
|
||||
r->texture_comp_instructions = read_dword(&ptr);
|
||||
TRACE("TextureCompInstructions: %u\n", r->texture_comp_instructions);
|
||||
r->texture_comp_instructions = read_u32(&ptr);
|
||||
TRACE("TextureCompInstructions: %u.\n", r->texture_comp_instructions);
|
||||
|
||||
r->texture_bias_instructions = read_dword(&ptr);
|
||||
TRACE("TextureBiasInstructions: %u\n", r->texture_bias_instructions);
|
||||
r->texture_bias_instructions = read_u32(&ptr);
|
||||
TRACE("TextureBiasInstructions: %u.\n", r->texture_bias_instructions);
|
||||
|
||||
r->texture_gradient_instructions = read_dword(&ptr);
|
||||
TRACE("TextureGradientInstructions: %u\n", r->texture_gradient_instructions);
|
||||
r->texture_gradient_instructions = read_u32(&ptr);
|
||||
TRACE("TextureGradientInstructions: %u.\n", r->texture_gradient_instructions);
|
||||
|
||||
r->mov_instruction_count = read_dword(&ptr);
|
||||
TRACE("MovInstructionCount: %u\n", r->mov_instruction_count);
|
||||
r->mov_instruction_count = read_u32(&ptr);
|
||||
TRACE("MovInstructionCount: %u.\n", r->mov_instruction_count);
|
||||
|
||||
skip_dword_unknown(&ptr, 1);
|
||||
skip_u32_unknown(&ptr, 1);
|
||||
|
||||
r->conversion_instruction_count = read_dword(&ptr);
|
||||
TRACE("ConversionInstructionCount: %u\n", r->conversion_instruction_count);
|
||||
r->conversion_instruction_count = read_u32(&ptr);
|
||||
TRACE("ConversionInstructionCount: %u.\n", r->conversion_instruction_count);
|
||||
|
||||
skip_dword_unknown(&ptr, 1);
|
||||
skip_u32_unknown(&ptr, 1);
|
||||
|
||||
r->input_primitive = read_dword(&ptr);
|
||||
TRACE("InputPrimitive: %x\n", r->input_primitive);
|
||||
r->input_primitive = read_u32(&ptr);
|
||||
TRACE("InputPrimitive: %x.\n", r->input_primitive);
|
||||
|
||||
r->gs_output_topology = read_dword(&ptr);
|
||||
TRACE("GSOutputTopology: %x\n", r->gs_output_topology);
|
||||
r->gs_output_topology = read_u32(&ptr);
|
||||
TRACE("GSOutputTopology: %x.\n", r->gs_output_topology);
|
||||
|
||||
r->gs_max_output_vertex_count = read_dword(&ptr);
|
||||
TRACE("GSMaxOutputVertexCount: %u\n", r->gs_max_output_vertex_count);
|
||||
r->gs_max_output_vertex_count = read_u32(&ptr);
|
||||
TRACE("GSMaxOutputVertexCount: %u.\n", r->gs_max_output_vertex_count);
|
||||
|
||||
skip_dword_unknown(&ptr, 2);
|
||||
skip_u32_unknown(&ptr, 2);
|
||||
|
||||
/* old dx10 stat size */
|
||||
if (size == 28) return S_OK;
|
||||
|
||||
skip_dword_unknown(&ptr, 1);
|
||||
skip_u32_unknown(&ptr, 1);
|
||||
|
||||
/* dx10 stat size */
|
||||
if (size == 29) return S_OK;
|
||||
|
||||
skip_dword_unknown(&ptr, 1);
|
||||
skip_u32_unknown(&ptr, 1);
|
||||
|
||||
r->c_control_points = read_dword(&ptr);
|
||||
TRACE("cControlPoints: %u\n", r->c_control_points);
|
||||
r->c_control_points = read_u32(&ptr);
|
||||
TRACE("cControlPoints: %u.\n", r->c_control_points);
|
||||
|
||||
r->hs_output_primitive = read_dword(&ptr);
|
||||
TRACE("HSOutputPrimitive: %x\n", r->hs_output_primitive);
|
||||
r->hs_output_primitive = read_u32(&ptr);
|
||||
TRACE("HSOutputPrimitive: %x.\n", r->hs_output_primitive);
|
||||
|
||||
r->hs_partitioning = read_dword(&ptr);
|
||||
TRACE("HSPartitioning: %x\n", r->hs_partitioning);
|
||||
r->hs_partitioning = read_u32(&ptr);
|
||||
TRACE("HSPartitioning: %x.\n", r->hs_partitioning);
|
||||
|
||||
r->tessellator_domain = read_dword(&ptr);
|
||||
TRACE("TessellatorDomain: %x\n", r->tessellator_domain);
|
||||
r->tessellator_domain = read_u32(&ptr);
|
||||
TRACE("TessellatorDomain: %x.\n", r->tessellator_domain);
|
||||
|
||||
skip_dword_unknown(&ptr, 3);
|
||||
skip_u32_unknown(&ptr, 3);
|
||||
|
||||
/* dx11 stat size */
|
||||
if (size == 37) return S_OK;
|
||||
|
||||
FIXME("Unhandled size %lu.\n", size);
|
||||
FIXME("Unhandled size %Iu.\n", size);
|
||||
|
||||
return E_FAIL;
|
||||
}
|
||||
|
@ -1207,9 +1207,9 @@ static HRESULT d3dcompiler_parse_stat(struct d3dcompiler_shader_reflection *r, c
|
|||
static HRESULT d3dcompiler_parse_type_members(struct d3dcompiler_shader_reflection *ref,
|
||||
struct d3dcompiler_shader_reflection_type_member *member, const char *data, const char **ptr)
|
||||
{
|
||||
DWORD offset;
|
||||
uint32_t offset;
|
||||
|
||||
offset = read_dword(ptr);
|
||||
offset = read_u32(ptr);
|
||||
if (!copy_name(data + offset, &member->name))
|
||||
{
|
||||
ERR("Failed to copy name.\n");
|
||||
|
@ -1217,8 +1217,8 @@ static HRESULT d3dcompiler_parse_type_members(struct d3dcompiler_shader_reflecti
|
|||
}
|
||||
TRACE("Member name: %s.\n", debugstr_a(member->name));
|
||||
|
||||
offset = read_dword(ptr);
|
||||
TRACE("Member type offset: %#lx\n", offset);
|
||||
offset = read_u32(ptr);
|
||||
TRACE("Member type offset: %x.\n", offset);
|
||||
|
||||
member->type = get_reflection_type(ref, data, offset);
|
||||
if (!member->type)
|
||||
|
@ -1228,45 +1228,45 @@ static HRESULT d3dcompiler_parse_type_members(struct d3dcompiler_shader_reflecti
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
member->offset = read_dword(ptr);
|
||||
TRACE("Member offset %#lx\n", member->offset);
|
||||
member->offset = read_u32(ptr);
|
||||
TRACE("Member offset %x.\n", member->offset);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT d3dcompiler_parse_type(struct d3dcompiler_shader_reflection_type *type, const char *data, DWORD offset)
|
||||
static HRESULT d3dcompiler_parse_type(struct d3dcompiler_shader_reflection_type *type, const char *data, uint32_t offset)
|
||||
{
|
||||
const char *ptr = data + offset;
|
||||
DWORD temp;
|
||||
uint32_t temp;
|
||||
D3D11_SHADER_TYPE_DESC *desc;
|
||||
unsigned int i;
|
||||
struct d3dcompiler_shader_reflection_type_member *members = NULL;
|
||||
HRESULT hr;
|
||||
DWORD member_offset;
|
||||
uint32_t member_offset;
|
||||
|
||||
desc = &type->desc;
|
||||
|
||||
temp = read_dword(&ptr);
|
||||
temp = read_u32(&ptr);
|
||||
desc->Class = temp & 0xffff;
|
||||
desc->Type = temp >> 16;
|
||||
TRACE("Class %s, Type %s\n", debug_d3dcompiler_shader_variable_class(desc->Class),
|
||||
debug_d3dcompiler_shader_variable_type(desc->Type));
|
||||
|
||||
temp = read_dword(&ptr);
|
||||
temp = read_u32(&ptr);
|
||||
desc->Rows = temp & 0xffff;
|
||||
desc->Columns = temp >> 16;
|
||||
TRACE("Rows %u, Columns %u\n", desc->Rows, desc->Columns);
|
||||
|
||||
temp = read_dword(&ptr);
|
||||
temp = read_u32(&ptr);
|
||||
desc->Elements = temp & 0xffff;
|
||||
desc->Members = temp >> 16;
|
||||
TRACE("Elements %u, Members %u\n", desc->Elements, desc->Members);
|
||||
|
||||
member_offset = read_dword(&ptr);
|
||||
TRACE("Member Offset %lu\n", member_offset);
|
||||
member_offset = read_u32(&ptr);
|
||||
TRACE("Member Offset %u.\n", member_offset);
|
||||
|
||||
if ((type->reflection->target & D3DCOMPILER_SHADER_TARGET_VERSION_MASK) >= 0x500)
|
||||
skip_dword_unknown(&ptr, 4);
|
||||
skip_u32_unknown(&ptr, 4);
|
||||
|
||||
if (desc->Members)
|
||||
{
|
||||
|
@ -1292,7 +1292,7 @@ static HRESULT d3dcompiler_parse_type(struct d3dcompiler_shader_reflection_type
|
|||
|
||||
if ((type->reflection->target & D3DCOMPILER_SHADER_TARGET_VERSION_MASK) >= 0x500)
|
||||
{
|
||||
offset = read_dword(&ptr);
|
||||
offset = read_u32(&ptr);
|
||||
if (!copy_name(data + offset, &type->name))
|
||||
{
|
||||
ERR("Failed to copy name.\n");
|
||||
|
@ -1316,7 +1316,7 @@ err_out:
|
|||
return hr;
|
||||
}
|
||||
|
||||
static struct d3dcompiler_shader_reflection_type *get_reflection_type(struct d3dcompiler_shader_reflection *reflection, const char *data, DWORD offset)
|
||||
static struct d3dcompiler_shader_reflection_type *get_reflection_type(struct d3dcompiler_shader_reflection *reflection, const char *data, uint32_t offset)
|
||||
{
|
||||
struct d3dcompiler_shader_reflection_type *type;
|
||||
struct wine_rb_entry *entry;
|
||||
|
@ -1357,7 +1357,7 @@ static struct d3dcompiler_shader_reflection_type *get_reflection_type(struct d3d
|
|||
}
|
||||
|
||||
static HRESULT d3dcompiler_parse_variables(struct d3dcompiler_shader_reflection_constant_buffer *cb,
|
||||
const char *data, DWORD data_size, const char *ptr)
|
||||
const char *data, size_t data_size, const char *ptr)
|
||||
{
|
||||
struct d3dcompiler_shader_reflection_variable *variables;
|
||||
unsigned int i;
|
||||
|
@ -1373,13 +1373,13 @@ static HRESULT d3dcompiler_parse_variables(struct d3dcompiler_shader_reflection_
|
|||
for (i = 0; i < cb->variable_count; i++)
|
||||
{
|
||||
struct d3dcompiler_shader_reflection_variable *v = &variables[i];
|
||||
DWORD offset;
|
||||
uint32_t offset;
|
||||
|
||||
v->ID3D11ShaderReflectionVariable_iface.lpVtbl = &d3dcompiler_shader_reflection_variable_vtbl;
|
||||
v->ID3D10ShaderReflectionVariable_iface.lpVtbl = &d3d10_shader_reflection_variable_vtbl;
|
||||
v->constant_buffer = cb;
|
||||
|
||||
offset = read_dword(&ptr);
|
||||
offset = read_u32(&ptr);
|
||||
if (!copy_name(data + offset, &v->name))
|
||||
{
|
||||
ERR("Failed to copy name.\n");
|
||||
|
@ -1388,17 +1388,17 @@ static HRESULT d3dcompiler_parse_variables(struct d3dcompiler_shader_reflection_
|
|||
}
|
||||
TRACE("Variable name: %s.\n", debugstr_a(v->name));
|
||||
|
||||
v->start_offset = read_dword(&ptr);
|
||||
v->start_offset = read_u32(&ptr);
|
||||
TRACE("Variable offset: %u\n", v->start_offset);
|
||||
|
||||
v->size = read_dword(&ptr);
|
||||
v->size = read_u32(&ptr);
|
||||
TRACE("Variable size: %u\n", v->size);
|
||||
|
||||
v->flags = read_dword(&ptr);
|
||||
v->flags = read_u32(&ptr);
|
||||
TRACE("Variable flags: %u\n", v->flags);
|
||||
|
||||
offset = read_dword(&ptr);
|
||||
TRACE("Variable type offset: %#lx.\n", offset);
|
||||
offset = read_u32(&ptr);
|
||||
TRACE("Variable type offset: %x.\n", offset);
|
||||
v->type = get_reflection_type(cb->reflection, data, offset);
|
||||
if (!v->type)
|
||||
{
|
||||
|
@ -1407,8 +1407,8 @@ static HRESULT d3dcompiler_parse_variables(struct d3dcompiler_shader_reflection_
|
|||
goto err_out;
|
||||
}
|
||||
|
||||
offset = read_dword(&ptr);
|
||||
TRACE("Variable default value offset: %#lx.\n", offset);
|
||||
offset = read_u32(&ptr);
|
||||
TRACE("Variable default value offset: %x.\n", offset);
|
||||
if (!copy_value(data + offset, &v->default_value, offset ? v->size : 0))
|
||||
{
|
||||
ERR("Failed to copy name.\n");
|
||||
|
@ -1417,7 +1417,7 @@ static HRESULT d3dcompiler_parse_variables(struct d3dcompiler_shader_reflection_
|
|||
}
|
||||
|
||||
if ((cb->reflection->target & D3DCOMPILER_SHADER_TARGET_VERSION_MASK) >= 0x500)
|
||||
skip_dword_unknown(&ptr, 4);
|
||||
skip_u32_unknown(&ptr, 4);
|
||||
}
|
||||
|
||||
cb->variables = variables;
|
||||
|
@ -1433,50 +1433,50 @@ err_out:
|
|||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT d3dcompiler_parse_rdef(struct d3dcompiler_shader_reflection *r, const char *data, DWORD data_size)
|
||||
static HRESULT d3dcompiler_parse_rdef(struct d3dcompiler_shader_reflection *r, const char *data, size_t data_size)
|
||||
{
|
||||
struct d3dcompiler_shader_reflection_constant_buffer *constant_buffers = NULL;
|
||||
DWORD offset, cbuffer_offset, resource_offset, creator_offset;
|
||||
uint32_t offset, cbuffer_offset, resource_offset, creator_offset;
|
||||
unsigned int i, string_data_offset, string_data_size;
|
||||
D3D12_SHADER_INPUT_BIND_DESC *bound_resources = NULL;
|
||||
char *string_data = NULL, *creator = NULL;
|
||||
DWORD size = data_size >> 2;
|
||||
size_t size = data_size >> 2;
|
||||
uint32_t target_version;
|
||||
const char *ptr = data;
|
||||
DWORD target_version;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("Size %lu\n", size);
|
||||
TRACE("Size %Iu.\n", size);
|
||||
|
||||
r->constant_buffer_count = read_dword(&ptr);
|
||||
TRACE("Constant buffer count: %u\n", r->constant_buffer_count);
|
||||
r->constant_buffer_count = read_u32(&ptr);
|
||||
TRACE("Constant buffer count: %u.\n", r->constant_buffer_count);
|
||||
|
||||
cbuffer_offset = read_dword(&ptr);
|
||||
TRACE("Constant buffer offset: %#lx\n", cbuffer_offset);
|
||||
cbuffer_offset = read_u32(&ptr);
|
||||
TRACE("Constant buffer offset: %#x.\n", cbuffer_offset);
|
||||
|
||||
r->bound_resource_count = read_dword(&ptr);
|
||||
TRACE("Bound resource count: %u\n", r->bound_resource_count);
|
||||
r->bound_resource_count = read_u32(&ptr);
|
||||
TRACE("Bound resource count: %u.\n", r->bound_resource_count);
|
||||
|
||||
resource_offset = read_dword(&ptr);
|
||||
TRACE("Bound resource offset: %#lx\n", resource_offset);
|
||||
resource_offset = read_u32(&ptr);
|
||||
TRACE("Bound resource offset: %#x.\n", resource_offset);
|
||||
|
||||
r->target = read_dword(&ptr);
|
||||
TRACE("Target: %#lx\n", r->target);
|
||||
r->target = read_u32(&ptr);
|
||||
TRACE("Target: %#x.\n", r->target);
|
||||
|
||||
target_version = r->target & D3DCOMPILER_SHADER_TARGET_VERSION_MASK;
|
||||
|
||||
#if D3D_COMPILER_VERSION < 47
|
||||
if (target_version >= 0x501)
|
||||
{
|
||||
WARN("Target version %#lx is not supported in d3dcompiler %u.\n", target_version, D3D_COMPILER_VERSION);
|
||||
WARN("Target version %#x is not supported in d3dcompiler %u.\n", target_version, D3D_COMPILER_VERSION);
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
#endif
|
||||
|
||||
r->flags = read_dword(&ptr);
|
||||
TRACE("Flags: %u\n", r->flags);
|
||||
r->flags = read_u32(&ptr);
|
||||
TRACE("Flags: %u.\n", r->flags);
|
||||
|
||||
creator_offset = read_dword(&ptr);
|
||||
TRACE("Creator at offset %#lx.\n", creator_offset);
|
||||
creator_offset = read_u32(&ptr);
|
||||
TRACE("Creator at offset %#x.\n", creator_offset);
|
||||
|
||||
if (!copy_name(data + creator_offset, &creator))
|
||||
{
|
||||
|
@ -1488,13 +1488,13 @@ static HRESULT d3dcompiler_parse_rdef(struct d3dcompiler_shader_reflection *r, c
|
|||
/* todo: Parse RD11 */
|
||||
if (target_version >= 0x500)
|
||||
{
|
||||
skip_dword_unknown(&ptr, 8);
|
||||
skip_u32_unknown(&ptr, 8);
|
||||
}
|
||||
|
||||
if (r->bound_resource_count)
|
||||
{
|
||||
/* 8 for each bind desc */
|
||||
string_data_offset = resource_offset + r->bound_resource_count * 8 * sizeof(DWORD);
|
||||
string_data_offset = resource_offset + r->bound_resource_count * 8 * sizeof(uint32_t);
|
||||
string_data_size = (cbuffer_offset ? cbuffer_offset : creator_offset) - string_data_offset;
|
||||
|
||||
string_data = HeapAlloc(GetProcessHeap(), 0, string_data_size);
|
||||
|
@ -1519,36 +1519,36 @@ static HRESULT d3dcompiler_parse_rdef(struct d3dcompiler_shader_reflection *r, c
|
|||
{
|
||||
D3D12_SHADER_INPUT_BIND_DESC *desc = &bound_resources[i];
|
||||
|
||||
offset = read_dword(&ptr);
|
||||
offset = read_u32(&ptr);
|
||||
desc->Name = string_data + (offset - string_data_offset);
|
||||
TRACE("Input bind Name: %s\n", debugstr_a(desc->Name));
|
||||
TRACE("Input bind Name: %s.\n", debugstr_a(desc->Name));
|
||||
|
||||
desc->Type = read_dword(&ptr);
|
||||
TRACE("Input bind Type: %#x\n", desc->Type);
|
||||
desc->Type = read_u32(&ptr);
|
||||
TRACE("Input bind Type: %#x.\n", desc->Type);
|
||||
|
||||
desc->ReturnType = read_dword(&ptr);
|
||||
TRACE("Input bind ReturnType: %#x\n", desc->ReturnType);
|
||||
desc->ReturnType = read_u32(&ptr);
|
||||
TRACE("Input bind ReturnType: %#x.\n", desc->ReturnType);
|
||||
|
||||
desc->Dimension = read_dword(&ptr);
|
||||
TRACE("Input bind Dimension: %#x\n", desc->Dimension);
|
||||
desc->Dimension = read_u32(&ptr);
|
||||
TRACE("Input bind Dimension: %#x.\n", desc->Dimension);
|
||||
|
||||
desc->NumSamples = read_dword(&ptr);
|
||||
TRACE("Input bind NumSamples: %u\n", desc->NumSamples);
|
||||
desc->NumSamples = read_u32(&ptr);
|
||||
TRACE("Input bind NumSamples: %u.\n", desc->NumSamples);
|
||||
|
||||
desc->BindPoint = read_dword(&ptr);
|
||||
TRACE("Input bind BindPoint: %u\n", desc->BindPoint);
|
||||
desc->BindPoint = read_u32(&ptr);
|
||||
TRACE("Input bind BindPoint: %u.\n", desc->BindPoint);
|
||||
|
||||
desc->BindCount = read_dword(&ptr);
|
||||
TRACE("Input bind BindCount: %u\n", desc->BindCount);
|
||||
desc->BindCount = read_u32(&ptr);
|
||||
TRACE("Input bind BindCount: %u.\n", desc->BindCount);
|
||||
|
||||
desc->uFlags = read_dword(&ptr);
|
||||
TRACE("Input bind uFlags: %u\n", desc->uFlags);
|
||||
desc->uFlags = read_u32(&ptr);
|
||||
TRACE("Input bind uFlags: %u.\n", desc->uFlags);
|
||||
|
||||
if (target_version >= 0x501)
|
||||
{
|
||||
desc->Space = read_dword(&ptr);
|
||||
desc->Space = read_u32(&ptr);
|
||||
TRACE("Input bind Space %u.\n", desc->Space);
|
||||
desc->uID = read_dword(&ptr);
|
||||
desc->uID = read_u32(&ptr);
|
||||
TRACE("Input bind uID %u.\n", desc->uID);
|
||||
}
|
||||
else
|
||||
|
@ -1578,7 +1578,7 @@ static HRESULT d3dcompiler_parse_rdef(struct d3dcompiler_shader_reflection *r, c
|
|||
cb->ID3D10ShaderReflectionConstantBuffer_iface.lpVtbl = &d3d10_shader_reflection_constant_buffer_vtbl;
|
||||
cb->reflection = r;
|
||||
|
||||
offset = read_dword(&ptr);
|
||||
offset = read_u32(&ptr);
|
||||
if (!copy_name(data + offset, &cb->name))
|
||||
{
|
||||
ERR("Failed to copy name.\n");
|
||||
|
@ -1587,11 +1587,11 @@ static HRESULT d3dcompiler_parse_rdef(struct d3dcompiler_shader_reflection *r, c
|
|||
}
|
||||
TRACE("Name: %s.\n", debugstr_a(cb->name));
|
||||
|
||||
cb->variable_count = read_dword(&ptr);
|
||||
TRACE("Variable count: %u\n", cb->variable_count);
|
||||
cb->variable_count = read_u32(&ptr);
|
||||
TRACE("Variable count: %u.\n", cb->variable_count);
|
||||
|
||||
offset = read_dword(&ptr);
|
||||
TRACE("Variable offset: %#lx\n", offset);
|
||||
offset = read_u32(&ptr);
|
||||
TRACE("Variable offset: %x.\n", offset);
|
||||
|
||||
hr = d3dcompiler_parse_variables(cb, data, data_size, data + offset);
|
||||
if (hr != S_OK)
|
||||
|
@ -1600,14 +1600,14 @@ static HRESULT d3dcompiler_parse_rdef(struct d3dcompiler_shader_reflection *r, c
|
|||
goto err_out;
|
||||
}
|
||||
|
||||
cb->size = read_dword(&ptr);
|
||||
TRACE("Cbuffer size: %u\n", cb->size);
|
||||
cb->size = read_u32(&ptr);
|
||||
TRACE("Cbuffer size: %u.\n", cb->size);
|
||||
|
||||
cb->flags = read_dword(&ptr);
|
||||
TRACE("Cbuffer flags: %u\n", cb->flags);
|
||||
cb->flags = read_u32(&ptr);
|
||||
TRACE("Cbuffer flags: %u.\n", cb->flags);
|
||||
|
||||
cb->type = read_dword(&ptr);
|
||||
TRACE("Cbuffer type: %#x\n", cb->type);
|
||||
cb->type = read_u32(&ptr);
|
||||
TRACE("Cbuffer type: %#x.\n", cb->type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1633,14 +1633,13 @@ err_out:
|
|||
|
||||
static HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *s, struct dxbc_section *section)
|
||||
{
|
||||
enum D3DCOMPILER_SIGNATURE_ELEMENT_SIZE element_size;
|
||||
D3D11_SIGNATURE_PARAMETER_DESC *d;
|
||||
unsigned int string_data_offset;
|
||||
unsigned int string_data_size;
|
||||
const char *ptr = section->data;
|
||||
unsigned int string_data_size;
|
||||
unsigned int i, count;
|
||||
char *string_data;
|
||||
unsigned int i;
|
||||
DWORD count;
|
||||
enum D3DCOMPILER_SIGNATURE_ELEMENT_SIZE element_size;
|
||||
|
||||
switch (section->tag)
|
||||
{
|
||||
|
@ -1660,10 +1659,10 @@ static HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *
|
|||
break;
|
||||
}
|
||||
|
||||
count = read_dword(&ptr);
|
||||
TRACE("%lu elements\n", count);
|
||||
count = read_u32(&ptr);
|
||||
TRACE("%u elements\n", count);
|
||||
|
||||
skip_dword_unknown(&ptr, 1);
|
||||
skip_u32_unknown(&ptr, 1);
|
||||
|
||||
d = HeapAlloc(GetProcessHeap(), 0, count * sizeof(*d));
|
||||
if (!d)
|
||||
|
@ -1672,8 +1671,8 @@ static HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *
|
|||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
/* 2 DWORDs for the header, element_size for each element. */
|
||||
string_data_offset = 2 * sizeof(DWORD) + count * element_size * sizeof(DWORD);
|
||||
/* 2 u32s for the header, element_size for each element. */
|
||||
string_data_offset = 2 * sizeof(uint32_t) + count * element_size * sizeof(uint32_t);
|
||||
string_data_size = section->data_size - string_data_offset;
|
||||
|
||||
string_data = HeapAlloc(GetProcessHeap(), 0, string_data_size);
|
||||
|
@ -1687,8 +1686,7 @@ static HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *
|
|||
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
UINT name_offset;
|
||||
DWORD mask;
|
||||
uint32_t name_offset, mask;
|
||||
|
||||
#if D3D_COMPILER_VERSION >= 46
|
||||
/* FIXME */
|
||||
|
@ -1696,20 +1694,20 @@ static HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *
|
|||
#endif
|
||||
if (element_size == D3DCOMPILER_SIGNATURE_ELEMENT_SIZE7)
|
||||
{
|
||||
d[i].Stream = read_dword(&ptr);
|
||||
d[i].Stream = read_u32(&ptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
d[i].Stream = 0;
|
||||
}
|
||||
|
||||
name_offset = read_dword(&ptr);
|
||||
name_offset = read_u32(&ptr);
|
||||
d[i].SemanticName = string_data + (name_offset - string_data_offset);
|
||||
d[i].SemanticIndex = read_dword(&ptr);
|
||||
d[i].SystemValueType = read_dword(&ptr);
|
||||
d[i].ComponentType = read_dword(&ptr);
|
||||
d[i].Register = read_dword(&ptr);
|
||||
mask = read_dword(&ptr);
|
||||
d[i].SemanticIndex = read_u32(&ptr);
|
||||
d[i].SystemValueType = read_u32(&ptr);
|
||||
d[i].ComponentType = read_u32(&ptr);
|
||||
d[i].Register = read_u32(&ptr);
|
||||
mask = read_u32(&ptr);
|
||||
d[i].ReadWriteMask = (mask >> 8) & 0xff;
|
||||
d[i].Mask = mask & 0xff;
|
||||
|
||||
|
@ -1737,11 +1735,11 @@ static HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT d3dcompiler_parse_shdr(struct d3dcompiler_shader_reflection *r, const char *data, DWORD data_size)
|
||||
static HRESULT d3dcompiler_parse_shdr(struct d3dcompiler_shader_reflection *r, const char *data, size_t data_size)
|
||||
{
|
||||
const char *ptr = data;
|
||||
|
||||
r->version = read_dword(&ptr);
|
||||
r->version = read_u32(&ptr);
|
||||
TRACE("Shader version: %u\n", r->version);
|
||||
|
||||
/* todo: Check if anything else is needed from the shdr or shex blob. */
|
||||
|
@ -2353,8 +2351,8 @@ HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10Shad
|
|||
HRESULT WINAPI D3DReflect(const void *data, SIZE_T data_size, REFIID riid, void **reflector)
|
||||
{
|
||||
struct d3dcompiler_shader_reflection *object;
|
||||
const uint32_t *temp = data;
|
||||
HRESULT hr;
|
||||
const DWORD *temp = data;
|
||||
|
||||
TRACE("data %p, data_size %Iu, riid %s, blob %p.\n", data, data_size, debugstr_guid(riid), reflector);
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ const char *debug_d3dcompiler_d3d_blob_part(D3D_BLOB_PART part)
|
|||
}
|
||||
}
|
||||
|
||||
const char *debug_print_srcmod(DWORD mod)
|
||||
const char *debug_print_srcmod(uint32_t mod)
|
||||
{
|
||||
switch (mod)
|
||||
{
|
||||
|
@ -143,14 +143,14 @@ const char *debug_print_srcmod(DWORD mod)
|
|||
WINE_D3DCOMPILER_TO_STR(BWRITERSPSM_ABSNEG);
|
||||
WINE_D3DCOMPILER_TO_STR(BWRITERSPSM_NOT);
|
||||
default:
|
||||
FIXME("Unrecognized source modifier %#lx.\n", mod);
|
||||
FIXME("Unrecognized source modifier %#x.\n", mod);
|
||||
return "unrecognized_src_mod";
|
||||
}
|
||||
}
|
||||
|
||||
#undef WINE_D3DCOMPILER_TO_STR
|
||||
|
||||
const char *debug_print_dstmod(DWORD mod)
|
||||
const char *debug_print_dstmod(uint32_t mod)
|
||||
{
|
||||
switch (mod)
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ const char *debug_print_dstmod(DWORD mod)
|
|||
}
|
||||
}
|
||||
|
||||
const char *debug_print_shift(DWORD shift)
|
||||
const char *debug_print_shift(uint32_t shift)
|
||||
{
|
||||
static const char * const shiftstrings[] =
|
||||
{
|
||||
|
@ -204,15 +204,15 @@ static const char *get_regname(const struct shader_reg *reg)
|
|||
switch (reg->type)
|
||||
{
|
||||
case BWRITERSPR_TEMP:
|
||||
return wine_dbg_sprintf("r%lu", reg->regnum);
|
||||
return wine_dbg_sprintf("r%u", reg->regnum);
|
||||
case BWRITERSPR_INPUT:
|
||||
return wine_dbg_sprintf("v%lu", reg->regnum);
|
||||
return wine_dbg_sprintf("v%u", reg->regnum);
|
||||
case BWRITERSPR_CONST:
|
||||
return wine_dbg_sprintf("c%lu", reg->regnum);
|
||||
return wine_dbg_sprintf("c%u", reg->regnum);
|
||||
case BWRITERSPR_ADDR:
|
||||
return wine_dbg_sprintf("a%lu", reg->regnum);
|
||||
return wine_dbg_sprintf("a%u", reg->regnum);
|
||||
case BWRITERSPR_TEXTURE:
|
||||
return wine_dbg_sprintf("t%lu", reg->regnum);
|
||||
return wine_dbg_sprintf("t%u", reg->regnum);
|
||||
case BWRITERSPR_RASTOUT:
|
||||
switch (reg->regnum)
|
||||
{
|
||||
|
@ -222,21 +222,21 @@ static const char *get_regname(const struct shader_reg *reg)
|
|||
default: return "Unexpected RASTOUT";
|
||||
}
|
||||
case BWRITERSPR_ATTROUT:
|
||||
return wine_dbg_sprintf("oD%lu", reg->regnum);
|
||||
return wine_dbg_sprintf("oD%u", reg->regnum);
|
||||
case BWRITERSPR_TEXCRDOUT:
|
||||
return wine_dbg_sprintf("oT%lu", reg->regnum);
|
||||
return wine_dbg_sprintf("oT%u", reg->regnum);
|
||||
case BWRITERSPR_OUTPUT:
|
||||
return wine_dbg_sprintf("o%lu", reg->regnum);
|
||||
return wine_dbg_sprintf("o%u", reg->regnum);
|
||||
case BWRITERSPR_CONSTINT:
|
||||
return wine_dbg_sprintf("i%lu", reg->regnum);
|
||||
return wine_dbg_sprintf("i%u", reg->regnum);
|
||||
case BWRITERSPR_COLOROUT:
|
||||
return wine_dbg_sprintf("oC%lu", reg->regnum);
|
||||
return wine_dbg_sprintf("oC%u", reg->regnum);
|
||||
case BWRITERSPR_DEPTHOUT:
|
||||
return "oDepth";
|
||||
case BWRITERSPR_SAMPLER:
|
||||
return wine_dbg_sprintf("s%lu", reg->regnum);
|
||||
return wine_dbg_sprintf("s%u", reg->regnum);
|
||||
case BWRITERSPR_CONSTBOOL:
|
||||
return wine_dbg_sprintf("b%lu", reg->regnum);
|
||||
return wine_dbg_sprintf("b%u", reg->regnum);
|
||||
case BWRITERSPR_LOOP:
|
||||
return "aL";
|
||||
case BWRITERSPR_MISCTYPE:
|
||||
|
@ -247,15 +247,15 @@ static const char *get_regname(const struct shader_reg *reg)
|
|||
default: return "unexpected misctype";
|
||||
}
|
||||
case BWRITERSPR_LABEL:
|
||||
return wine_dbg_sprintf("l%lu", reg->regnum);
|
||||
return wine_dbg_sprintf("l%u", reg->regnum);
|
||||
case BWRITERSPR_PREDICATE:
|
||||
return wine_dbg_sprintf("p%lu", reg->regnum);
|
||||
return wine_dbg_sprintf("p%u", reg->regnum);
|
||||
default:
|
||||
return wine_dbg_sprintf("unknown regname %#lx", reg->type);
|
||||
return wine_dbg_sprintf("unknown regname %#x", reg->type);
|
||||
}
|
||||
}
|
||||
|
||||
static const char *debug_print_writemask(DWORD mask)
|
||||
static const char *debug_print_writemask(uint32_t mask)
|
||||
{
|
||||
char ret[6];
|
||||
unsigned char pos = 1;
|
||||
|
@ -271,11 +271,11 @@ static const char *debug_print_writemask(DWORD mask)
|
|||
return wine_dbg_sprintf("%s", ret);
|
||||
}
|
||||
|
||||
static const char *debug_print_swizzle(DWORD arg)
|
||||
static const char *debug_print_swizzle(uint32_t arg)
|
||||
{
|
||||
char ret[6];
|
||||
unsigned int i;
|
||||
DWORD swizzle[4];
|
||||
uint32_t swizzle[4];
|
||||
|
||||
switch (arg)
|
||||
{
|
||||
|
@ -317,10 +317,10 @@ static const char *debug_print_relarg(const struct shader_reg *reg)
|
|||
const char *short_swizzle;
|
||||
if (!reg->rel_reg) return "";
|
||||
|
||||
short_swizzle = debug_print_swizzle(reg->rel_reg->u.swizzle);
|
||||
short_swizzle = debug_print_swizzle(reg->rel_reg->swizzle);
|
||||
|
||||
if (reg->rel_reg->type == BWRITERSPR_ADDR)
|
||||
return wine_dbg_sprintf("[a%lu%s]", reg->rel_reg->regnum, short_swizzle);
|
||||
return wine_dbg_sprintf("[a%u%s]", reg->rel_reg->regnum, short_swizzle);
|
||||
else if(reg->rel_reg->type == BWRITERSPR_LOOP && reg->rel_reg->regnum == 0)
|
||||
return wine_dbg_sprintf("[aL%s]", short_swizzle);
|
||||
else
|
||||
|
@ -331,7 +331,7 @@ const char *debug_print_dstreg(const struct shader_reg *reg)
|
|||
{
|
||||
return wine_dbg_sprintf("%s%s%s", get_regname(reg),
|
||||
debug_print_relarg(reg),
|
||||
debug_print_writemask(reg->u.writemask));
|
||||
debug_print_writemask(reg->writemask));
|
||||
}
|
||||
|
||||
const char *debug_print_srcreg(const struct shader_reg *reg)
|
||||
|
@ -341,64 +341,64 @@ const char *debug_print_srcreg(const struct shader_reg *reg)
|
|||
case BWRITERSPSM_NONE:
|
||||
return wine_dbg_sprintf("%s%s%s", get_regname(reg),
|
||||
debug_print_relarg(reg),
|
||||
debug_print_swizzle(reg->u.swizzle));
|
||||
debug_print_swizzle(reg->swizzle));
|
||||
case BWRITERSPSM_NEG:
|
||||
return wine_dbg_sprintf("-%s%s%s", get_regname(reg),
|
||||
debug_print_relarg(reg),
|
||||
debug_print_swizzle(reg->u.swizzle));
|
||||
debug_print_swizzle(reg->swizzle));
|
||||
case BWRITERSPSM_BIAS:
|
||||
return wine_dbg_sprintf("%s%s_bias%s", get_regname(reg),
|
||||
debug_print_relarg(reg),
|
||||
debug_print_swizzle(reg->u.swizzle));
|
||||
debug_print_swizzle(reg->swizzle));
|
||||
case BWRITERSPSM_BIASNEG:
|
||||
return wine_dbg_sprintf("-%s%s_bias%s", get_regname(reg),
|
||||
debug_print_relarg(reg),
|
||||
debug_print_swizzle(reg->u.swizzle));
|
||||
debug_print_swizzle(reg->swizzle));
|
||||
case BWRITERSPSM_SIGN:
|
||||
return wine_dbg_sprintf("%s%s_bx2%s", get_regname(reg),
|
||||
debug_print_relarg(reg),
|
||||
debug_print_swizzle(reg->u.swizzle));
|
||||
debug_print_swizzle(reg->swizzle));
|
||||
case BWRITERSPSM_SIGNNEG:
|
||||
return wine_dbg_sprintf("-%s%s_bx2%s", get_regname(reg),
|
||||
debug_print_relarg(reg),
|
||||
debug_print_swizzle(reg->u.swizzle));
|
||||
debug_print_swizzle(reg->swizzle));
|
||||
case BWRITERSPSM_COMP:
|
||||
return wine_dbg_sprintf("1 - %s%s%s", get_regname(reg),
|
||||
debug_print_relarg(reg),
|
||||
debug_print_swizzle(reg->u.swizzle));
|
||||
debug_print_swizzle(reg->swizzle));
|
||||
case BWRITERSPSM_X2:
|
||||
return wine_dbg_sprintf("%s%s_x2%s", get_regname(reg),
|
||||
debug_print_relarg(reg),
|
||||
debug_print_swizzle(reg->u.swizzle));
|
||||
debug_print_swizzle(reg->swizzle));
|
||||
case BWRITERSPSM_X2NEG:
|
||||
return wine_dbg_sprintf("-%s%s_x2%s", get_regname(reg),
|
||||
debug_print_relarg(reg),
|
||||
debug_print_swizzle(reg->u.swizzle));
|
||||
debug_print_swizzle(reg->swizzle));
|
||||
case BWRITERSPSM_DZ:
|
||||
return wine_dbg_sprintf("%s%s_dz%s", get_regname(reg),
|
||||
debug_print_relarg(reg),
|
||||
debug_print_swizzle(reg->u.swizzle));
|
||||
debug_print_swizzle(reg->swizzle));
|
||||
case BWRITERSPSM_DW:
|
||||
return wine_dbg_sprintf("%s%s_dw%s", get_regname(reg),
|
||||
debug_print_relarg(reg),
|
||||
debug_print_swizzle(reg->u.swizzle));
|
||||
debug_print_swizzle(reg->swizzle));
|
||||
case BWRITERSPSM_ABS:
|
||||
return wine_dbg_sprintf("%s%s_abs%s", get_regname(reg),
|
||||
debug_print_relarg(reg),
|
||||
debug_print_swizzle(reg->u.swizzle));
|
||||
debug_print_swizzle(reg->swizzle));
|
||||
case BWRITERSPSM_ABSNEG:
|
||||
return wine_dbg_sprintf("-%s%s_abs%s", get_regname(reg),
|
||||
debug_print_relarg(reg),
|
||||
debug_print_swizzle(reg->u.swizzle));
|
||||
debug_print_swizzle(reg->swizzle));
|
||||
case BWRITERSPSM_NOT:
|
||||
return wine_dbg_sprintf("!%s%s%s", get_regname(reg),
|
||||
debug_print_relarg(reg),
|
||||
debug_print_swizzle(reg->u.swizzle));
|
||||
debug_print_swizzle(reg->swizzle));
|
||||
}
|
||||
return "Unknown modifier";
|
||||
}
|
||||
|
||||
const char *debug_print_comp(DWORD comp)
|
||||
const char *debug_print_comp(uint32_t comp)
|
||||
{
|
||||
switch (comp)
|
||||
{
|
||||
|
@ -413,7 +413,7 @@ const char *debug_print_comp(DWORD comp)
|
|||
}
|
||||
}
|
||||
|
||||
const char *debug_print_opcode(DWORD opcode)
|
||||
const char *debug_print_opcode(uint32_t opcode)
|
||||
{
|
||||
switch (opcode)
|
||||
{
|
||||
|
@ -507,28 +507,28 @@ const char *debug_print_opcode(DWORD opcode)
|
|||
}
|
||||
}
|
||||
|
||||
void skip_dword_unknown(const char **ptr, unsigned int count)
|
||||
void skip_u32_unknown(const char **ptr, unsigned int count)
|
||||
{
|
||||
unsigned int i;
|
||||
DWORD d;
|
||||
uint32_t u32;
|
||||
|
||||
FIXME("Skipping %u unknown DWORDs:\n", count);
|
||||
FIXME("Skipping %u unknown u32s:\n", count);
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
d = read_dword(ptr);
|
||||
FIXME("\t0x%08lx\n", d);
|
||||
u32 = read_u32(ptr);
|
||||
FIXME("\t0x%08x\n", u32);
|
||||
}
|
||||
}
|
||||
|
||||
static void write_dword_unknown(char **ptr, DWORD d)
|
||||
static void write_u32_unknown(char **ptr, uint32_t u32)
|
||||
{
|
||||
FIXME("Writing unknown DWORD 0x%08lx.\n", d);
|
||||
write_dword(ptr, d);
|
||||
FIXME("Writing unknown u32 0x%08x.\n", u32);
|
||||
write_u32(ptr, u32);
|
||||
}
|
||||
|
||||
HRESULT dxbc_add_section(struct dxbc *dxbc, DWORD tag, const char *data, DWORD data_size)
|
||||
HRESULT dxbc_add_section(struct dxbc *dxbc, DWORD tag, const char *data, size_t data_size)
|
||||
{
|
||||
TRACE("dxbc %p, tag %s, size %#lx.\n", dxbc, debugstr_an((const char *)&tag, 4), data_size);
|
||||
TRACE("dxbc %p, tag %s, size %#Ix.\n", dxbc, debugstr_an((const char *)&tag, 4), data_size);
|
||||
|
||||
if (dxbc->count >= dxbc->size)
|
||||
{
|
||||
|
@ -576,10 +576,10 @@ HRESULT dxbc_init(struct dxbc *dxbc, unsigned int size)
|
|||
|
||||
HRESULT dxbc_parse(const char *data, SIZE_T data_size, struct dxbc *dxbc)
|
||||
{
|
||||
uint32_t tag, total_size, chunk_count;
|
||||
const char *ptr = data;
|
||||
HRESULT hr;
|
||||
unsigned int i;
|
||||
DWORD tag, total_size, chunk_count;
|
||||
HRESULT hr;
|
||||
|
||||
if (!data)
|
||||
{
|
||||
|
@ -587,7 +587,7 @@ HRESULT dxbc_parse(const char *data, SIZE_T data_size, struct dxbc *dxbc)
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
tag = read_dword(&ptr);
|
||||
tag = read_u32(&ptr);
|
||||
TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
|
||||
|
||||
if (tag != TAG_DXBC)
|
||||
|
@ -597,12 +597,12 @@ HRESULT dxbc_parse(const char *data, SIZE_T data_size, struct dxbc *dxbc)
|
|||
}
|
||||
|
||||
/* checksum? */
|
||||
skip_dword_unknown(&ptr, 4);
|
||||
skip_u32_unknown(&ptr, 4);
|
||||
|
||||
skip_dword_unknown(&ptr, 1);
|
||||
skip_u32_unknown(&ptr, 1);
|
||||
|
||||
total_size = read_dword(&ptr);
|
||||
TRACE("total size: %#lx\n", total_size);
|
||||
total_size = read_u32(&ptr);
|
||||
TRACE("total size: %#x\n", total_size);
|
||||
|
||||
if (data_size != total_size)
|
||||
{
|
||||
|
@ -610,8 +610,8 @@ HRESULT dxbc_parse(const char *data, SIZE_T data_size, struct dxbc *dxbc)
|
|||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
chunk_count = read_dword(&ptr);
|
||||
TRACE("chunk count: %#lx\n", chunk_count);
|
||||
chunk_count = read_u32(&ptr);
|
||||
TRACE("chunk count: %#x\n", chunk_count);
|
||||
|
||||
hr = dxbc_init(dxbc, chunk_count);
|
||||
if (FAILED(hr))
|
||||
|
@ -622,17 +622,17 @@ HRESULT dxbc_parse(const char *data, SIZE_T data_size, struct dxbc *dxbc)
|
|||
|
||||
for (i = 0; i < chunk_count; ++i)
|
||||
{
|
||||
DWORD chunk_tag, chunk_size;
|
||||
uint32_t chunk_tag, chunk_size;
|
||||
const char *chunk_ptr;
|
||||
DWORD chunk_offset;
|
||||
uint32_t chunk_offset;
|
||||
|
||||
chunk_offset = read_dword(&ptr);
|
||||
TRACE("chunk %u at offset %#lx\n", i, chunk_offset);
|
||||
chunk_offset = read_u32(&ptr);
|
||||
TRACE("chunk %u at offset %#x\n", i, chunk_offset);
|
||||
|
||||
chunk_ptr = data + chunk_offset;
|
||||
|
||||
chunk_tag = read_dword(&chunk_ptr);
|
||||
chunk_size = read_dword(&chunk_ptr);
|
||||
chunk_tag = read_u32(&chunk_ptr);
|
||||
chunk_size = read_u32(&chunk_ptr);
|
||||
|
||||
hr = dxbc_add_section(dxbc, chunk_tag, chunk_ptr, chunk_size);
|
||||
if (FAILED(hr))
|
||||
|
@ -676,35 +676,35 @@ HRESULT dxbc_write_blob(struct dxbc *dxbc, ID3DBlob **blob)
|
|||
|
||||
ptr = ID3D10Blob_GetBufferPointer(object);
|
||||
|
||||
write_dword(&ptr, TAG_DXBC);
|
||||
write_u32(&ptr, TAG_DXBC);
|
||||
|
||||
/* signature(?) */
|
||||
write_dword_unknown(&ptr, 0);
|
||||
write_dword_unknown(&ptr, 0);
|
||||
write_dword_unknown(&ptr, 0);
|
||||
write_dword_unknown(&ptr, 0);
|
||||
write_u32_unknown(&ptr, 0);
|
||||
write_u32_unknown(&ptr, 0);
|
||||
write_u32_unknown(&ptr, 0);
|
||||
write_u32_unknown(&ptr, 0);
|
||||
|
||||
/* seems to be always 1 */
|
||||
write_dword_unknown(&ptr, 1);
|
||||
write_u32_unknown(&ptr, 1);
|
||||
|
||||
/* DXBC size */
|
||||
write_dword(&ptr, size);
|
||||
write_u32(&ptr, size);
|
||||
|
||||
/* chunk count */
|
||||
write_dword(&ptr, dxbc->count);
|
||||
write_u32(&ptr, dxbc->count);
|
||||
|
||||
/* write the chunk offsets */
|
||||
for (i = 0; i < dxbc->count; ++i)
|
||||
{
|
||||
write_dword(&ptr, offset);
|
||||
write_u32(&ptr, offset);
|
||||
offset += 8 + dxbc->sections[i].data_size;
|
||||
}
|
||||
|
||||
/* write the chunks */
|
||||
for (i = 0; i < dxbc->count; ++i)
|
||||
{
|
||||
write_dword(&ptr, dxbc->sections[i].tag);
|
||||
write_dword(&ptr, dxbc->sections[i].data_size);
|
||||
write_u32(&ptr, dxbc->sections[i].tag);
|
||||
write_u32(&ptr, dxbc->sections[i].data_size);
|
||||
memcpy(ptr, dxbc->sections[i].data, dxbc->sections[i].data_size);
|
||||
ptr += dxbc->sections[i].data_size;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue