wined3d: Add a frontend function to determine if there are any tokens left.
This commit is contained in:
parent
2378108eb9
commit
5f96c0083a
|
@ -326,7 +326,8 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
|
|||
reg_maps->shader_version = shader_version = *pToken++;
|
||||
pshader = shader_is_pshader_version(shader_version);
|
||||
|
||||
while (WINED3DVS_END() != *pToken) {
|
||||
while (!fe->shader_is_end(&pToken))
|
||||
{
|
||||
struct wined3d_shader_instruction ins;
|
||||
const char *comment;
|
||||
UINT param_size;
|
||||
|
@ -569,7 +570,6 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
|
|||
}
|
||||
}
|
||||
}
|
||||
++pToken;
|
||||
reg_maps->loop_depth = max_loop_depth;
|
||||
|
||||
This->baseShader.functionLength = ((char *)pToken - (char *)byte_code);
|
||||
|
@ -870,7 +870,7 @@ void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER *buffer,
|
|||
return;
|
||||
}
|
||||
|
||||
while (WINED3DPS_END() != *pToken)
|
||||
while (!fe->shader_is_end(&pToken))
|
||||
{
|
||||
const char *comment;
|
||||
UINT param_size;
|
||||
|
@ -980,7 +980,7 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe,
|
|||
TRACE("%s_%u_%u\n", shader_is_pshader_version(shader_version) ? "ps": "vs",
|
||||
WINED3DSHADER_VERSION_MAJOR(shader_version), WINED3DSHADER_VERSION_MINOR(shader_version));
|
||||
|
||||
while (WINED3DVS_END() != *pToken)
|
||||
while (!fe->shader_is_end(&pToken))
|
||||
{
|
||||
struct wined3d_shader_instruction ins;
|
||||
const char *comment;
|
||||
|
|
|
@ -84,6 +84,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
|
|||
#define WINED3DSP_SRCMOD_SHIFT 24
|
||||
#define WINED3DSP_SRCMOD_MASK (0xf << WINED3DSP_SRCMOD_SHIFT)
|
||||
|
||||
#define WINED3DSP_END 0x0000ffff
|
||||
|
||||
enum WINED3DSHADER_ADDRESSMODE_TYPE
|
||||
{
|
||||
WINED3DSHADER_ADDRMODE_ABSOLUTE = 0 << WINED3DSHADER_ADDRESSMODE_SHIFT,
|
||||
|
@ -303,6 +305,17 @@ static void shader_sm1_read_comment(const DWORD **ptr, const char **comment)
|
|||
*ptr += (token & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT;
|
||||
}
|
||||
|
||||
static BOOL shader_sm1_is_end(const DWORD **ptr)
|
||||
{
|
||||
if (**ptr == WINED3DSP_END)
|
||||
{
|
||||
++(*ptr);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const struct wined3d_shader_frontend sm1_shader_frontend =
|
||||
{
|
||||
shader_sm1_read_opcode,
|
||||
|
@ -310,4 +323,5 @@ const struct wined3d_shader_frontend sm1_shader_frontend =
|
|||
shader_sm1_read_dst_param,
|
||||
shader_sm1_read_semantic,
|
||||
shader_sm1_read_comment,
|
||||
shader_sm1_is_end,
|
||||
};
|
||||
|
|
|
@ -475,8 +475,6 @@ typedef enum COMPARISON_TYPE
|
|||
#define WINED3DVS_VERSION(major, minor) (0xfffe0000 | ((major) << 8) | (minor))
|
||||
#define WINED3DSHADER_VERSION_MAJOR(version) (((version) >> 8) & 0xff)
|
||||
#define WINED3DSHADER_VERSION_MINOR(version) (((version) >> 0) & 0xff)
|
||||
#define WINED3DPS_END() 0x0000ffff
|
||||
#define WINED3DVS_END() 0x0000ffff
|
||||
|
||||
/* Shader backends */
|
||||
|
||||
|
@ -684,6 +682,7 @@ struct wined3d_shader_frontend
|
|||
struct wined3d_shader_src_param *dst_rel_addr, DWORD shader_version);
|
||||
void (*shader_read_semantic)(const DWORD **ptr, struct wined3d_shader_semantic *semantic);
|
||||
void (*shader_read_comment)(const DWORD **ptr, const char **comment);
|
||||
BOOL (*shader_is_end)(const DWORD **ptr);
|
||||
};
|
||||
|
||||
extern const struct wined3d_shader_frontend sm1_shader_frontend;
|
||||
|
|
Loading…
Reference in New Issue