4 ms·
I wonder if GPU hardware does it right or wrong on texture rendering. Someone care to test?
by Geee 16y ago
I wonder if GPU hardware does it right or wrong on texture rendering. Someone care to test?
- jacquesm 16y agoGPU hardware runs software designed for it, so in the end if it doesn't work properly it's not the hardware that's at fault.
- jckarter 16y agoTexture sampling is still performed with specialized hardware. It does bilinear or trilinear sampling, which would be "wrong" by the original article's definition.
- miloshh 16y agoYes, but I think the GPU designers did the right thing here by not injecting "magic" gamma-correction functionality into the texture sampler. There are many operations done on textures before they become pixel colors, plus they are often used to store non-image information (positions, normals, CT densities) where gamma correction would be incorrect.If you care about correct tone-mapping (most games probably don't), you can correct your textures beforehand.
- jckarter 16y agoOh, I agree entirely. I just called it "wrong" in response to Geee's original question. Should have clarified.
- ssp 16y agoBasically all newer hardware has the ability to convert from sRGB to linear RGB during texture sampling, and back again during ROP. See these OpenGL extensions: http://www.opengl.org/registry/specs/EXT/texture_sRGB.txt http://www.opengl.org/registry/specs/EXT/texture_sRGB.txt http://www.opengl.org/registry/specs/ARB/framebuffer_sRGB.txt http://www.opengl.org/registry/specs/ARB/framebuffer_sRGB.tx...
- jckarter 16y agoIs the sRGB-to-linear transformation actually done in the GPU's texturing hardware? nVidia's PTX ISA at least doesn't expose any sRGB-specific sampling opcodes.
- ssp 16y agoThe conversion should take place before filtering, so it has to be in the texturing hardware. There is no need for sRGB specific sampling opcodes because sRGB is considered a property of the texture, not of the way you sample it.
- jckarter 16y agoYeah, but PTX doesn't give texture or sampler values an sRGB mode either. Are you sure the driver doesn't just convert the texture when glTex(Sub)Image* is called?
- deleted 16y ago[deleted]
- ssp 16y agoI would be very surprised. I do know that both Intel and ATI chips support it in texture hardware. See this, for example: http://www.x.org/docs/AMD/R5xx_Acceleration_v1.5.pdf http://www.x.org/docs/AMD/R5xx_Acceleration_v1.5.pdf Bit 21 of TXFORMAT0: GAMMA 21 none Optionally remove gamma from texture before passing to shader. Only apply to 8bit or less components. POSSIBLE VALUES: 00 - Disable gamma removal 01 - Enable gamma removal There is also support for re-applying gamma before storing to a color buffer.
- watmough 16y agoPinch scaling on the iPad turned all the examples in the article to pink and green garbage, so maybe someone at Apple needs to take a look at that. Might be worth trying to use the CATiledLayer stuff and the CoreImage scaling to generate 'live' scaling. That might work better than whatever Safari, UIKit and the GPU presently do.