Skip to main content

texture-h​

source

Types​


adgif-shader​

adgif-shader: structuresource
Fields​
quad: qword
prims: gs-reg64
tex0: gs-tex0
tex1: gs-tex1
miptbp1: gs-miptbp
clamp: gs-clamp
clamp-reg: gs-reg64
alpha: gs-alpha
alpha-as-miptb2: gs-miptbp
link-test: link-test-flags
texture-id: texture-id
next: shader-ptr

adgif-shader-array​

adgif-shader-array: inline-array-classsource
Fields​
type: type
length: int32
allocated-length: int32
_data: uint8
data: adgif-shader

shader-ptr​

shader-ptr: uint32source

texture​

texture: basicsource
Fields​
type: type
w: int16
wu: uint16
h: int16
hu: uint16
num-mips: uint8
tex1-control: uint8
psm: gs-psm
mip-shift: uint8
clutpsm: uint16
dest: uint16
clutdest: uint16
width: uint8
name: string
size: uint32
uv-dist: float
masks: uint32

texture-id​

texture-id: uint32source
texture-link: structuresource
Fields​
next: shader-ptr

texture-page​

texture-page: basicsource
Fields​
type: type
info: file-info
name: basic
id: uint32
length: int32
mip0-size: uint32
size: uint32
segment: texture-page-segment
pad: uint32
data: texture
Methods​
relocate(obj: texture-page, arg0: kheap, arg1: pointer) => nonesource

Add to VRAM and allocate links.
This method is called by the GOAL linker when it loads a texture page.

remove-from-heap(obj: texture-page, seg: kheap) => _type_source

Remove the texture data from the heap. This can only safely be called immediately after
the texture-page is loaded. This is used for textures that always live in VRAM.

get-leftover-block-count(obj: texture-page, segment-count: int, additional-size: int) => intsource

This returns how many blocks are used in the last pool page.
It uses pool-pages, which are 64 blocks or 16 kB.

unused-11: unknown
relocate-dests!(obj: texture-page, new-dest: int, seg-id: int) => nonesource

Update a texture-page so all the textures point to a new location

add-to-dma-buffer(obj: texture-page, dma-buff: dma-buffer, mode: int) => intsource

Helper for upload-now! to upload texture-page to VRAM

upload-now!(obj: texture-page, arg0: int) => nonesource

Immediately upload the texture-page to the given buffer, using arg0 mode.

texture-page-dir​

texture-page-dir: basicsource
Fields​
type: type
length: int32
entries: texture-page-dir-entry
Methods​
relocate(obj: texture-page-dir, arg0: kheap, arg1: pointer) => nonesource

Load a texture-page-dir

unlink-textures-in-heap!(obj: texture-page-dir, heap: kheap) => intsource

Remove adgif shaders that are in the given heap

texture-page-dir-entry​

texture-page-dir-entry: structuresource
Fields​
length: int16
status: uint16
page: texture-page
link: texture-link

texture-page-segment​

texture-page-segment: structuresource
Fields​
block-data: pointer
size: uint32
dest: uint32

texture-pool​

texture-pool: basicsource
Fields​
type: type
top: int32
cur: int32
allocate-func: function
font-palette: int32
segment-near: texture-pool-segment
segment-common: texture-pool-segment
segment: texture-pool-segment
common-page: texture-page
common-page-mask: int32
ids: uint32
Methods​
initialize!(obj: texture-pool) => _type_source

Initialize (or maybe reinitialize) a texture pool.

print-usage(obj: texture-pool) => _type_source

Print out VRAM usage.

setup-font-texture!(obj: texture-pool) => nonesource

Move the font textures to the upper 8-bits of the depth buffer.

allocate-defaults!(obj: texture-pool) => nonesource

Allocate default segments

login-level-textures(obj: texture-pool, level: level, max-page-kind: int, id-array: pointer) => nonesource

Login textures in a level. Only does up to max-page-kind. Set this to water (4) to do all of them.
Also checks sizes.
This is called from level.gc as part of level loading.

add-tex-to-dma!(obj: texture-pool, level: level, tex-page-kind: int) => nonesource

For the given tpage-kind, upload as needed for the level

allocate-vram-words!(obj: texture-pool, word-count: int) => intsource

Allocate words in vram. Returns the index of the first word.

allocate-segment!(obj: texture-pool, segment: texture-pool-segment, size: int) => texture-pool-segmentsource

Allocate a segment of the given size. The segment is an output here, containing size/dest.

unused-17: unknown
unused-18: unknown
unused-19: unknown
unload!(obj: texture-pool, arg0: texture-page) => intsource

Unload the texture from the directory

upload-one-common!(obj: texture-pool, lev: level) => symbolsource

Upload the first common texture page that's in in the common-page-mask.

lookup-boot-common-id(obj: texture-pool, arg0: int) => intsource

Map these special textures to a number betwen 0 and 19. For other textures, return -1.
NOTE: hud means start menu + zoomer, not the usual health HUD.

texture-pool-segment​

texture-pool-segment: structuresource
Fields​
dest: uint32
size: uint32

texture-relocate-later​

texture-relocate-later: basicsource
Fields​
type: type
memcpy: symbol
dest: uint32
source: uint32
move: uint32
entry: texture-page-dir-entry
page: texture-page

Functions​


texture-mip->segment​

texture-mip->segment(arg0: int, arg1: int) => intsource

Convert a mip level to the segment that it is stored in.

Variables​


*depth-cue-base-block*​

*depth-cue-base-block*: intsource

*depth-cue-base-page*​

*depth-cue-base-page*: intsource

*depth-cue-base-vram-word*​

*depth-cue-base-vram-word*: intsource

*eyes-base-block*​

*eyes-base-block*: intsource

*eyes-base-page*​

*eyes-base-page*: intsource

*eyes-base-vram-word*​

*eyes-base-vram-word*: intsource

*ocean-base-block*​

*ocean-base-block*: intsource

*ocean-base-page*​

*ocean-base-page*: intsource

*ocean-base-vram-word*​

*ocean-base-vram-word*: intsource

*sky-base-block*​

*sky-base-block*: intsource

*sky-base-page*​

*sky-base-page*: intsource

*sky-base-vram-word*​

*sky-base-vram-word*: intsource

*texture-enable-user-menu*​

*texture-enable-user-menu*: intsource

*texture-enable-user*​

*texture-enable-user*: intsource

*texture-page-dir*​

*texture-page-dir*: texture-page-dirsource

*texture-relocate-later*​

*texture-relocate-later*: texture-relocate-latersource

texture-upload​

source

Variables​


*generic-envmap-texture*​

*generic-envmap-texture*: texturesource

*ocean-texture*​

*ocean-texture*: texturesource

*shadow-middot-texture*​

*shadow-middot-texture*: texturesource

texture​

source

Functions​


adgif-shader-login​

adgif-shader-login(shader: adgif-shader) => texturesource

If not logged in already, link us and update from texture.

adgif-shader-login-fast​

adgif-shader-login-fast(shader: adgif-shader) => texturesource

Like adgif-shader-login, but assumes you've already logged in the texture

adgif-shader-login-no-remap​

adgif-shader-login-no-remap(arg0: adgif-shader) => texturesource

Same as adgif-shader-login, but don't remap our texture id

adgif-shader-login-no-remap-fast​

adgif-shader-login-no-remap-fast(arg0: adgif-shader) => texturesource

Like adgif-shader-login-fast, but no level remap

adgif-shader-update!​

adgif-shader-update!(arg0: adgif-shader, arg1: texture) => nonesource

Update tex1

adgif-shader<-texture!​

adgif-shader<-texture!(arg0: adgif-shader, arg1: texture) => adgif-shadersource

Set up an ADGIF shader from a texture.

adgif-shader<-texture-simple!​

adgif-shader<-texture-simple!(arg0: adgif-shader, arg1: texture) => adgif-shadersource

dma-buffer-add-ref-texture​

dma-buffer-add-ref-texture(buf: dma-buffer, data: pointer, tex-w: int, tex-h: int, tex-format: gs-psm) => nonesource

Add texture data to a dma buffer. You must first set up the GS transfer to the correct destination.
This just sets IMAGE mode and sends data. Doesn't copy the texture into the buffer.

gs-block-height​

gs-block-height(arg0: gs-psm) => intsource

gs-block-width​

gs-block-width(arg0: gs-psm) => intsource

gs-blocks-used​

gs-blocks-used(tex-width: int, tex-height: int, tex-format: gs-psm) => intsource

This function doesn't make much sense... It's unused so maybe it's just wrong?

gs-find-block​

gs-find-block(bx: int, by: int, tex-format: gs-psm) => intsource

Block index lookup.

gs-largest-block​

gs-largest-block(tex-width: int, tex-height: int, tex-format: gs-psm) => intsource

Determine the largest block occupied by the given texture

gs-page-height​

gs-page-height(arg0: gs-psm) => intsource

gs-page-width​

gs-page-width(arg0: gs-psm) => intsource
link-texture-by-id(arg0: texture-id, arg1: adgif-shader) => texture-page-dir-entrysource

Link the given adgif shader to the texture with the given ID

lookup-texture-by-id​

lookup-texture-by-id(arg0: texture-id) => texturesource

Look up a texture by ID, loading it from debug network if its not loaded.
Default allocates if it has to load, so it will permanently use VRAM

physical-address​

physical-address(arg0: pointer) => pointersource

Convert a pointer to a physical address than can be used for DMA

relocate-later​

relocate-later() => symbolsource

Level loader will call this. At this point, the data is kicked out

texture-bpp​

texture-bpp(arg0: gs-psm) => intsource

Get the number of bits per pixel for the given texture format

texture-page-common-allocate​

texture-page-common-allocate(pool: texture-pool, page: texture-page, heap: kheap, tpage-id: int) => texture-pagesource

Set up an entire texture page for eventual upload to the common segment of the pool.
The texture will remain in EE memory and will share its slot in VRAM with other textures.
All three segments will be together.

texture-page-common-boot-allocate​

texture-page-common-boot-allocate(pool: texture-pool, page: texture-page, heap: kheap, tpage-id: int) => texture-pagesource

Allocator for textures at boot time. It will put boot-common textures in common. Once it gets a non-common
texture, it will change the allocator to default.

texture-page-default-allocate​

texture-page-default-allocate(pool: texture-pool, page: texture-page, heap: kheap, tpage-id: int) => texture-pagesource

Default allocator for textures. This permanently uploads the texture to VRAM and uses up VRAM that
can never be reclaimed, and does it immediately.
It modifies the texture to point to the allocated VRAM.
It also kicks out the texture data (and any data after it) from the heap.
All three segments of the texture page will be together.

texture-page-dir-inspect​

texture-page-dir-inspect(dir: texture-page-dir, mode: symbol) => nonesource

texture-page-level-allocate​

texture-page-level-allocate(pool: texture-pool, page: texture-page, heap: kheap, mode: int) => texture-pagesource

Allocator for level textures, will pick the appropriate allocator (usually near0/near1).

texture-page-login​

texture-page-login(id: texture-id, alloc-func: function, heap: kheap) => texture-page-dir-entrysource

Return the tpage-dir entry for the given texture.
Load if from the debug network if its not loaded. Return #f if it doesn't work

texture-page-near-allocate-0​

texture-page-near-allocate-0(pool: texture-pool, page: texture-page, heap: kheap, mode: int) => texture-pagesource

Allocator for tpages which use the near segment.
This is expected to be used on the first texture of a level load, the TFRAG.
Note: the zoomerhud texture may occur before this, but it's strange.
This is used for level 0, which gets the first part of the NEAR segment
as private texture memory.

texture-page-near-allocate-1​

texture-page-near-allocate-1(pool: texture-pool, page: texture-page, heap: kheap, mode: int) => texture-pagesource

Allocate for level 1's near textures

texture-page-size-check​

texture-page-size-check(pool: texture-pool, level: level, hide-prints: symbol) => intsource

Check to see if any textures in the level are oversize. Sets bits in the output flag if they are

texture-qwc​

texture-qwc(w: int, h: int, tex-format: gs-psm) => intsource

Get the number of quadwords in a texture. Round up.

texture-relocate​

texture-relocate(dma-buff: dma-buffer, tex: texture, dest-loc: int, dest-fmt: gs-psm, clut-dst: int) => dma-buffersource

Move a texture in VRAM. Unrelated to the texture-relocate-later, which moves textures in RAM.
Will try to move the whole thing, including the clut, assuming you provide a destination for it.
Note that this uses the format/width stuff properly, so it will be slower, but won't scramble your texture.

update-vram-pages​

update-vram-pages(pool: texture-pool, pool-segment: texture-pool-segment, page: texture-page, mode: int) => intsource

Update texture pool info if given texture page was uploaded in the given mode, but not using upload-vram-pages
or upload-vram-pages-pris
You should call this after doing an upload-now!, for example

upload-vram-data​

upload-vram-data(buf: dma-buffer, dest: int, tex-data: pointer, tex-h: int) => nonesource

Add DMA packet to prepare to upload a texture.

upload-vram-pages​

upload-vram-pages(pool: texture-pool, segment: texture-pool-segment, page: texture-page, mode: int, bucket-idx: bucket-id) => intsource

Add a dma chain to upload textures to the bucket. This will only upload chunks that aren't already there.
This will automatically update the cache info in the pool for the upload.
mode: -3 = don't want anything (this function does nothing)
0 = page segment 0
-2 = page segment 0 and 1
-1 = the whole page.
2 = just segment 2 of the page.

upload-vram-pages-pris​

upload-vram-pages-pris(pool: texture-pool, segment: texture-pool-segment, page: texture-page, bucket-idx: bucket-id, needed-mask: int) => intsource

Upload the entire texture page. If the needed-mask is not set, it will not upload those chunks.
Unlike other pages, it's pretty easy to determine a mask of needed textures - if you draw no cows, don't bother
uploading cow textures.
Upload will be added to the given bucket for on-screen.
The nth bit of the mask determines if the nth 16-kB chunk is needed in this upload.
A 64-bit mask is enough to address the entire common segment, which is the only destination for PRIS textures.

Variables​


*edit-shader*​

*edit-shader*: texture-idsource

*shader-list*​

*shader-list*: pairsource

*texture-pool*​

*texture-pool*: texture-poolsource

*txt-dma-list*​

*txt-dma-list*: dma-buffersource

COMMON_SEGMENT_WORDS​

COMMON_SEGMENT_WORDS: unknownsource

ct16-block-table​

ct16-block-table: arraysource

ct16s-block-table​

ct16s-block-table: arraysource

ct32-24-block-table​

ct32-24-block-table: arraysource

mt4-block-table​

mt4-block-table: arraysource

mt8-block-table​

mt8-block-table: arraysource

mz16-block-table​

mz16-block-table: arraysource

mz16s-block-table​

mz16s-block-table: arraysource

mz32-24-block-table​

mz32-24-block-table: arraysource

NEAR_PER_LEV_WORDS​

NEAR_PER_LEV_WORDS: unknownsource

NEAR_PRIVATE_WORDS​

NEAR_PRIVATE_WORDS: unknownsource

NEAR_SEGMENT_WORDS​

NEAR_SEGMENT_WORDS: unknownsource

NEAR_SHARED_WORDS​

NEAR_SHARED_WORDS: unknownsource

SPECIAL_VRAM_WORDS​

SPECIAL_VRAM_WORDS: unknownsource