Commit 55573e13 by Jamie Madill

Use cross-platform enum for Vendor ID.

BUG=angle:795 Change-Id: Ibe9bbb79b92730ba80ca7275528c8b61d5d44c59 Reviewed-on: https://chromium-review.googlesource.com/228914Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 2207213b
...@@ -11,12 +11,12 @@ ...@@ -11,12 +11,12 @@
#include "common/platform.h" #include "common/platform.h"
#include <stddef.h> #include <climits>
#include <limits.h> #include <cstdarg>
#include <cstddef>
#include <string> #include <string>
#include <set> #include <set>
#include <sstream> #include <sstream>
#include <cstdarg>
#include <vector> #include <vector>
// A macro to disallow the copy constructor and operator= functions // A macro to disallow the copy constructor and operator= functions
...@@ -152,10 +152,6 @@ std::string FormatString(const char *fmt, ...); ...@@ -152,10 +152,6 @@ std::string FormatString(const char *fmt, ...);
#define snprintf _snprintf #define snprintf _snprintf
#endif #endif
#define VENDOR_ID_AMD 0x1002
#define VENDOR_ID_INTEL 0x8086
#define VENDOR_ID_NVIDIA 0x10DE
#define GL_BGRA4_ANGLEX 0x6ABC #define GL_BGRA4_ANGLEX 0x6ABC
#define GL_BGR5_A1_ANGLEX 0x6ABD #define GL_BGR5_A1_ANGLEX 0x6ABD
#define GL_INT_64_ANGLEX 0x6ABE #define GL_INT_64_ANGLEX 0x6ABE
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include "libANGLE/Constants.h" #include "libANGLE/Constants.h"
#include "libANGLE/RefCountObject.h" #include "libANGLE/RefCountObject.h"
#include <cstdint>
namespace gl namespace gl
{ {
class Buffer; class Buffer;
...@@ -252,6 +254,13 @@ enum VertexConversionType ...@@ -252,6 +254,13 @@ enum VertexConversionType
VERTEX_CONVERT_BOTH = 3 VERTEX_CONVERT_BOTH = 3
}; };
enum VendorID : uint32_t
{
VENDOR_ID_AMD = 0x1002,
VENDOR_ID_INTEL = 0x8086,
VENDOR_ID_NVIDIA = 0x10DE,
};
} }
#endif // LIBANGLE_ANGLETYPES_H_ #endif // LIBANGLE_ANGLETYPES_H_
...@@ -143,7 +143,7 @@ class Renderer ...@@ -143,7 +143,7 @@ class Renderer
virtual bool testDeviceLost() = 0; virtual bool testDeviceLost() = 0;
virtual bool testDeviceResettable() = 0; virtual bool testDeviceResettable() = 0;
virtual DWORD getAdapterVendor() const = 0; virtual VendorID getVendorId() const = 0;
virtual std::string getRendererDescription() const = 0; virtual std::string getRendererDescription() const = 0;
virtual GUID getAdapterIdentifier() const = 0; virtual GUID getAdapterIdentifier() const = 0;
......
...@@ -1935,9 +1935,9 @@ bool Renderer11::resetDevice() ...@@ -1935,9 +1935,9 @@ bool Renderer11::resetDevice()
return true; return true;
} }
DWORD Renderer11::getAdapterVendor() const VendorID Renderer11::getVendorId() const
{ {
return mAdapterDescription.VendorId; return static_cast<VendorID>(mAdapterDescription.VendorId);
} }
std::string Renderer11::getRendererDescription() const std::string Renderer11::getRendererDescription() const
......
...@@ -102,7 +102,7 @@ class Renderer11 : public RendererD3D ...@@ -102,7 +102,7 @@ class Renderer11 : public RendererD3D
bool testDeviceLost() override; bool testDeviceLost() override;
bool testDeviceResettable() override; bool testDeviceResettable() override;
DWORD getAdapterVendor() const override; VendorID getVendorId() const override;
std::string getRendererDescription() const override; std::string getRendererDescription() const override;
GUID getAdapterIdentifier() const override; GUID getAdapterIdentifier() const override;
......
...@@ -857,7 +857,7 @@ gl::Error Renderer9::setBlendState(const gl::Framebuffer *framebuffer, const gl: ...@@ -857,7 +857,7 @@ gl::Error Renderer9::setBlendState(const gl::Framebuffer *framebuffer, const gl:
GLenum internalFormat = attachment ? attachment->getInternalFormat() : GL_NONE; GLenum internalFormat = attachment ? attachment->getInternalFormat() : GL_NONE;
// Set the color mask // Set the color mask
bool zeroColorMaskAllowed = getAdapterVendor() != VENDOR_ID_AMD; bool zeroColorMaskAllowed = getVendorId() != VENDOR_ID_AMD;
// Apparently some ATI cards have a bug where a draw with a zero color // 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, // 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 // set a nonzero color write mask but modify the blend state so that no
...@@ -2306,9 +2306,9 @@ bool Renderer9::resetRemovedDevice() ...@@ -2306,9 +2306,9 @@ bool Renderer9::resetRemovedDevice()
return (initialize() == EGL_SUCCESS); return (initialize() == EGL_SUCCESS);
} }
DWORD Renderer9::getAdapterVendor() const VendorID Renderer9::getVendorId() const
{ {
return mAdapterIdentifier.VendorId; return static_cast<VendorID>(mAdapterIdentifier.VendorId);
} }
std::string Renderer9::getRendererDescription() const std::string Renderer9::getRendererDescription() const
......
...@@ -103,7 +103,7 @@ class Renderer9 : public RendererD3D ...@@ -103,7 +103,7 @@ class Renderer9 : public RendererD3D
bool testDeviceLost() override; bool testDeviceLost() override;
bool testDeviceResettable() override; bool testDeviceResettable() override;
DWORD getAdapterVendor() const override; VendorID getVendorId() const override;
std::string getRendererDescription() const override; std::string getRendererDescription() const override;
GUID getAdapterIdentifier() const override; GUID getAdapterIdentifier() const override;
......
...@@ -180,7 +180,7 @@ EGLint SwapChain9::reset(int backbufferWidth, int backbufferHeight, EGLint swapI ...@@ -180,7 +180,7 @@ EGLint SwapChain9::reset(int backbufferWidth, int backbufferHeight, EGLint swapI
// //
// Some non-switchable AMD GPUs / drivers do not respect the source rectangle to Present. Therefore, when the vendor ID // 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. // is not Intel, the back buffer width must be exactly the same width as the window or horizontal scaling will occur.
if (mRenderer->getAdapterVendor() == VENDOR_ID_INTEL) if (mRenderer->getVendorId() == VENDOR_ID_INTEL)
{ {
presentParameters.BackBufferWidth = (presentParameters.BackBufferWidth + 63) / 64 * 64; presentParameters.BackBufferWidth = (presentParameters.BackBufferWidth + 63) / 64 * 64;
} }
......
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