Matteo Bruni : wined3d: Pop control frames in disabled if branches ( ARB shader backend).
Alexandre Julliard
julliard at winehq.org
Fri Nov 9 11:03:23 CST 2012
Module: wine
Branch: master
Commit: a7956c4c4f8f2abd673f9e5cbb159419e1d003be
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a7956c4c4f8f2abd673f9e5cbb159419e1d003be
Author: Matteo Bruni <mbruni at codeweavers.com>
Date: Fri Nov 9 15:20:35 2012 +0100
wined3d: Pop control frames in disabled if branches (ARB shader backend).
---
dlls/wined3d/arb_program_shader.c | 52 ++++++++++++++++++++++++-------------
1 files changed, 34 insertions(+), 18 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 6328fdf..6ea73c0 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -5395,6 +5395,29 @@ static void free_recorded_instruction(struct list *list)
}
}
+static void pop_control_frame(const struct wined3d_shader_instruction *ins)
+{
+ struct shader_arb_ctx_priv *priv = ins->ctx->backend_data;
+ struct control_frame *control_frame;
+
+ if (ins->handler_idx == WINED3DSIH_ENDLOOP || ins->handler_idx == WINED3DSIH_ENDREP)
+ {
+ struct list *e = list_head(&priv->control_frames);
+ control_frame = LIST_ENTRY(e, struct control_frame, entry);
+ list_remove(&control_frame->entry);
+ HeapFree(GetProcessHeap(), 0, control_frame);
+ priv->loop_depth--;
+ }
+ else if (ins->handler_idx == WINED3DSIH_ENDIF)
+ {
+ /* Non-ifc ENDIFs were already handled previously. */
+ struct list *e = list_head(&priv->control_frames);
+ control_frame = LIST_ENTRY(e, struct control_frame, entry);
+ list_remove(&control_frame->entry);
+ HeapFree(GetProcessHeap(), 0, control_frame);
+ }
+}
+
static void shader_arb_handle_instruction(const struct wined3d_shader_instruction *ins) {
SHADER_HANDLER hw_fct;
struct shader_arb_ctx_priv *priv = ins->ctx->backend_data;
@@ -5564,6 +5587,8 @@ static void shader_arb_handle_instruction(const struct wined3d_shader_instructio
return; /* Instruction is handled. */
}
/* In case of an ifc, generate a HW shader instruction */
+ if (control_frame->type != IFC)
+ ERR("Control frame does not match.\n");
}
else if(ins->handler_idx == WINED3DSIH_ENDIF)
{
@@ -5578,9 +5603,16 @@ static void shader_arb_handle_instruction(const struct wined3d_shader_instructio
HeapFree(GetProcessHeap(), 0, control_frame);
return; /* Instruction is handled */
}
+ /* In case of an ifc, generate a HW shader instruction */
+ if (control_frame->type != IFC)
+ ERR("Control frame does not match.\n");
}
- if(priv->muted) return;
+ if(priv->muted)
+ {
+ pop_control_frame(ins);
+ return;
+ }
/* Select handler */
hw_fct = shader_arb_instruction_handler_table[ins->handler_idx];
@@ -5593,23 +5625,7 @@ static void shader_arb_handle_instruction(const struct wined3d_shader_instructio
}
hw_fct(ins);
- if(ins->handler_idx == WINED3DSIH_ENDLOOP || ins->handler_idx == WINED3DSIH_ENDREP)
- {
- struct list *e = list_head(&priv->control_frames);
- control_frame = LIST_ENTRY(e, struct control_frame, entry);
- list_remove(&control_frame->entry);
- HeapFree(GetProcessHeap(), 0, control_frame);
- priv->loop_depth--;
- }
- else if(ins->handler_idx == WINED3DSIH_ENDIF)
- {
- /* Non-ifc ENDIFs don't reach that place because of the return in the if block above */
- struct list *e = list_head(&priv->control_frames);
- control_frame = LIST_ENTRY(e, struct control_frame, entry);
- list_remove(&control_frame->entry);
- HeapFree(GetProcessHeap(), 0, control_frame);
- }
-
+ pop_control_frame(ins);
shader_arb_add_instruction_modifiers(ins);
}
More information about the wine-cvs
mailing list