Re: Re: Tips for debugging D3D Textures & DirectSound?
Ove Kaaven <[email protected]> Fri, 08 Oct 2004 13:14:04 -0400
| Newsgroups | gmane.comp.emulators.winex.devel |
|---|---|
| Organization | TransGaming Technologies Inc |
| Message-ID | <1097255643.1848.155.camel@renegade> |
fre, 08.10.2004 kl. 07.38 skrev Adam Luchjenbroers:
> Just curiously, can you explain why these code fragments are there?
>
> texstate.c, D3D_GL_texture_map, 932:
> GLenum target = priv->texture_target[Stage];
>
> texstate.c, D3D_GL_texture_map, 945-954:
> if (new_target != target) {
> if (target) {
> glBindTexture(target, 0);
> glDisable(target);
> TRACE("Target %04x has been disabled\n",target);
> priv->texture_used[Stage] = FALSE;
> }
> target = new_target;
> priv->texture_target[Stage] = target;
> }
>
> d3dgl_main.c, D3D_GL_initialize, 160-165
> priv->texture_target[0] = GL_TEXTURE_2D;
> for (u=1; u<priv->lpCaps->wMaxTextureBlendStages; u++) {
> GLD(priv)->glActiveTextureARB(GL_TEXTURE0_ARB + u);
> glBindTexture(GL_TEXTURE_2D, priv->dummy_texture);
> priv->texture_target[u] = GL_TEXTURE_2D;
> }
They're there so we can support different kinds of textures, including
2D, 3D, cube map, and rectangle (NPOT). Of course only 2D and cube map
is currently actually supported by the code in general.
> Because in combination, they mean that whenever D3D_GL_texture_map is called
> for a non-power of two texture, the code within the body of the if gets
> executed. While I have only a limited understanding of priv structure, it
> would seem like this might cause some issues.
You don't mention what kind of issues. And I certainly don't see any
problem with it; it looks exactly as it should. And if there were a
problem, we would have seen it with cube maps long ago. What is it you
believe is the problem? (If you're just wondering exactly where the
corresponding glEnable for the new target is, it's in
GL_UpdateStageEnable, called from GL_StageUpdated, called from
D3D_GL_update_texture_stage_states when D3D_GL_texture_map returns
STAGE_UPDATED.)
> Can I get you to explain this and the nature of the priv structure to me?
The priv structure is just a per-context driver-specific data area.