d3dx9_36-GetShaderSemantics: Minor cleanup.

This commit is contained in:
Sebastian Lackner 2015-10-22 02:20:08 +02:00
parent 4f051ce511
commit 8d0e6ea5c8
2 changed files with 24 additions and 21 deletions

View File

@ -1,9 +1,11 @@
From f791fc56711cd4860b405604af4b30b0efc22f52 Mon Sep 17 00:00:00 2001
From 93378d11e8fc9c56251847f7eebf55454fe1d585 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Sat, 5 Apr 2014 14:02:07 +0200
Subject: d3dx9_36: Implement D3DXGetShaderInputSemantics + tests. (rev 3)
Fixes bug 22682.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/d3dx9_36/d3dx9_36.spec | 2 +-
dlls/d3dx9_36/shader.c | 92 ++++++++++++++++++++++++++++++++++++++++++++
@ -12,7 +14,7 @@ Fixes bug 22682.
4 files changed, 180 insertions(+), 1 deletion(-)
diff --git a/dlls/d3dx9_36/d3dx9_36.spec b/dlls/d3dx9_36/d3dx9_36.spec
index 15d693c..9b55d21 100644
index f79b6fa..cba33b4 100644
--- a/dlls/d3dx9_36/d3dx9_36.spec
+++ b/dlls/d3dx9_36/d3dx9_36.spec
@@ -159,7 +159,7 @@
@ -25,7 +27,7 @@ index 15d693c..9b55d21 100644
@ stdcall D3DXGetShaderSamplers(ptr ptr ptr)
@ stdcall D3DXGetShaderSize(ptr)
diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c
index cdc470b..fecc3ee 100644
index e9d893b..39f1f31 100644
--- a/dlls/d3dx9_36/shader.c
+++ b/dlls/d3dx9_36/shader.c
@@ -1,6 +1,7 @@
@ -36,7 +38,7 @@ index cdc470b..fecc3ee 100644
* Copyright 2011 Travis Athougies
*
* This library is free software; you can redistribute it and/or
@@ -2130,3 +2131,94 @@ HRESULT WINAPI D3DXDisassembleShader(const DWORD *shader, BOOL colorcode, const
@@ -2151,3 +2152,94 @@ HRESULT WINAPI D3DXDisassembleShader(const DWORD *shader, BOOL colorcode, const
FIXME("%p %d %s %p: stub\n", shader, colorcode, debugstr_a(comments), disassembly);
return E_OUTOFMEMORY;
}
@ -61,7 +63,7 @@ index cdc470b..fecc3ee 100644
+ else
+ {
+ /* Handle remaining safe instructions */
+ while (*++byte_code & (1 << 31));
+ while (*++byte_code & (1u << 31));
+ }
+
+ return byte_code;
@ -78,7 +80,7 @@ index cdc470b..fecc3ee 100644
+
+ while (*ptr != D3DSIO_END)
+ {
+ if (*ptr & (1 << 31))
+ if (*ptr & (1u << 31))
+ {
+ FIXME("Opcode expected\n");
+ return 0;
@ -88,8 +90,8 @@ index cdc470b..fecc3ee 100644
+ DWORD param1 = *++ptr;
+ DWORD param2 = *++ptr;
+ DWORD usage = param1 & 0x1f;
+ DWORD usage_index = (param1 >> 16) & 0xf;
+ DWORD reg_type = (((param2 >> 11) & 0x3) << 3) | ((param2 >> 28) & 0x7);
+ DWORD usage_index = (param1 >> D3DSP_DCL_USAGEINDEX_SHIFT) & D3DSP_DCL_USAGE_MASK;
+ DWORD reg_type = (((param2 >> 11) & 0x3) << 3) | ((param2 >> D3DSP_REGTYPE_SHIFT) & 0x7);
+
+ TRACE("D3DSIO_DCL param1: %#x, param2: %#x, usage: %u, usage_index: %u, reg_type: %u\n",
+ param1, param2, usage, usage_index, reg_type);
@ -247,10 +249,10 @@ index 694540c..728cd86 100644
+ test_get_shader_semantics();
}
diff --git a/include/d3dx9shader.h b/include/d3dx9shader.h
index d665f72..f565432 100644
index a3f68f2..5714ddb 100644
--- a/include/d3dx9shader.h
+++ b/include/d3dx9shader.h
@@ -315,6 +315,7 @@ DWORD WINAPI D3DXGetShaderVersion(const DWORD *byte_code);
@@ -352,6 +352,7 @@ DWORD WINAPI D3DXGetShaderVersion(const DWORD *byte_code);
const char * WINAPI D3DXGetVertexShaderProfile(struct IDirect3DDevice9 *device);
HRESULT WINAPI D3DXFindShaderComment(const DWORD *byte_code, DWORD fourcc, const void **data, UINT *size);
HRESULT WINAPI D3DXGetShaderSamplers(const DWORD *byte_code, const char **samplers, UINT *count);
@ -259,5 +261,5 @@ index d665f72..f565432 100644
HRESULT WINAPI D3DXAssembleShaderFromFileA(const char *filename, const D3DXMACRO *defines,
ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages);
--
2.4.5
2.6.1

View File

@ -1,8 +1,9 @@
From f16ccf29286616feb69533c178cfccf2709184d6 Mon Sep 17 00:00:00 2001
From b92b1b248050bc0b0b900de72b01cb79ef88df94 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 8 Jul 2015 10:55:03 +1000
Subject: d3dx9_36: Implement D3DXGetShaderOutputSemantics. (rev 2)
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/d3dx9_36/d3dx9_36.spec | 2 +-
dlls/d3dx9_36/shader.c | 20 +++++++++++++++-
@ -11,7 +12,7 @@ Subject: d3dx9_36: Implement D3DXGetShaderOutputSemantics. (rev 2)
4 files changed, 75 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dx9_36/d3dx9_36.spec b/dlls/d3dx9_36/d3dx9_36.spec
index 9b55d21..4ae1384 100644
index cba33b4..7cbf499 100644
--- a/dlls/d3dx9_36/d3dx9_36.spec
+++ b/dlls/d3dx9_36/d3dx9_36.spec
@@ -160,7 +160,7 @@
@ -24,19 +25,19 @@ index 9b55d21..4ae1384 100644
@ stdcall D3DXGetShaderSize(ptr)
@ stdcall D3DXGetShaderVersion(ptr)
diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c
index fecc3ee..07e3ff1 100644
index 39f1f31..c699299 100644
--- a/dlls/d3dx9_36/shader.c
+++ b/dlls/d3dx9_36/shader.c
@@ -2171,7 +2171,7 @@ static UINT get_shader_semantics(const DWORD *byte_code, D3DXSEMANTIC *semantics
@@ -2192,7 +2192,7 @@ static UINT get_shader_semantics(const DWORD *byte_code, D3DXSEMANTIC *semantics
{
if (*ptr & (1 << 31))
if (*ptr & (1u << 31))
{
- FIXME("Opcode expected\n");
+ FIXME("Opcode expected but got %#x\n", *ptr);
return 0;
}
else if ((*ptr & D3DSI_OPCODE_MASK) == D3DSIO_DCL)
@@ -2222,3 +2222,21 @@ HRESULT WINAPI D3DXGetShaderInputSemantics(const DWORD *byte_code, D3DXSEMANTIC
@@ -2243,3 +2243,21 @@ HRESULT WINAPI D3DXGetShaderInputSemantics(const DWORD *byte_code, D3DXSEMANTIC
return D3D_OK;
}
@ -59,7 +60,7 @@ index fecc3ee..07e3ff1 100644
+ return D3D_OK;
+}
diff --git a/dlls/d3dx9_36/tests/shader.c b/dlls/d3dx9_36/tests/shader.c
index 728cd86..62de9fb 100644
index 728cd86..946143e 100644
--- a/dlls/d3dx9_36/tests/shader.c
+++ b/dlls/d3dx9_36/tests/shader.c
@@ -6572,6 +6572,60 @@ static void test_get_shader_semantics(void)
@ -124,10 +125,10 @@ index 728cd86..62de9fb 100644
START_TEST(shader)
diff --git a/include/d3dx9shader.h b/include/d3dx9shader.h
index f565432..056033b 100644
index 5714ddb..1176143 100644
--- a/include/d3dx9shader.h
+++ b/include/d3dx9shader.h
@@ -316,6 +316,7 @@ const char * WINAPI D3DXGetVertexShaderProfile(struct IDirect3DDevice9 *device);
@@ -353,6 +353,7 @@ const char * WINAPI D3DXGetVertexShaderProfile(struct IDirect3DDevice9 *device);
HRESULT WINAPI D3DXFindShaderComment(const DWORD *byte_code, DWORD fourcc, const void **data, UINT *size);
HRESULT WINAPI D3DXGetShaderSamplers(const DWORD *byte_code, const char **samplers, UINT *count);
HRESULT WINAPI D3DXGetShaderInputSemantics(const DWORD *byte_code, D3DXSEMANTIC *semantics, UINT *count);
@ -136,5 +137,5 @@ index f565432..056033b 100644
HRESULT WINAPI D3DXAssembleShaderFromFileA(const char *filename, const D3DXMACRO *defines,
ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages);
--
2.4.5
2.6.1