mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 11:28:17 -04:00
Add preliminary fix to RTT
This commit is contained in:
parent
a83ac32cc6
commit
8a8ecf20f4
@ -54,6 +54,7 @@ wdxGraphicsBuffer9(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
|
|||||||
_z_stencil_buffer = NULL;
|
_z_stencil_buffer = NULL;
|
||||||
_direct_3d_surface = NULL;
|
_direct_3d_surface = NULL;
|
||||||
_dx_texture_context9 = NULL;
|
_dx_texture_context9 = NULL;
|
||||||
|
_new_z_stencil_surface = NULL;
|
||||||
|
|
||||||
// is this correct ???
|
// is this correct ???
|
||||||
// Since the pbuffer never gets flipped, we get screenshots from the
|
// Since the pbuffer never gets flipped, we get screenshots from the
|
||||||
@ -152,8 +153,10 @@ begin_render_texture() {
|
|||||||
if (direct_3d_texture) {
|
if (direct_3d_texture) {
|
||||||
hr = direct_3d_texture -> GetSurfaceLevel (mipmap_level, &_direct_3d_surface);
|
hr = direct_3d_texture -> GetSurfaceLevel (mipmap_level, &_direct_3d_surface);
|
||||||
if (SUCCEEDED (hr)) {
|
if (SUCCEEDED (hr)) {
|
||||||
hr = dxgsg -> _d3d_device -> SetRenderTarget (render_target_index,
|
hr = dxgsg -> _d3d_device -> SetRenderTarget (render_target_index, _direct_3d_surface);
|
||||||
_direct_3d_surface);
|
if (SUCCEEDED (hr)) {
|
||||||
|
if (this -> _new_z_stencil_surface) {
|
||||||
|
hr = dxgsg -> _d3d_device -> SetDepthStencilSurface (this -> _new_z_stencil_surface);
|
||||||
if (SUCCEEDED (hr)) {
|
if (SUCCEEDED (hr)) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -162,6 +165,8 @@ begin_render_texture() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -256,10 +261,15 @@ select_cube_map(int cube_map_index) {
|
|||||||
if (SUCCEEDED (hr)) {
|
if (SUCCEEDED (hr)) {
|
||||||
hr = dxgsg -> _d3d_device -> SetRenderTarget (render_target_index,
|
hr = dxgsg -> _d3d_device -> SetRenderTarget (render_target_index,
|
||||||
_direct_3d_surface);
|
_direct_3d_surface);
|
||||||
|
if (SUCCEEDED (hr)) {
|
||||||
|
if (this -> _new_z_stencil_surface) {
|
||||||
|
hr = dxgsg -> _d3d_device -> SetDepthStencilSurface (this -> _new_z_stencil_surface);
|
||||||
if (SUCCEEDED (hr)) {
|
if (SUCCEEDED (hr)) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// error: invalid cube map face index
|
// error: invalid cube map face index
|
||||||
}
|
}
|
||||||
@ -349,6 +359,12 @@ close_buffer() {
|
|||||||
dx_texture_context9 -> _d3d_volume_texture = NULL;
|
dx_texture_context9 -> _d3d_volume_texture = NULL;
|
||||||
dx_texture_context9 -> _d3d_cube_texture = NULL;
|
dx_texture_context9 -> _d3d_cube_texture = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// release new depth stencil buffer if one was created
|
||||||
|
if (this -> _new_z_stencil_surface) {
|
||||||
|
this -> _new_z_stencil_surface -> Release ( );
|
||||||
|
this -> _new_z_stencil_surface = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_cube_map_index = -1;
|
_cube_map_index = -1;
|
||||||
@ -387,9 +403,42 @@ open_buffer() {
|
|||||||
if (tc != NULL) {
|
if (tc != NULL) {
|
||||||
_dx_texture_context9 = DCAST (DXTextureContext9, tc);
|
_dx_texture_context9 = DCAST (DXTextureContext9, tc);
|
||||||
|
|
||||||
|
// ***** CREATE A DEPTH STENCIL BUFFER IF NEEDED
|
||||||
|
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
UINT width;
|
||||||
|
UINT height;
|
||||||
|
D3DFORMAT format;
|
||||||
|
D3DMULTISAMPLE_TYPE multisample_type;
|
||||||
|
DWORD multisample_quality;
|
||||||
|
BOOL discard;
|
||||||
|
|
||||||
|
width = ;
|
||||||
|
height = ;
|
||||||
|
format = ;
|
||||||
|
multisample_type = ;
|
||||||
|
multisample_quality = ;
|
||||||
|
discard = true;
|
||||||
|
|
||||||
|
hr = dxgsg -> _d3d_device -> CreateDepthStencilSurface (
|
||||||
|
width, height, format, multisample_type, multisample_quality,
|
||||||
|
discard, &this -> _new_z_stencil_surface, NULL);
|
||||||
|
if (SUCCEEDED (hr))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
_is_valid = true;
|
_is_valid = true;
|
||||||
state = true;
|
state = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,8 @@ private:
|
|||||||
IDirect3DSurface9 *_direct_3d_surface;
|
IDirect3DSurface9 *_direct_3d_surface;
|
||||||
DXTextureContext9 *_dx_texture_context9;
|
DXTextureContext9 *_dx_texture_context9;
|
||||||
|
|
||||||
|
IDirect3DSurface9 *_new_z_stencil_surface;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static TypeHandle get_class_type() {
|
static TypeHandle get_class_type() {
|
||||||
return _type_handle;
|
return _type_handle;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user