Add adapter LUID to EGL vendor string.

This is so Chrome can create another D3D device on the same adapter that can share resources with ANGLE's D3D device. Review URL: https://codereview.appspot.com/9225046 SVN URL: https://code.google.com/p/angleproject/source/detail?r=2210 TRAC #23166 Signed-off-by: Shannon Woods Signed-off-by: Geoff Lang Merged-by: Jamie Madill Author: apatrick@chromium.org git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@2253 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 552bf2f2
......@@ -113,6 +113,7 @@ bool Display::initialize()
}
initExtensionString();
initVendorString();
return true;
}
......@@ -513,5 +514,24 @@ const char *Display::getExtensionString() const
return mExtensionString.c_str();
}
void Display::initVendorString()
{
mVendorString = "Google Inc.";
LUID adapterLuid = {0};
if (mRenderer && mRenderer->getLUID(&adapterLuid))
{
char adapterLuidString[64];
sprintf_s(adapterLuidString, sizeof(adapterLuidString), " (adapter LUID: %08x%08x)", adapterLuid.HighPart, adapterLuid.LowPart);
mVendorString += adapterLuidString;
}
}
const char *Display::getVendorString() const
{
return mVendorString.c_str();
}
}
......@@ -60,6 +60,7 @@ class Display
virtual void recreateSwapChains();
const char *getExtensionString() const;
const char *getVendorString() const;
private:
DISALLOW_COPY_AND_ASSIGN(Display);
......@@ -84,7 +85,9 @@ class Display
rx::Renderer *mRenderer;
void initExtensionString();
void initVendorString();
std::string mExtensionString;
std::string mVendorString;
};
}
......
......@@ -180,9 +180,9 @@ const char *__stdcall eglQueryString(EGLDisplay dpy, EGLint name)
case EGL_CLIENT_APIS:
return egl::success("OpenGL_ES");
case EGL_EXTENSIONS:
return display->getExtensionString();
return egl::success(display->getExtensionString());
case EGL_VENDOR:
return egl::success("Google Inc.");
return egl::success(display->getVendorString());
case EGL_VERSION:
return egl::success("1.4 (ANGLE " VERSION_STRING ")");
}
......
......@@ -225,6 +225,8 @@ class Renderer
virtual QueryImpl *createQuery(GLenum type) = 0;
virtual FenceImpl *createFence() = 0;
virtual bool getLUID(LUID *adapterLuid) const = 0;
protected:
bool initializeCompiler();
ShaderBlob *compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile, UINT optimizationFlags, bool alternateFlags);
......
......@@ -3491,4 +3491,24 @@ ID3D11Texture2D *Renderer11::resolveMultisampledTexture(ID3D11Texture2D *source,
}
}
bool Renderer11::getLUID(LUID *adapterLuid) const
{
adapterLuid->HighPart = 0;
adapterLuid->LowPart = 0;
if (!mDxgiAdapter)
{
return false;
}
DXGI_ADAPTER_DESC adapterDesc;
if (FAILED(mDxgiAdapter->GetDesc(&adapterDesc)))
{
return false;
}
*adapterLuid = adapterDesc.AdapterLuid;
return true;
}
}
......@@ -182,6 +182,8 @@ class Renderer11 : public Renderer
void unapplyRenderTargets();
void setOneTimeRenderTarget(ID3D11RenderTargetView *renderTargetView);
virtual bool getLUID(LUID *adapterLuid) const;
private:
DISALLOW_COPY_AND_ASSIGN(Renderer11);
......
......@@ -3187,4 +3187,18 @@ TextureStorage *Renderer9::createTextureStorageCube(int levels, GLenum internalf
return new TextureStorage9_Cube(this, levels, internalformat, usage, forceRenderable, size);
}
}
\ No newline at end of file
bool Renderer9::getLUID(LUID *adapterLuid) const
{
adapterLuid->HighPart = 0;
adapterLuid->LowPart = 0;
if (mD3d9Ex)
{
mD3d9Ex->GetAdapterLUID(mAdapter, adapterLuid);
return true;
}
return false;
}
}
......@@ -193,6 +193,8 @@ class Renderer9 : public Renderer
D3DPOOL getTexturePool(DWORD usage) const;
virtual bool getLUID(LUID *adapterLuid) const;
private:
DISALLOW_COPY_AND_ASSIGN(Renderer9);
......
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