Paul Gofman : d3dx9: Return correct comment length from get_instr_length() .
Alexandre Julliard
julliard at winehq.org
Wed Jan 9 16:57:11 CST 2019
Module: wine
Branch: master
Commit: 807e5fc04af7a7ea563af1e7da6ebe6662536e6b
URL: https://source.winehq.org/git/wine.git/?a=commit;h=807e5fc04af7a7ea563af1e7da6ebe6662536e6b
Author: Paul Gofman <gofmanp at gmail.com>
Date: Wed Jan 9 20:17:52 2019 +0100
d3dx9: Return correct comment length from get_instr_length().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46435
Signed-off-by: Paul Gofman <gofmanp at gmail.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3dx9_36/shader.c | 8 +++++---
dlls/d3dx9_36/tests/shader.c | 1 +
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c
index acbbf07..e8ce3dd 100644
--- a/dlls/d3dx9_36/shader.c
+++ b/dlls/d3dx9_36/shader.c
@@ -2415,18 +2415,20 @@ HRESULT WINAPI D3DXCreateTextureShader(const DWORD *function, ID3DXTextureShader
static unsigned int get_instr_length(const DWORD *byte_code, unsigned int major, unsigned int minor)
{
+ DWORD opcode = *byte_code & 0xffff;
unsigned int len = 0;
+ if (opcode == D3DSIO_COMMENT)
+ return (*byte_code & D3DSI_COMMENTSIZE_MASK) >> D3DSI_COMMENTSIZE_SHIFT;
+
if (major > 1)
return (*byte_code & D3DSI_INSTLENGTH_MASK) >> D3DSI_INSTLENGTH_SHIFT;
- switch (*byte_code & 0xffff)
+ switch (opcode)
{
case D3DSIO_END:
ERR("Unexpected END token.\n");
return 0;
- case D3DSIO_COMMENT:
- return (*byte_code & D3DSI_COMMENTSIZE_MASK) >> D3DSI_COMMENTSIZE_SHIFT;
case D3DSIO_DEF:
case D3DSIO_DEFI:
return 5;
diff --git a/dlls/d3dx9_36/tests/shader.c b/dlls/d3dx9_36/tests/shader.c
index 1086e5e..b67ffb2 100644
--- a/dlls/d3dx9_36/tests/shader.c
+++ b/dlls/d3dx9_36/tests/shader.c
@@ -6457,6 +6457,7 @@ static void test_shader_semantics(void)
vs_3_0[] =
{
0xfffe0300, /* vs_3_0 */
+ 0x0002fffe, 0x0200000f, 0x00000000, /* comment */
0x0200001f, 0x80000000, 0x900f0000, /* dcl_position v0 */
0x0200001f, 0x80000003, 0x900f0001, /* dcl_normal v1 */
0x0200001f, 0x8001000a, 0x900f0002, /* dcl_color1 v2 */
More information about the wine-cvs
mailing list