Loads texture as a contiguous 4-bit texture block
Syntax
#include <ultra64.h> /* gbi.h */ gDPLoadTextureBlock_4b( Gfx *gdl, u32 timg, u32 fmt, u32 width, u32 height, u32 pal, u32 cms, u32 cmt, u32 masks, u32 maskt, u32 shifts, u32 shiftt ) gsDPLoadTextureBlock_4b( u32 timg, u32 fmt, u32 width, u32 height, u32 pal, u32 cms, u32 cmt, u32 masks, u32 maskt, u32 shifts, u32 shiftt )
Arguments
Description
Loads a 4-bit texture from DRAM into texture memory (TMEM). The size is implicitly 4 bits, so no size argument in included. Because this macro loads the texture image into a contiguous region in memory, it is the most efficient way to load a texture. DRAM transfers are also most efficient with large blocks.
gDPLoadTextureBlock* is actually comprised of a number of 64-bit GBI commands. Thus, if you need to find out the exact size of the display list, you need to consider how many GBI commands it is comprised of.
Regarding the fmt argument:
G_IM_SIZ_(Size) | ||
4b | ||
G_IM_FMT_ (Format) |
CI | X |
IA | X (3/1) | |
I | X |
Regarding the cms and cmt arguments:
Multiple specifications can be made with a bit sum of the following flags:
Regarding the masks and maskt arguments:
Regarding the shifts and shiftt arguments:
The values specified by shifts and shiftt (the shift parameter values) represent the amount by which the s,t coordinates are shifted to the left or to the right. This is used for the MIP-mapping, detail, and sharp mode settings. The values 0~10 are interpreted as right shifts, and the values 11~15 are interpreted as left shifts (see the table below).
Shift parameter value | Shift amount |
0 | No shift |
1 | >> 1 |
2 | >> 2 |
... | |
9 | >> 9 |
10 | >> 10 |
11 | << 5 |
12 | << 4 |
13 | << 3 |
14 | << 2 |
15 | << 1 |
For details about each argument, see Section 13.4 "Tile Attributes" in the N64 Programming Manual. Also, for information about using this macro, see Section 13.5 "Tile Descriptor Loading" in the N64 Programming Manual.
Note
4-bit textures must be aligned on byte boundaries.
Comment
There are some restrictions regarding the loading of textures with this macro. To ignore the restrictions, use the gDPLoadTextureBlock_4bS macro. However, that form of the macro requires that every 32 bits in the odd lines of the texture data be pre-swapped. This kind of texture data is created using rgb2c with the -S option. You enter a number after -S to indicate how many texels to swap at a time. That is to say, if the texture you are creating is 32bit or 16bit, you enter 2, 4 for 8bit, and 8 for 4bit. To learn about the restrictions on loading, see Section 13 "Texture mapping", Appendix A "LoadBlock Line Limits", and Section 13.8 "Texture Memory" in the N64 Programming Manual. Also, note that additional texture macros are defined in <gbi.h>
See Also
gDPLoadTextureBlock, gDPLoadTextureTile, gDPLoadTextureTile_4b, gDPLoadTLUT_pal16, gDPSetTextureDetail, guLoadTextureBlockMipMap, and rgb2c
Revision History
02/01/99 Completely rewritten.
03/31/99 Modified the Description.