wined3d: Properly report shader comment sizes.

This commit is contained in:
Henri Verbeet 2010-02-22 21:37:19 +01:00 committed by Alexandre Julliard
parent 4064efdc27
commit eefb45f333
4 changed files with 14 additions and 8 deletions

View File

@ -467,10 +467,11 @@ static HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct
{
struct wined3d_shader_instruction ins;
const char *comment;
UINT comment_size;
UINT param_size;
/* Skip comments. */
fe->shader_read_comment(&ptr, &comment);
fe->shader_read_comment(&ptr, &comment, &comment_size);
if (comment) continue;
/* Fetch opcode. */
@ -1115,10 +1116,11 @@ void shader_generate_main(IWineD3DBaseShader *iface, struct wined3d_shader_buffe
while (!fe->shader_is_end(fe_data, &ptr))
{
const char *comment;
UINT comment_size;
UINT param_size;
/* Skip comment tokens. */
fe->shader_read_comment(&ptr, &comment);
fe->shader_read_comment(&ptr, &comment, &comment_size);
if (comment) continue;
/* Read opcode. */
@ -1222,10 +1224,11 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
{
struct wined3d_shader_instruction ins;
const char *comment;
UINT comment_size;
UINT param_size;
/* comment */
fe->shader_read_comment(&ptr, &comment);
fe->shader_read_comment(&ptr, &comment, &comment_size);
if (comment)
{
TRACE("//%s\n", comment);

View File

@ -641,9 +641,10 @@ static void shader_sm1_read_semantic(const DWORD **ptr, struct wined3d_shader_se
shader_parse_dst_param(dst_token, NULL, &semantic->reg);
}
static void shader_sm1_read_comment(const DWORD **ptr, const char **comment)
static void shader_sm1_read_comment(const DWORD **ptr, const char **comment, UINT *comment_size)
{
DWORD token = **ptr;
UINT size;
if ((token & WINED3DSI_OPCODE_MASK) != WINED3D_SM1_OP_COMMENT)
{
@ -651,8 +652,10 @@ static void shader_sm1_read_comment(const DWORD **ptr, const char **comment)
return;
}
size = (token & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT;
*comment = (const char *)++(*ptr);
*ptr += (token & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT;
*comment_size = size * sizeof(DWORD);
*ptr += size;
}
static BOOL shader_sm1_is_end(void *data, const DWORD **ptr)

View File

@ -406,9 +406,9 @@ static void shader_sm4_read_semantic(const DWORD **ptr, struct wined3d_shader_se
FIXME("ptr %p, semantic %p stub!\n", ptr, semantic);
}
static void shader_sm4_read_comment(const DWORD **ptr, const char **comment)
static void shader_sm4_read_comment(const DWORD **ptr, const char **comment, UINT *comment_size)
{
FIXME("ptr %p, comment %p stub!\n", ptr, comment);
FIXME("ptr %p, comment %p, comment_size %p stub!\n", ptr, comment, comment_size);
*comment = NULL;
}

View File

@ -625,7 +625,7 @@ struct wined3d_shader_frontend
void (*shader_read_dst_param)(void *data, const DWORD **ptr, struct wined3d_shader_dst_param *dst_param,
struct wined3d_shader_src_param *dst_rel_addr);
void (*shader_read_semantic)(const DWORD **ptr, struct wined3d_shader_semantic *semantic);
void (*shader_read_comment)(const DWORD **ptr, const char **comment);
void (*shader_read_comment)(const DWORD **ptr, const char **comment, UINT *comment_size);
BOOL (*shader_is_end)(void *data, const DWORD **ptr);
};