Matteo Bruni : d3dcompiler: Parse compilation target.

Alexandre Julliard julliard at winehq.org
Tue Jul 10 19:01:42 CDT 2012


Module: wine
Branch: master
Commit: 45e8a644ebac3da966f5f4945fad1afcd72696f6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=45e8a644ebac3da966f5f4945fad1afcd72696f6

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Tue Jul 10 15:39:44 2012 +0200

d3dcompiler: Parse compilation target.

---

 dlls/d3dcompiler_43/compiler.c |   35 ++++++++++++++++++++++++++++++++---
 1 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/dlls/d3dcompiler_43/compiler.c b/dlls/d3dcompiler_43/compiler.c
index f3ba03f..a977315 100644
--- a/dlls/d3dcompiler_43/compiler.c
+++ b/dlls/d3dcompiler_43/compiler.c
@@ -496,14 +496,43 @@ static HRESULT compile_shader(const char *preproc_shader, const char *target, co
     struct bwriter_shader *shader;
     char *messages = NULL;
     HRESULT hr;
-    DWORD *res, size;
+    DWORD *res, size, major, minor;
     ID3DBlob *buffer;
     char *pos;
+    enum shader_type shader_type;
 
     TRACE("Preprocessed shader source: %s\n", debugstr_a(preproc_shader));
 
-    FIXME("Parse compilation target.\n");
-    shader = parse_hlsl_shader(preproc_shader, ST_VERTEX, 2, 0, entrypoint, &messages);
+    TRACE("Parsing compilation target %s.\n", debugstr_a(target));
+    if (strlen(target) != 6 || target[1] != 's' || target[2] != '_' || target[4] != '_')
+    {
+        FIXME("Unknown compilation target %s.\n", debugstr_a(target));
+        return D3DERR_INVALIDCALL;
+    }
+
+    if (target[0] == 'v')
+        shader_type = ST_VERTEX;
+    else if (target[0] == 'p')
+        shader_type = ST_PIXEL;
+    else
+    {
+        FIXME("Unsupported shader target type %s.\n", debugstr_a(target));
+        return D3DERR_INVALIDCALL;
+    }
+
+    major = target[3] - '0';
+    if (major == 0 || major > 5)
+    {
+        FIXME("Unsupported shader target major version %d.\n", major);
+        return D3DERR_INVALIDCALL;
+    }
+    minor = target[5] - '0';
+    if (minor > 1 || (minor == 1 && (shader_type != ST_VERTEX || major > 1)))
+    {
+        FIXME("Unsupported shader target minor version %d.\n", minor);
+        return D3DERR_INVALIDCALL;
+    }
+    shader = parse_hlsl_shader(preproc_shader, shader_type, major, minor, entrypoint, &messages);
 
     if (messages)
     {




More information about the wine-cvs mailing list