diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /gfx/angle/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'gfx/angle/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp')
-rwxr-xr-x | gfx/angle/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp b/gfx/angle/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp new file mode 100755 index 000000000..b0bf0f9cd --- /dev/null +++ b/gfx/angle/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp @@ -0,0 +1,96 @@ +// +// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// RenderbufferD3d.cpp: Implements the RenderbufferD3D class, a specialization of RenderbufferImpl + + +#include "libANGLE/renderer/d3d/RenderbufferD3D.h" + +#include "libANGLE/Image.h" +#include "libANGLE/renderer/d3d/EGLImageD3D.h" +#include "libANGLE/renderer/d3d/RendererD3D.h" +#include "libANGLE/renderer/d3d/RenderTargetD3D.h" + +namespace rx +{ +RenderbufferD3D::RenderbufferD3D(RendererD3D *renderer) + : mRenderer(renderer), mRenderTarget(nullptr), mImage(nullptr) +{ +} + +RenderbufferD3D::~RenderbufferD3D() +{ + SafeDelete(mRenderTarget); + mImage = nullptr; +} + +gl::Error RenderbufferD3D::setStorage(GLenum internalformat, size_t width, size_t height) +{ + return setStorageMultisample(0, internalformat, width, height); +} + +gl::Error RenderbufferD3D::setStorageMultisample(size_t samples, GLenum internalformat, size_t width, size_t height) +{ + // If the renderbuffer parameters are queried, the calling function + // will expect one of the valid renderbuffer formats for use in + // glRenderbufferStorage, but we should create depth and stencil buffers + // as DEPTH24_STENCIL8 + GLenum creationFormat = internalformat; + if (internalformat == GL_DEPTH_COMPONENT16 || internalformat == GL_STENCIL_INDEX8) + { + creationFormat = GL_DEPTH24_STENCIL8_OES; + } + + // ANGLE_framebuffer_multisample states GL_OUT_OF_MEMORY is generated on a failure to create + // the specified storage. + // Because ES 3.0 already knows the exact number of supported samples, it would already have been + // validated and generated GL_INVALID_VALUE. + const gl::TextureCaps &formatCaps = mRenderer->getNativeTextureCaps().get(creationFormat); + if (samples > formatCaps.getMaxSamples()) + { + return gl::Error(GL_OUT_OF_MEMORY, "Renderbuffer format does not support %u samples, %u is the maximum.", + samples, formatCaps.getMaxSamples()); + } + + RenderTargetD3D *newRT = NULL; + ANGLE_TRY(mRenderer->createRenderTarget(static_cast<int>(width), static_cast<int>(height), + creationFormat, static_cast<GLsizei>(samples), &newRT)); + + SafeDelete(mRenderTarget); + mImage = nullptr; + mRenderTarget = newRT; + + return gl::NoError(); +} + +gl::Error RenderbufferD3D::setStorageEGLImageTarget(egl::Image *image) +{ + mImage = GetImplAs<EGLImageD3D>(image); + SafeDelete(mRenderTarget); + + return gl::NoError(); +} + +gl::Error RenderbufferD3D::getRenderTarget(RenderTargetD3D **outRenderTarget) +{ + if (mImage) + { + return mImage->getRenderTarget(outRenderTarget); + } + else + { + *outRenderTarget = mRenderTarget; + return gl::NoError(); + } +} + +gl::Error RenderbufferD3D::getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target, + FramebufferAttachmentRenderTarget **rtOut) +{ + return getRenderTarget(reinterpret_cast<RenderTargetD3D **>(rtOut)); +} + +} |