Commit 807e5fc0 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

d3dx9: Return correct comment length from get_instr_length().

parent 6a7a635b
......@@ -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;
......
......@@ -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 */
......
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