Skip to content
This repository was archived by the owner on Aug 15, 2019. It is now read-only.

Conversation

@nkreeger
Copy link
Contributor

@nkreeger nkreeger commented Feb 27, 2019

Looks like this was regressed a few months ago here: #1375

I'm curious how this worked on iOS devices? From what I was told - Safari only supported OES_texture_half_float which enables creating gl.OES_HALF_FLOAT textures but allows them to write f32 data in gl.texSubImage2D().

Happy to discuss offline. But this essentially makes devices that only support f16 not work with the regression in texture manager.

This change is Reviewable

@nkreeger nkreeger changed the title [do-not-review] Fix upload of half-float textures in WebGL 1 Fix upload of half-float textures in "WebGL 1" Feb 28, 2019
@nsthorat
Copy link
Contributor

I don't think this will work on an iPhone -- we've always uploaded to 32 bit textures there (there is no way to upload to a 16 bit texture, I read the WebKit code :P)

@nkreeger
Copy link
Contributor Author

Upload yes - from my understanding things work like this:

const oes = gl.getExtension('OES_texture_half_float');

// Create texture (for upload):
const t = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, t);
...
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, border, gl.RGBA, ext.HALF_FLOAT_OES, null);

// Now actually send values to texture:
const values = new Float32Array([0.5, 1.5, 2.5, 3.5]);
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 1, 1, gl.RGBA, gl.FLOAT, values);

Note that the texture has to be created as f16, but data can be uploaded via f32.

@nsthorat
Copy link
Contributor

Have you tried that on an iPhone out of curiosity? That is the WebGL spec, but Apple iPhones fail most WebGL conformance tests.

@nsthorat
Copy link
Contributor

By the way, that seems completely fine if this works on iOS :)

@nsthorat
Copy link
Contributor

Actually, if this does work on iOS, we need to do a flag refactor. We don't have a flag for the upload type since it's unconditionally 32 bits right now (this is why you may be confused by the render / download flags).

@nsthorat
Copy link
Contributor

nsthorat commented Aug 6, 2019

Closing this out since it's old.

@nsthorat nsthorat closed this Aug 6, 2019
@nsthorat nsthorat deleted the kreeger-upload-f16 branch August 6, 2019 21:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants