On 7/24/06, Jason Green <[EMAIL PROTECTED]> wrote:
I've spent a couple of days researching the issue of
broken/upside-down character/object models in Wine in almost all newer
games when you have vertex shaders enabled (Civ4, Half Life 2,
Oblivion, Max Payne 2, etc.).

Yes, I remember some talk on IRC, and wanted to comment, but will do now.

 I think I've boiled it down to a single
case:  When "device->renderUpsideDown" is set in the case where vertex
shaders are enabled.  That flag gets set in device.c:7395 when the
current renderTarget is not on the current swapchain.  The comments in
the source say that the upside-downedness is produced by
glCopyTexImage, so it sets a flag to flip everything over.

In the case w/o shaders, there is code in drawprim.c which loads the
WORLDVIEW and PROJECTION matrices and then multiplies those matrices
by one which inverts the y coordinates when that flag is set. That
seems to work in the case without vertex shaders, but when shaders are
enabled, they bypass the WORLD, VIEW, and PROJECTION matrices
entirely.  The shader case was written when only software shaders
worked, but that is no longer true.   It loads identity matrices and
performs the y flip, but that code is entirely irrelevant since the
vertex shader doesn't reference those matrices; it only uses constants
that are passed by the app, which we can't perform any type of fixup
on since we don't know which constants will be used for which
calculation.

Yeah, I've noticed all this with Star Wars Battlefront. See bug 5247.

Without vertex shaders, I have a very simple hack to fix the one issue
of an upside down skybox. What I did should be quite obvious to you.
With vertex shaders (note: I make brief mention in bug comments about
how to get them working with dri, you might remember this from IRC
too) having them enabled, the problem gets a little worse as certain
parts of the skybox are correctly up and others upside down. If you
apply the hack, then *everything* got flipped -- those that were
correct were now upside down, and vice-versa. Also parts of the box
got shifted a bit. This is with ARB shaders BTW. I'll post screen
shots when I get the chance.  I wonder if there was a reason for the
flip code because it does flip some things correctly.



So, I think what we need to do is prevent ourselves from having to do
any flipping whatsoever. That's the part that I'm not sure how to do
and is the reason for this email.

That I'd agree with. There are certainly things it does wrong. But I
think I need to go back studying the code before I make any
recommendations. :) I'll try to get back to you later.

Jesse


Reply via email to