migrate to DirectX 9Ex from DirectX 9

This commit is contained in:
mq1n
2025-09-19 16:12:33 +03:00
parent df346e156b
commit fb7e53b909
24 changed files with 100 additions and 88 deletions

View File

@@ -58,10 +58,10 @@ static CGraphicVertexBuffer* __AllocDeformVertexBuffer(unsigned deformableVertex
CGraphicVertexBuffer* pkNewVB = new CGraphicVertexBuffer;
if (!pkNewVB->Create(
capacity,
D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1,
D3DUSAGE_WRITEONLY,
D3DPOOL_MANAGED))
capacity,
D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1,
D3DUSAGE_DYNAMIC,
D3DPOOL_DEFAULT))
{
TraceError("NEW_ERROR %8d: %d(%d)", time(NULL) - base, capacity, deformableVertexCount);
}
@@ -101,10 +101,10 @@ void __ReserveSharedVertexBuffers(unsigned index, unsigned count)
{
CGraphicVertexBuffer* pkNewVB = new CGraphicVertexBuffer;
pkNewVB->Create(
capacity,
D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1,
D3DUSAGE_WRITEONLY,
D3DPOOL_MANAGED);
capacity,
D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1,
D3DUSAGE_DYNAMIC,
D3DPOOL_DEFAULT);
gs_vbs[index].push_back(pkNewVB);
}
NANOEND

View File

@@ -109,7 +109,7 @@ bool CGrannyModel::LoadPNTVertices()
assert(m_meshs != NULL);
if (!m_pntVtxBuf.Create(m_rigidVtxCount, m_dwFvF, D3DUSAGE_WRITEONLY, D3DPOOL_MANAGED))
if (!m_pntVtxBuf.Create(m_rigidVtxCount, m_dwFvF, D3DUSAGE_WRITEONLY, D3DPOOL_DEFAULT))
return false;
void* vertices;
@@ -361,7 +361,7 @@ bool CGrannyModel::__LoadVertices()
// assert((m_dwFvF & (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1)) == m_dwFvF);
// if (!m_pntVtxBuf.Create(m_rigidVtxCount, D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1, D3DUSAGE_WRITEONLY, D3DPOOL_MANAGED))
if (!m_pntVtxBuf.Create(m_rigidVtxCount, m_dwFvF, D3DUSAGE_WRITEONLY, D3DPOOL_MANAGED))
if (!m_pntVtxBuf.Create(m_rigidVtxCount, m_dwFvF, D3DUSAGE_WRITEONLY, D3DPOOL_DEFAULT))
return false;
void* vertices;

View File

@@ -232,9 +232,7 @@ void CGrannyModelInstance::__CreateDynamicVertexBuffer()
{
if (!m_kLocalDeformableVertexBuffer.Create(vtxCount,
D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1,
//D3DUSAGE_DYNAMIC, D3DPOOL_SYSTEMMEM
D3DUSAGE_WRITEONLY, D3DPOOL_MANAGED
D3DUSAGE_DYNAMIC, D3DPOOL_DEFAULT
))
return;
}

View File

@@ -155,7 +155,7 @@ void CBlockTexture::InvalidateRect(const RECT & c_rsrcRect)
bool CBlockTexture::Create(CGraphicDib * pDIB, const RECT & c_rRect, DWORD dwWidth, DWORD dwHeight)
{
if (FAILED(ms_lpd3dDevice->CreateTexture(dwWidth, dwHeight, 0, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &m_lpd3dTexture, nullptr)))
if (FAILED(ms_lpd3dDevice->CreateTexture(dwWidth, dwHeight, 0, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &m_lpd3dTexture, nullptr)))
{
Tracef("Failed to create block texture %u, %u\n", dwWidth, dwHeight);
return false;

View File

@@ -22,8 +22,8 @@ void D3DXVECTOR3ToPixelPosition(const D3DXVECTOR3& c_rv3Src, D3DXVECTOR3* pv3Dst
HWND CGraphicBase::ms_hWnd;
HDC CGraphicBase::ms_hDC;
LPDIRECT3D9 CGraphicBase::ms_lpd3d = NULL;
LPDIRECT3DDEVICE9 CGraphicBase::ms_lpd3dDevice = NULL;
LPDIRECT3D9EX CGraphicBase::ms_lpd3d = NULL;
LPDIRECT3DDEVICE9EX CGraphicBase::ms_lpd3dDevice = NULL;
ID3DXMatrixStack * CGraphicBase::ms_lpd3dMatStack = NULL;
D3DPRESENT_PARAMETERS CGraphicBase::ms_d3dPresentParameter;
D3DVIEWPORT9 CGraphicBase::ms_Viewport;

View File

@@ -241,8 +241,8 @@ class CGraphicBase
static HWND ms_hWnd;
static HDC ms_hDC;
static LPDIRECT3D9 ms_lpd3d;
static LPDIRECT3DDEVICE9 ms_lpd3dDevice;
static LPDIRECT3D9EX ms_lpd3d;
static LPDIRECT3DDEVICE9EX ms_lpd3dDevice;
static ID3DXMatrixStack* ms_lpd3dMatStack;
static D3DVIEWPORT9 ms_Viewport;

View File

@@ -77,7 +77,7 @@ void CGraphicDevice::EnableWebBrowserMode(const RECT& c_rcWebPage)
rkD3DPP.BackBufferCount = 1;
rkD3DPP.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
IDirect3DDevice9& rkD3DDev=*ms_lpd3dDevice;
IDirect3DDevice9Ex& rkD3DDev=*ms_lpd3dDevice;
HRESULT hr=rkD3DDev.Reset(&rkD3DPP);
if (FAILED(hr))
return;
@@ -96,7 +96,7 @@ void CGraphicDevice::DisableWebBrowserMode()
rkD3DPP=g_kD3DPP;
IDirect3DDevice9& rkD3DDev=*ms_lpd3dDevice;
IDirect3DDevice9Ex& rkD3DDev=*ms_lpd3dDevice;
HRESULT hr=rkD3DDev.Reset(&rkD3DPP);
if (FAILED(hr))
return;
@@ -117,7 +117,7 @@ bool CGraphicDevice::ResizeBackBuffer(UINT uWidth, UINT uHeight)
rkD3DPP.BackBufferWidth=uWidth;
rkD3DPP.BackBufferHeight=uHeight;
IDirect3DDevice9& rkD3DDev=*ms_lpd3dDevice;
IDirect3DDevice9Ex& rkD3DDev=*ms_lpd3dDevice;
HRESULT hr=rkD3DDev.Reset(&rkD3DPP);
if (FAILED(hr))
@@ -310,7 +310,7 @@ int CGraphicDevice::Create(HWND hWnd, int iHres, int iVres, bool Windowed, int /
ms_hWnd = hWnd;
ms_hDC = GetDC(hWnd);
ms_lpd3d = Direct3DCreate9(D3D_SDK_VERSION);
Direct3DCreate9Ex(D3D_SDK_VERSION, &ms_lpd3d);
if (!ms_lpd3d)
return CREATE_NO_DIRECTX;
@@ -411,12 +411,24 @@ RETRY:
ms_d3dPresentParameter.MultiSampleQuality = 0;
}
if (FAILED(ms_hLastResult = ms_lpd3d->CreateDevice(
D3DDISPLAYMODEEX displayModeEx;
ZeroMemory(&displayModeEx, sizeof(displayModeEx));
displayModeEx.Size = sizeof(D3DDISPLAYMODEEX);
displayModeEx.Width = iHres;
displayModeEx.Height = iVres;
displayModeEx.RefreshRate = iReflashRate;
displayModeEx.Format = d3dDisplayMode.Format;
displayModeEx.ScanLineOrdering = D3DSCANLINEORDERING_PROGRESSIVE;
D3DDISPLAYMODEEX* pDisplayMode = Windowed ? NULL : &displayModeEx;
if (FAILED(ms_hLastResult = ms_lpd3d->CreateDeviceEx(
D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
hWnd,
ms_dwD3DBehavior,
&ms_d3dPresentParameter,
pDisplayMode,
&ms_lpd3dDevice)))
{
switch (ms_hLastResult)
@@ -598,7 +610,7 @@ bool CGraphicDevice::__CreatePDTVertexBufferList()
sizeof(TPDTVertex)*PDT_VERTEX_NUM,
D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1,
D3DPOOL_SYSTEMMEM,
D3DPOOL_DEFAULT,
&ms_alpd3dPDTVB[i], nullptr)
))
return false;
@@ -626,19 +638,20 @@ bool CGraphicDevice::__CreateDefaultIndexBuffer(UINT eDefIB, UINT uIdxCount, con
{
assert(ms_alpd3dDefIB[eDefIB]==NULL);
if (FAILED(
ms_lpd3dDevice->CreateIndexBuffer(
sizeof(WORD)*uIdxCount,
D3DUSAGE_WRITEONLY,
D3DFMT_INDEX16,
D3DPOOL_MANAGED,
&ms_alpd3dDefIB[eDefIB], nullptr)
)) return false;
auto hr = ms_lpd3dDevice->CreateIndexBuffer(
sizeof(WORD)*uIdxCount,
D3DUSAGE_WRITEONLY,
D3DFMT_INDEX16,
D3DPOOL_DEFAULT,
&ms_alpd3dDefIB[eDefIB], nullptr
);
if (FAILED(hr))
return false;
WORD* dstIndices;
if (FAILED(
ms_alpd3dDefIB[eDefIB]->Lock(0, 0, (void**)&dstIndices, 0)
)) return false;
hr = ms_alpd3dDefIB[eDefIB]->Lock(0, 0, (void**)&dstIndices, 0);
if (FAILED(hr))
return false;
memcpy(dstIndices, c_awIndices, sizeof(WORD)*uIdxCount);

View File

@@ -48,7 +48,7 @@ bool CGraphicImageTexture::CreateDeviceObjects()
if (m_stFileName.empty())
{
// 폰트 텍스쳐
if (FAILED(ms_lpd3dDevice->CreateTexture(m_width, m_height, 1, 0, m_d3dFmt, D3DPOOL_MANAGED, &m_lpd3dTexture, nullptr)))
if (FAILED(ms_lpd3dDevice->CreateTexture(m_width, m_height, 1, D3DUSAGE_DYNAMIC, m_d3dFmt, D3DPOOL_DEFAULT, &m_lpd3dTexture, nullptr)))
return false;
}
else
@@ -96,7 +96,7 @@ void CGraphicImageTexture::CreateFromTexturePointer(const CGraphicTexture* c_pSr
bool CGraphicImageTexture::CreateFromDDSTexture(UINT bufSize, const void* c_pvBuf)
{
if (FAILED(DirectX::CreateDDSTextureFromMemoryEx(ms_lpd3dDevice, reinterpret_cast<const uint8_t*>(c_pvBuf), bufSize, 0, D3DPOOL_MANAGED, false, &m_lpd3dTexture)))
if (FAILED(DirectX::CreateDDSTextureFromMemoryEx(ms_lpd3dDevice, reinterpret_cast<const uint8_t*>(c_pvBuf), bufSize, 0, D3DPOOL_DEFAULT, false, &m_lpd3dTexture)))
return false;
D3DSURFACE_DESC desc;
@@ -113,7 +113,7 @@ bool CGraphicImageTexture::CreateFromSTB(UINT bufSize, const void* c_pvBuf)
unsigned char* data = stbi_load_from_memory((stbi_uc*)c_pvBuf, bufSize, &width, &height, &channels, 4); // force RGBA
if (data) {
LPDIRECT3DTEXTURE9 texture;
if (SUCCEEDED(ms_lpd3dDevice->CreateTexture(width, height, 1, 0, channels == 4 ? D3DFMT_A8R8G8B8 : D3DFMT_X8R8G8B8, D3DPOOL_MANAGED, &texture, nullptr))) {
if (SUCCEEDED(ms_lpd3dDevice->CreateTexture(width, height, 1, 0, channels == 4 ? D3DFMT_A8R8G8B8 : D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &texture, nullptr))) {
D3DLOCKED_RECT rect;
if (SUCCEEDED(texture->LockRect(0, &rect, nullptr, 0))) {
uint8_t* dstData = (uint8_t*)rect.pBits;
@@ -153,7 +153,7 @@ bool CGraphicImageTexture::CreateFromMemoryFile(UINT bufSize, const void * c_pvB
D3DXIMAGE_INFO imageInfo;
if (FAILED(D3DXCreateTextureFromFileInMemoryEx(ms_lpd3dDevice, c_pvBuf, bufSize
, D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT, 0, d3dFmt, D3DPOOL_MANAGED
, D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT, 0, d3dFmt, D3DPOOL_DEFAULT
, dwFilter, dwFilter, 0xffff00ff, &imageInfo, NULL, &m_lpd3dTexture))) {
TraceError("CreateFromMemoryFile: Cannot create texture");
return false;
@@ -188,7 +188,7 @@ bool CGraphicImageTexture::CreateFromMemoryFile(UINT bufSize, const void * c_pvB
if (SUCCEEDED(D3DXCreateTexture(ms_lpd3dDevice
, imageInfo.Width >> uTexBias, imageInfo.Height >> uTexBias
, imageInfo.MipLevels, 0, format, D3DPOOL_MANAGED, &pkTexDst))) {
, imageInfo.MipLevels, 0, format, D3DPOOL_DEFAULT, &pkTexDst))) {
m_lpd3dTexture = pkTexDst;
for (int i = 0; i < imageInfo.MipLevels; ++i) {

View File

@@ -106,7 +106,7 @@ bool CGraphicIndexBuffer::CreateDeviceObjects()
m_dwBufferSize,
D3DUSAGE_WRITEONLY,
m_d3dFmt,
D3DPOOL_MANAGED,
D3DPOOL_DEFAULT,
&m_lpd3dIdxBuf,
NULL)
))

View File

@@ -630,7 +630,7 @@ BOOL CScreen::IsLostDevice()
if (!ms_lpd3dDevice)
return TRUE;
IDirect3DDevice9 & rkD3DDev = *ms_lpd3dDevice;
IDirect3DDevice9Ex & rkD3DDev = *ms_lpd3dDevice;
HRESULT hrTestCooperativeLevel = rkD3DDev.TestCooperativeLevel();
if (FAILED(hrTestCooperativeLevel))
return TRUE;
@@ -643,8 +643,8 @@ BOOL CScreen::RestoreDevice()
if (!ms_lpd3dDevice)
return FALSE;
IDirect3D9& rkD3D = *ms_lpd3d;
IDirect3DDevice9& rkD3DDev = *ms_lpd3dDevice;
IDirect3D9Ex& rkD3D = *ms_lpd3d;
IDirect3DDevice9Ex& rkD3DDev = *ms_lpd3dDevice;
D3DPRESENT_PARAMETERS& rkD3DPP = ms_d3dPresentParameter;
HRESULT hrTestCooperativeLevel = rkD3DDev.TestCooperativeLevel();

View File

@@ -3,8 +3,8 @@
bool CStaticVertexBuffer::Create(int vtxCount, DWORD fvf, bool /*isManaged*/)
{
// 무조건 MANAGED 모드
return CGraphicVertexBuffer::Create(vtxCount, fvf, D3DUSAGE_WRITEONLY, D3DPOOL_MANAGED);
// DirectX 9Ex: Use DEFAULT pool instead of MANAGED
return CGraphicVertexBuffer::Create(vtxCount, fvf, D3DUSAGE_WRITEONLY, D3DPOOL_DEFAULT);
}
CStaticVertexBuffer::CStaticVertexBuffer()

View File

@@ -2,6 +2,7 @@
#include "NetStream.h"
//#include "eterCrypt.h"
#include <iomanip>
#include <sstream>
#ifndef _IMPROVED_PACKET_ENCRYPTION_
#include "EterBase/tea.h"

View File

@@ -51,7 +51,7 @@ void CStateManager::EndScene()
m_bScene = false;
}
CStateManager::CStateManager(LPDIRECT3DDEVICE9 lpDevice) : m_lpD3DDev(NULL)
CStateManager::CStateManager(LPDIRECT3DDEVICE9EX lpDevice) : m_lpD3DDev(NULL)
{
m_bScene = false;
m_dwBestMinFilter = D3DTEXF_ANISOTROPIC;
@@ -77,7 +77,7 @@ CStateManager::~CStateManager()
}
}
void CStateManager::SetDevice(LPDIRECT3DDEVICE9 lpDevice)
void CStateManager::SetDevice(LPDIRECT3DDEVICE9EX lpDevice)
{
StateManager_Assert(lpDevice);
lpDevice->AddRef();
@@ -441,7 +441,7 @@ void CStateManager::StateManager_Apply()
m_CurrentState = m_CurrentState_Copy;
}
LPDIRECT3DDEVICE9 CStateManager::GetDevice()
LPDIRECT3DDEVICE9EX CStateManager::GetDevice()
{
return m_lpD3DDev;
}

View File

@@ -226,7 +226,7 @@ public:
class CStateManager : public CSingleton<CStateManager>
{
public:
CStateManager(LPDIRECT3DDEVICE9 lpDevice);
CStateManager(LPDIRECT3DDEVICE9EX lpDevice);
virtual ~CStateManager();
void SetDefaultState();
@@ -333,7 +333,7 @@ public:
void StateManager_Capture();
void StateManager_Apply();
LPDIRECT3DDEVICE9 GetDevice();
LPDIRECT3DDEVICE9EX GetDevice();
#ifdef _DEBUG
void ResetDrawCallCounter();
@@ -341,7 +341,7 @@ public:
#endif
private:
void SetDevice(LPDIRECT3DDEVICE9 lpDevice);
void SetDevice(LPDIRECT3DDEVICE9EX lpDevice);
private:
@@ -352,7 +352,7 @@ private:
bool m_bScene;
DWORD m_dwBestMinFilter;
DWORD m_dwBestMagFilter;
LPDIRECT3DDEVICE9 m_lpD3DDev;
LPDIRECT3DDEVICE9EX m_lpD3DDev;
std::vector<DWORD> m_RenderStateStack[STATEMANAGER_MAX_RENDERSTATES];
std::vector<DWORD> m_SamplerStateStack[STATEMANAGER_MAX_STAGES][STATEMANAGER_MAX_TEXTURESTATES];

View File

@@ -9,7 +9,7 @@ void CPythonGraphic::Destroy()
{
}
LPDIRECT3D9 CPythonGraphic::GetD3D()
LPDIRECT3D9EX CPythonGraphic::GetD3D()
{
return ms_lpd3d;
}

View File

@@ -18,7 +18,7 @@ class CPythonGraphic : public CScreen, public CSingleton<CPythonGraphic>
void PushState();
void PopState();
LPDIRECT3D9 GetD3D();
LPDIRECT3D9EX GetD3D();
float GetOrthoDepth();
void SetInterfaceRenderState();

View File

@@ -782,11 +782,11 @@ LPDIRECT3DTEXTURE9 CTerrain::AddTexture32(BYTE byImageNum, BYTE * pbyImage, long
UINT uiNewWidth = 256;
UINT uiNewHeight = 256;
hr = ms_lpd3dDevice->CreateTexture(
uiNewWidth, uiNewHeight, 5, 0,
format, D3DPOOL_MANAGED, &pkTex, nullptr);
uiNewWidth, uiNewHeight, 5, D3DUSAGE_DYNAMIC,
format, D3DPOOL_DEFAULT, &pkTex, nullptr);
if (FAILED(hr))
{
TraceError("CTerrain::AddTexture32 - CreateTexture Error");
TraceError("CTerrain::AddTexture32 - CreateTexture failed with hr=%p", hr);
return NULL;
}
@@ -1153,7 +1153,7 @@ void CTerrain::AllocateMarkedSplats(BYTE * pbyAlphaMap)
do
{
hr = ms_lpd3dDevice->CreateTexture(ATTRMAP_XSIZE, ATTRMAP_YSIZE, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &m_lpMarkedTexture, nullptr);
hr = ms_lpd3dDevice->CreateTexture(ATTRMAP_XSIZE, ATTRMAP_YSIZE, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &m_lpMarkedTexture, nullptr);
} while(FAILED(hr));
D3DLOCKED_RECT d3dlr;

View File

@@ -224,10 +224,10 @@ bool CDungeonBlock::Load(const char * c_szFileName)
DWORD dwVertexCount = pModelInstance->GetVertexCount();
m_kDeformableVertexBuffer.Destroy();
m_kDeformableVertexBuffer.Create(
dwVertexCount,
D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1,
D3DUSAGE_WRITEONLY,
D3DPOOL_MANAGED);
dwVertexCount,
D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1,
D3DUSAGE_DYNAMIC,
D3DPOOL_DEFAULT);
m_ModelInstanceContainer.push_back(pModelInstance);
}

View File

@@ -676,10 +676,10 @@ bool CMapOutdoor::__SoftwareTransformPatch_Create()
assert(NULL==m_kSTPD.m_pkVBSplat[uIndex]);
if (FAILED(
ms_lpd3dDevice->CreateVertexBuffer(
sizeof(SoftwareTransformPatch_SSplatVertex)*CTerrainPatch::TERRAIN_VERTEX_COUNT,
D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_SPECULAR|D3DFVF_TEX2,
D3DPOOL_SYSTEMMEM,
sizeof(SoftwareTransformPatch_SSplatVertex)*CTerrainPatch::TERRAIN_VERTEX_COUNT,
D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_SPECULAR|D3DFVF_TEX2,
D3DPOOL_DEFAULT,
&m_kSTPD.m_pkVBSplat[uIndex],
nullptr
)
@@ -693,10 +693,10 @@ bool CMapOutdoor::__SoftwareTransformPatch_Create()
assert(NULL==m_kSTPD.m_pkVBNone[uIndex]);
if (FAILED(
ms_lpd3dDevice->CreateVertexBuffer(
sizeof(SoftwareTransformPatch_STVertex)*CTerrainPatch::TERRAIN_VERTEX_COUNT,
D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
D3DFVF_XYZRHW,
D3DPOOL_SYSTEMMEM,
sizeof(SoftwareTransformPatch_STVertex)*CTerrainPatch::TERRAIN_VERTEX_COUNT,
D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
D3DFVF_XYZRHW,
D3DPOOL_DEFAULT,
&m_kSTPD.m_pkVBNone[uIndex],
nullptr
)

View File

@@ -257,14 +257,14 @@ bool CSnowEnvironment::__CreateGeometry()
if (FAILED(ms_lpd3dDevice->CreateVertexBuffer(sizeof(SParticleVertex) * m_dwParticleMaxNum * 4,
D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY,
D3DFVF_XYZ | D3DFVF_TEX1,
D3DPOOL_SYSTEMMEM,
D3DPOOL_DEFAULT,
&m_pVB, nullptr)))
return false;
if (FAILED(ms_lpd3dDevice->CreateIndexBuffer(sizeof(WORD) * m_dwParticleMaxNum * 6,
D3DUSAGE_WRITEONLY,
D3DUSAGE_DYNAMIC,
D3DFMT_INDEX16,
D3DPOOL_MANAGED,
D3DPOOL_DEFAULT,
&m_pIB, nullptr)))
return false;

View File

@@ -64,7 +64,7 @@ void CTerrainPatch::BuildWaterVertexBuffer(SWaterVertex* akSrcVertex, UINT uWate
{
CGraphicVertexBuffer& rkVB=m_WaterVertexBuffer;
if (!rkVB.Create(uWaterVertexCount, D3DFVF_XYZ | D3DFVF_DIFFUSE, D3DUSAGE_WRITEONLY, D3DPOOL_MANAGED))
if (!rkVB.Create(uWaterVertexCount, D3DFVF_XYZ | D3DFVF_DIFFUSE, D3DUSAGE_DYNAMIC, D3DPOOL_DEFAULT))
return;
SWaterVertex* akDstWaterVertex;
@@ -104,7 +104,7 @@ void CTerrainPatch::__BuildHardwareTerrainVertexBuffer(HardwareTransformPatch_SS
{
CGraphicVertexBuffer& rkVB=m_kHT.m_kVB;
if (!rkVB.Create(TERRAIN_VERTEX_COUNT, D3DFVF_XYZ | D3DFVF_NORMAL, D3DUSAGE_WRITEONLY, D3DPOOL_MANAGED))
if (!rkVB.Create(TERRAIN_VERTEX_COUNT, D3DFVF_XYZ | D3DFVF_NORMAL, D3DUSAGE_DYNAMIC, D3DPOOL_DEFAULT))
return;
HardwareTransformPatch_SSourceVertex* akDstVertex;

View File

@@ -99,7 +99,7 @@ void CSpeedTreeWrapper::OnRenderPCBlocker()
CSpeedTreeForestDirectX8::Instance().UpdateSystem(ELTimer_GetMSec() / 1000.0f);
// 하나만 렌더링 할 때는 LOD 사용하지 않음
// <EFBFBD>ϳ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> LOD <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
m_pSpeedTree->SetLodLevel(1.0f);
//Advance();
@@ -242,7 +242,7 @@ void CSpeedTreeWrapper::OnRender()
CSpeedTreeForestDirectX8::Instance().UpdateSystem(ELTimer_GetMSec() / 1000.0f);
// 하나만 렌더링 할 때는 LOD 사용하지 않음
// <EFBFBD>ϳ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> LOD <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
m_pSpeedTree->SetLodLevel(1.0f);
//Advance();
@@ -487,11 +487,11 @@ void CSpeedTreeWrapper::SetupBranchBuffers(void)
SFVFBranchVertex * pVertexBuffer = NULL;
#ifndef WRAPPER_USE_CPU_WIND
ms_lpd3dDevice->CreateVertexBuffer(m_unBranchVertexCount * sizeof(SFVFBranchVertex), D3DUSAGE_WRITEONLY, D3DFVF_SPEEDTREE_BRANCH_VERTEX, D3DPOOL_MANAGED, &m_pBranchVertexBuffer, NULL);
ms_lpd3dDevice->CreateVertexBuffer(m_unBranchVertexCount * sizeof(SFVFBranchVertex), D3DUSAGE_WRITEONLY, D3DFVF_SPEEDTREE_BRANCH_VERTEX, D3DPOOL_DEFAULT, &m_pBranchVertexBuffer, NULL);
// fill the vertex buffer by interleaving SpeedTree data
m_pBranchVertexBuffer->Lock(0, 0, reinterpret_cast<void**>(&pVertexBuffer), 0);
#else
ms_lpd3dDevice->CreateVertexBuffer(m_unBranchVertexCount * sizeof(SFVFBranchVertex), D3DUSAGE_DYNAMIC, D3DFVF_SPEEDTREE_BRANCH_VERTEX, D3DPOOL_SYSTEMMEM, &m_pBranchVertexBuffer, NULL);
ms_lpd3dDevice->CreateVertexBuffer(m_unBranchVertexCount * sizeof(SFVFBranchVertex), D3DUSAGE_DYNAMIC, D3DFVF_SPEEDTREE_BRANCH_VERTEX, D3DPOOL_DEFAULT, &m_pBranchVertexBuffer, NULL);
// fill the vertex buffer by interleaving SpeedTree data
m_pBranchVertexBuffer->Lock(0, 0, reinterpret_cast<void**>(&pVertexBuffer), D3DLOCK_DISCARD | D3DLOCK_NOSYSLOCK);
#endif
@@ -548,7 +548,7 @@ void CSpeedTreeWrapper::SetupBranchBuffers(void)
// the first LOD level contains the most indices of all the levels, so
// we use its size to allocate the index buffer
ms_lpd3dDevice->CreateIndexBuffer(m_pBranchIndexCounts[0] * sizeof(unsigned short), D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_MANAGED, &m_pBranchIndexBuffer, NULL);
ms_lpd3dDevice->CreateIndexBuffer(m_pBranchIndexCounts[0] * sizeof(unsigned short), D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_DEFAULT, &m_pBranchIndexBuffer, NULL);
// fill the index buffer
unsigned short* pIndexBuffer = NULL;
@@ -574,11 +574,11 @@ void CSpeedTreeWrapper::SetupFrondBuffers(void)
// create the vertex buffer for storing frond vertices
SFVFBranchVertex * pVertexBuffer = NULL;
#ifndef WRAPPER_USE_CPU_WIND
ms_lpd3dDevice->CreateVertexBuffer(m_unFrondVertexCount * sizeof(SFVFBranchVertex), D3DUSAGE_WRITEONLY, D3DFVF_SPEEDTREE_BRANCH_VERTEX, D3DPOOL_MANAGED, &m_pFrondVertexBuffer, NULL);
ms_lpd3dDevice->CreateVertexBuffer(m_unFrondVertexCount * sizeof(SFVFBranchVertex), D3DUSAGE_WRITEONLY, D3DFVF_SPEEDTREE_BRANCH_VERTEX, D3DPOOL_DEFAULT, &m_pFrondVertexBuffer, NULL);
// fill the vertex buffer by interleaving SpeedTree data
m_pFrondVertexBuffer->Lock(0, 0, reinterpret_cast<void**>(&pVertexBuffer), 0);
#else
ms_lpd3dDevice->CreateVertexBuffer(m_unFrondVertexCount * sizeof(SFVFBranchVertex), D3DUSAGE_DYNAMIC, D3DFVF_SPEEDTREE_BRANCH_VERTEX, D3DPOOL_SYSTEMMEM, &m_pFrondVertexBuffer, NULL);
ms_lpd3dDevice->CreateVertexBuffer(m_unFrondVertexCount * sizeof(SFVFBranchVertex), D3DUSAGE_DYNAMIC, D3DFVF_SPEEDTREE_BRANCH_VERTEX, D3DPOOL_DEFAULT, &m_pFrondVertexBuffer, NULL);
// fill the vertex buffer by interleaving SpeedTree data
m_pFrondVertexBuffer->Lock(0, 0, reinterpret_cast<void**>(&pVertexBuffer), D3DLOCK_DISCARD | D3DLOCK_NOSYSLOCK);
#endif
@@ -633,7 +633,7 @@ void CSpeedTreeWrapper::SetupFrondBuffers(void)
// the first LOD level contains the most indices of all the levels, so
// we use its size to allocate the index buffer
ms_lpd3dDevice->CreateIndexBuffer(m_pFrondIndexCounts[0] * sizeof(unsigned short), D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_MANAGED, &m_pFrondIndexBuffer, NULL);
ms_lpd3dDevice->CreateIndexBuffer(m_pFrondIndexCounts[0] * sizeof(unsigned short), D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_DEFAULT, &m_pFrondIndexBuffer, NULL);
// fill the index buffer
unsigned short * pIndexBuffer = NULL;
@@ -677,11 +677,11 @@ void CSpeedTreeWrapper::SetupLeafBuffers(void)
SFVFLeafVertex* pVertexBuffer = NULL;
// create the vertex buffer for storing leaf vertices
#ifndef WRAPPER_USE_CPU_LEAF_PLACEMENT
ms_lpd3dDevice->CreateVertexBuffer(usLeafCount * 6 * sizeof(SFVFLeafVertex), D3DUSAGE_WRITEONLY, D3DFVF_SPEEDTREE_LEAF_VERTEX, D3DPOOL_MANAGED, &m_pLeafVertexBuffer[unLod], nullptr);
ms_lpd3dDevice->CreateVertexBuffer(usLeafCount * 6 * sizeof(SFVFLeafVertex), D3DUSAGE_WRITEONLY, D3DFVF_SPEEDTREE_LEAF_VERTEX, D3DPOOL_DEFAULT, &m_pLeafVertexBuffer[unLod], nullptr);
// fill the vertex buffer by interleaving SpeedTree data
m_pLeafVertexBuffer[unLod]->Lock(0, 0, reinterpret_cast<void**>(&pVertexBuffer), 0);
#else
ms_lpd3dDevice->CreateVertexBuffer(usLeafCount * 6 * sizeof(SFVFLeafVertex), D3DUSAGE_DYNAMIC, D3DFVF_SPEEDTREE_LEAF_VERTEX, D3DPOOL_SYSTEMMEM, &m_pLeafVertexBuffer[unLod], NULL);
ms_lpd3dDevice->CreateVertexBuffer(usLeafCount * 6 * sizeof(SFVFLeafVertex), D3DUSAGE_DYNAMIC, D3DFVF_SPEEDTREE_LEAF_VERTEX, D3DPOOL_DEFAULT, &m_pLeafVertexBuffer[unLod], NULL);
// fill the vertex buffer by interleaving SpeedTree data
m_pLeafVertexBuffer[unLod]->Lock(0, 0, reinterpret_cast<void**>(&pVertexBuffer), D3DLOCK_DISCARD | D3DLOCK_NOSYSLOCK);
#endif

View File

@@ -576,7 +576,7 @@ bool CPythonMiniMap::Create()
LPMINIMAPVERTEX lpOrigMiniMapVertex;
#pragma pack(pop)
if (!m_VertexBuffer.Create(36, D3DFVF_XYZ | D3DFVF_TEX1, D3DUSAGE_WRITEONLY, D3DPOOL_MANAGED) )
if (!m_VertexBuffer.Create(36, D3DFVF_XYZ | D3DFVF_TEX1, D3DUSAGE_DYNAMIC, D3DPOOL_DEFAULT) )
{
return false;
}

View File

@@ -36,7 +36,7 @@ void CPythonSystem::GetDisplaySettings()
memset(m_ResolutionList, 0, sizeof(TResolution) * RESOLUTION_MAX_NUM);
m_ResolutionCount = 0;
LPDIRECT3D9 lpD3D = CPythonGraphic::Instance().GetD3D();
LPDIRECT3D9EX lpD3D = CPythonGraphic::Instance().GetD3D();
D3DADAPTER_IDENTIFIER9 d3dAdapterIdentifier;
D3DDISPLAYMODE d3ddmDesktop;