Commit f845a387 by James Darpinian Committed by Commit Bot

Misc. iOS fixes

These fixes are necessary for ANGLE to work on iOS. I made these while updating ANGLE in WebKit. Unless we make an iOS bot, there will likely be small fixes like this every time we roll ANGLE in WebKit. Bug: angleproject:4613 Change-Id: Ia0ed432c82d0a43b9514c26ddb65c168c393d50d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2551537 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org>
parent 040de921
...@@ -35,6 +35,7 @@ SOFT_LINK_FUNCTION_SOURCE(OpenGL, CGLDestroyContext, CGLError, (CGLContextObj ct ...@@ -35,6 +35,7 @@ SOFT_LINK_FUNCTION_SOURCE(OpenGL, CGLDestroyContext, CGLError, (CGLContextObj ct
SOFT_LINK_FUNCTION_SOURCE(OpenGL, CGLDestroyPixelFormat, CGLError, (CGLPixelFormatObj pix), (pix)) SOFT_LINK_FUNCTION_SOURCE(OpenGL, CGLDestroyPixelFormat, CGLError, (CGLPixelFormatObj pix), (pix))
SOFT_LINK_FUNCTION_SOURCE(OpenGL, CGLErrorString, const char *, (CGLError error), (error)) SOFT_LINK_FUNCTION_SOURCE(OpenGL, CGLErrorString, const char *, (CGLError error), (error))
SOFT_LINK_FUNCTION_SOURCE(OpenGL, CGLReleaseContext, void, (CGLContextObj ctx), (ctx)) SOFT_LINK_FUNCTION_SOURCE(OpenGL, CGLReleaseContext, void, (CGLContextObj ctx), (ctx))
SOFT_LINK_FUNCTION_SOURCE(OpenGL, CGLGetCurrentContext, CGLContextObj, (void), ())
SOFT_LINK_FUNCTION_SOURCE(OpenGL, CGLSetCurrentContext, CGLError, (CGLContextObj ctx), (ctx)) SOFT_LINK_FUNCTION_SOURCE(OpenGL, CGLSetCurrentContext, CGLError, (CGLContextObj ctx), (ctx))
SOFT_LINK_FUNCTION_SOURCE(OpenGL, SOFT_LINK_FUNCTION_SOURCE(OpenGL,
CGLSetVirtualScreen, CGLSetVirtualScreen,
......
...@@ -57,6 +57,7 @@ SOFT_LINK_FUNCTION_HEADER(OpenGL, ...@@ -57,6 +57,7 @@ SOFT_LINK_FUNCTION_HEADER(OpenGL,
(GLuint display_mask, CGLRendererInfoObj *rend, GLint *nrend), (GLuint display_mask, CGLRendererInfoObj *rend, GLint *nrend),
(display_mask, rend, nrend)) (display_mask, rend, nrend))
SOFT_LINK_FUNCTION_HEADER(OpenGL, CGLReleaseContext, void, (CGLContextObj ctx), (ctx)) SOFT_LINK_FUNCTION_HEADER(OpenGL, CGLReleaseContext, void, (CGLContextObj ctx), (ctx))
SOFT_LINK_FUNCTION_HEADER(OpenGL, CGLGetCurrentContext, CGLContextObj, (void), ())
SOFT_LINK_FUNCTION_HEADER(OpenGL, CGLSetCurrentContext, CGLError, (CGLContextObj ctx), (ctx)) SOFT_LINK_FUNCTION_HEADER(OpenGL, CGLSetCurrentContext, CGLError, (CGLContextObj ctx), (ctx))
SOFT_LINK_FUNCTION_HEADER(OpenGL, SOFT_LINK_FUNCTION_HEADER(OpenGL,
CGLSetVirtualScreen, CGLSetVirtualScreen,
......
...@@ -47,6 +47,8 @@ std::string VendorName(VendorID vendor) ...@@ -47,6 +47,8 @@ std::string VendorName(VendorID vendor)
return "Vivante"; return "Vivante";
case kVendorID_VMWare: case kVendorID_VMWare:
return "VMWare"; return "VMWare";
case kVendorID_Apple:
return "Apple";
default: default:
return "Unknown (" + std::to_string(vendor) + ")"; return "Unknown (" + std::to_string(vendor) + ")";
} }
...@@ -160,6 +162,11 @@ bool IsVivante(VendorID vendorId) ...@@ -160,6 +162,11 @@ bool IsVivante(VendorID vendorId)
return vendorId == kVendorID_Vivante; return vendorId == kVendorID_Vivante;
} }
bool IsApple(VendorID vendorId)
{
return vendorId == kVendorID_Apple;
}
bool ParseAMDBrahmaDriverVersion(const std::string &content, std::string *version) bool ParseAMDBrahmaDriverVersion(const std::string &content, std::string *version)
{ {
const size_t begin = content.find_first_of("0123456789"); const size_t begin = content.find_first_of("0123456789");
......
...@@ -98,6 +98,7 @@ constexpr VendorID kVendorID_Intel = 0x8086; ...@@ -98,6 +98,7 @@ constexpr VendorID kVendorID_Intel = 0x8086;
constexpr VendorID kVendorID_NVIDIA = 0x10DE; constexpr VendorID kVendorID_NVIDIA = 0x10DE;
constexpr VendorID kVendorID_Qualcomm = 0x5143; constexpr VendorID kVendorID_Qualcomm = 0x5143;
constexpr VendorID kVendorID_VMWare = 0x15ad; constexpr VendorID kVendorID_VMWare = 0x15ad;
constexpr VendorID kVendorID_Apple = 0x106B;
// Known non-PCI (i.e. Khronos-registered) vendor IDs // Known non-PCI (i.e. Khronos-registered) vendor IDs
constexpr VendorID kVendorID_Vivante = 0x10001; constexpr VendorID kVendorID_Vivante = 0x10001;
...@@ -123,6 +124,7 @@ bool IsSwiftshader(VendorID vendorId); ...@@ -123,6 +124,7 @@ bool IsSwiftshader(VendorID vendorId);
bool IsVeriSilicon(VendorID vendorId); bool IsVeriSilicon(VendorID vendorId);
bool IsVMWare(VendorID vendorId); bool IsVMWare(VendorID vendorId);
bool IsVivante(VendorID vendorId); bool IsVivante(VendorID vendorId);
bool IsApple(VendorID vendorId);
// Use a heuristic to attempt to find the GPU used for 3D graphics. Sets activeGPUIndex, // Use a heuristic to attempt to find the GPU used for 3D graphics. Sets activeGPUIndex,
// isOptimus, and isAMDSwitchable. // isOptimus, and isAMDSwitchable.
......
...@@ -18,8 +18,9 @@ namespace angle ...@@ -18,8 +18,9 @@ namespace angle
bool GetSystemInfo_ios(SystemInfo *info) bool GetSystemInfo_ios(SystemInfo *info)
{ {
{ {
// TODO(anglebug.com/4275): Get the actual system version. // TODO(anglebug.com/4275): Get the actual system version and GPU info.
info->machineModelVersion = "0.0"; info->machineModelVersion = "0.0";
info->gpus.emplace_back().vendorId = kVendorID_Apple;
} }
return true; return true;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
# import <OpenGLES/EAGLDrawable.h> # import <OpenGLES/EAGLDrawable.h>
# import <OpenGLES/EAGLIOSurface.h> # import <OpenGLES/EAGLIOSurface.h>
# include "libANGLE/renderer/gl/apple/SoftLinking.h" # include "common/apple/SoftLinking.h"
SOFT_LINK_FRAMEWORK_HEADER(OpenGLES) SOFT_LINK_FRAMEWORK_HEADER(OpenGLES)
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# import <OpenGLES/EAGLDrawable.h> # import <OpenGLES/EAGLDrawable.h>
# import <OpenGLES/EAGLIOSurface.h> # import <OpenGLES/EAGLIOSurface.h>
# include "libANGLE/renderer/gl/apple/SoftLinking.h" # include "common/apple/SoftLinking.h"
SOFT_LINK_FRAMEWORK_SOURCE(OpenGLES) SOFT_LINK_FRAMEWORK_SOURCE(OpenGLES)
......
...@@ -206,7 +206,10 @@ egl::Error IOSurfaceSurfaceEAGL::bindTexImage(const gl::Context *context, ...@@ -206,7 +206,10 @@ egl::Error IOSurfaceSurfaceEAGL::bindTexImage(const gl::Context *context,
// TODO(kbr): possibly more state to be set here, including setting any // TODO(kbr): possibly more state to be set here, including setting any
// pixel unpack buffer to 0 when using ES 3.0 contexts. // pixel unpack buffer to 0 when using ES 3.0 contexts.
gl::PixelUnpackState defaultUnpackState; gl::PixelUnpackState defaultUnpackState;
stateManager->setPixelUnpackState(defaultUnpackState); if (IsError(stateManager->setPixelUnpackState(context, defaultUnpackState)))
{
return egl::EglBadState() << "Failed to set pixel unpack state.";
}
textureData = IOSurfaceGetBaseAddress(mIOSurface); textureData = IOSurfaceGetBaseAddress(mIOSurface);
} }
...@@ -238,7 +241,10 @@ egl::Error IOSurfaceSurfaceEAGL::releaseTexImage(const gl::Context *context, EGL ...@@ -238,7 +241,10 @@ egl::Error IOSurfaceSurfaceEAGL::releaseTexImage(const gl::Context *context, EGL
gl::PixelPackState state; gl::PixelPackState state;
state.rowLength = mRowStrideInPixels; state.rowLength = mRowStrideInPixels;
state.alignment = 1; state.alignment = 1;
stateManager->setPixelPackState(state); if (IsError(stateManager->setPixelPackState(context, state)))
{
return egl::EglBadState() << "Failed to set pixel pack state.";
}
// TODO(kbr): possibly more state to be set here, including setting any // TODO(kbr): possibly more state to be set here, including setting any
// pixel pack buffer to 0 when using ES 3.0 contexts. // pixel pack buffer to 0 when using ES 3.0 contexts.
const auto &format = kIOSurfaceFormats[mFormatIndex]; const auto &format = kIOSurfaceFormats[mFormatIndex];
......
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