Commit 29aa316d authored by Ivan Gyurdiev's avatar Ivan Gyurdiev Committed by Alexandre Julliard

wined3d: Add D3DSI and other opcode masks to the WINED3D namespace.

parent 6f0bb0f6
...@@ -74,7 +74,7 @@ const SHADER_OPCODE* shader_get_opcode( ...@@ -74,7 +74,7 @@ const SHADER_OPCODE* shader_get_opcode(
/** TODO: use dichotomic search */ /** TODO: use dichotomic search */
while (NULL != shader_ins[i].name) { while (NULL != shader_ins[i].name) {
if (((code & D3DSI_OPCODE_MASK) == shader_ins[i].opcode) && if (((code & WINED3DSI_OPCODE_MASK) == shader_ins[i].opcode) &&
(((hex_version >= shader_ins[i].min_version) && (hex_version <= shader_ins[i].max_version)) || (((hex_version >= shader_ins[i].min_version) && (hex_version <= shader_ins[i].max_version)) ||
((shader_ins[i].min_version == 0) && (shader_ins[i].max_version == 0)))) { ((shader_ins[i].min_version == 0) && (shader_ins[i].max_version == 0)))) {
return &shader_ins[i]; return &shader_ins[i];
...@@ -82,7 +82,7 @@ const SHADER_OPCODE* shader_get_opcode( ...@@ -82,7 +82,7 @@ const SHADER_OPCODE* shader_get_opcode(
++i; ++i;
} }
FIXME("Unsupported opcode %#x(%d) masked %#x, shader version %#x\n", FIXME("Unsupported opcode %#x(%d) masked %#x, shader version %#x\n",
code, code, code & D3DSI_OPCODE_MASK, hex_version); code, code, code & WINED3DSI_OPCODE_MASK, hex_version);
return NULL; return NULL;
} }
...@@ -119,7 +119,7 @@ static inline int shader_skip_opcode( ...@@ -119,7 +119,7 @@ static inline int shader_skip_opcode(
* have a useful legnth mask - use it here. Shaders 1.0 contain no such tokens */ * have a useful legnth mask - use it here. Shaders 1.0 contain no such tokens */
return (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2)? return (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2)?
((opcode_token & D3DSI_INSTLENGTH_MASK) >> D3DSI_INSTLENGTH_SHIFT): ((opcode_token & WINED3DSI_INSTLENGTH_MASK) >> WINED3DSI_INSTLENGTH_SHIFT):
curOpcode->num_params; curOpcode->num_params;
} }
...@@ -202,7 +202,7 @@ HRESULT shader_get_registers_used( ...@@ -202,7 +202,7 @@ HRESULT shader_get_registers_used(
/* Skip comments */ /* Skip comments */
} else if (shader_is_comment(*pToken)) { } else if (shader_is_comment(*pToken)) {
DWORD comment_len = (*pToken & D3DSI_COMMENTSIZE_MASK) >> D3DSI_COMMENTSIZE_SHIFT; DWORD comment_len = (*pToken & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT;
++pToken; ++pToken;
pToken += comment_len; pToken += comment_len;
continue; continue;
...@@ -354,7 +354,7 @@ HRESULT shader_get_registers_used( ...@@ -354,7 +354,7 @@ HRESULT shader_get_registers_used(
* okay, since we'll catch any address registers when * okay, since we'll catch any address registers when
* they are initialized (required by spec) */ * they are initialized (required by spec) */
limit = (opcode_token & D3DSHADER_INSTRUCTION_PREDICATED)? limit = (opcode_token & WINED3DSHADER_INSTRUCTION_PREDICATED)?
curOpcode->num_params + 1: curOpcode->num_params; curOpcode->num_params + 1: curOpcode->num_params;
for (i = 0; i < limit; ++i) { for (i = 0; i < limit; ++i) {
...@@ -699,7 +699,7 @@ void shader_generate_main( ...@@ -699,7 +699,7 @@ void shader_generate_main(
/* Skip comment tokens */ /* Skip comment tokens */
if (shader_is_comment(*pToken)) { if (shader_is_comment(*pToken)) {
DWORD comment_len = (*pToken & D3DSI_COMMENTSIZE_MASK) >> D3DSI_COMMENTSIZE_SHIFT; DWORD comment_len = (*pToken & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT;
++pToken; ++pToken;
TRACE("#%s\n", (char*)pToken); TRACE("#%s\n", (char*)pToken);
pToken += comment_len; pToken += comment_len;
...@@ -749,7 +749,7 @@ void shader_generate_main( ...@@ -749,7 +749,7 @@ void shader_generate_main(
} }
/* Predication token */ /* Predication token */
if (hw_arg.opcode_token & D3DSHADER_INSTRUCTION_PREDICATED) if (hw_arg.opcode_token & WINED3DSHADER_INSTRUCTION_PREDICATED)
hw_arg.predicate = *pToken++; hw_arg.predicate = *pToken++;
/* Other source tokens */ /* Other source tokens */
...@@ -832,7 +832,7 @@ void shader_trace_init( ...@@ -832,7 +832,7 @@ void shader_trace_init(
continue; continue;
} }
if (shader_is_comment(*pToken)) { /** comment */ if (shader_is_comment(*pToken)) { /** comment */
DWORD comment_len = (*pToken & D3DSI_COMMENTSIZE_MASK) >> D3DSI_COMMENTSIZE_SHIFT; DWORD comment_len = (*pToken & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT;
++pToken; ++pToken;
TRACE("//%s\n", (char*)pToken); TRACE("//%s\n", (char*)pToken);
pToken += comment_len; pToken += comment_len;
...@@ -901,7 +901,7 @@ void shader_trace_init( ...@@ -901,7 +901,7 @@ void shader_trace_init(
/* Print out predication source token first - it follows /* Print out predication source token first - it follows
* the destination token. */ * the destination token. */
if (opcode_token & D3DSHADER_INSTRUCTION_PREDICATED) { if (opcode_token & WINED3DSHADER_INSTRUCTION_PREDICATED) {
TRACE("("); TRACE("(");
shader_dump_param(iface, *(pToken + 2), 0, 1); shader_dump_param(iface, *(pToken + 2), 0, 1);
TRACE(") "); TRACE(") ");
...@@ -939,7 +939,7 @@ void shader_trace_init( ...@@ -939,7 +939,7 @@ void shader_trace_init(
} }
/* Predication token - already printed out, just skip it */ /* Predication token - already printed out, just skip it */
if (opcode_token & D3DSHADER_INSTRUCTION_PREDICATED) { if (opcode_token & WINED3DSHADER_INSTRUCTION_PREDICATED) {
pToken++; pToken++;
len++; len++;
} }
......
...@@ -895,7 +895,7 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_ExecuteSW(IWineD3DVertexShader* iface, W ...@@ -895,7 +895,7 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_ExecuteSW(IWineD3DVertexShader* iface, W
} }
while (D3DVS_END() != *pToken) { while (D3DVS_END() != *pToken) {
if (shader_is_comment(*pToken)) { /** comment */ if (shader_is_comment(*pToken)) { /** comment */
DWORD comment_len = (*pToken & D3DSI_COMMENTSIZE_MASK) >> D3DSI_COMMENTSIZE_SHIFT; DWORD comment_len = (*pToken & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT;
++pToken; ++pToken;
pToken += comment_len; pToken += comment_len;
continue ; continue ;
......
...@@ -1683,7 +1683,7 @@ inline static BOOL shader_is_vshader_version(DWORD token) { ...@@ -1683,7 +1683,7 @@ inline static BOOL shader_is_vshader_version(DWORD token) {
} }
inline static BOOL shader_is_comment(DWORD token) { inline static BOOL shader_is_comment(DWORD token) {
return WINED3DSIO_COMMENT == (token & D3DSI_OPCODE_MASK); return WINED3DSIO_COMMENT == (token & WINED3DSI_OPCODE_MASK);
} }
/* Internally used shader constants. Applications can use constants 0 to GL_LIMITS(vshader_constantsF) - 1, /* Internally used shader constants. Applications can use constants 0 to GL_LIMITS(vshader_constantsF) - 1,
......
...@@ -249,4 +249,19 @@ typedef enum _WINED3DSHADER_INSTRUCTION_OPCODE_TYPE { ...@@ -249,4 +249,19 @@ typedef enum _WINED3DSHADER_INSTRUCTION_OPCODE_TYPE {
WINED3DSIO_FORCE_DWORD = 0X7FFFFFFF /** for 32-bit alignment */ WINED3DSIO_FORCE_DWORD = 0X7FFFFFFF /** for 32-bit alignment */
} WINED3DSHADER_INSTRUCTION_OPCODE_TYPE; } WINED3DSHADER_INSTRUCTION_OPCODE_TYPE;
/** opcode-related masks **/
#define WINED3DSI_OPCODE_MASK 0x0000FFFF
#define WINED3DSI_INSTLENGTH_MASK 0x0F000000
#define WINED3DSI_INSTLENGTH_SHIFT 24
#define WINED3DSI_COISSUE 0x40000000
#define WINED3DSI_COMMENTSIZE_SHIFT 16
#define WINED3DSI_COMMENTSIZE_MASK (0x7FFF << WINED3DSI_COMMENTSIZE_SHIFT)
#define WINED3DSHADER_COMMENT(commentSize) \
((((commentSize) << WINED3DSI_COMMENTSIZE_SHIFT) & WINED3DSI_COMMENTSIZE_MASK) | WINED3DSIO_COMMENT)
#define WINED3DSHADER_INSTRUCTION_PREDICATED (1 << 28)
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment