mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
build on windows with new PreparedGraphicsObjects
This commit is contained in:
parent
25a44c9b26
commit
fd8bc506d3
@ -7,7 +7,6 @@
|
|||||||
#define DIR_TYPE metalib
|
#define DIR_TYPE metalib
|
||||||
#define BUILDING_DLL BUILDING_PANDA
|
#define BUILDING_DLL BUILDING_PANDA
|
||||||
#define USE_PACKAGES net
|
#define USE_PACKAGES net
|
||||||
#define WIN_SYS_LIBS $[WIN_SYS_LIBS] Ws2_32.lib
|
|
||||||
|
|
||||||
#define COMPONENT_LIBS \
|
#define COMPONENT_LIBS \
|
||||||
recorder pgraph \
|
recorder pgraph \
|
||||||
|
@ -3309,15 +3309,6 @@ TextureContext *DXGraphicsStateGuardian7::
|
|||||||
prepare_texture(Texture *tex) {
|
prepare_texture(Texture *tex) {
|
||||||
|
|
||||||
DXTextureContext7 *dtc = new DXTextureContext7(tex);
|
DXTextureContext7 *dtc = new DXTextureContext7(tex);
|
||||||
#ifdef WBD_GL_MODE
|
|
||||||
glGenTextures(1, >c->_index);
|
|
||||||
|
|
||||||
bind_texture(gtc);
|
|
||||||
glPrioritizeTextures(1, >c->_index, >c->_priority);
|
|
||||||
specify_texture(tex);
|
|
||||||
apply_texture_immediate(tex);
|
|
||||||
#else
|
|
||||||
|
|
||||||
#ifdef USE_TEXFMTVEC
|
#ifdef USE_TEXFMTVEC
|
||||||
if (dtc->CreateTexture(_pScrn->pD3DDevice,_pScrn->TexPixFmts,&_pScrn->D3DDevDesc) == NULL) {
|
if (dtc->CreateTexture(_pScrn->pD3DDevice,_pScrn->TexPixFmts,&_pScrn->D3DDevDesc) == NULL) {
|
||||||
#else
|
#else
|
||||||
@ -3326,14 +3317,6 @@ prepare_texture(Texture *tex) {
|
|||||||
delete dtc;
|
delete dtc;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif // WBD_GL_MODE
|
|
||||||
|
|
||||||
bool inserted = mark_prepared_texture(dtc);
|
|
||||||
|
|
||||||
// If this assertion fails, the same texture was prepared twice,
|
|
||||||
// which shouldn't be possible, since the texture itself should
|
|
||||||
// detect this.
|
|
||||||
nassertr(inserted, NULL);
|
|
||||||
|
|
||||||
return dtc;
|
return dtc;
|
||||||
}
|
}
|
||||||
@ -3503,17 +3486,7 @@ apply_texture(TextureContext *tc) {
|
|||||||
void DXGraphicsStateGuardian7::
|
void DXGraphicsStateGuardian7::
|
||||||
release_texture(TextureContext *tc) {
|
release_texture(TextureContext *tc) {
|
||||||
DXTextureContext7 *gtc = DCAST(DXTextureContext7, tc);
|
DXTextureContext7 *gtc = DCAST(DXTextureContext7, tc);
|
||||||
Texture *tex = tc->_texture;
|
|
||||||
|
|
||||||
gtc->DeleteTexture();
|
gtc->DeleteTexture();
|
||||||
bool erased = unmark_prepared_texture(gtc);
|
|
||||||
|
|
||||||
// If this assertion fails, a texture was released that hadn't been
|
|
||||||
// prepared (or a texture was released twice).
|
|
||||||
nassertv(erased);
|
|
||||||
|
|
||||||
tex->clear_gsg(this);
|
|
||||||
|
|
||||||
delete gtc;
|
delete gtc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3913,7 +3886,9 @@ issue_texture(const TextureAttrib *attrib) {
|
|||||||
enable_texturing(true);
|
enable_texturing(true);
|
||||||
Texture *tex = attrib->get_texture();
|
Texture *tex = attrib->get_texture();
|
||||||
nassertv(tex != (Texture *)NULL);
|
nassertv(tex != (Texture *)NULL);
|
||||||
tex->apply(this);
|
|
||||||
|
TextureContext *tc = tex->prepare_now(_prepared_objects, this);
|
||||||
|
apply_texture(tc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4835,12 +4810,6 @@ dx_cleanup(bool bRestoreDisplayMode,bool bAtExitFnCalled) {
|
|||||||
|
|
||||||
PRINTREFCNT(_pScrn->pDD,"exit start IDirectDraw7");
|
PRINTREFCNT(_pScrn->pDD,"exit start IDirectDraw7");
|
||||||
|
|
||||||
// these 2 calls release ddraw surfaces and vbuffers. unsafe unless not on exit
|
|
||||||
release_all_textures();
|
|
||||||
release_all_geoms();
|
|
||||||
|
|
||||||
PRINTREFCNT(_pScrn->pDD,"after release_all_textures IDirectDraw7");
|
|
||||||
|
|
||||||
// Do a safe check for releasing the D3DDEVICE. RefCount should be zero.
|
// Do a safe check for releasing the D3DDEVICE. RefCount should be zero.
|
||||||
// if we're called from exit(), _pScrn->pD3DDevice may already have been released
|
// if we're called from exit(), _pScrn->pD3DDevice may already have been released
|
||||||
if (_pScrn->pD3DDevice!=NULL) {
|
if (_pScrn->pD3DDevice!=NULL) {
|
||||||
|
@ -3004,27 +3004,10 @@ TextureContext *DXGraphicsStateGuardian8::
|
|||||||
prepare_texture(Texture *tex) {
|
prepare_texture(Texture *tex) {
|
||||||
|
|
||||||
DXTextureContext8 *dtc = new DXTextureContext8(tex);
|
DXTextureContext8 *dtc = new DXTextureContext8(tex);
|
||||||
#ifdef WBD_GL_MODE
|
|
||||||
glGenTextures(1, >c->_index);
|
|
||||||
|
|
||||||
bind_texture(gtc);
|
|
||||||
glPrioritizeTextures(1, >c->_index, >c->_priority);
|
|
||||||
specify_texture(tex);
|
|
||||||
apply_texture_immediate(tex);
|
|
||||||
#else
|
|
||||||
|
|
||||||
if (dtc->CreateTexture(*_pScrn) == NULL) {
|
if (dtc->CreateTexture(*_pScrn) == NULL) {
|
||||||
delete dtc;
|
delete dtc;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif // WBD_GL_MODE
|
|
||||||
|
|
||||||
bool inserted = mark_prepared_texture(dtc);
|
|
||||||
|
|
||||||
// If this assertion fails, the same texture was prepared twice,
|
|
||||||
// which shouldn't be possible, since the texture itself should
|
|
||||||
// detect this.
|
|
||||||
nassertr(inserted, NULL);
|
|
||||||
|
|
||||||
return dtc;
|
return dtc;
|
||||||
}
|
}
|
||||||
@ -3199,17 +3182,7 @@ apply_texture(TextureContext *tc) {
|
|||||||
void DXGraphicsStateGuardian8::
|
void DXGraphicsStateGuardian8::
|
||||||
release_texture(TextureContext *tc) {
|
release_texture(TextureContext *tc) {
|
||||||
DXTextureContext8 *gtc = DCAST(DXTextureContext8, tc);
|
DXTextureContext8 *gtc = DCAST(DXTextureContext8, tc);
|
||||||
Texture *tex = tc->_texture;
|
|
||||||
|
|
||||||
gtc->DeleteTexture();
|
gtc->DeleteTexture();
|
||||||
bool erased = unmark_prepared_texture(gtc);
|
|
||||||
|
|
||||||
// If this assertion fails, a texture was released that hadn't been
|
|
||||||
// prepared (or a texture was released twice).
|
|
||||||
nassertv(erased);
|
|
||||||
|
|
||||||
tex->clear_gsg(this);
|
|
||||||
|
|
||||||
delete gtc;
|
delete gtc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3673,7 +3646,9 @@ issue_texture(const TextureAttrib *attrib) {
|
|||||||
enable_texturing(true);
|
enable_texturing(true);
|
||||||
Texture *tex = attrib->get_texture();
|
Texture *tex = attrib->get_texture();
|
||||||
nassertv(tex != (Texture *)NULL);
|
nassertv(tex != (Texture *)NULL);
|
||||||
tex->apply(this);
|
|
||||||
|
TextureContext *tc = tex->prepare_now(_prepared_objects, this);
|
||||||
|
apply_texture(tc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4578,12 +4553,6 @@ dx_cleanup(bool bRestoreDisplayMode,bool bAtExitFnCalled) {
|
|||||||
|
|
||||||
PRINT_REFCNT(dxgsg8,_pD3DDevice);
|
PRINT_REFCNT(dxgsg8,_pD3DDevice);
|
||||||
|
|
||||||
// these 2 calls release ddraw surfaces and vbuffers. unsafe unless not on exit
|
|
||||||
release_all_textures();
|
|
||||||
release_all_geoms();
|
|
||||||
|
|
||||||
PRINT_REFCNT(dxgsg8,_pD3DDevice);
|
|
||||||
|
|
||||||
// delete non-panda-texture/geom DX objects (VBs/textures/shaders)
|
// delete non-panda-texture/geom DX objects (VBs/textures/shaders)
|
||||||
SAFE_DELSHADER(Vertex,_CurVertexShader,_pD3DDevice);
|
SAFE_DELSHADER(Vertex,_CurVertexShader,_pD3DDevice);
|
||||||
SAFE_DELSHADER(Pixel,_CurPixelShader,_pD3DDevice);
|
SAFE_DELSHADER(Pixel,_CurPixelShader,_pD3DDevice);
|
||||||
|
@ -3020,30 +3020,11 @@ draw_sphere(GeomSphere *geom, GeomContext *gc) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
TextureContext *DXGraphicsStateGuardian9::
|
TextureContext *DXGraphicsStateGuardian9::
|
||||||
prepare_texture(Texture *tex) {
|
prepare_texture(Texture *tex) {
|
||||||
|
|
||||||
DXTextureContext9 *dtc = new DXTextureContext9(tex);
|
DXTextureContext9 *dtc = new DXTextureContext9(tex);
|
||||||
#ifdef WBD_GL_MODE
|
|
||||||
glGenTextures(1, >c->_index);
|
|
||||||
|
|
||||||
bind_texture(gtc);
|
|
||||||
glPrioritizeTextures(1, >c->_index, >c->_priority);
|
|
||||||
specify_texture(tex);
|
|
||||||
apply_texture_immediate(tex);
|
|
||||||
#else
|
|
||||||
|
|
||||||
if (dtc->CreateTexture(*_pScrn) == NULL) {
|
if (dtc->CreateTexture(*_pScrn) == NULL) {
|
||||||
delete dtc;
|
delete dtc;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif // WBD_GL_MODE
|
|
||||||
|
|
||||||
bool inserted = mark_prepared_texture(dtc);
|
|
||||||
|
|
||||||
// If this assertion fails, the same texture was prepared twice,
|
|
||||||
// which shouldn't be possible, since the texture itself should
|
|
||||||
// detect this.
|
|
||||||
nassertr(inserted, NULL);
|
|
||||||
|
|
||||||
return dtc;
|
return dtc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3217,17 +3198,7 @@ apply_texture(TextureContext *tc) {
|
|||||||
void DXGraphicsStateGuardian9::
|
void DXGraphicsStateGuardian9::
|
||||||
release_texture(TextureContext *tc) {
|
release_texture(TextureContext *tc) {
|
||||||
DXTextureContext9 *gtc = DCAST(DXTextureContext9, tc);
|
DXTextureContext9 *gtc = DCAST(DXTextureContext9, tc);
|
||||||
Texture *tex = tc->_texture;
|
|
||||||
|
|
||||||
gtc->DeleteTexture();
|
gtc->DeleteTexture();
|
||||||
bool erased = unmark_prepared_texture(gtc);
|
|
||||||
|
|
||||||
// If this assertion fails, a texture was released that hadn't been
|
|
||||||
// prepared (or a texture was released twice).
|
|
||||||
nassertv(erased);
|
|
||||||
|
|
||||||
tex->clear_gsg(this);
|
|
||||||
|
|
||||||
delete gtc;
|
delete gtc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3692,7 +3663,9 @@ issue_texture(const TextureAttrib *attrib) {
|
|||||||
enable_texturing(true);
|
enable_texturing(true);
|
||||||
Texture *tex = attrib->get_texture();
|
Texture *tex = attrib->get_texture();
|
||||||
nassertv(tex != (Texture *)NULL);
|
nassertv(tex != (Texture *)NULL);
|
||||||
tex->apply(this);
|
|
||||||
|
TextureContext *tc = tex->prepare_now(_prepared_objects, this);
|
||||||
|
apply_texture(tc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4597,12 +4570,6 @@ dx_cleanup(bool bRestoreDisplayMode,bool bAtExitFnCalled) {
|
|||||||
|
|
||||||
PRINT_REFCNT(dxgsg9,_pD3DDevice);
|
PRINT_REFCNT(dxgsg9,_pD3DDevice);
|
||||||
|
|
||||||
// these 2 calls release ddraw surfaces and vbuffers. unsafe unless not on exit
|
|
||||||
release_all_textures();
|
|
||||||
release_all_geoms();
|
|
||||||
|
|
||||||
PRINT_REFCNT(dxgsg9,_pD3DDevice);
|
|
||||||
|
|
||||||
// delete non-panda-texture/geom DX objects (VBs/textures/shaders)
|
// delete non-panda-texture/geom DX objects (VBs/textures/shaders)
|
||||||
//SAFE_DELSHADER(Vertex,_CurVertexShader,_pD3DDevice);
|
//SAFE_DELSHADER(Vertex,_CurVertexShader,_pD3DDevice);
|
||||||
//SAFE_DELSHADER(Pixel,_CurPixelShader,_pD3DDevice);
|
//SAFE_DELSHADER(Pixel,_CurPixelShader,_pD3DDevice);
|
||||||
|
@ -134,7 +134,8 @@ end_frame() {
|
|||||||
|
|
||||||
DisplayRegion dr(this, _x_size, _y_size);
|
DisplayRegion dr(this, _x_size, _y_size);
|
||||||
RenderBuffer buffer = _gsg->get_render_buffer(get_draw_buffer_type());
|
RenderBuffer buffer = _gsg->get_render_buffer(get_draw_buffer_type());
|
||||||
get_texture()->copy(_gsg, &dr, buffer);
|
TextureContext *tc = get_texture()->prepare_now(_gsg->get_prepared_objects(), _gsg);
|
||||||
|
_gsg->copy_texture(tc, &dr, buffer);
|
||||||
|
|
||||||
// It appears that the nVidia graphics driver 5.3.0.3, dated
|
// It appears that the nVidia graphics driver 5.3.0.3, dated
|
||||||
// 11/17/2003 will get confused with the above copy operation and
|
// 11/17/2003 will get confused with the above copy operation and
|
||||||
|
Loading…
x
Reference in New Issue
Block a user