[1/2] wined3d: unbound texture units should sample black instead of white.

Stefan Dösinger stefandoesinger at gmx.at
Fri Jul 2 05:37:05 CDT 2010


Am 01.07.2010 um 20:58 schrieb Fabian Bieler:
> I hoped that OpenGL took care of those cases. According to the spec samplers 
> with incomplete textures bound to them should return (0, 0, 0, 1), too. 
> Wouldn't sampling from a texture unit to which the binding of matching 
> dimensionality is 0 count as incomplete? (At least as long as no one uploads 
> an image to it, I'm not sure if it's legal to use texture name 0)
Part of the problem is that we don't maintain a texture dimension that isn't used on a sampler. E.g.

bind Volume texture to sampler 0
draw with a shader reading the volume texture
bind 2D texture to sampler 0
draw with a shader reading the 2D texture
bind a shader reading volume textures
draw with that shader

The last step reads from the volume texture bound in step 0, but I guess the correct thing would be to return 0,0,0,1 because the sampler doesn't match the shader. That's why I am afraid you'll have to fix this in the shader, by not sampling at all if the texture doesn't match.

> Anyhow, I just did some testing and found out that nvidia returns (0, 0, 0, 0) 
> for incomplete textures and 'unbound' texture units i.e. bound to 0.
> Maybe it does that on windows for D3D, too. I only tested on AMD and the 
> reference rasterizer (which both return (0, 0, 0, 1)) and bug 14942 only 
> depends on the rgb components.
I can do some testing, but first I have to fix the existing tests. I get about 1000 failures on my Win7+Nvidia box.

> Also: If you want to work around the issue with more dummy textures, wouldn't 
> you also have to bind dummy textures to all available texture units (and not 
> just the ones exposed to the fixed-function-pipeline)?
I don't think dummy textures are the way to go here. They're needed for fixed function for texture ops that don't involve textures, because otherwise ARB_texture_combiners returns an error. E.g.

stage 1 texture: NULL
stage 1 color op: D3DTOP_ADD
stage 1 color arg1: D3DTA_PREVIOUS
stage 1 color arg2: D3DTA_TEXFACTOR

The texture isn't used here, but the texture_combiner API says that using a stage without a texture is an error, hence the dummy textures. We shouldn't need them for the nvrc, arbfp and atifs pipelines.




More information about the wine-devel mailing list