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@gmail.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2019-01-09 20:17:52 +01:00 committed by Alexandre Julliard
parent 6a7a635b46
commit 807e5fc04a
2 changed files with 6 additions and 3 deletions

View File

@ -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;

View File

@ -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 */