Skip to content

Revisions of Texture and PlatformBitmap Format types#920

Open
ggcrunchy wants to merge 27 commits into
coronalabs:masterfrom
ggcrunchy:TextureType
Open

Revisions of Texture and PlatformBitmap Format types#920
ggcrunchy wants to merge 27 commits into
coronalabs:masterfrom
ggcrunchy:TextureType

Conversation

@ggcrunchy
Copy link
Copy Markdown
Contributor

First off, this is meant to build on #918.


I did a first draft of some texture stuff last year.

A big chunk of that was adding support (where possible) for other formats, e.g. floating-point or integer ones; compression; R, RG types; etc.

It got a bit kitchen sink-y, and would have been rather impolite to submit. 😄 Thus I'm trying to do another sweep and divvy it up PR-wise, this being the first offering, along with some improvements as well.


You'd have to "skip ahead" in that branch to see how some of this is put into practice, but anyhow, when adding further texture formats, some way of conveying "what am I?" is needed, at the very least. On its own, this could just mean using more bits for some constants, and bumping the format count. A minor further complication is that many such formats might not be supported on a given setup.

Some of this information, along with further details, can be looked up from a little format database we maintain, once we're up and running.

However, when doing the earlier work I ran across many little queries, e.g. "how many bytes does this have?" or "does it have an alpha channel?", needing to be done without the handy manager around to ask. The relevant details do crunch down fairly nicely, however, and so can be crammed into the same integer as the format types themselves. (Texture and PlatformBitmap both maintain format types, and mostly overlap.)


A few assumptions about the layout of Texture::Format (or FormatValue as the enums get renamed, with each then enclosed in a Format class) lining up with PlatformBitmap::FormatValue, backed by Rtt_STATIC_ASSERT()s, are made and put to use: I added some utilities in RenderTypes.cpp to do some common bitfield utilities, for getting and setting all the pieces of info. This was done a bit differently in the earlier draft, but the approach there was feeling a little brittle.

Compressed texture formats were part of this work and so their details show up in this, along with a couple utilities that go with them. I hadn't done packed formats, so don't know if they would bring any surprises. But anyhow, this is all internal.

New with the PR itself, there are also some bits set aside for texture targets, so you could ensure (currently) that a sampler2D correctly pairs with a 2D texture, although it's meant to open up the whole gamut, e.g. a samplerCubeArray won't match with a BitmapPaint having that same 2D texture. I looked over the sampler types from ES 3.2 and most recent desktop GL to allot these bits (came out to 73 possibilities, I think); some reading suggests this generalizes to other backends, but we'll see. (There are still bits to spare.)


For easier / offline reference, I saved PDF snapshots of the "changed files" from each of the draft branch's commits: FPTexture.zip This PR references parts of #1 and #8. (I collapsed mostly irrelevant local changes; forgot to expand Rtt_GLTexture.cpp, unfortunately.)

ggcrunchy and others added 26 commits February 7, 2019 17:09
…nd buffer and assignment logic

Next up, prepare details from graphics.defineEffect()
…from Program

Slight redesign of TimeTransform with caching (to synchronize multiple invocations with a frame) and slightly less heavyweight call site
Err, was calling Modulo for sine method, heh

That said, time transform seems to work in basic test
Fixed error detection for positive number time transform inputs

Relaxed amplitude positivity requirement
Maintenance Revert Test
My mistake adding back changes made
Following that, removed Rtt_GPU.h includes and pulled GL backend stream stuff into FrameBufferObject

Isolates the GL code to tachyon, so less work on ANGLE branch, and also should be helpful for some texture support

Still needs a bit of testing and some Windows checks (might still have dependencies there, although they look old too)
…ged in on Windows, although the logic that used them was #if 0'd out

With these out of the way we might have decoupled GL includes
…field structs (that default to the current behavior)

This is adapted from some earlier work in my FPTexture branch; the coordination between the two formats is a little more explicit... and simpler, I hope... with lazier fetching of non-core format info

Also worked out a promising scheme for targets, since those would also want to at hand for coordinating with samplers
@ggcrunchy ggcrunchy requested a review from Shchvova as a code owner May 14, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants