mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
wined3d: Handle SM1 comments in the frontend.
This commit is contained in:
parent
5626e165ff
commit
311a1e0148
4 changed files with 44 additions and 69 deletions
|
@ -494,12 +494,6 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
|
|||
while (!fe->shader_is_end(fe_data, &ptr))
|
||||
{
|
||||
struct wined3d_shader_instruction ins;
|
||||
const char *comment;
|
||||
UINT comment_size;
|
||||
|
||||
/* Skip comments. */
|
||||
fe->shader_read_comment(&ptr, &comment, &comment_size);
|
||||
if (comment) continue;
|
||||
|
||||
/* Fetch opcode. */
|
||||
fe->shader_read_instruction(fe_data, &ptr, &ins);
|
||||
|
@ -1214,13 +1208,6 @@ void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_sh
|
|||
|
||||
while (!fe->shader_is_end(fe_data, &ptr))
|
||||
{
|
||||
const char *comment;
|
||||
UINT comment_size;
|
||||
|
||||
/* Skip comment tokens. */
|
||||
fe->shader_read_comment(&ptr, &comment, &comment_size);
|
||||
if (comment) continue;
|
||||
|
||||
/* Read opcode. */
|
||||
fe->shader_read_instruction(fe_data, &ptr, &ins);
|
||||
|
||||
|
@ -1342,36 +1329,6 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
|
|||
while (!fe->shader_is_end(fe_data, &ptr))
|
||||
{
|
||||
struct wined3d_shader_instruction ins;
|
||||
const char *comment;
|
||||
UINT comment_size;
|
||||
|
||||
/* comment */
|
||||
fe->shader_read_comment(&ptr, &comment, &comment_size);
|
||||
if (comment)
|
||||
{
|
||||
if (comment_size > 4 && *(const DWORD *)comment == WINEMAKEFOURCC('T', 'E', 'X', 'T'))
|
||||
{
|
||||
const char *end = comment + comment_size;
|
||||
const char *ptr = comment + 4;
|
||||
const char *line = ptr;
|
||||
|
||||
TRACE("// TEXT\n");
|
||||
while (ptr != end)
|
||||
{
|
||||
if (*ptr == '\n')
|
||||
{
|
||||
UINT len = ptr - line;
|
||||
if (len && *(ptr - 1) == '\r') --len;
|
||||
TRACE("// %s\n", debugstr_an(line, len));
|
||||
line = ++ptr;
|
||||
}
|
||||
else ++ptr;
|
||||
}
|
||||
if (line != ptr) TRACE("// %s\n", debugstr_an(line, ptr - line));
|
||||
}
|
||||
else TRACE("// %s\n", debugstr_an(comment, comment_size));
|
||||
continue;
|
||||
}
|
||||
|
||||
fe->shader_read_instruction(fe_data, &ptr, &ins);
|
||||
if (ins.handler_idx == WINED3DSIH_TABLE_SIZE)
|
||||
|
|
|
@ -642,6 +642,48 @@ static void shader_sm1_read_immconst(const DWORD **ptr, struct wined3d_shader_sr
|
|||
*ptr += count;
|
||||
}
|
||||
|
||||
static void shader_sm1_read_comment(const DWORD **ptr)
|
||||
{
|
||||
DWORD token = **ptr;
|
||||
const char *comment;
|
||||
UINT size;
|
||||
|
||||
while ((token & WINED3DSI_OPCODE_MASK) == WINED3D_SM1_OP_COMMENT)
|
||||
{
|
||||
size = (token & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT;
|
||||
comment = (const char *)++(*ptr);
|
||||
*ptr += size;
|
||||
|
||||
if (size > 1 && *(const DWORD *)comment == WINEMAKEFOURCC('T', 'E', 'X', 'T'))
|
||||
{
|
||||
const char *end = comment + size * sizeof(token);
|
||||
const char *p = comment + sizeof(token);
|
||||
const char *line = p;
|
||||
|
||||
TRACE("// TEXT\n");
|
||||
while (p != end)
|
||||
{
|
||||
if (*p == '\n')
|
||||
{
|
||||
UINT len = p - line;
|
||||
if (len && *(p - 1) == '\r') --len;
|
||||
TRACE("// %s\n", debugstr_an(line, len));
|
||||
line = ++p;
|
||||
}
|
||||
else ++p;
|
||||
}
|
||||
if (line != p)
|
||||
TRACE("// %s\n", debugstr_an(line, p - line));
|
||||
}
|
||||
else if (size)
|
||||
TRACE("// %s\n", debugstr_an(comment, size * sizeof(token)));
|
||||
else
|
||||
break;
|
||||
|
||||
token = **ptr;
|
||||
}
|
||||
}
|
||||
|
||||
static void shader_sm1_read_instruction(void *data, const DWORD **ptr, struct wined3d_shader_instruction *ins)
|
||||
{
|
||||
const struct wined3d_sm1_opcode_info *opcode_info;
|
||||
|
@ -650,6 +692,8 @@ static void shader_sm1_read_instruction(void *data, const DWORD **ptr, struct wi
|
|||
unsigned int i;
|
||||
const DWORD *p;
|
||||
|
||||
shader_sm1_read_comment(ptr);
|
||||
|
||||
opcode_token = *(*ptr)++;
|
||||
if (!(opcode_info = shader_get_opcode(priv, opcode_token)))
|
||||
{
|
||||
|
@ -708,23 +752,6 @@ static void shader_sm1_read_instruction(void *data, const DWORD **ptr, struct wi
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
*comment = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
size = (token & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT;
|
||||
*comment = (const char *)++(*ptr);
|
||||
*comment_size = size * sizeof(DWORD);
|
||||
*ptr += size;
|
||||
}
|
||||
|
||||
static BOOL shader_sm1_is_end(void *data, const DWORD **ptr)
|
||||
{
|
||||
if (**ptr == WINED3DSP_END)
|
||||
|
@ -742,6 +769,5 @@ const struct wined3d_shader_frontend sm1_shader_frontend =
|
|||
shader_sm1_free,
|
||||
shader_sm1_read_header,
|
||||
shader_sm1_read_instruction,
|
||||
shader_sm1_read_comment,
|
||||
shader_sm1_is_end,
|
||||
};
|
||||
|
|
|
@ -789,12 +789,6 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi
|
|||
}
|
||||
}
|
||||
|
||||
static void shader_sm4_read_comment(const DWORD **ptr, const char **comment, UINT *comment_size)
|
||||
{
|
||||
FIXME("ptr %p, comment %p, comment_size %p stub!\n", ptr, comment, comment_size);
|
||||
*comment = NULL;
|
||||
}
|
||||
|
||||
static BOOL shader_sm4_is_end(void *data, const DWORD **ptr)
|
||||
{
|
||||
struct wined3d_sm4_data *priv = data;
|
||||
|
@ -807,6 +801,5 @@ const struct wined3d_shader_frontend sm4_shader_frontend =
|
|||
shader_sm4_free,
|
||||
shader_sm4_read_header,
|
||||
shader_sm4_read_instruction,
|
||||
shader_sm4_read_comment,
|
||||
shader_sm4_is_end,
|
||||
};
|
||||
|
|
|
@ -702,7 +702,6 @@ struct wined3d_shader_frontend
|
|||
void (*shader_free)(void *data);
|
||||
void (*shader_read_header)(void *data, const DWORD **ptr, struct wined3d_shader_version *shader_version);
|
||||
void (*shader_read_instruction)(void *data, const DWORD **ptr, struct wined3d_shader_instruction *ins);
|
||||
void (*shader_read_comment)(const DWORD **ptr, const char **comment, UINT *comment_size);
|
||||
BOOL (*shader_is_end)(void *data, const DWORD **ptr);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue