Exemplo n.º 1
0
Error Display::initialize()
{
    // Re-initialize default platform if it's needed
    InitDefaultPlatformImpl();

    double createDeviceBegin = ANGLEPlatformCurrent()->currentTime();

    TRACE_EVENT0("gpu.angle", "egl::Display::initialize");

    ASSERT(mImplementation != nullptr);

    if (isInitialized())
    {
        return Error(EGL_SUCCESS);
    }

    Error error = mImplementation->initialize(this);
    if (error.isError())
    {
        return error;
    }

    mCaps = mImplementation->getCaps();

    mConfigSet = mImplementation->generateConfigs();
    if (mConfigSet.size() == 0)
    {
        mImplementation->terminate();
        return Error(EGL_NOT_INITIALIZED);
    }

    initDisplayExtensions();
    initVendorString();

    if (mDisplayExtensions.deviceQuery)
    {
        rx::DeviceImpl *impl = nullptr;
        error = mImplementation->getDevice(&impl);
        if (error.isError())
        {
            return error;
        }
        mDevice = new Device(this, impl);
    }
    else
    {
        mDevice = nullptr;
    }

    mInitialized = true;

    double displayInitializeSec = ANGLEPlatformCurrent()->currentTime() - createDeviceBegin;
    int displayInitializeMS = static_cast<int>(displayInitializeSec * 1000);
    ANGLE_HISTOGRAM_TIMES("GPU.ANGLE.DisplayInitializeMS", displayInitializeMS);

    return Error(EGL_SUCCESS);
}
Exemplo n.º 2
0
Error Display::initialize()
{
    // Re-initialize default platform if it's needed
    InitDefaultPlatformImpl();

    SCOPED_ANGLE_HISTOGRAM_TIMER("GPU.ANGLE.DisplayInitializeMS");
    TRACE_EVENT0("gpu.angle", "egl::Display::initialize");

    ASSERT(mImplementation != nullptr);

    if (isInitialized())
    {
        return Error(EGL_SUCCESS);
    }

    Error error = mImplementation->initialize(this);
    if (error.isError())
    {
        // Log extended error message here
        std::stringstream errorStream;
        errorStream << "ANGLE Display::initialize error " << error.getID() << ": "
                    << error.getMessage();
        ANGLEPlatformCurrent()->logError(errorStream.str().c_str());
        return error;
    }

    mCaps = mImplementation->getCaps();

    mConfigSet = mImplementation->generateConfigs();
    if (mConfigSet.size() == 0)
    {
        mImplementation->terminate();
        return Error(EGL_NOT_INITIALIZED);
    }

    initDisplayExtensions();
    initVendorString();

    if (mDisplayExtensions.deviceQuery)
    {
        rx::DeviceImpl *impl = nullptr;
        error = mImplementation->getDevice(&impl);
        if (error.isError())
        {
            return error;
        }
        mDevice = new Device(this, impl);
    }
    else
    {
        mDevice = nullptr;
    }

    mInitialized = true;

    return Error(EGL_SUCCESS);
}
Exemplo n.º 3
0
bool FramebufferGL::checkStatus() const
{
    mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
    GLenum status = mFunctions->checkFramebufferStatus(GL_FRAMEBUFFER);
    if (status != GL_FRAMEBUFFER_COMPLETE)
    {
        ANGLEPlatformCurrent()->logWarning("GL framebuffer returned incomplete.");
    }
    return (status == GL_FRAMEBUFFER_COMPLETE);
}
Exemplo n.º 4
0
GLuint DisplayOzone::makeShader(GLuint type, const char *src)
{
    FunctionsGL *gl = mFunctionsGL;
    GLuint shader = gl->createShader(type);
    gl->shaderSource(shader, 1, &src, nullptr);
    gl->compileShader(shader);

    GLchar buf[999];
    GLsizei len;
    GLint compiled;
    gl->getShaderInfoLog(shader, sizeof(buf), &len, buf);
    gl->getShaderiv(shader, GL_COMPILE_STATUS, &compiled);
    if (compiled != GL_TRUE)
    {
        ANGLEPlatformCurrent()->logError("DisplayOzone shader compilation error:");
        ANGLEPlatformCurrent()->logError(buf);
    }

    return shader;
}
Exemplo n.º 5
0
angle::WorkaroundsD3D GenerateWorkarounds()
{
    angle::WorkaroundsD3D workarounds;
    workarounds.mrtPerfWorkaround                = true;
    workarounds.setDataFasterThanImageUpload     = false;
    workarounds.useInstancedPointSpriteEmulation = false;

    // TODO(jmadill): Disable workaround when we have a fixed compiler DLL.
    workarounds.expandIntegerPowExpressions = true;

    // Call platform hooks for testing overrides.
    auto *platform = ANGLEPlatformCurrent();
    platform->overrideWorkaroundsD3D(platform, &workarounds);

    return workarounds;
}
Exemplo n.º 6
0
bool ProgramGL::checkLinkStatus(gl::InfoLog &infoLog)
{
    GLint linkStatus = GL_FALSE;
    mFunctions->getProgramiv(mProgramID, GL_LINK_STATUS, &linkStatus);
    if (linkStatus == GL_FALSE)
    {
        // Linking failed, put the error into the info log
        GLint infoLogLength = 0;
        mFunctions->getProgramiv(mProgramID, GL_INFO_LOG_LENGTH, &infoLogLength);

        std::string warning;

        // Info log length includes the null terminator, so 1 means that the info log is an empty
        // string.
        if (infoLogLength > 1)
        {
            std::vector<char> buf(infoLogLength);
            mFunctions->getProgramInfoLog(mProgramID, infoLogLength, nullptr, &buf[0]);

            mFunctions->deleteProgram(mProgramID);
            mProgramID = 0;

            infoLog << buf.data();

            warning = FormatString("Program link failed unexpectedly: %s", buf.data());
        }
        else
        {
            warning = "Program link failed unexpectedly with no info log.";
        }
        ANGLEPlatformCurrent()->logWarning(warning.c_str());
        TRACE("\n%s", warning.c_str());

        // TODO, return GL_OUT_OF_MEMORY or just fail the link? This is an unexpected case
        return false;
    }

    return true;
}
Exemplo n.º 7
0
void LoggingAnnotator::logMessage(const gl::LogMessage &msg) const
{
    auto *plat = ANGLEPlatformCurrent();
    if (plat != nullptr)
    {
        switch (msg.getSeverity())
        {
            case gl::LOG_FATAL:
            case gl::LOG_ERR:
                plat->logError(plat, msg.getMessage().c_str());
                break;
            case gl::LOG_WARN:
                plat->logWarning(plat, msg.getMessage().c_str());
                break;
            default:
                UNREACHABLE();
        }
    }
    else
    {
        gl::Trace(msg.getSeverity(), msg.getMessage().c_str());
    }
}
Exemplo n.º 8
0
Error Display::initialize()
{
    // Re-initialize default platform if it's needed
    InitDefaultPlatformImpl();

    SCOPED_ANGLE_HISTOGRAM_TIMER("GPU.ANGLE.DisplayInitializeMS");
    TRACE_EVENT0("gpu.angle", "egl::Display::initialize");

    ASSERT(mImplementation != nullptr);

    if (isInitialized())
    {
        return egl::Error(EGL_SUCCESS);
    }

    Error error = mImplementation->initialize(this);
    if (error.isError())
    {
        // Log extended error message here
        std::stringstream errorStream;
        errorStream << "ANGLE Display::initialize error " << error.getID() << ": "
                    << error.getMessage();
        ANGLEPlatformCurrent()->logError(errorStream.str().c_str());
        return error;
    }

    mCaps = mImplementation->getCaps();

    mConfigSet = mImplementation->generateConfigs();
    if (mConfigSet.size() == 0)
    {
        mImplementation->terminate();
        return Error(EGL_NOT_INITIALIZED);
    }

    initDisplayExtensions();
    initVendorString();

    // Populate the Display's EGLDeviceEXT if the Display wasn't created using one
    if (mPlatform != EGL_PLATFORM_DEVICE_EXT)
    {
        if (mDisplayExtensions.deviceQuery)
        {
            rx::DeviceImpl *impl = nullptr;
            ANGLE_TRY(mImplementation->getDevice(&impl));
            ANGLE_TRY(Device::CreateDevice(this, impl, &mDevice));
        }
        else
        {
            mDevice = nullptr;
        }
    }
    else
    {
        // For EGL_PLATFORM_DEVICE_EXT, mDevice should always be populated using
        // an external device
        ASSERT(mDevice != nullptr);
    }

    mInitialized = true;

    return egl::Error(EGL_SUCCESS);
}