Henri Verbeet : wined3d: Recognize the SM4 dcl_constantBuffer opcode.
Alexandre Julliard
julliard at winehq.org
Tue Oct 2 14:09:39 CDT 2012
Module: wine
Branch: master
Commit: 6d948e1a8cdd8a9a5ae2b6124468275cbf13f2b8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6d948e1a8cdd8a9a5ae2b6124468275cbf13f2b8
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Mon Oct 1 22:48:13 2012 +0200
wined3d: Recognize the SM4 dcl_constantBuffer opcode.
---
dlls/wined3d/arb_program_shader.c | 1 +
dlls/wined3d/glsl_shader.c | 1 +
dlls/wined3d/shader.c | 7 +++++++
dlls/wined3d/shader_sm4.c | 14 +++++++++++++-
dlls/wined3d/wined3d_private.h | 7 +++++--
5 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index a54a37f..4f5efe0 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -5101,6 +5101,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
/* WINED3DSIH_CRS */ shader_hw_map2gl,
/* WINED3DSIH_CUT */ NULL,
/* WINED3DSIH_DCL */ shader_hw_nop,
+ /* WINED3DSIH_DCL_CONSTANT_BUFFER */ shader_hw_nop,
/* WINED3DSIH_DCL_INPUT_PRIMITIVE */ shader_hw_nop,
/* WINED3DSIH_DCL_OUTPUT_TOPOLOGY */ shader_hw_nop,
/* WINED3DSIH_DCL_VERTICES_OUT */ shader_hw_nop,
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index db04c6a..d344bfa 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -5120,6 +5120,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
/* WINED3DSIH_CRS */ shader_glsl_cross,
/* WINED3DSIH_CUT */ shader_glsl_cut,
/* WINED3DSIH_DCL */ shader_glsl_nop,
+ /* WINED3DSIH_DCL_CONSTANT_BUFFER */ shader_glsl_nop,
/* WINED3DSIH_DCL_INPUT_PRIMITIVE */ shader_glsl_nop,
/* WINED3DSIH_DCL_OUTPUT_TOPOLOGY */ shader_glsl_nop,
/* WINED3DSIH_DCL_VERTICES_OUT */ shader_glsl_nop,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 72f2fa6..d07809b 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -50,6 +50,7 @@ static const char * const shader_opcode_names[] =
/* WINED3DSIH_CRS */ "crs",
/* WINED3DSIH_CUT */ "cut",
/* WINED3DSIH_DCL */ "dcl",
+ /* WINED3DSIH_DCL_CONSTANT_BUFFER */ "dcl_constantBuffer",
/* WINED3DSIH_DCL_INPUT_PRIMITIVE */ "dcl_inputPrimitive",
/* WINED3DSIH_DCL_OUTPUT_TOPOLOGY */ "dcl_outputTopology",
/* WINED3DSIH_DCL_VERTICES_OUT */ "dcl_maxOutputVertexCount",
@@ -1367,6 +1368,12 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
TRACE(" ");
shader_dump_dst_param(&ins.declaration.semantic.reg, &shader_version);
}
+ else if (ins.handler_idx == WINED3DSIH_DCL_CONSTANT_BUFFER)
+ {
+ TRACE("%s ", shader_opcode_names[ins.handler_idx]);
+ shader_dump_src_param(&ins.declaration.src, &shader_version);
+ TRACE(", %s", ins.flags & WINED3DSI_INDEXED_DYNAMIC ? "dynamicIndexed" : "immediateIndexed");
+ }
else if (ins.handler_idx == WINED3DSIH_DCL_INPUT_PRIMITIVE
|| ins.handler_idx == WINED3DSIH_DCL_OUTPUT_TOPOLOGY)
{
diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c
index f50fd76..cd93fb3 100644
--- a/dlls/wined3d/shader_sm4.c
+++ b/dlls/wined3d/shader_sm4.c
@@ -32,6 +32,9 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_bytecode);
#define WINED3D_SM4_PRIMITIVE_TYPE_SHIFT 11
#define WINED3D_SM4_PRIMITIVE_TYPE_MASK (0x7 << WINED3D_SM4_PRIMITIVE_TYPE_SHIFT)
+#define WINED3D_SM4_INDEX_TYPE_SHIFT 11
+#define WINED3D_SM4_INDEX_TYPE_MASK (0x1 << WINED3D_SM4_INDEX_TYPE_SHIFT)
+
#define WINED3D_SM4_OPCODE_MASK 0xff
#define WINED3D_SM4_REGISTER_MODIFIER (1 << 31)
@@ -102,6 +105,7 @@ enum wined3d_sm4_opcode
WINED3D_SM4_OP_USHR = 0x55,
WINED3D_SM4_OP_UTOF = 0x56,
WINED3D_SM4_OP_XOR = 0x57,
+ WINED3D_SM4_OP_DCL_CONSTANT_BUFFER = 0x59,
WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY = 0x5c,
WINED3D_SM4_OP_DCL_INPUT_PRIMITIVE = 0x5d,
WINED3D_SM4_OP_DCL_VERTICES_OUT = 0x5e,
@@ -222,6 +226,7 @@ static const struct wined3d_sm4_opcode_info opcode_table[] =
{WINED3D_SM4_OP_USHR, WINED3DSIH_USHR, "U", "UU"},
{WINED3D_SM4_OP_UTOF, WINED3DSIH_UTOF, "F", "U"},
{WINED3D_SM4_OP_XOR, WINED3DSIH_XOR, "U", "UU"},
+ {WINED3D_SM4_OP_DCL_CONSTANT_BUFFER, WINED3DSIH_DCL_CONSTANT_BUFFER, "", ""},
{WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY, WINED3DSIH_DCL_OUTPUT_TOPOLOGY, "", ""},
{WINED3D_SM4_OP_DCL_INPUT_PRIMITIVE, WINED3DSIH_DCL_INPUT_PRIMITIVE, "", ""},
{WINED3D_SM4_OP_DCL_VERTICES_OUT, WINED3DSIH_DCL_VERTICES_OUT, "", ""},
@@ -592,7 +597,14 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi
FIXME("Skipping modifier 0x%08x.\n", modifier);
}
- if (opcode == WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY)
+ if (opcode == WINED3D_SM4_OP_DCL_CONSTANT_BUFFER)
+ {
+ shader_sm4_read_src_param(priv, &p, WINED3D_DATA_FLOAT,
+ &ins->declaration.src, NULL);
+ if (opcode_token & WINED3D_SM4_INDEX_TYPE_MASK)
+ ins->flags |= WINED3DSI_INDEXED_DYNAMIC;
+ }
+ else if (opcode == WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY)
{
enum wined3d_sm4_output_primitive_type primitive_type;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 6db495f..b14e85d 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -374,8 +374,9 @@ enum wined3d_shader_dst_modifier
};
/* Undocumented opcode control to identify projective texture lookups in ps 2.0 and later */
-#define WINED3DSI_TEXLD_PROJECT 1
-#define WINED3DSI_TEXLD_BIAS 2
+#define WINED3DSI_TEXLD_PROJECT 0x1
+#define WINED3DSI_TEXLD_BIAS 0x2
+#define WINED3DSI_INDEXED_DYNAMIC 0x4
enum wined3d_shader_rel_op
{
@@ -439,6 +440,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER
WINED3DSIH_CRS,
WINED3DSIH_CUT,
WINED3DSIH_DCL,
+ WINED3DSIH_DCL_CONSTANT_BUFFER,
WINED3DSIH_DCL_INPUT_PRIMITIVE,
WINED3DSIH_DCL_OUTPUT_TOPOLOGY,
WINED3DSIH_DCL_VERTICES_OUT,
@@ -670,6 +672,7 @@ struct wined3d_shader_instruction
{
struct wined3d_shader_semantic semantic;
enum wined3d_primitive_type primitive_type;
+ struct wined3d_shader_src_param src;
UINT count;
} declaration;
};
More information about the wine-cvs
mailing list