[PATCH 1/2] wined3d: Properly report shader comment sizes.

Henri Verbeet hverbeet at codeweavers.com
Mon Feb 22 14:37:19 CST 2010


---
 dlls/wined3d/shader.c          |    9 ++++++---
 dlls/wined3d/shader_sm1.c      |    7 +++++--
 dlls/wined3d/shader_sm4.c      |    4 ++--
 dlls/wined3d/wined3d_private.h |    2 +-
 4 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index e95b4b5..a3b4ddc 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -467,10 +467,11 @@ static HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct
     {
         struct wined3d_shader_instruction ins;
         const char *comment;
+        UINT comment_size;
         UINT param_size;
 
         /* Skip comments. */
-        fe->shader_read_comment(&ptr, &comment);
+        fe->shader_read_comment(&ptr, &comment, &comment_size);
         if (comment) continue;
 
         /* Fetch opcode. */
@@ -1115,10 +1116,11 @@ void shader_generate_main(IWineD3DBaseShader *iface, struct wined3d_shader_buffe
     while (!fe->shader_is_end(fe_data, &ptr))
     {
         const char *comment;
+        UINT comment_size;
         UINT param_size;
 
         /* Skip comment tokens. */
-        fe->shader_read_comment(&ptr, &comment);
+        fe->shader_read_comment(&ptr, &comment, &comment_size);
         if (comment) continue;
 
         /* Read opcode. */
@@ -1222,10 +1224,11 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
     {
         struct wined3d_shader_instruction ins;
         const char *comment;
+        UINT comment_size;
         UINT param_size;
 
         /* comment */
-        fe->shader_read_comment(&ptr, &comment);
+        fe->shader_read_comment(&ptr, &comment, &comment_size);
         if (comment)
         {
             TRACE("//%s\n", comment);
diff --git a/dlls/wined3d/shader_sm1.c b/dlls/wined3d/shader_sm1.c
index 64876b3..aa1da56 100644
--- a/dlls/wined3d/shader_sm1.c
+++ b/dlls/wined3d/shader_sm1.c
@@ -641,9 +641,10 @@ static void shader_sm1_read_semantic(const DWORD **ptr, struct wined3d_shader_se
     shader_parse_dst_param(dst_token, NULL, &semantic->reg);
 }
 
-static void shader_sm1_read_comment(const DWORD **ptr, const char **comment)
+static void shader_sm1_read_comment(const DWORD **ptr, const char **comment, UINT *comment_size)
 {
     DWORD token = **ptr;
+    UINT size;
 
     if ((token & WINED3DSI_OPCODE_MASK) != WINED3D_SM1_OP_COMMENT)
     {
@@ -651,8 +652,10 @@ static void shader_sm1_read_comment(const DWORD **ptr, const char **comment)
         return;
     }
 
+    size = (token & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT;
     *comment = (const char *)++(*ptr);
-    *ptr += (token & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT;
+    *comment_size = size * sizeof(DWORD);
+    *ptr += size;
 }
 
 static BOOL shader_sm1_is_end(void *data, const DWORD **ptr)
diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c
index e5b4609..b463790 100644
--- a/dlls/wined3d/shader_sm4.c
+++ b/dlls/wined3d/shader_sm4.c
@@ -406,9 +406,9 @@ static void shader_sm4_read_semantic(const DWORD **ptr, struct wined3d_shader_se
     FIXME("ptr %p, semantic %p stub!\n", ptr, semantic);
 }
 
-static void shader_sm4_read_comment(const DWORD **ptr, const char **comment)
+static void shader_sm4_read_comment(const DWORD **ptr, const char **comment, UINT *comment_size)
 {
-    FIXME("ptr %p, comment %p stub!\n", ptr, comment);
+    FIXME("ptr %p, comment %p, comment_size %p stub!\n", ptr, comment, comment_size);
     *comment = NULL;
 }
 
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 819b55e..a51ea54 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -625,7 +625,7 @@ struct wined3d_shader_frontend
     void (*shader_read_dst_param)(void *data, const DWORD **ptr, struct wined3d_shader_dst_param *dst_param,
             struct wined3d_shader_src_param *dst_rel_addr);
     void (*shader_read_semantic)(const DWORD **ptr, struct wined3d_shader_semantic *semantic);
-    void (*shader_read_comment)(const DWORD **ptr, const char **comment);
+    void (*shader_read_comment)(const DWORD **ptr, const char **comment, UINT *comment_size);
     BOOL (*shader_is_end)(void *data, const DWORD **ptr);
 };
 
-- 
1.6.4.4




More information about the wine-patches mailing list