Operations 33
© 2006 Advanced Micro Devices, Inc.
ATI CTM Guide v. 1.01
3.4.1
Operations
There are five texture operations available.
3.4.2
Semaphore
The semaphore is used to synchronize texture lookups with their subsequent use in the program. It also serves a
second purpose in uncached write mode, where it synchronizes uncached writes with subsequent uncached reads
through the texture unit.
Each texture instruction has a bit, TEX_SEM_ACQUIRE, specifying whether it should hold the texture semaphore
until the looked-up data comes back and is written to the destination temporary register. All program instructions have
another semaphore bit, TEX_SEM_WAIT, that specifies whether to wait on the semaphore so its (dependent) source
data is up to date. You may take advantage of the texture semaphore to perform various independent computations
while waiting on the texture operation to complete.
Hardware disallows more than one ACQUIRE operation at a time, so if you set TEX_SEM_ACQUIRE on a lookup
or uncached write, you must also set TEX_SEM_WAIT for that instruction. WAIT has no cost if there are no
outstanding ACQUIRE operations. For an instruction with TEX_SEM_WAIT and TEX_SEM_ACQUIRE both set,
the wait happens first.
There is only one texture semaphore, however you may use it to protect multiple texture lookups, as long as the
lookups are themselves independent. When a texture instruction sets TEX_SEM_ACQUIRE, the texture unit ensures
that that particular lookup, and all prior lookups, have completed before releasing the semaphore. Therefore, to protect
several texture lookups, you may set TEX_SEM_ACQUIRE only on the last texture lookup, and set
TEX_SEM_WAIT on the first instruction that uses any of the results. This example illustrates the usage:
Texture Option
Description
TEX_INST_NOP
Perform no operation. The source addresses are ignored, and nothing is written to
the destination address. A texture NOP may acquire the texture semaphore, so
NOP can be used for synchronization purposes.
TEX_INST_LOOKUP
A standard texture lookup. Reads the coordinates from SRC_ADDR and writes
the results of the lookup to DST_ADDR.
TEX_INST_KILL_LT_0
Kill the processor if any components in SRC_ADDR are less than zero. Note that
the source swizzles are ignored in this case; if you want to limit which channels
are examined, you may use the write masks in WMASK_RGB, WMASK_ALPHA,
and/or predication. Nothing is written to the destination address.
TEX_INST_LOOKUP_PROJ
Lookup a projected texture. Q is used for the projective divide.
TEX_INST_LOOKUP_UNCACHED
Perform an uncached read. This mechanism is used to retrieve data that was
written using uncached writes, either in this program or by a previous program. If
reading data written by this program, the texture semaphore mechanism must be
used on the uncached write instructions. If reading data written by a previous
program, it may be necessary to flush the pipe. Typically the UNSCALED bit
should be set for an uncached read.
INSTRUCTION
TEX_SEM_WAIT
TEX_SEM_ACQUIRE
0:
r4 = TEXLD(s0, r1)
0
0
1:
r5 = TEXLD(s1, r2)
0
0
2:
r6 = TEXLD(s2, r3)
1
1
3:
r1 = r1 + 1
0
Summary of Contents for ATI CTM
Page 1: ...ATI CTM Guide Technical Reference Manual Version 1 01...
Page 6: ...ATI CTM Guide v 1 01 2006 Advanced Micro Devices Inc 2 Related Documents...
Page 48: ...ATI CTM Guide v 1 01 2006 Advanced Micro Devices Inc 44 Errata...
Page 54: ...ATI CTM Guide v 1 01 2006 Advanced Micro Devices Inc 50 Executable Files...