summaryrefslogtreecommitdiffstats
path: root/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-07-11 18:11:13 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-07-11 18:11:13 +0200
commit4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0 (patch)
treef000dd831240707a03b8c806db292c2a15cde3ce /gfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
parent3b7ffb477eec078c7036c92c6a51bb5de6de4f28 (diff)
downloadUXP-4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0.tar
UXP-4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0.tar.gz
UXP-4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0.tar.lz
UXP-4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0.tar.xz
UXP-4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0.zip
Roll back to ANGLE/2845
Diffstat (limited to 'gfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp')
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp143
1 files changed, 5 insertions, 138 deletions
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
index d578d4075..63b33b6f2 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
@@ -525,7 +525,6 @@ void Renderer9::generateDisplayExtensions(egl::DisplayExtensions *outExtensions)
outExtensions->d3dShareHandleClientBuffer = true;
outExtensions->surfaceD3DTexture2DShareHandle = true;
}
- outExtensions->d3dTextureClientBuffer = true;
outExtensions->querySurfacePointer = true;
outExtensions->windowFixedSize = true;
@@ -673,111 +672,12 @@ NativeWindowD3D *Renderer9::createNativeWindow(EGLNativeWindowType window,
SwapChainD3D *Renderer9::createSwapChain(NativeWindowD3D *nativeWindow,
HANDLE shareHandle,
- IUnknown *d3dTexture,
GLenum backBufferFormat,
GLenum depthBufferFormat,
EGLint orientation)
{
- return new SwapChain9(this, GetAs<NativeWindow9>(nativeWindow), shareHandle, d3dTexture,
- backBufferFormat, depthBufferFormat, orientation);
-}
-
-egl::Error Renderer9::getD3DTextureInfo(IUnknown *d3dTexture,
- EGLint *width,
- EGLint *height,
- GLenum *fboFormat) const
-{
- IDirect3DTexture9 *texture = nullptr;
- if (FAILED(d3dTexture->QueryInterface(&texture)))
- {
- return egl::Error(EGL_BAD_PARAMETER, "client buffer is not a IDirect3DTexture9");
- }
-
- IDirect3DDevice9 *textureDevice = nullptr;
- texture->GetDevice(&textureDevice);
- if (textureDevice != mDevice)
- {
- SafeRelease(texture);
- return egl::Error(EGL_BAD_PARAMETER, "Texture's device does not match.");
- }
- SafeRelease(textureDevice);
-
- D3DSURFACE_DESC desc;
- texture->GetLevelDesc(0, &desc);
- SafeRelease(texture);
-
- if (width)
- {
- *width = static_cast<EGLint>(desc.Width);
- }
- if (height)
- {
- *height = static_cast<EGLint>(desc.Height);
- }
-
- // From table egl.restrictions in EGL_ANGLE_d3d_texture_client_buffer.
- switch (desc.Format)
- {
- case D3DFMT_R8G8B8:
- case D3DFMT_A8R8G8B8:
- case D3DFMT_A16B16G16R16F:
- case D3DFMT_A32B32G32R32F:
- break;
-
- default:
- return egl::Error(EGL_BAD_PARAMETER, "Unknown client buffer texture format: %u.",
- desc.Format);
- }
-
- if (fboFormat)
- {
- const auto &d3dFormatInfo = d3d9::GetD3DFormatInfo(desc.Format);
- ASSERT(d3dFormatInfo.info().id != angle::Format::ID::NONE);
- *fboFormat = d3dFormatInfo.info().fboImplementationInternalFormat;
- }
-
- return egl::Error(EGL_SUCCESS);
-}
-
-egl::Error Renderer9::validateShareHandle(const egl::Config *config,
- HANDLE shareHandle,
- const egl::AttributeMap &attribs) const
-{
- if (shareHandle == nullptr)
- {
- return egl::Error(EGL_BAD_PARAMETER, "NULL share handle.");
- }
-
- EGLint width = attribs.getAsInt(EGL_WIDTH, 0);
- EGLint height = attribs.getAsInt(EGL_HEIGHT, 0);
- ASSERT(width != 0 && height != 0);
-
- const d3d9::TextureFormat &backBufferd3dFormatInfo =
- d3d9::GetTextureFormatInfo(config->renderTargetFormat);
-
- IDirect3DTexture9 *texture = nullptr;
- HRESULT result = mDevice->CreateTexture(width, height, 1, D3DUSAGE_RENDERTARGET,
- backBufferd3dFormatInfo.texFormat, D3DPOOL_DEFAULT,
- &texture, &shareHandle);
- if (FAILED(result))
- {
- return egl::Error(EGL_BAD_PARAMETER, "Failed to open share handle, result: 0x%X.", result);
- }
-
- DWORD levelCount = texture->GetLevelCount();
-
- D3DSURFACE_DESC desc;
- texture->GetLevelDesc(0, &desc);
- SafeRelease(texture);
-
- if (levelCount != 1 || desc.Width != static_cast<UINT>(width) ||
- desc.Height != static_cast<UINT>(height) ||
- desc.Format != backBufferd3dFormatInfo.texFormat)
- {
- return egl::Error(EGL_BAD_PARAMETER, "Invalid texture parameters in share handle texture.");
- }
-
- return egl::Error(EGL_SUCCESS);
+ return new SwapChain9(this, GetAs<NativeWindow9>(nativeWindow), shareHandle, backBufferFormat,
+ depthBufferFormat, orientation);
}
ContextImpl *Renderer9::createContext(const gl::ContextState &state)
@@ -918,9 +818,7 @@ gl::Error Renderer9::setSamplerState(gl::SamplerType type, int index, gl::Textur
mDevice->SetSamplerState(d3dSampler, D3DSAMP_MIPMAPLODBIAS, static_cast<DWORD>(lodBias));
if (getNativeExtensions().textureFilterAnisotropic)
{
- DWORD maxAnisotropy =
- std::min(mDeviceCaps.MaxAnisotropy, static_cast<DWORD>(samplerState.maxAnisotropy));
- mDevice->SetSamplerState(d3dSampler, D3DSAMP_MAXANISOTROPY, maxAnisotropy);
+ mDevice->SetSamplerState(d3dSampler, D3DSAMP_MAXANISOTROPY, (DWORD)samplerState.maxAnisotropy);
}
}
@@ -1007,18 +905,7 @@ gl::Error Renderer9::updateState(Context9 *context, GLenum drawMode)
setScissorRectangle(glState.getScissor(), glState.isScissorTestEnabled());
// Setting blend, depth stencil, and rasterizer states
- // Since framebuffer->getSamples will return the original samples which may be different with
- // the sample counts that we set in render target view, here we use renderTarget->getSamples to
- // get the actual samples.
- GLsizei samples = 0;
- auto firstColorAttachment = framebuffer->getFirstColorbuffer();
- if (firstColorAttachment)
- {
- ASSERT(firstColorAttachment->isAttached());
- RenderTarget9 *renderTarget = nullptr;
- ANGLE_TRY(firstColorAttachment->getRenderTarget(&renderTarget));
- samples = renderTarget->getSamples();
- }
+ int samples = framebuffer->getSamples(data);
gl::RasterizerState rasterizer = glState.getRasterizerState();
rasterizer.pointDrawMode = (drawMode == GL_POINTS);
rasterizer.multiSample = (samples != 0);
@@ -1041,18 +928,7 @@ gl::Error Renderer9::setBlendDepthRasterStates(const gl::ContextState &glData, G
const auto &glState = glData.getState();
auto drawFramebuffer = glState.getDrawFramebuffer();
ASSERT(!drawFramebuffer->hasAnyDirtyBit());
- // Since framebuffer->getSamples will return the original samples which may be different with
- // the sample counts that we set in render target view, here we use renderTarget->getSamples to
- // get the actual samples.
- GLsizei samples = 0;
- auto firstColorAttachment = drawFramebuffer->getFirstColorbuffer();
- if (firstColorAttachment)
- {
- ASSERT(firstColorAttachment->isAttached());
- RenderTarget9 *renderTarget = nullptr;
- ANGLE_TRY(firstColorAttachment->getRenderTarget(&renderTarget));
- samples = renderTarget->getSamples();
- }
+ int samples = drawFramebuffer->getSamples(glData);
gl::RasterizerState rasterizer = glState.getRasterizerState();
rasterizer.pointDrawMode = (drawMode == GL_POINTS);
rasterizer.multiSample = (samples != 0);
@@ -2464,15 +2340,6 @@ gl::Error Renderer9::copyTexture(const gl::Texture *source,
return gl::Error(GL_INVALID_OPERATION);
}
-gl::Error Renderer9::copyCompressedTexture(const gl::Texture *source,
- GLint sourceLevel,
- TextureStorage *storage,
- GLint destLevel)
-{
- UNIMPLEMENTED();
- return gl::Error(GL_INVALID_OPERATION);
-}
-
gl::Error Renderer9::createRenderTarget(int width, int height, GLenum format, GLsizei samples, RenderTargetD3D **outRT)
{
const d3d9::TextureFormat &d3d9FormatInfo = d3d9::GetTextureFormatInfo(format);