Tighten the workaround for B5G6R5 on Intel drivers

This driver bug has been fixed in 20.19.15.4539.

BUG=chromium:644610
TEST=dEQP-GLES3.functional.fbo.blit.default_framebuffer.rgb565*

Change-Id: I37556304ed4f70771fb88b792c01b6be5b3aa294
Reviewed-on: https://chromium-review.googlesource.com/424103
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Qin Jiajia 2016-12-26 13:12:22 +08:00 коммит произвёл Commit Bot
Родитель 4021932f25
Коммит 4af4951ff9
4 изменённых файлов: 80 добавлений и 21 удалений

Просмотреть файл

@ -83,7 +83,7 @@ struct WorkaroundsD3D
// In Intel driver, the data with format DXGI_FORMAT_B5G6R5_UNORM will be parsed incorrectly.
// This workaroud will disable B5G6R5 support when it's Intel driver. By default, it will use
// R8G8B8A8 format.
// R8G8B8A8 format. This bug is fixed in version 4539 on Intel drivers.
bool disableB5G6R5Support = false;
// On some Intel drivers, evaluating unary minus operator on integer may get wrong answer in

Просмотреть файл

@ -980,6 +980,18 @@ size_t GetMaximumStreamOutputSeparateComponents(D3D_FEATURE_LEVEL featureLevel)
}
}
IntelDriverVersion GetIntelDriverVersion(const Optional<LARGE_INTEGER> driverVersion)
{
if (!driverVersion.valid())
return IntelDriverVersion(0);
// According to http://www.intel.com/content/www/us/en/support/graphics-drivers/000005654.html,
// only the fourth part is necessary since it stands for the driver specific unique version
// number.
WORD part = LOWORD(driverVersion.value().LowPart);
return IntelDriverVersion(part);
}
} // anonymous namespace
unsigned int GetReservedVertexUniformVectors(D3D_FEATURE_LEVEL featureLevel)
@ -1853,28 +1865,22 @@ angle::WorkaroundsD3D GenerateWorkarounds(const Renderer11DeviceCaps &deviceCaps
workarounds.flushAfterEndingTransformFeedback = IsNvidia(adapterDesc.VendorId);
workarounds.getDimensionsIgnoresBaseLevel = IsNvidia(adapterDesc.VendorId);
workarounds.preAddTexelFetchOffsets = IsIntel(adapterDesc.VendorId);
workarounds.disableB5G6R5Support = IsIntel(adapterDesc.VendorId);
workarounds.rewriteUnaryMinusOperator =
IsIntel(adapterDesc.VendorId) &&
(IsBroadwell(adapterDesc.DeviceId) || IsHaswell(adapterDesc.DeviceId));
if (IsIntel(adapterDesc.VendorId) && IsSkylake(adapterDesc.DeviceId))
if (IsIntel(adapterDesc.VendorId))
{
if (deviceCaps.driverVersion.valid())
workarounds.preAddTexelFetchOffsets = true;
workarounds.useSystemMemoryForConstantBuffers = true;
workarounds.disableB5G6R5Support =
d3d11_gl::GetIntelDriverVersion(deviceCaps.driverVersion) < IntelDriverVersion(4539);
if (IsSkylake(adapterDesc.DeviceId))
{
WORD part1 = HIWORD(deviceCaps.driverVersion.value().LowPart);
WORD part2 = LOWORD(deviceCaps.driverVersion.value().LowPart);
// Disable the workaround on the new fixed driver.
workarounds.emulateIsnanFloat = part1 <= 16u && part2 < 4542u;
}
else
{
workarounds.emulateIsnanFloat = true;
workarounds.callClearTwiceOnSmallTarget = true;
workarounds.emulateIsnanFloat =
d3d11_gl::GetIntelDriverVersion(deviceCaps.driverVersion) <
IntelDriverVersion(4542);
}
workarounds.rewriteUnaryMinusOperator =
IsBroadwell(adapterDesc.DeviceId) || IsHaswell(adapterDesc.DeviceId);
}
workarounds.callClearTwiceOnSmallTarget =
IsIntel(adapterDesc.VendorId) && IsSkylake(adapterDesc.DeviceId);
// TODO(jmadill): Disable when we have a fixed driver version.
workarounds.emulateTinyStencilTextures = IsAMD(adapterDesc.VendorId);
@ -1888,8 +1894,6 @@ angle::WorkaroundsD3D GenerateWorkarounds(const Renderer11DeviceCaps &deviceCaps
workarounds.emulateTinyStencilTextures = false;
}
workarounds.useSystemMemoryForConstantBuffers = IsIntel(adapterDesc.VendorId);
// Call platform hooks for testing overrides.
ANGLEPlatformCurrent()->overrideWorkaroundsD3D(&workarounds);

Просмотреть файл

@ -47,6 +47,45 @@ const uint32_t Kabylake[] = {0x5916, 0x5913, 0x5906, 0x5926, 0x5921, 0x5915, 0x5
} // anonymous namespace
IntelDriverVersion::IntelDriverVersion(uint16_t lastPart) : mVersionPart(lastPart)
{
}
bool IntelDriverVersion::operator==(const IntelDriverVersion &version)
{
return mVersionPart == version.mVersionPart;
}
bool IntelDriverVersion::operator!=(const IntelDriverVersion &version)
{
return !(*this == version);
}
bool IntelDriverVersion::operator<(const IntelDriverVersion &version)
{
// See http://www.intel.com/content/www/us/en/support/graphics-drivers/000005654.html to
// understand the Intel graphics driver version number on Windows.
// mVersionPart1 changes with OS version. mVersionPart2 changes with DirectX version.
// mVersionPart3 stands for release year. mVersionPart4 is driver specific unique version
// number.
// For example: Intel driver version '20.19.15.4539'
// 20 -> windows 10 driver
// 19 -> DirectX 12 first version(12.0) supported
// 15 -> Driver released in 2015
// 4539 -> Driver specific unique version number
// For linux, Intel graphics driver version is the mesa version. The version number has three
// parts: major revision, minor revision, release number. So, for linux, we need to compare
// three parts.
// Currently, it's only used in windows. So, checking the last part is enough. Once it's needed
// in other platforms, it's easy to be extended.
return mVersionPart < version.mVersionPart;
}
bool IntelDriverVersion::operator>=(const IntelDriverVersion &version)
{
return !(*this < version);
}
bool IsHaswell(uint32_t DeviceId)
{
return std::find(std::begin(Haswell), std::end(Haswell), DeviceId) != std::end(Haswell);

Просмотреть файл

@ -46,6 +46,22 @@ inline bool IsQualcomm(uint32_t vendor_id)
}
// Intel
class IntelDriverVersion
{
public:
// Currently, We only provide the constructor with one parameter. It mainly used in Intel
// version number on windows. If you want to use this class on other platforms, it's easy to
// be extended.
IntelDriverVersion(uint16_t lastPart);
bool operator==(const IntelDriverVersion &);
bool operator!=(const IntelDriverVersion &);
bool operator<(const IntelDriverVersion &);
bool operator>=(const IntelDriverVersion &);
private:
uint16_t mVersionPart;
};
bool IsHaswell(uint32_t DeviceId);
bool IsBroadwell(uint32_t DeviceId);
bool IsCherryView(uint32_t DeviceId);