mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
Add support for desination alpha for the back buffer.
This commit is contained in:
parent
a8f09b9631
commit
0924c50cd1
@ -477,8 +477,7 @@ do_fullscreen_resize(int x_size, int y_size) {
|
|||||||
_wcontext._display_mode.Height = y_size;
|
_wcontext._display_mode.Height = y_size;
|
||||||
_wcontext._display_mode.Format = pixFmt;
|
_wcontext._display_mode.Format = pixFmt;
|
||||||
_wcontext._display_mode.RefreshRate = D3DPRESENT_RATE_DEFAULT;
|
_wcontext._display_mode.RefreshRate = D3DPRESENT_RATE_DEFAULT;
|
||||||
|
// keep the previous setting for _wcontext._presentation_params.BackBufferFormat
|
||||||
_wcontext._presentation_params.BackBufferFormat = pixFmt; // make reset_device_resize use presparams or displaymode??
|
|
||||||
|
|
||||||
bResizeSucceeded = reset_device_resize_window(x_size, y_size);
|
bResizeSucceeded = reset_device_resize_window(x_size, y_size);
|
||||||
|
|
||||||
@ -533,14 +532,13 @@ create_screen_buffers_and_device(DXScreenData &display, bool force_16bpp_zbuffer
|
|||||||
// Update: Did I fix the bug? - Josh
|
// Update: Did I fix the bug? - Josh
|
||||||
int frame_buffer_mode = _fb_properties.get_frame_buffer_mode();
|
int frame_buffer_mode = _fb_properties.get_frame_buffer_mode();
|
||||||
bool bWantStencil = ((frame_buffer_mode & FrameBufferProperties::FM_stencil) != 0);
|
bool bWantStencil = ((frame_buffer_mode & FrameBufferProperties::FM_stencil) != 0);
|
||||||
|
bool bWantAlpha = ((frame_buffer_mode & FrameBufferProperties::FM_rgba) != 0);
|
||||||
|
|
||||||
PRINT_REFCNT(wdxdisplay9, _d3d9);
|
PRINT_REFCNT(wdxdisplay9, _d3d9);
|
||||||
|
|
||||||
assert(_d3d9 != NULL);
|
assert(_d3d9 != NULL);
|
||||||
assert(pD3DCaps->DevCaps & D3DDEVCAPS_HWRASTERIZATION);
|
assert(pD3DCaps->DevCaps & D3DDEVCAPS_HWRASTERIZATION);
|
||||||
|
|
||||||
presentation_params->BackBufferFormat = display._display_mode.Format; // dont need dest alpha, so just use adapter format
|
|
||||||
|
|
||||||
bool do_sync = sync_video;
|
bool do_sync = sync_video;
|
||||||
|
|
||||||
if (do_sync && !(pD3DCaps->Caps & D3DCAPS_READ_SCANLINE)) {
|
if (do_sync && !(pD3DCaps->Caps & D3DCAPS_READ_SCANLINE)) {
|
||||||
@ -549,11 +547,33 @@ create_screen_buffers_and_device(DXScreenData &display, bool force_16bpp_zbuffer
|
|||||||
do_sync = false;
|
do_sync = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// verify the rendertarget fmt one last time
|
bool check_device_format;
|
||||||
if (FAILED(_d3d9->CheckDeviceFormat(display._card_id, D3DDEVTYPE_HAL, display._display_mode.Format, D3DUSAGE_RENDERTARGET,
|
|
||||||
D3DRTYPE_SURFACE, presentation_params->BackBufferFormat))) {
|
// check for D3DFMT_A8R8G8B8 first
|
||||||
wdxdisplay9_cat.error() << "device #" << display._card_id << " CheckDeviceFmt failed for surface fmt " << D3DFormatStr(presentation_params->BackBufferFormat) << endl;
|
check_device_format = false;
|
||||||
goto Fallback_to_16bpp_buffers;
|
if (bWantAlpha) {
|
||||||
|
presentation_params->BackBufferFormat = D3DFMT_A8R8G8B8;
|
||||||
|
// verify the rendertarget fmt
|
||||||
|
if (FAILED(_d3d9->CheckDeviceFormat(display._card_id, D3DDEVTYPE_HAL, display._display_mode.Format, D3DUSAGE_RENDERTARGET,
|
||||||
|
D3DRTYPE_SURFACE, presentation_params->BackBufferFormat))) {
|
||||||
|
wdxdisplay9_cat.error() << "device #" << display._card_id << " CheckDeviceFmt failed for surface fmt " << D3DFormatStr(presentation_params->BackBufferFormat) << endl;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
check_device_format = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check for same format as display_mode
|
||||||
|
if (check_device_format == false) {
|
||||||
|
presentation_params->BackBufferFormat = display._display_mode.Format;
|
||||||
|
// verify the rendertarget fmt
|
||||||
|
if (FAILED(_d3d9->CheckDeviceFormat(display._card_id, D3DDEVTYPE_HAL, display._display_mode.Format, D3DUSAGE_RENDERTARGET,
|
||||||
|
D3DRTYPE_SURFACE, presentation_params->BackBufferFormat))) {
|
||||||
|
wdxdisplay9_cat.error() << "device #" << display._card_id << " CheckDeviceFmt failed for surface fmt " << D3DFormatStr(presentation_params->BackBufferFormat) << endl;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
check_device_format = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(_d3d9->CheckDeviceType(display._card_id, D3DDEVTYPE_HAL, display._display_mode.Format, presentation_params->BackBufferFormat,
|
if (FAILED(_d3d9->CheckDeviceType(display._card_id, D3DDEVTYPE_HAL, display._display_mode.Format, presentation_params->BackBufferFormat,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user