Stefan Dösinger : wined3d: Handle LRP in vertex shaders.
Alexandre Julliard
julliard at winehq.org
Tue Jun 2 08:44:34 CDT 2009
Module: wine
Branch: master
Commit: 7e1100d0e41611724b6838ac5b297cc8c098c059
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7e1100d0e41611724b6838ac5b297cc8c098c059
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Tue May 26 16:34:44 2009 +0200
wined3d: Handle LRP in vertex shaders.
The ARB "LRP" instruction is a fragment program only instruction. It is
however valid in vs_2_0+ vertex shaders, so we have to emulate it.
---
dlls/wined3d/arb_program_shader.c | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index f59ef54..ac68683 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -1819,6 +1819,28 @@ static void shader_hw_nrm(const struct wined3d_shader_instruction *ins)
}
}
+static void shader_hw_lrp(const struct wined3d_shader_instruction *ins)
+{
+ SHADER_BUFFER *buffer = ins->ctx->buffer;
+ char dst_name[50];
+ char src_name[3][50];
+
+ /* ARB_fragment_program has a convenient LRP instruction */
+ if(shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type)) {
+ shader_hw_map2gl(ins);
+ return;
+ }
+
+ shader_arb_get_dst_param(ins, &ins->dst[0], dst_name);
+ shader_arb_get_src_param(ins, &ins->src[0], 0, src_name[0]);
+ shader_arb_get_src_param(ins, &ins->src[1], 1, src_name[1]);
+ shader_arb_get_src_param(ins, &ins->src[2], 2, src_name[2]);
+
+ shader_addline(buffer, "SUB TA, %s, %s;\n", src_name[1], src_name[2]);
+ shader_addline(buffer, "MAD%s %s, %s, TA, %s;\n", shader_arb_get_modifier(ins),
+ dst_name, src_name[0], src_name[2]);
+}
+
static void shader_hw_sincos(const struct wined3d_shader_instruction *ins)
{
/* This instruction exists in ARB, but the d3d instruction takes two extra parameters which
@@ -2820,7 +2842,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
/* WINED3DSIH_LOG */ shader_hw_map2gl,
/* WINED3DSIH_LOGP */ shader_hw_map2gl,
/* WINED3DSIH_LOOP */ NULL,
- /* WINED3DSIH_LRP */ shader_hw_map2gl,
+ /* WINED3DSIH_LRP */ shader_hw_lrp,
/* WINED3DSIH_M3x2 */ shader_hw_mnxn,
/* WINED3DSIH_M3x3 */ shader_hw_mnxn,
/* WINED3DSIH_M3x4 */ shader_hw_mnxn,
More information about the wine-cvs
mailing list