Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some upload cleanup #203

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open

Some upload cleanup #203

wants to merge 8 commits into from

Conversation

Neu2o
Copy link
Collaborator

@Neu2o Neu2o commented Sep 29, 2020

This makes the code for stage3d texture and vertex/index buffer upload consistent, except that for CubeTexture there is no null buffer upload by the constructor (which we might want to add, but so far it isn't needed). And for RectangleTexture there is no dimension check.

This PR also has a fix for uploading compressed rectangular mipmaps (e.g. 1024x512). The problem is that such mipmaps have the following final dimensions and buffers:

0 = 1024x512
...
n-2 = 2x1
n-1 = 1x1

The n-1 dimension is interesting, as the code by bitshift produces 1x0, while the buffer contains data for 1x1. That's why we apply the same dimension check (and correction) as we have for non-compressed mipmaps.

While cleaning this up I was wondering about the fake data upload for compressed textures again. As we also don't upload anything special in case other texture uploads fail (e.g. fail by dimension check), I'm not sure if we really want to upload fake data when the texture file doesn't contain proper compressed data... Anyhow, I haven't touched it for now

@@ -34,16 +34,19 @@ class GLCubeTexture {

var hasTexture = false;

reader.readTextures(function(side, level, gpuFormat, width, height, blockLength, bytes) {
reader.readTextures(function(side, level, gpuFormat, size, unused, blockLength, bytes) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally in Haxe we use _ for "unused" stuff :)

Copy link
Collaborator Author

@Neu2o Neu2o Sep 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was actually looking for that and I think I tried exactly that and it failed 🤔 Does it maybe interfer with our global _ from the game?

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