CHAPTER 3 DESIGN
3.2 T EXTURE PLACEMENT
3.2.3 Address translation idea of RZ
The address translation can be viewed as a translation function with inputs, and generates the output,
, , , ,
m n U V B A , which are dimension of texture’s width and
texture’s height, u coordinate, v coordinate, base address of the texture and the translated address as defined in figure 3-2-2-1. So, we are going to find a RZ function which is
( , , , , ) The translated address is 2 The base address of texture is 2
m d
Figure 3-2-2-1 definition of terms
There are three cases in RZ, which are m equal to n, m smaller than n, and m larger than n, respectively. However, the main concept of these cases is the same, that is recursive translation.
The first case is m equal to n, that is texture’s width is equal to texture’s height. As shown in Figure 3-2-2-2, the base case only invokes one texel, and the translated address
A is 0.
Base case iteration I iteration II Least significant 2 bits Most significant 2 bits
Figure 3-2-2-2 the case I of address translation
In iteration I, the translated address, a a1 0, could be found by using Karnaugh Map. Thus
v0
a a could be 1 0 v u0 0, which u0and are the least significant bit of U and V, respectively.
In iteration II, we first focus on the least significant 2 bits of each translated address. And we found that each of the bit pattern in dotted rectangle is corresponding to the bit patterns found in the iteration I. Thus, we can suggest that the least significant 2 bits of translated address in iteration II may equal the bit pattern in iteration I, that is v u0 0.
We now look at the most significant 2 bits of each translated address. And we can also use Karnaugh Map to translate a a3 2. The result shows that a a3 2=v u1 1. So the translated
address of iteration II, .The bit pattern can be view as the form which is iteratively cross interleaving each u and v coordinate bit, respectively. In the term of recursive concept, the translated address bit pattern of base case is the subset in iteration I. And the translated address bit pattern of iteration I is also the subset in the iteration II, iteration II is the subset in iteration III, etc.
3 2 1 0 is 1 1 0 0
a a a a v u v u
Now, we can suppose that when the texture is 8 by 8, the translated address
is by cross interleaving each least significant 3 bits of u and v coordinate.
5 4 3 2 1 0 Figure 3-2-2-3 example of address translation case I.
For example, since we are going to translate the pair of (4, 7), all we need to do is cross interleaving each least significant 3 bits of u and v coordinate, respectively. In figure 3-2-2-3, the result of cross interleaving is 58.
However, texture filtering may sample the texture with n by m dimension which is not equal , but is power of 2, respectively. The translation idea mentioned before may need to
modify slightly. In figure 3-2-2-4, the texture’s width is larger than texture’s height. This is . In the case, since texture’s height is shorter than texture’s width, for any texel, we do not have enough v-coordinate bits to cross interleave with u-coordinate bits. On the other words, after perform cross interleaving, some u-coordinate bits are left. These left bits should be followed by the cross interleaved result, in order to obtain the correct translated address.
m>n
Figure 3-2-2-4 the case II of address translation
In figure 3-2-2-4, we have 3 u-coordinate bits and 1 v-coordinate bit to cross interleave for translated address. After cross interleaving, we have a part of translated address equal to . However, the translated address should have four bits to index the required
texel. The part of address, , we do not assign them yet. So, we focus on the most significant 2 bits of the translated address. The bit pattern of each texel is exactly the same as the unused 2 u-coordinate bits, .
a a1 0
v u0 0
a a3 2
u u2 1
U
Figure 3-2-2-5 example of address translation case II
For example, since we are going to translate the pair of (9, 3) and m is larger than n, we should need to cross interleave 2 bits of u and v, respectively. And the left 2 bits, , should be followed by the cross interleaved result. In figure 3-2-2-5, the result of cross interleaving is 43.
u u3 2
The conclusion is that, when the texture’s dimension is not equal, the cross interleaving is still work, but the remaining coordinate bits should be followed by the cross interleaved result. In this case, the two bits should be followed by the cross interleaved result in order to obtain the correct translated address.
Moreover, in terms of recursive concept, the inequality of two dimensions means incompletely recursive texture. The iteration of placement will break when the short side is met. So, the recursive bit pattern will be limited when the coordinate bits of shorter side is exhausted.
The final case is shown in figure 3-2-2-6. That is texture’s width is smaller than texture’s height. After we cross interleave them, the left v-coordinate bits, , should be followed by the cross interleaved result, say , in order to obtain the correct translated address.
v v2 1
v u0 0
0
Least significant 2 bits Most significant 2 bits
Figure 3-2-2-6 the case III of address translation
2
Figure 3-2-2-7 example of address translation case III
For example, since we are going to translate the pair of (3, 9) and m is larger than n, we should need to cross interleave 2 bits of u and v, respectively. And the left 2 bits, , should be followed by the cross interleaved result. In figure 3-2-2-7, the result of cross interleaving is 39.
v v3 2
So far as here, the translated address mentioned before is not the final address we are going to use. This is because we did not take base address of the texture as a consideration. So the translated address will be added with base address and be left shifted 2 bits for 4 bytes a texel. Final address is( 'A <<2)+B
Finally, we have a figure 3-2-2-8 to summarize the address translation idea under three
cases.
1 1 2 2 1 1 0 0
1 2 1 1 1 1 1 0 0
1 2 1 1 1 1 1 0
Address translation of Recursive Z :
case I ( , )
Figure 3-2-2-8 summary of RZ address translation function