dx9 multisample refresh rate lock

Bug #784923 reported by zhao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Panda3D
Fix Released
Undecided
Unassigned

Bug Description

Under the dx9 pipe, enabling multisample auto-locks the refresh rate to the monitors default refresh rate even
when vysnc is turned off.

This can be fixed by adding the following omission to the wdxGraphicsWindow9.cxx line 711
 } else {

+ if (do_sync == false) {
+ presentation_params->SwapEffect = D3DSWAPEFFECT_FLIP;
+ presentation_params->PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
+ }

      presentation_params->SwapEffect = D3DSWAPEFFECT_DISCARD;
    }

Revision history for this message
David Rose (droklaunchpad) wrote :

Awesome! But how does this code not result in SwapEffect being set to D3DSWAPEFFECT_DISCARD in all cases?

Revision history for this message
zhao (oahz12) wrote : Re: [Bug 784923] Re: dx9 multisample refresh rate lock

Hi david, you're completely right. (This should be on line 771 by the way,
not 711 as in the bug report)

      if (do_sync == false) {
        presentation_params->SwapEffect = D3DSWAPEFFECT_FLIP;
        presentation_params->PresentationInterval =
D3DPRESENT_INTERVAL_IMMEDIATE;
      }
      presentation_params->SwapEffect = D3DSWAPEFFECT_DISCARD;

there should an else or the order of the two swapped in my earlier proposal.
I think I was blinded by the redundant if
statement in the earlier block and wasn't thinking clearly.

Unfortunately, when i was testing, the line

 presentation_params->PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

had the most effect and masked out my carelesness. Thanks for catching it!

Revision history for this message
zhao (oahz12) wrote :

Now that I look at it some more,

the entire block starting at line 752

if ( supported_multisample... )
{ }
else
{}

might as well be swapped out for

      presentation_params->SwapEffect = D3DSWAPEFFECT_DISCARD;
      if (do_sync == false) {
        presentation_params->SwapEffect = D3DSWAPEFFECT_FLIP;
        presentation_params->PresentationInterval =
D3DPRESENT_INTERVAL_IMMEDIATE;
      }

On Thu, May 19, 2011 at 2:41 AM, zhao huang <email address hidden> wrote:

> Hi david, you're completely right. (This should be on line 771 by the way,
> not 711 as in the bug report)
>
>
> if (do_sync == false) {
> presentation_params->SwapEffect = D3DSWAPEFFECT_FLIP;
> presentation_params->PresentationInterval =
> D3DPRESENT_INTERVAL_IMMEDIATE;
> }
> presentation_params->SwapEffect = D3DSWAPEFFECT_DISCARD;
>
> there should an else or the order of the two swapped in my earlier
> proposal. I think I was blinded by the redundant if
> statement in the earlier block and wasn't thinking clearly.
>
> Unfortunately, when i was testing, the line
>
>
> presentation_params->PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
>
> had the most effect and masked out my carelesness. Thanks for catching it!
>
>
>

Revision history for this message
zhao (oahz12) wrote :

hi david,

 more testing reveals that my ati hd540 does not like

        presentation_params->SwapEffect = D3DSWAPEFFECT_FLIP;

with a multisample buffer.

So my earlier mistake was actually correct. When using multisample,

      presentation_params->SwapEffect = D3DSWAPEFFECT_DISCARD;

should always be used. I'm tired right now to lookup why microsoft decided
this must be so, but i have tested it. For my test scene

gl MSAA no vysnc is 70 fps
dx MSAA no vysnc is 85fps (without the proposed change, dx MSAA drops down
to 60 fps)

On Thu, May 19, 2011 at 2:47 AM, zhao huang <email address hidden> wrote:

> Now that I look at it some more,
>
> the entire block starting at line 752
>
> if ( supported_multisample... )
> { }
> else
> {}
>
> might as well be swapped out for
>
> presentation_params->SwapEffect = D3DSWAPEFFECT_DISCARD;
> if (do_sync == false) {
> presentation_params->SwapEffect = D3DSWAPEFFECT_FLIP;
> presentation_params->PresentationInterval =
> D3DPRESENT_INTERVAL_IMMEDIATE;
> }
>
>
> On Thu, May 19, 2011 at 2:41 AM, zhao huang <email address hidden> wrote:
>
>> Hi david, you're completely right. (This should be on line 771 by the way,
>> not 711 as in the bug report)
>>
>>
>> if (do_sync == false) {
>> presentation_params->SwapEffect = D3DSWAPEFFECT_FLIP;
>> presentation_params->PresentationInterval =
>> D3DPRESENT_INTERVAL_IMMEDIATE;
>> }
>> presentation_params->SwapEffect = D3DSWAPEFFECT_DISCARD;
>>
>> there should an else or the order of the two swapped in my earlier
>> proposal. I think I was blinded by the redundant if
>> statement in the earlier block and wasn't thinking clearly.
>>
>> Unfortunately, when i was testing, the line
>>
>>
>> presentation_params->PresentationInterval =
>> D3DPRESENT_INTERVAL_IMMEDIATE;
>>
>> had the most effect and masked out my carelesness. Thanks for catching it!
>>
>>
>>
>

Moguri (mogurijin)
tags: added: directx windows
ponyboy837 (ponyboy837)
Changed in panda3d:
status: New → Confirmed
Revision history for this message
rdb (rdb) wrote :

This appears to have already been committed:
https://github.com/panda3d/panda3d/commit/73e89c8

Changed in panda3d:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.