Eliminated D3DADAPTER_IDENTIFIER9 uses.
TRAC #21963
Signed-off-by: Daniel Koch
Author: Nicolas Capens
git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1356 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index bf780d8..79fad65 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -2056,8 +2056,7 @@
GLint alwaysFront = !isTriangleMode(drawMode);
programBinary->setUniform1iv(pointsOrLines, 1, &alwaysFront);
- D3DADAPTER_IDENTIFIER9 *identifier = mRenderer->getAdapterIdentifier();
- bool zeroColorMaskAllowed = identifier->VendorId != 0x1002;
+ bool zeroColorMaskAllowed = mRenderer->getAdapterVendor() != VENDOR_ID_AMD;
// Apparently some ATI cards have a bug where a draw with a zero color
// write mask can cause later draws to have incorrect results. Instead,
// set a nonzero color write mask but modify the blend state so that no
@@ -3893,10 +3892,8 @@
void Context::initRendererString()
{
- D3DADAPTER_IDENTIFIER9 *identifier = mRenderer->getAdapterIdentifier();
-
mRendererString = "ANGLE (";
- mRendererString += identifier->Description;
+ mRendererString += mRenderer->getAdapterDescription();
mRendererString += ")";
}
diff --git a/src/libGLESv2/ProgramBinary.cpp b/src/libGLESv2/ProgramBinary.cpp
index b0e541e..af0d16c 100644
--- a/src/libGLESv2/ProgramBinary.cpp
+++ b/src/libGLESv2/ProgramBinary.cpp
@@ -1746,9 +1746,8 @@
const D3DCAPS9 *binaryIdentifier = (const D3DCAPS9*) ptr;
ptr += sizeof(GUID);
- // D3D9_REPLACE
- D3DADAPTER_IDENTIFIER9 *currentIdentifier = mRenderer->getAdapterIdentifier();
- if (memcmp(¤tIdentifier->DeviceIdentifier, binaryIdentifier, sizeof(GUID)) != 0)
+ GUID identifier = mRenderer->getAdapterIdentifier();
+ if (memcmp(&identifier, binaryIdentifier, sizeof(GUID)) != 0)
{
infoLog.append("Invalid program binary.");
return false;
@@ -1853,8 +1852,7 @@
ASSERT(SUCCEEDED(result));
stream.write(vertexShaderSize);
- // D3D9_REPLACE
- D3DADAPTER_IDENTIFIER9 *identifier = mRenderer->getAdapterIdentifier();
+ GUID identifier = mRenderer->getAdapterIdentifier();
GLsizei streamLength = stream.length();
const void *streamData = stream.data();
@@ -1877,7 +1875,7 @@
memcpy(ptr, streamData, streamLength);
ptr += streamLength;
- memcpy(ptr, &identifier->DeviceIdentifier, sizeof(GUID));
+ memcpy(ptr, &identifier, sizeof(GUID));
ptr += sizeof(GUID);
result = mPixelExecutable->GetFunction(ptr, &pixelShaderSize);
diff --git a/src/libGLESv2/renderer/Renderer.cpp b/src/libGLESv2/renderer/Renderer.cpp
index 219afc9..a46a823 100644
--- a/src/libGLESv2/renderer/Renderer.cpp
+++ b/src/libGLESv2/renderer/Renderer.cpp
@@ -683,6 +683,21 @@
return true;
}
+DWORD Renderer::getAdapterVendor() const
+{
+ return mAdapterIdentifier.VendorId;
+}
+
+const char *Renderer::getAdapterDescription() const
+{
+ return mAdapterIdentifier.Description;
+}
+
+GUID Renderer::getAdapterIdentifier() const
+{
+ return mAdapterIdentifier.DeviceIdentifier;
+}
+
void Renderer::getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray)
{
for (int multiSampleIndex = 0; multiSampleIndex <= D3DMULTISAMPLE_16_SAMPLES; multiSampleIndex++)
diff --git a/src/libGLESv2/renderer/Renderer.h b/src/libGLESv2/renderer/Renderer.h
index 347829f..6564bff 100644
--- a/src/libGLESv2/renderer/Renderer.h
+++ b/src/libGLESv2/renderer/Renderer.h
@@ -102,7 +102,9 @@
// Renderer capabilities
virtual IDirect3DDevice9 *getDevice() {return mDevice;}; // D3D9_REPLACE
- virtual D3DADAPTER_IDENTIFIER9 *getAdapterIdentifier() {return &mAdapterIdentifier;}; // D3D9_REPLACE
+ virtual DWORD getAdapterVendor() const;
+ virtual const char *getAdapterDescription() const;
+ virtual GUID getAdapterIdentifier() const;
virtual bool isD3d9ExDevice() const { return mD3d9Ex != NULL; } // D3D9_REMOVE
virtual bool getDXT1TextureSupport();
diff --git a/src/libGLESv2/renderer/SwapChain.cpp b/src/libGLESv2/renderer/SwapChain.cpp
index c474933..339ff18 100644
--- a/src/libGLESv2/renderer/SwapChain.cpp
+++ b/src/libGLESv2/renderer/SwapChain.cpp
@@ -209,8 +209,7 @@
//
// Some non-switchable AMD GPUs / drivers do not respect the source rectangle to Present. Therefore, when the vendor ID
// is not Intel, the back buffer width must be exactly the same width as the window or horizontal scaling will occur.
- D3DADAPTER_IDENTIFIER9* adapterIdentifier = mRenderer->getAdapterIdentifier();
- if (adapterIdentifier->VendorId == VENDOR_ID_INTEL)
+ if (mRenderer->getAdapterVendor() == VENDOR_ID_INTEL)
{
presentParameters.BackBufferWidth = (presentParameters.BackBufferWidth + 63) / 64 * 64;
}