diff options
author | Keith Whitwell <[email protected]> | 2009-08-19 11:54:06 +0100 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2009-08-19 11:54:26 +0100 |
commit | 265e210edb2fdf0f6ae777635676f05613b38eb7 (patch) | |
tree | a55f2bb1afc89e546b7d32cf3513c1167a1a3e8d /src/gallium/auxiliary/tgsi/tgsi_ureg.h | |
parent | e327845e2b72936c60a143d46a52dbbe81afdd72 (diff) |
tgsi: add missing functionality to support instructions with labels
Could previously emit opcodes with label arguments, but was no way to
patch them with the actual destinations of those labels.
Adds two functions:
ureg_get_instruction_number - to get the id of the next instruction
to be emitted
ureg_fixup_label - to patch an emitted label to point to a given
instruction number.
Need some more complex examples than u_simple_shader, so far this has
only been compile-tested.
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_ureg.h')
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ureg.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index 0a976fd63b7..5a48bb7a35c 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -175,6 +175,33 @@ ureg_DECL_immediate1f( struct ureg_program *ureg, } /*********************************************************************** + * Functions for patching up labels + */ + + +/* Will return a number which can be used in a label to point to the + * next instruction to be emitted. + */ +unsigned +ureg_get_instruction_number( struct ureg_program *ureg ); + + +/* Patch a given label (expressed as a token number) to point to a + * given instruction (expressed as an instruction number). + * + * Labels are obtained from instruction emitters, eg ureg_CAL(). + * Instruction numbers are obtained from ureg_get_instruction_number(), + * above. + */ +void +ureg_fixup_label(struct ureg_program *ureg, + unsigned label_token, + unsigned instruction_number ); + + + + +/*********************************************************************** * Internal instruction helpers, don't call these directly: */ |