mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -04:00
Fix for when clearing non 2D textures.
This commit is contained in:
parent
8b08531496
commit
75a7b1226a
@ -98,6 +98,7 @@ create_texture(DXScreenData &scrn) {
|
|||||||
DWORD target_bpp = get_bits_per_pixel(get_texture()->get_format(), &num_alpha_bits);
|
DWORD target_bpp = get_bits_per_pixel(get_texture()->get_format(), &num_alpha_bits);
|
||||||
DWORD num_color_channels = get_texture()->get_num_components();
|
DWORD num_color_channels = get_texture()->get_num_components();
|
||||||
|
|
||||||
|
// printf ("format = %d \n", get_texture()->get_format());
|
||||||
// printf ("target_bpp %d, num_color_channels %d num_alpha_bits %d \n", target_bpp, num_color_channels, num_alpha_bits);
|
// printf ("target_bpp %d, num_color_channels %d num_alpha_bits %d \n", target_bpp, num_color_channels, num_alpha_bits);
|
||||||
|
|
||||||
//PRINT_REFCNT(dxgsg9, scrn._d3d9);
|
//PRINT_REFCNT(dxgsg9, scrn._d3d9);
|
||||||
@ -1427,33 +1428,35 @@ fill_d3d_texture_pixels(bool supports_automatic_mipmap_generation, IDirect3DDev
|
|||||||
if (get_texture()->get_render_to_texture()) {
|
if (get_texture()->get_render_to_texture()) {
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
|
|
||||||
// clear render to texture
|
if (_d3d_2d_texture) {
|
||||||
IDirect3DSurface9 *surface;
|
// clear render to texture
|
||||||
|
IDirect3DSurface9 *surface;
|
||||||
|
|
||||||
result = _d3d_2d_texture -> GetSurfaceLevel (0, &surface);
|
result = _d3d_2d_texture -> GetSurfaceLevel (0, &surface);
|
||||||
if (result == D3D_OK) {
|
if (result == D3D_OK) {
|
||||||
D3DSURFACE_DESC surface_description;
|
D3DSURFACE_DESC surface_description;
|
||||||
|
|
||||||
if (surface -> GetDesc (&surface_description) == D3D_OK) {
|
if (surface -> GetDesc (&surface_description) == D3D_OK) {
|
||||||
IDirect3DSurface9 *current_render_target;
|
IDirect3DSurface9 *current_render_target;
|
||||||
|
|
||||||
if (device -> GetRenderTarget (0, ¤t_render_target) == D3D_OK) {
|
if (device -> GetRenderTarget (0, ¤t_render_target) == D3D_OK) {
|
||||||
if (device -> SetRenderTarget (0, surface) == D3D_OK) {
|
if (device -> SetRenderTarget (0, surface) == D3D_OK) {
|
||||||
DWORD flags;
|
DWORD flags;
|
||||||
D3DCOLOR color;
|
D3DCOLOR color;
|
||||||
|
|
||||||
color = 0xFF000000;
|
color = 0xFF000000;
|
||||||
flags = D3DCLEAR_TARGET;
|
flags = D3DCLEAR_TARGET;
|
||||||
if (device -> Clear (NULL, NULL, flags, color, 0.0f, 0) == D3D_OK) {
|
if (device -> Clear (NULL, NULL, flags, color, 0.0f, 0) == D3D_OK) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
device -> SetRenderTarget (0, current_render_target);
|
||||||
|
current_render_target -> Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
device -> SetRenderTarget (0, current_render_target);
|
|
||||||
current_render_target -> Release();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
surface -> Release();
|
surface -> Release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user