Create buffers in the managed pool on Windows XP.

TRAC #14888 Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@527 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 83921386
...@@ -606,6 +606,11 @@ bool Display::getLuminanceAlphaTextureSupport() ...@@ -606,6 +606,11 @@ bool Display::getLuminanceAlphaTextureSupport()
return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_A8L8)); return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_A8L8));
} }
bool Display::isDirect3D9Ex()
{
return mD3d9ex != NULL;
}
bool Display::getEventQuerySupport() bool Display::getEventQuerySupport()
{ {
IDirect3DQuery9 *query; IDirect3DQuery9 *query;
......
...@@ -66,6 +66,7 @@ class Display ...@@ -66,6 +66,7 @@ class Display
virtual bool getHalfFloatTextureSupport(bool *filtering, bool *renderable); virtual bool getHalfFloatTextureSupport(bool *filtering, bool *renderable);
virtual bool getLuminanceTextureSupport(); virtual bool getLuminanceTextureSupport();
virtual bool getLuminanceAlphaTextureSupport(); virtual bool getLuminanceAlphaTextureSupport();
virtual bool isDirect3D9Ex();
private: private:
DISALLOW_COPY_AND_ASSIGN(Display); DISALLOW_COPY_AND_ASSIGN(Display);
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "libGLESv2/Buffer.h" #include "libGLESv2/Buffer.h"
#include "libGLESv2/mathutil.h" #include "libGLESv2/mathutil.h"
#include "libGLESv2/main.h"
namespace namespace
{ {
...@@ -202,7 +203,8 @@ IndexBuffer::IndexBuffer(IDirect3DDevice9 *device, UINT size, D3DFORMAT format) ...@@ -202,7 +203,8 @@ IndexBuffer::IndexBuffer(IDirect3DDevice9 *device, UINT size, D3DFORMAT format)
{ {
if (size > 0) if (size > 0)
{ {
HRESULT result = device->CreateIndexBuffer(size, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, format, D3DPOOL_DEFAULT, &mIndexBuffer, NULL); D3DPOOL pool = getDisplay()->isDirect3D9Ex() ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED;
HRESULT result = device->CreateIndexBuffer(size, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, format, pool, &mIndexBuffer, NULL);
if (FAILED(result)) if (FAILED(result))
{ {
...@@ -274,7 +276,8 @@ void StreamingIndexBuffer::reserveSpace(UINT requiredSpace, GLenum type) ...@@ -274,7 +276,8 @@ void StreamingIndexBuffer::reserveSpace(UINT requiredSpace, GLenum type)
mBufferSize = std::max(requiredSpace, 2 * mBufferSize); mBufferSize = std::max(requiredSpace, 2 * mBufferSize);
HRESULT result = mDevice->CreateIndexBuffer(mBufferSize, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, type == GL_UNSIGNED_INT ? D3DFMT_INDEX32 : D3DFMT_INDEX16, D3DPOOL_DEFAULT, &mIndexBuffer, NULL); D3DPOOL pool = getDisplay()->isDirect3D9Ex() ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED;
HRESULT result = mDevice->CreateIndexBuffer(mBufferSize, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, type == GL_UNSIGNED_INT ? D3DFMT_INDEX32 : D3DFMT_INDEX16, pool, &mIndexBuffer, NULL);
if (FAILED(result)) if (FAILED(result))
{ {
...@@ -326,7 +329,8 @@ void StaticIndexBuffer::reserveSpace(UINT requiredSpace, GLenum type) ...@@ -326,7 +329,8 @@ void StaticIndexBuffer::reserveSpace(UINT requiredSpace, GLenum type)
{ {
if (!mIndexBuffer && mBufferSize == 0) if (!mIndexBuffer && mBufferSize == 0)
{ {
HRESULT result = mDevice->CreateIndexBuffer(requiredSpace, D3DUSAGE_WRITEONLY, type == GL_UNSIGNED_INT ? D3DFMT_INDEX32 : D3DFMT_INDEX16, D3DPOOL_DEFAULT, &mIndexBuffer, NULL); D3DPOOL pool = getDisplay()->isDirect3D9Ex() ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED;
HRESULT result = mDevice->CreateIndexBuffer(requiredSpace, D3DUSAGE_WRITEONLY, type == GL_UNSIGNED_INT ? D3DFMT_INDEX32 : D3DFMT_INDEX16, pool, &mIndexBuffer, NULL);
if (FAILED(result)) if (FAILED(result))
{ {
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "libGLESv2/Buffer.h" #include "libGLESv2/Buffer.h"
#include "libGLESv2/Program.h" #include "libGLESv2/Program.h"
#include "libGLESv2/main.h"
#include "libGLESv2/geometry/vertexconversion.h" #include "libGLESv2/geometry/vertexconversion.h"
#include "libGLESv2/geometry/IndexDataManager.h" #include "libGLESv2/geometry/IndexDataManager.h"
...@@ -529,7 +530,8 @@ VertexBuffer::VertexBuffer(IDirect3DDevice9 *device, std::size_t size, DWORD usa ...@@ -529,7 +530,8 @@ VertexBuffer::VertexBuffer(IDirect3DDevice9 *device, std::size_t size, DWORD usa
{ {
if (size > 0) if (size > 0)
{ {
HRESULT result = device->CreateVertexBuffer(size, usageFlags, 0, D3DPOOL_DEFAULT, &mVertexBuffer, NULL); D3DPOOL pool = getDisplay()->isDirect3D9Ex() ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED;
HRESULT result = device->CreateVertexBuffer(size, usageFlags, 0, pool, &mVertexBuffer, NULL);
if (FAILED(result)) if (FAILED(result))
{ {
...@@ -651,7 +653,9 @@ void StreamingVertexBuffer::reserveRequiredSpace() ...@@ -651,7 +653,9 @@ void StreamingVertexBuffer::reserveRequiredSpace()
} }
mBufferSize = std::max(mRequiredSpace, 3 * mBufferSize / 2); // 1.5 x mBufferSize is arbitrary and should be checked to see we don't have too many reallocations. mBufferSize = std::max(mRequiredSpace, 3 * mBufferSize / 2); // 1.5 x mBufferSize is arbitrary and should be checked to see we don't have too many reallocations.
HRESULT result = mDevice->CreateVertexBuffer(mBufferSize, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &mVertexBuffer, NULL);
D3DPOOL pool = getDisplay()->isDirect3D9Ex() ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED;
HRESULT result = mDevice->CreateVertexBuffer(mBufferSize, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, 0, pool, &mVertexBuffer, NULL);
if (FAILED(result)) if (FAILED(result))
{ {
...@@ -712,7 +716,8 @@ void StaticVertexBuffer::reserveRequiredSpace() ...@@ -712,7 +716,8 @@ void StaticVertexBuffer::reserveRequiredSpace()
{ {
if (!mVertexBuffer && mBufferSize == 0) if (!mVertexBuffer && mBufferSize == 0)
{ {
HRESULT result = mDevice->CreateVertexBuffer(mRequiredSpace, D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &mVertexBuffer, NULL); D3DPOOL pool = getDisplay()->isDirect3D9Ex() ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED;
HRESULT result = mDevice->CreateVertexBuffer(mRequiredSpace, D3DUSAGE_WRITEONLY, 0, pool, &mVertexBuffer, NULL);
if (FAILED(result)) if (FAILED(result))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment