D3D: Use angle::Result error pattern.
This completes the refactor for the D3D9/D3D11 back-ends.
Bug: angleproject:2752
Change-Id: Ie35a925f75c902d8f9fdab6bc33b3bb9c937f85b
Reviewed-on: https://chromium-review.googlesource.com/1167209
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/ContextImpl.cpp b/src/libANGLE/renderer/ContextImpl.cpp
index c366121..2430c50 100644
--- a/src/libANGLE/renderer/ContextImpl.cpp
+++ b/src/libANGLE/renderer/ContextImpl.cpp
@@ -122,9 +122,4 @@
{
mErrors = errorSet;
}
-
-void ContextImpl::handleError(const gl::Error &error)
-{
- mErrors->handleError(error);
-}
} // namespace rx
diff --git a/src/libANGLE/renderer/ContextImpl.h b/src/libANGLE/renderer/ContextImpl.h
index cdf6bcc..94ffe5c 100644
--- a/src/libANGLE/renderer/ContextImpl.h
+++ b/src/libANGLE/renderer/ContextImpl.h
@@ -185,8 +185,6 @@
// TODO(jmadill): Move init into the constructor. http://anglebug.com/2491
void setErrorSet(gl::ErrorSet *errorSet);
- void handleError(const gl::Error &error);
-
protected:
const gl::ContextState &mState;
gl::MemoryProgramCache *mMemoryProgramCache;
diff --git a/src/libANGLE/renderer/d3d/BufferD3D.h b/src/libANGLE/renderer/d3d/BufferD3D.h
index 2f0ff48..dfb6bee 100644
--- a/src/libANGLE/renderer/d3d/BufferD3D.h
+++ b/src/libANGLE/renderer/d3d/BufferD3D.h
@@ -43,8 +43,8 @@
virtual size_t getSize() const = 0;
virtual bool supportsDirectBinding() const = 0;
- virtual gl::Error markTransformFeedbackUsage(const gl::Context *context) = 0;
- virtual gl::Error getData(const gl::Context *context, const uint8_t **outData) = 0;
+ virtual angle::Result markTransformFeedbackUsage(const gl::Context *context) = 0;
+ virtual angle::Result getData(const gl::Context *context, const uint8_t **outData) = 0;
// Warning: you should ensure binding really matches attrib.bindingIndex before using this
// function.
diff --git a/src/libANGLE/renderer/d3d/ContextD3D.h b/src/libANGLE/renderer/d3d/ContextD3D.h
new file mode 100644
index 0000000..22e8b6a
--- /dev/null
+++ b/src/libANGLE/renderer/d3d/ContextD3D.h
@@ -0,0 +1,24 @@
+//
+// Copyright 2018 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.
+//
+// ContextD3D: Shared common class for Context9 and Context11.
+
+#ifndef LIBANGLE_RENDERER_CONTEXTD3D_H_
+#define LIBANGLE_RENDERER_CONTEXTD3D_H_
+
+#include "libANGLE/renderer/ContextImpl.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+
+namespace rx
+{
+class ContextD3D : public ContextImpl, public d3d::Context
+{
+ public:
+ ContextD3D(const gl::ContextState &state) : ContextImpl(state) {}
+ ~ContextD3D() override {}
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_CONTEXTD3D_H_
diff --git a/src/libANGLE/renderer/d3d/EGLImageD3D.cpp b/src/libANGLE/renderer/d3d/EGLImageD3D.cpp
index 27decef..d51eb1a 100644
--- a/src/libANGLE/renderer/d3d/EGLImageD3D.cpp
+++ b/src/libANGLE/renderer/d3d/EGLImageD3D.cpp
@@ -11,10 +11,11 @@
#include "common/debug.h"
#include "common/utilities.h"
#include "libANGLE/AttributeMap.h"
+#include "libANGLE/Context.h"
#include "libANGLE/Texture.h"
+#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
#include "libANGLE/renderer/d3d/RenderbufferD3D.h"
#include "libANGLE/renderer/d3d/RendererD3D.h"
-#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
#include "libANGLE/renderer/d3d/TextureD3D.h"
#include "libANGLE/renderer/d3d/TextureStorage.h"
@@ -52,23 +53,22 @@
return gl::NoError();
}
-gl::Error EGLImageD3D::getRenderTarget(const gl::Context *context, RenderTargetD3D **outRT) const
+angle::Result EGLImageD3D::getRenderTarget(const gl::Context *context,
+ RenderTargetD3D **outRT) const
{
if (mState.source != nullptr)
{
ASSERT(!mRenderTarget);
FramebufferAttachmentRenderTarget *rt = nullptr;
- ANGLE_TRY(
- mState.source->getAttachmentRenderTarget(context, GL_NONE, mState.imageIndex, &rt));
+ ANGLE_TRY_HANDLE(context, mState.source->getAttachmentRenderTarget(context, GL_NONE,
+ mState.imageIndex, &rt));
*outRT = static_cast<RenderTargetD3D *>(rt);
- return gl::NoError();
+ return angle::Result::Continue();
}
- else
- {
- ASSERT(mRenderTarget);
- *outRT = mRenderTarget;
- return gl::NoError();
- }
+
+ ASSERT(mRenderTarget);
+ *outRT = mRenderTarget;
+ return angle::Result::Continue();
}
gl::Error EGLImageD3D::copyToLocalRendertarget(const gl::Context *context)
diff --git a/src/libANGLE/renderer/d3d/EGLImageD3D.h b/src/libANGLE/renderer/d3d/EGLImageD3D.h
index 494f1f6..76b1f64 100644
--- a/src/libANGLE/renderer/d3d/EGLImageD3D.h
+++ b/src/libANGLE/renderer/d3d/EGLImageD3D.h
@@ -42,7 +42,7 @@
gl::Error orphan(const gl::Context *context, egl::ImageSibling *sibling) override;
- gl::Error getRenderTarget(const gl::Context *context, RenderTargetD3D **outRT) const;
+ angle::Result getRenderTarget(const gl::Context *context, RenderTargetD3D **outRT) const;
private:
gl::Error copyToLocalRendertarget(const gl::Context *context);
diff --git a/src/libANGLE/renderer/d3d/FramebufferD3D.cpp b/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
index b443f9a..8c5e92e 100644
--- a/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
+++ b/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
@@ -401,8 +401,7 @@
gl::Texture *dummyTex = nullptr;
// TODO(Jamie): Handle error if dummy texture can't be created.
- ANGLE_SWALLOW_ERR(
- mRenderer->getIncompleteTexture(context, gl::TextureType::_2D, &dummyTex));
+ (void)mRenderer->getIncompleteTexture(context, gl::TextureType::_2D, &dummyTex);
if (dummyTex)
{
diff --git a/src/libANGLE/renderer/d3d/FramebufferD3D.h b/src/libANGLE/renderer/d3d/FramebufferD3D.h
index 9e54e55..b922181 100644
--- a/src/libANGLE/renderer/d3d/FramebufferD3D.h
+++ b/src/libANGLE/renderer/d3d/FramebufferD3D.h
@@ -105,25 +105,26 @@
void destroy(const gl::Context *context) override;
private:
- virtual gl::Error clearImpl(const gl::Context *context, const ClearParameters &clearParams) = 0;
+ virtual angle::Result clearImpl(const gl::Context *context,
+ const ClearParameters &clearParams) = 0;
- virtual gl::Error readPixelsImpl(const gl::Context *context,
- const gl::Rectangle &area,
- GLenum format,
- GLenum type,
- size_t outputPitch,
- const gl::PixelPackState &pack,
- uint8_t *pixels) = 0;
+ virtual angle::Result readPixelsImpl(const gl::Context *context,
+ const gl::Rectangle &area,
+ GLenum format,
+ GLenum type,
+ size_t outputPitch,
+ const gl::PixelPackState &pack,
+ uint8_t *pixels) = 0;
- virtual gl::Error blitImpl(const gl::Context *context,
- const gl::Rectangle &sourceArea,
- const gl::Rectangle &destArea,
- const gl::Rectangle *scissor,
- bool blitRenderTarget,
- bool blitDepth,
- bool blitStencil,
- GLenum filter,
- const gl::Framebuffer *sourceFramebuffer) = 0;
+ virtual angle::Result blitImpl(const gl::Context *context,
+ const gl::Rectangle &sourceArea,
+ const gl::Rectangle &destArea,
+ const gl::Rectangle *scissor,
+ bool blitRenderTarget,
+ bool blitDepth,
+ bool blitStencil,
+ GLenum filter,
+ const gl::Framebuffer *sourceFramebuffer) = 0;
virtual GLenum getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const = 0;
@@ -133,6 +134,6 @@
gl::FramebufferAttachment mDummyAttachment;
};
-}
+} // namespace rx
#endif // LIBANGLE_RENDERER_D3D_FRAMBUFFERD3D_H_
diff --git a/src/libANGLE/renderer/d3d/HLSLCompiler.cpp b/src/libANGLE/renderer/d3d/HLSLCompiler.cpp
index 4427e44..d8cea97 100644
--- a/src/libANGLE/renderer/d3d/HLSLCompiler.cpp
+++ b/src/libANGLE/renderer/d3d/HLSLCompiler.cpp
@@ -9,9 +9,11 @@
#include <sstream>
#include "common/utilities.h"
+#include "libANGLE/Context.h"
#include "libANGLE/Program.h"
#include "libANGLE/features.h"
#include "libANGLE/histogram_macros.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
#include "third_party/trace_event/trace_event.h"
#if ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO == ANGLE_ENABLED
@@ -108,11 +110,11 @@
release();
}
-gl::Error HLSLCompiler::ensureInitialized(const gl::Context *context)
+angle::Result HLSLCompiler::ensureInitialized(const gl::Context *context)
{
if (mInitialized)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
TRACE_EVENT0("gpu.angle", "HLSLCompiler::initialize");
@@ -136,10 +138,12 @@
mD3DCompilerModule = LoadLibrary(D3DCOMPILER_DLL);
}
+ ContextD3D *contextD3D = GetImplAs<ContextD3D>(context);
+
if (!mD3DCompilerModule)
{
ERR() << "D3D compiler module not found.";
- return gl::OutOfMemory() << "D3D compiler module not found.";
+ ANGLE_TRY_HR(contextD3D, E_OUTOFMEMORY, "D3D compiler module not found.");
}
mD3DCompileFunc = reinterpret_cast<pD3DCompile>(GetProcAddress(mD3DCompilerModule, "D3DCompile"));
@@ -156,13 +160,11 @@
mD3DDisassembleFunc = reinterpret_cast<pD3DDisassemble>(D3DDisassemble);
#endif
- if (mD3DCompileFunc == nullptr)
- {
- return gl::OutOfMemory() << "Error finding D3DCompile entry point.";
- }
+ ANGLE_CHECK_HR(contextD3D, mD3DCompileFunc, "Error finding D3DCompile entry point.",
+ E_OUTOFMEMORY);
mInitialized = true;
- return gl::NoError();
+ return angle::Result::Continue();
}
void HLSLCompiler::release()
@@ -177,14 +179,14 @@
}
}
-gl::Error HLSLCompiler::compileToBinary(const gl::Context *context,
- gl::InfoLog &infoLog,
- const std::string &hlsl,
- const std::string &profile,
- const std::vector<CompileConfig> &configs,
- const D3D_SHADER_MACRO *overrideMacros,
- ID3DBlob **outCompiledBlob,
- std::string *outDebugInfo)
+angle::Result HLSLCompiler::compileToBinary(const gl::Context *context,
+ gl::InfoLog &infoLog,
+ const std::string &hlsl,
+ const std::string &profile,
+ const std::vector<CompileConfig> &configs,
+ const D3D_SHADER_MACRO *overrideMacros,
+ ID3DBlob **outCompiledBlob,
+ std::string *outDebugInfo)
{
ASSERT(mInitialized);
@@ -281,14 +283,14 @@
ANGLE_TRY(disassembleBinary(context, binary, &disassembly));
(*outDebugInfo) += "\n" + disassembly + "\n// ASSEMBLY END\n";
#endif // ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO == ANGLE_ENABLED
- return gl::NoError();
+ return angle::Result::Continue();
}
if (result == E_OUTOFMEMORY)
{
*outCompiledBlob = nullptr;
- return gl::OutOfMemory()
- << "HLSL compiler had an unexpected failure, " << gl::FmtHR(result);
+ ANGLE_TRY_HR(GetImplAs<ContextD3D>(context), result,
+ "HLSL compiler had an unexpected failure");
}
infoLog << "Warning: D3D shader compilation failed with " << configs[i].name << " flags. ("
@@ -302,12 +304,12 @@
// None of the configurations succeeded in compiling this shader but the compiler is still intact
*outCompiledBlob = nullptr;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error HLSLCompiler::disassembleBinary(const gl::Context *context,
- ID3DBlob *shaderBinary,
- std::string *disassemblyOut)
+angle::Result HLSLCompiler::disassembleBinary(const gl::Context *context,
+ ID3DBlob *shaderBinary,
+ std::string *disassemblyOut)
{
ANGLE_TRY(ensureInitialized(context));
@@ -330,7 +332,7 @@
SafeRelease(disassembly);
- return gl::NoError();
+ return angle::Result::Continue();
}
} // namespace rx
diff --git a/src/libANGLE/renderer/d3d/HLSLCompiler.h b/src/libANGLE/renderer/d3d/HLSLCompiler.h
index d346faa..76efa67 100644
--- a/src/libANGLE/renderer/d3d/HLSLCompiler.h
+++ b/src/libANGLE/renderer/d3d/HLSLCompiler.h
@@ -45,19 +45,19 @@
// Attempt to compile a HLSL shader using the supplied configurations, may output a NULL compiled blob
// even if no GL errors are returned.
- gl::Error compileToBinary(const gl::Context *context,
- gl::InfoLog &infoLog,
- const std::string &hlsl,
- const std::string &profile,
- const std::vector<CompileConfig> &configs,
- const D3D_SHADER_MACRO *overrideMacros,
- ID3DBlob **outCompiledBlob,
- std::string *outDebugInfo);
+ angle::Result compileToBinary(const gl::Context *context,
+ gl::InfoLog &infoLog,
+ const std::string &hlsl,
+ const std::string &profile,
+ const std::vector<CompileConfig> &configs,
+ const D3D_SHADER_MACRO *overrideMacros,
+ ID3DBlob **outCompiledBlob,
+ std::string *outDebugInfo);
- gl::Error disassembleBinary(const gl::Context *context,
- ID3DBlob *shaderBinary,
- std::string *disassemblyOut);
- gl::Error ensureInitialized(const gl::Context *context);
+ angle::Result disassembleBinary(const gl::Context *context,
+ ID3DBlob *shaderBinary,
+ std::string *disassemblyOut);
+ angle::Result ensureInitialized(const gl::Context *context);
private:
diff --git a/src/libANGLE/renderer/d3d/ImageD3D.cpp b/src/libANGLE/renderer/d3d/ImageD3D.cpp
index 68887ee..47a0095 100644
--- a/src/libANGLE/renderer/d3d/ImageD3D.cpp
+++ b/src/libANGLE/renderer/d3d/ImageD3D.cpp
@@ -29,34 +29,34 @@
{
}
-gl::Error ImageD3D::setManagedSurface2D(const gl::Context *context,
- TextureStorage *storage,
- int level)
+angle::Result ImageD3D::setManagedSurface2D(const gl::Context *context,
+ TextureStorage *storage,
+ int level)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error ImageD3D::setManagedSurfaceCube(const gl::Context *context,
- TextureStorage *storage,
- int face,
- int level)
+angle::Result ImageD3D::setManagedSurfaceCube(const gl::Context *context,
+ TextureStorage *storage,
+ int face,
+ int level)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error ImageD3D::setManagedSurface3D(const gl::Context *context,
- TextureStorage *storage,
- int level)
+angle::Result ImageD3D::setManagedSurface3D(const gl::Context *context,
+ TextureStorage *storage,
+ int level)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error ImageD3D::setManagedSurface2DArray(const gl::Context *context,
- TextureStorage *storage,
- int layer,
- int level)
+angle::Result ImageD3D::setManagedSurface2DArray(const gl::Context *context,
+ TextureStorage *storage,
+ int layer,
+ int level)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
} // namespace rx
diff --git a/src/libANGLE/renderer/d3d/ImageD3D.h b/src/libANGLE/renderer/d3d/ImageD3D.h
index 419dd5f..b4ed05d 100644
--- a/src/libANGLE/renderer/d3d/ImageD3D.h
+++ b/src/libANGLE/renderer/d3d/ImageD3D.h
@@ -56,42 +56,42 @@
const gl::Extents &size,
bool forceRelease) = 0;
- virtual gl::Error loadData(const gl::Context *context,
- const gl::Box &area,
- const gl::PixelUnpackState &unpack,
- GLenum type,
- const void *input,
- bool applySkipImages) = 0;
- virtual gl::Error loadCompressedData(const gl::Context *context,
- const gl::Box &area,
- const void *input) = 0;
+ virtual angle::Result loadData(const gl::Context *context,
+ const gl::Box &area,
+ const gl::PixelUnpackState &unpack,
+ GLenum type,
+ const void *input,
+ bool applySkipImages) = 0;
+ virtual angle::Result loadCompressedData(const gl::Context *context,
+ const gl::Box &area,
+ const void *input) = 0;
- virtual gl::Error setManagedSurface2D(const gl::Context *context,
- TextureStorage *storage,
- int level);
- virtual gl::Error setManagedSurfaceCube(const gl::Context *context,
- TextureStorage *storage,
- int face,
- int level);
- virtual gl::Error setManagedSurface3D(const gl::Context *context,
- TextureStorage *storage,
- int level);
- virtual gl::Error setManagedSurface2DArray(const gl::Context *context,
- TextureStorage *storage,
- int layer,
- int level);
- virtual gl::Error copyToStorage(const gl::Context *context,
- TextureStorage *storage,
- const gl::ImageIndex &index,
- const gl::Box ®ion) = 0;
+ virtual angle::Result setManagedSurface2D(const gl::Context *context,
+ TextureStorage *storage,
+ int level);
+ virtual angle::Result setManagedSurfaceCube(const gl::Context *context,
+ TextureStorage *storage,
+ int face,
+ int level);
+ virtual angle::Result setManagedSurface3D(const gl::Context *context,
+ TextureStorage *storage,
+ int level);
+ virtual angle::Result setManagedSurface2DArray(const gl::Context *context,
+ TextureStorage *storage,
+ int layer,
+ int level);
+ virtual angle::Result copyToStorage(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::ImageIndex &index,
+ const gl::Box ®ion) = 0;
- virtual gl::Error copyFromTexStorage(const gl::Context *context,
- const gl::ImageIndex &imageIndex,
- TextureStorage *source) = 0;
- virtual gl::Error copyFromFramebuffer(const gl::Context *context,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source) = 0;
+ virtual angle::Result copyFromTexStorage(const gl::Context *context,
+ const gl::ImageIndex &imageIndex,
+ TextureStorage *source) = 0;
+ virtual angle::Result copyFromFramebuffer(const gl::Context *context,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ const gl::Framebuffer *source) = 0;
protected:
GLsizei mWidth;
diff --git a/src/libANGLE/renderer/d3d/IndexBuffer.cpp b/src/libANGLE/renderer/d3d/IndexBuffer.cpp
index 68e926e..565f730 100644
--- a/src/libANGLE/renderer/d3d/IndexBuffer.cpp
+++ b/src/libANGLE/renderer/d3d/IndexBuffer.cpp
@@ -8,7 +8,9 @@
// class with derivations, classes that perform graphics API agnostic index buffer operations.
#include "libANGLE/renderer/d3d/IndexBuffer.h"
-#include "libANGLE/renderer/d3d/RendererD3D.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
namespace rx
{
@@ -66,20 +68,19 @@
return mIndexBuffer->getSerial();
}
-gl::Error IndexBufferInterface::mapBuffer(const gl::Context *context,
- unsigned int size,
- void **outMappedMemory,
- unsigned int *streamOffset)
+angle::Result IndexBufferInterface::mapBuffer(const gl::Context *context,
+ unsigned int size,
+ void **outMappedMemory,
+ unsigned int *streamOffset)
{
// Protect against integer overflow
- if (mWritePosition + size < mWritePosition)
- {
- return gl::OutOfMemory()
- << "Mapping of internal index buffer would cause an integer overflow.";
- }
+ bool check = (mWritePosition + size < mWritePosition);
+ ANGLE_CHECK_HR(GetImplAs<ContextD3D>(context), !check,
+ "Mapping of internal index buffer would cause an integer overflow.",
+ E_OUTOFMEMORY);
- gl::Error error = mIndexBuffer->mapBuffer(context, mWritePosition, size, outMappedMemory);
- if (error.isError())
+ angle::Result error = mIndexBuffer->mapBuffer(context, mWritePosition, size, outMappedMemory);
+ if (error == angle::Result::Stop())
{
if (outMappedMemory)
{
@@ -94,10 +95,10 @@
}
mWritePosition += size;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error IndexBufferInterface::unmapBuffer(const gl::Context *context)
+angle::Result IndexBufferInterface::unmapBuffer(const gl::Context *context)
{
return mIndexBuffer->unmapBuffer(context);
}
@@ -117,14 +118,14 @@
mWritePosition = writePosition;
}
-gl::Error IndexBufferInterface::discard(const gl::Context *context)
+angle::Result IndexBufferInterface::discard(const gl::Context *context)
{
return mIndexBuffer->discard(context);
}
-gl::Error IndexBufferInterface::setBufferSize(const gl::Context *context,
- unsigned int bufferSize,
- GLenum indexType)
+angle::Result IndexBufferInterface::setBufferSize(const gl::Context *context,
+ unsigned int bufferSize,
+ GLenum indexType)
{
if (mIndexBuffer->getBufferSize() == 0)
{
@@ -145,9 +146,9 @@
{
}
-gl::Error StreamingIndexBufferInterface::reserveBufferSpace(const gl::Context *context,
- unsigned int size,
- GLenum indexType)
+angle::Result StreamingIndexBufferInterface::reserveBufferSpace(const gl::Context *context,
+ unsigned int size,
+ GLenum indexType)
{
unsigned int curBufferSize = getBufferSize();
unsigned int writePos = getWritePosition();
@@ -162,7 +163,7 @@
setWritePosition(0);
}
- return gl::NoError();
+ return angle::Result::Continue();
}
@@ -175,24 +176,18 @@
{
}
-gl::Error StaticIndexBufferInterface::reserveBufferSpace(const gl::Context *context,
- unsigned int size,
- GLenum indexType)
+angle::Result StaticIndexBufferInterface::reserveBufferSpace(const gl::Context *context,
+ unsigned int size,
+ GLenum indexType)
{
unsigned int curSize = getBufferSize();
if (curSize == 0)
{
return setBufferSize(context, size, indexType);
}
- else if (curSize >= size && indexType == getIndexType())
- {
- return gl::NoError();
- }
- else
- {
- UNREACHABLE();
- return gl::InternalError() << "Internal static index buffers can't be resized";
- }
+
+ ASSERT(curSize >= size && indexType == getIndexType());
+ return angle::Result::Continue();
}
} // namespace rx
diff --git a/src/libANGLE/renderer/d3d/IndexBuffer.h b/src/libANGLE/renderer/d3d/IndexBuffer.h
index 0b1f291..8ab519d 100644
--- a/src/libANGLE/renderer/d3d/IndexBuffer.h
+++ b/src/libANGLE/renderer/d3d/IndexBuffer.h
@@ -28,24 +28,24 @@
IndexBuffer();
virtual ~IndexBuffer();
- virtual gl::Error initialize(const gl::Context *context,
- unsigned int bufferSize,
- GLenum indexType,
- bool dynamic) = 0;
+ virtual angle::Result initialize(const gl::Context *context,
+ unsigned int bufferSize,
+ GLenum indexType,
+ bool dynamic) = 0;
- virtual gl::Error mapBuffer(const gl::Context *context,
- unsigned int offset,
- unsigned int size,
- void **outMappedMemory) = 0;
- virtual gl::Error unmapBuffer(const gl::Context *context) = 0;
+ virtual angle::Result mapBuffer(const gl::Context *context,
+ unsigned int offset,
+ unsigned int size,
+ void **outMappedMemory) = 0;
+ virtual angle::Result unmapBuffer(const gl::Context *context) = 0;
- virtual gl::Error discard(const gl::Context *context) = 0;
+ virtual angle::Result discard(const gl::Context *context) = 0;
virtual GLenum getIndexType() const = 0;
virtual unsigned int getBufferSize() const = 0;
- virtual gl::Error setSize(const gl::Context *context,
- unsigned int bufferSize,
- GLenum indexType) = 0;
+ virtual angle::Result setSize(const gl::Context *context,
+ unsigned int bufferSize,
+ GLenum indexType) = 0;
unsigned int getSerial() const;
@@ -63,20 +63,20 @@
IndexBufferInterface(BufferFactoryD3D *factory, bool dynamic);
virtual ~IndexBufferInterface();
- virtual gl::Error reserveBufferSpace(const gl::Context *context,
- unsigned int size,
- GLenum indexType) = 0;
+ virtual angle::Result reserveBufferSpace(const gl::Context *context,
+ unsigned int size,
+ GLenum indexType) = 0;
GLenum getIndexType() const;
unsigned int getBufferSize() const;
unsigned int getSerial() const;
- gl::Error mapBuffer(const gl::Context *context,
- unsigned int size,
- void **outMappedMemory,
- unsigned int *streamOffset);
- gl::Error unmapBuffer(const gl::Context *context);
+ angle::Result mapBuffer(const gl::Context *context,
+ unsigned int size,
+ void **outMappedMemory,
+ unsigned int *streamOffset);
+ angle::Result unmapBuffer(const gl::Context *context);
IndexBuffer *getIndexBuffer() const;
@@ -84,9 +84,11 @@
unsigned int getWritePosition() const;
void setWritePosition(unsigned int writePosition);
- gl::Error discard(const gl::Context *context);
+ angle::Result discard(const gl::Context *context);
- gl::Error setBufferSize(const gl::Context *context, unsigned int bufferSize, GLenum indexType);
+ angle::Result setBufferSize(const gl::Context *context,
+ unsigned int bufferSize,
+ GLenum indexType);
private:
IndexBuffer *mIndexBuffer;
@@ -101,9 +103,9 @@
explicit StreamingIndexBufferInterface(BufferFactoryD3D *factory);
~StreamingIndexBufferInterface() override;
- gl::Error reserveBufferSpace(const gl::Context *context,
- unsigned int size,
- GLenum indexType) override;
+ angle::Result reserveBufferSpace(const gl::Context *context,
+ unsigned int size,
+ GLenum indexType) override;
};
class StaticIndexBufferInterface : public IndexBufferInterface
@@ -112,9 +114,9 @@
explicit StaticIndexBufferInterface(BufferFactoryD3D *factory);
~StaticIndexBufferInterface() override;
- gl::Error reserveBufferSpace(const gl::Context *context,
- unsigned int size,
- GLenum indexType) override;
+ angle::Result reserveBufferSpace(const gl::Context *context,
+ unsigned int size,
+ GLenum indexType) override;
};
} // namespace rx
diff --git a/src/libANGLE/renderer/d3d/IndexDataManager.cpp b/src/libANGLE/renderer/d3d/IndexDataManager.cpp
index 183303c..80a6c04 100644
--- a/src/libANGLE/renderer/d3d/IndexDataManager.cpp
+++ b/src/libANGLE/renderer/d3d/IndexDataManager.cpp
@@ -15,6 +15,7 @@
#include "libANGLE/VertexArray.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/d3d/BufferD3D.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
#include "libANGLE/renderer/d3d/IndexBuffer.h"
namespace rx
@@ -82,22 +83,20 @@
UNREACHABLE();
}
-gl::Error StreamInIndexBuffer(const gl::Context *context,
- IndexBufferInterface *buffer,
- const void *data,
- unsigned int count,
- GLenum srcType,
- GLenum dstType,
- bool usePrimitiveRestartFixedIndex,
- unsigned int *offset)
+angle::Result StreamInIndexBuffer(const gl::Context *context,
+ IndexBufferInterface *buffer,
+ const void *data,
+ unsigned int count,
+ GLenum srcType,
+ GLenum dstType,
+ bool usePrimitiveRestartFixedIndex,
+ unsigned int *offset)
{
const gl::Type &dstTypeInfo = gl::GetTypeInfo(dstType);
- if (count > (std::numeric_limits<unsigned int>::max() >> dstTypeInfo.bytesShift))
- {
- return gl::OutOfMemory() << "Reserving " << count << " indices of " << dstTypeInfo.bytes
- << " bytes each exceeds the maximum buffer size.";
- }
+ bool check = (count > (std::numeric_limits<unsigned int>::max() >> dstTypeInfo.bytesShift));
+ ANGLE_CHECK_HR(GetImplAs<ContextD3D>(context), !check,
+ "Reserving indices exceeds the maximum buffer size.", E_OUTOFMEMORY);
unsigned int bufferSizeRequired = count << dstTypeInfo.bytesShift;
ANGLE_TRY(buffer->reserveBufferSpace(context, bufferSizeRequired, dstType));
@@ -108,7 +107,7 @@
ConvertIndices(srcType, dstType, data, count, output, usePrimitiveRestartFixedIndex);
ANGLE_TRY(buffer->unmapBuffer(context));
- return gl::NoError();
+ return angle::Result::Continue();
}
unsigned int ElementTypeSize(GLenum elementType)
@@ -158,13 +157,13 @@
// When we have a buffer with an unsupported format (subcase b) then we need to do some translation:
// we will start by falling back to streaming, and after a while will start using a static
// translated copy of the index buffer.
-gl::Error IndexDataManager::prepareIndexData(const gl::Context *context,
- GLenum srcType,
- GLenum dstType,
- GLsizei count,
- gl::Buffer *glBuffer,
- const void *indices,
- TranslatedIndexData *translated)
+angle::Result IndexDataManager::prepareIndexData(const gl::Context *context,
+ GLenum srcType,
+ GLenum dstType,
+ GLsizei count,
+ gl::Buffer *glBuffer,
+ const void *indices,
+ TranslatedIndexData *translated)
{
const gl::Type &srcTypeInfo = gl::GetTypeInfo(srcType);
const gl::Type &dstTypeInfo = gl::GetTypeInfo(dstType);
@@ -203,7 +202,7 @@
translated->serial = buffer->getSerial();
translated->startIndex = (offset >> srcTypeInfo.bytesShift);
translated->startOffset = offset;
- return gl::NoError();
+ return angle::Result::Continue();
}
translated->storage = nullptr;
@@ -252,16 +251,16 @@
translated->startOffset = (offset >> srcTypeInfo.bytesShift) << dstTypeInfo.bytesShift;
}
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error IndexDataManager::streamIndexData(const gl::Context *context,
- const void *data,
- unsigned int count,
- GLenum srcType,
- GLenum dstType,
- bool usePrimitiveRestartFixedIndex,
- TranslatedIndexData *translated)
+angle::Result IndexDataManager::streamIndexData(const gl::Context *context,
+ const void *data,
+ unsigned int count,
+ GLenum srcType,
+ GLenum dstType,
+ bool usePrimitiveRestartFixedIndex,
+ TranslatedIndexData *translated)
{
const gl::Type &dstTypeInfo = gl::GetTypeInfo(dstType);
@@ -278,12 +277,12 @@
translated->startIndex = (offset >> dstTypeInfo.bytesShift);
translated->startOffset = offset;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error IndexDataManager::getStreamingIndexBuffer(const gl::Context *context,
- GLenum destinationIndexType,
- IndexBufferInterface **outBuffer)
+angle::Result IndexDataManager::getStreamingIndexBuffer(const gl::Context *context,
+ GLenum destinationIndexType,
+ IndexBufferInterface **outBuffer)
{
ASSERT(outBuffer);
ASSERT(destinationIndexType == GL_UNSIGNED_SHORT || destinationIndexType == GL_UNSIGNED_INT);
@@ -300,13 +299,13 @@
}
*outBuffer = streamingBuffer.get();
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error GetIndexTranslationDestType(const gl::Context *context,
- const gl::DrawCallParams &drawCallParams,
- bool usePrimitiveRestartWorkaround,
- GLenum *destTypeOut)
+angle::Result GetIndexTranslationDestType(const gl::Context *context,
+ const gl::DrawCallParams &drawCallParams,
+ bool usePrimitiveRestartWorkaround,
+ GLenum *destTypeOut)
{
// Avoid D3D11's primitive restart index value
// see http://msdn.microsoft.com/en-us/library/windows/desktop/bb205124(v=vs.85).aspx
@@ -316,20 +315,20 @@
if (drawCallParams.isDrawIndirect())
{
*destTypeOut = GL_UNSIGNED_INT;
- return gl::NoError();
+ return angle::Result::Continue();
}
- ANGLE_TRY(drawCallParams.ensureIndexRangeResolved(context));
+ ANGLE_TRY_HANDLE(context, drawCallParams.ensureIndexRangeResolved(context));
const gl::IndexRange &indexRange = drawCallParams.getIndexRange();
if (indexRange.end == gl::GetPrimitiveRestartIndex(drawCallParams.type()))
{
*destTypeOut = GL_UNSIGNED_INT;
- return gl::NoError();
+ return angle::Result::Continue();
}
}
*destTypeOut = (drawCallParams.type() == GL_UNSIGNED_INT) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT;
- return gl::NoError();
+ return angle::Result::Continue();
}
} // namespace rx
diff --git a/src/libANGLE/renderer/d3d/IndexDataManager.h b/src/libANGLE/renderer/d3d/IndexDataManager.h
index a0c6d88..6425d6b 100644
--- a/src/libANGLE/renderer/d3d/IndexDataManager.h
+++ b/src/libANGLE/renderer/d3d/IndexDataManager.h
@@ -69,25 +69,25 @@
void deinitialize();
- gl::Error prepareIndexData(const gl::Context *context,
- GLenum srcType,
- GLenum dstType,
- GLsizei count,
- gl::Buffer *glBuffer,
- const void *indices,
- TranslatedIndexData *translated);
+ angle::Result prepareIndexData(const gl::Context *context,
+ GLenum srcType,
+ GLenum dstType,
+ GLsizei count,
+ gl::Buffer *glBuffer,
+ const void *indices,
+ TranslatedIndexData *translated);
private:
- gl::Error streamIndexData(const gl::Context *context,
- const void *data,
- unsigned int count,
- GLenum srcType,
- GLenum dstType,
- bool usePrimitiveRestartFixedIndex,
- TranslatedIndexData *translated);
- gl::Error getStreamingIndexBuffer(const gl::Context *context,
- GLenum destinationIndexType,
- IndexBufferInterface **outBuffer);
+ angle::Result streamIndexData(const gl::Context *context,
+ const void *data,
+ unsigned int count,
+ GLenum srcType,
+ GLenum dstType,
+ bool usePrimitiveRestartFixedIndex,
+ TranslatedIndexData *translated);
+ angle::Result getStreamingIndexBuffer(const gl::Context *context,
+ GLenum destinationIndexType,
+ IndexBufferInterface **outBuffer);
using StreamingBuffer = std::unique_ptr<StreamingIndexBufferInterface>;
@@ -96,10 +96,10 @@
std::unique_ptr<StreamingIndexBufferInterface> mStreamingBufferInt;
};
-gl::Error GetIndexTranslationDestType(const gl::Context *context,
- const gl::DrawCallParams &drawCallParams,
- bool usePrimitiveRestartWorkaround,
- GLenum *destTypeOut);
+angle::Result GetIndexTranslationDestType(const gl::Context *context,
+ const gl::DrawCallParams &drawCallParams,
+ bool usePrimitiveRestartWorkaround,
+ GLenum *destTypeOut);
bool IsOffsetAligned(GLenum elementType, unsigned int offset);
diff --git a/src/libANGLE/renderer/d3d/ProgramD3D.cpp b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
index a681a3a..1cf03f6 100644
--- a/src/libANGLE/renderer/d3d/ProgramD3D.cpp
+++ b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
@@ -1193,14 +1193,15 @@
{
}
-gl::Error ProgramD3D::getPixelExecutableForCachedOutputLayout(const gl::Context *context,
- ShaderExecutableD3D **outExecutable,
- gl::InfoLog *infoLog)
+angle::Result ProgramD3D::getPixelExecutableForCachedOutputLayout(
+ const gl::Context *context,
+ ShaderExecutableD3D **outExecutable,
+ gl::InfoLog *infoLog)
{
if (mCachedPixelExecutableIndex.valid())
{
*outExecutable = mPixelExecutables[mCachedPixelExecutableIndex.value()]->shaderExecutable();
- return gl::NoError();
+ return angle::Result::Continue();
}
std::string finalPixelHLSL = mDynamicHLSL->generatePixelShaderForOutputSignature(
@@ -1231,18 +1232,19 @@
}
*outExecutable = pixelExecutable;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error ProgramD3D::getVertexExecutableForCachedInputLayout(const gl::Context *context,
- ShaderExecutableD3D **outExectuable,
- gl::InfoLog *infoLog)
+angle::Result ProgramD3D::getVertexExecutableForCachedInputLayout(
+ const gl::Context *context,
+ ShaderExecutableD3D **outExectuable,
+ gl::InfoLog *infoLog)
{
if (mCachedVertexExecutableIndex.valid())
{
*outExectuable =
mVertexExecutables[mCachedVertexExecutableIndex.value()]->shaderExecutable();
- return gl::NoError();
+ return angle::Result::Continue();
}
// Generate new dynamic layout with attribute conversions
@@ -1273,13 +1275,13 @@
}
*outExectuable = vertexExecutable;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error ProgramD3D::getGeometryExecutableForPrimitiveType(const gl::Context *context,
- gl::PrimitiveMode drawMode,
- ShaderExecutableD3D **outExecutable,
- gl::InfoLog *infoLog)
+angle::Result ProgramD3D::getGeometryExecutableForPrimitiveType(const gl::Context *context,
+ gl::PrimitiveMode drawMode,
+ ShaderExecutableD3D **outExecutable,
+ gl::InfoLog *infoLog)
{
if (outExecutable)
{
@@ -1289,7 +1291,7 @@
// Return a null shader if the current rendering doesn't use a geometry shader
if (!usesGeometryShader(drawMode))
{
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::PrimitiveMode geometryShaderType = GetGeometryShaderTypeFromDrawMode(drawMode);
@@ -1300,7 +1302,7 @@
{
*outExecutable = mGeometryExecutables[geometryShaderType].get();
}
- return gl::NoError();
+ return angle::Result::Continue();
}
std::string geometryHLSL = mDynamicHLSL->generateGeometryShaderHLSL(
@@ -1312,12 +1314,12 @@
gl::InfoLog *currentInfoLog = infoLog ? infoLog : &tempInfoLog;
ShaderExecutableD3D *geometryExecutable = nullptr;
- gl::Error error = mRenderer->compileToExecutable(
+ angle::Result result = mRenderer->compileToExecutable(
context, *currentInfoLog, geometryHLSL, gl::ShaderType::Geometry, mStreamOutVaryings,
(mState.getTransformFeedbackBufferMode() == GL_SEPARATE_ATTRIBS),
angle::CompilerWorkaroundsD3D(), &geometryExecutable);
- if (!infoLog && error.isError())
+ if (!infoLog && result == angle::Result::Stop())
{
ERR() << "Error compiling dynamic geometry executable:" << std::endl
<< tempInfoLog.str() << std::endl;
@@ -1332,30 +1334,34 @@
{
*outExecutable = mGeometryExecutables[geometryShaderType].get();
}
- return error;
+ return result;
}
class ProgramD3D::GetExecutableTask : public Closure
{
public:
GetExecutableTask(ProgramD3D *program, const gl::Context *context)
- : mProgram(program), mError(gl::NoError()), mInfoLog(), mResult(nullptr), mContext(context)
+ : mProgram(program),
+ mResult(angle::Result::Continue()),
+ mInfoLog(),
+ mExecutable(nullptr),
+ mContext(context)
{
}
- virtual gl::Error run() = 0;
+ virtual angle::Result run() = 0;
- void operator()() override { mError = run(); }
+ void operator()() override { mResult = run(); }
- const gl::Error &getError() const { return mError; }
+ angle::Result getResult() const { return mResult; }
const gl::InfoLog &getInfoLog() const { return mInfoLog; }
- ShaderExecutableD3D *getResult() { return mResult; }
+ ShaderExecutableD3D *getExecutable() { return mExecutable; }
protected:
ProgramD3D *mProgram;
- gl::Error mError;
+ angle::Result mResult;
gl::InfoLog mInfoLog;
- ShaderExecutableD3D *mResult;
+ ShaderExecutableD3D *mExecutable;
const gl::Context *mContext;
};
@@ -1366,13 +1372,14 @@
: GetExecutableTask(program, context)
{
}
- gl::Error run() override
+ angle::Result run() override
{
mProgram->updateCachedInputLayoutFromShader(mContext);
- ANGLE_TRY(mProgram->getVertexExecutableForCachedInputLayout(mContext, &mResult, &mInfoLog));
+ ANGLE_TRY(
+ mProgram->getVertexExecutableForCachedInputLayout(mContext, &mExecutable, &mInfoLog));
- return gl::NoError();
+ return angle::Result::Continue();
}
};
@@ -1391,13 +1398,14 @@
: GetExecutableTask(program, context)
{
}
- gl::Error run() override
+ angle::Result run() override
{
mProgram->updateCachedOutputLayoutFromShader();
- ANGLE_TRY(mProgram->getPixelExecutableForCachedOutputLayout(mContext, &mResult, &mInfoLog));
+ ANGLE_TRY(
+ mProgram->getPixelExecutableForCachedOutputLayout(mContext, &mExecutable, &mInfoLog));
- return gl::NoError();
+ return angle::Result::Continue();
}
};
@@ -1415,28 +1423,28 @@
{
}
- gl::Error run() override
+ angle::Result run() override
{
// Auto-generate the geometry shader here, if we expect to be using point rendering in
// D3D11.
if (mProgram->usesGeometryShader(gl::PrimitiveMode::Points))
{
ANGLE_TRY(mProgram->getGeometryExecutableForPrimitiveType(
- mContext, gl::PrimitiveMode::Points, &mResult, &mInfoLog));
+ mContext, gl::PrimitiveMode::Points, &mExecutable, &mInfoLog));
}
- return gl::NoError();
+ return angle::Result::Continue();
}
};
-gl::Error ProgramD3D::getComputeExecutable(ShaderExecutableD3D **outExecutable)
+angle::Result ProgramD3D::getComputeExecutable(ShaderExecutableD3D **outExecutable)
{
if (outExecutable)
{
*outExecutable = mComputeExecutable.get();
}
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::LinkResult ProgramD3D::compileProgramExecutables(const gl::Context *context,
@@ -1470,13 +1478,13 @@
infoLog << geometryTask.getInfoLog().str();
}
- ANGLE_TRY(vertexTask.getError());
- ANGLE_TRY(pixelTask.getError());
- ANGLE_TRY(geometryTask.getError());
+ ANGLE_TRY(vertexTask.getResult());
+ ANGLE_TRY(pixelTask.getResult());
+ ANGLE_TRY(geometryTask.getResult());
- ShaderExecutableD3D *defaultVertexExecutable = vertexTask.getResult();
- ShaderExecutableD3D *defaultPixelExecutable = pixelTask.getResult();
- ShaderExecutableD3D *pointGS = geometryTask.getResult();
+ ShaderExecutableD3D *defaultVertexExecutable = vertexTask.getExecutable();
+ ShaderExecutableD3D *defaultPixelExecutable = pixelTask.getExecutable();
+ ShaderExecutableD3D *pointGS = geometryTask.getExecutable();
const ShaderD3D *vertexShaderD3D =
GetImplAs<ShaderD3D>(mState.getAttachedShader(gl::ShaderType::Vertex));
diff --git a/src/libANGLE/renderer/d3d/ProgramD3D.h b/src/libANGLE/renderer/d3d/ProgramD3D.h
index beda51c..ec95bbb 100644
--- a/src/libANGLE/renderer/d3d/ProgramD3D.h
+++ b/src/libANGLE/renderer/d3d/ProgramD3D.h
@@ -171,7 +171,6 @@
bool readonly,
const gl::Caps &caps) const;
GLuint getUsedImageRange(gl::ShaderType type, bool readonly) const;
- GLenum getImageTextureType(gl::ShaderType type, unsigned int imageIndex, bool readonly) const;
bool usesPointSize() const { return mUsesPointSize; }
bool usesPointSpriteEmulation() const;
@@ -186,17 +185,17 @@
void setBinaryRetrievableHint(bool retrievable) override;
void setSeparable(bool separable) override;
- gl::Error getVertexExecutableForCachedInputLayout(const gl::Context *context,
- ShaderExecutableD3D **outExectuable,
- gl::InfoLog *infoLog);
- gl::Error getGeometryExecutableForPrimitiveType(const gl::Context *context,
- gl::PrimitiveMode drawMode,
- ShaderExecutableD3D **outExecutable,
- gl::InfoLog *infoLog);
- gl::Error getPixelExecutableForCachedOutputLayout(const gl::Context *context,
- ShaderExecutableD3D **outExectuable,
- gl::InfoLog *infoLog);
- gl::Error getComputeExecutable(ShaderExecutableD3D **outExecutable);
+ angle::Result getVertexExecutableForCachedInputLayout(const gl::Context *context,
+ ShaderExecutableD3D **outExectuable,
+ gl::InfoLog *infoLog);
+ angle::Result getGeometryExecutableForPrimitiveType(const gl::Context *context,
+ gl::PrimitiveMode drawMode,
+ ShaderExecutableD3D **outExecutable,
+ gl::InfoLog *infoLog);
+ angle::Result getPixelExecutableForCachedOutputLayout(const gl::Context *context,
+ ShaderExecutableD3D **outExectuable,
+ gl::InfoLog *infoLog);
+ angle::Result getComputeExecutable(ShaderExecutableD3D **outExecutable);
gl::LinkResult link(const gl::Context *context,
const gl::ProgramLinkedResources &resources,
gl::InfoLog &infoLog) override;
diff --git a/src/libANGLE/renderer/d3d/RendererD3D.cpp b/src/libANGLE/renderer/d3d/RendererD3D.cpp
index 5ffa037..12a8217 100644
--- a/src/libANGLE/renderer/d3d/RendererD3D.cpp
+++ b/src/libANGLE/renderer/d3d/RendererD3D.cpp
@@ -187,7 +187,8 @@
mode == gl::PrimitiveMode::Points;
}
-gl::Error RendererD3D::initRenderTarget(const gl::Context *context, RenderTargetD3D *renderTarget)
+angle::Result RendererD3D::initRenderTarget(const gl::Context *context,
+ RenderTargetD3D *renderTarget)
{
return clearRenderTarget(context, renderTarget, gl::ColorF(0, 0, 0, 0), 1, 0);
}
diff --git a/src/libANGLE/renderer/d3d/RendererD3D.h b/src/libANGLE/renderer/d3d/RendererD3D.h
index 4d0ba5a..554882a 100644
--- a/src/libANGLE/renderer/d3d/RendererD3D.h
+++ b/src/libANGLE/renderer/d3d/RendererD3D.h
@@ -116,6 +116,13 @@
#define ANGLE_CHECK_HR_ALLOC(context, result) \
ANGLE_CHECK_HR(context, result, "Failed to allocate host memory", E_OUTOFMEMORY)
+#define ANGLE_CHECK_HR_MATH(context, result) \
+ ANGLE_CHECK_HR(context, result, "Integer overflow.", E_FAIL)
+
+#define ANGLE_HR_UNREACHABLE(context) \
+ UNREACHABLE(); \
+ ANGLE_CHECK_HR(context, false, "Unreachble code reached.", E_FAIL)
+
// Check if the device is lost every 10 failures to get the query data
constexpr unsigned int kPollingD3DDeviceLostCheckFrequency = 10;
@@ -136,12 +143,12 @@
// Warning: you should ensure binding really matches attrib.bindingIndex before using this
// function.
- virtual gl::Error getVertexSpaceRequired(const gl::Context *context,
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- size_t count,
- GLsizei instances,
- unsigned int *bytesRequiredOut) const = 0;
+ virtual angle::Result getVertexSpaceRequired(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances,
+ unsigned int *bytesRequiredOut) const = 0;
};
using AttribIndexArray = gl::AttribArray<int>;
@@ -193,102 +200,102 @@
const angle::WorkaroundsD3D &getWorkarounds() const;
// Pixel operations
- virtual gl::Error copyImage2D(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level) = 0;
- virtual gl::Error copyImageCube(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- gl::TextureTarget target,
- GLint level) = 0;
- virtual gl::Error copyImage3D(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level) = 0;
- virtual gl::Error copyImage2DArray(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level) = 0;
+ virtual angle::Result copyImage2D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) = 0;
+ virtual angle::Result copyImageCube(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget target,
+ GLint level) = 0;
+ virtual angle::Result copyImage3D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) = 0;
+ virtual angle::Result copyImage2DArray(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) = 0;
- virtual gl::Error copyTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- GLenum destType,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- gl::TextureTarget destTarget,
- GLint destLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha) = 0;
- virtual gl::Error copyCompressedTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- TextureStorage *storage,
- GLint destLevel) = 0;
+ virtual angle::Result copyTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ GLenum destType,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget destTarget,
+ GLint destLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha) = 0;
+ virtual angle::Result copyCompressedTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ TextureStorage *storage,
+ GLint destLevel) = 0;
// RenderTarget creation
- virtual gl::Error createRenderTarget(const gl::Context *context,
- int width,
- int height,
- GLenum format,
- GLsizei samples,
- RenderTargetD3D **outRT) = 0;
- virtual gl::Error createRenderTargetCopy(const gl::Context *context,
- RenderTargetD3D *source,
- RenderTargetD3D **outRT) = 0;
+ virtual angle::Result createRenderTarget(const gl::Context *context,
+ int width,
+ int height,
+ GLenum format,
+ GLsizei samples,
+ RenderTargetD3D **outRT) = 0;
+ virtual angle::Result createRenderTargetCopy(const gl::Context *context,
+ RenderTargetD3D *source,
+ RenderTargetD3D **outRT) = 0;
// Shader operations
- virtual gl::Error loadExecutable(const gl::Context *context,
- const uint8_t *function,
- size_t length,
- gl::ShaderType type,
- const std::vector<D3DVarying> &streamOutVaryings,
- bool separatedOutputBuffers,
- ShaderExecutableD3D **outExecutable) = 0;
- virtual gl::Error compileToExecutable(const gl::Context *context,
- gl::InfoLog &infoLog,
- const std::string &shaderHLSL,
- gl::ShaderType type,
- const std::vector<D3DVarying> &streamOutVaryings,
- bool separatedOutputBuffers,
- const angle::CompilerWorkaroundsD3D &workarounds,
- ShaderExecutableD3D **outExectuable) = 0;
- virtual gl::Error ensureHLSLCompilerInitialized(const gl::Context *context) = 0;
+ virtual angle::Result loadExecutable(const gl::Context *context,
+ const uint8_t *function,
+ size_t length,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ ShaderExecutableD3D **outExecutable) = 0;
+ virtual angle::Result compileToExecutable(const gl::Context *context,
+ gl::InfoLog &infoLog,
+ const std::string &shaderHLSL,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ const angle::CompilerWorkaroundsD3D &workarounds,
+ ShaderExecutableD3D **outExectuable) = 0;
+ virtual angle::Result ensureHLSLCompilerInitialized(const gl::Context *context) = 0;
virtual UniformStorageD3D *createUniformStorage(size_t storageSize) = 0;
// Image operations
virtual ImageD3D *createImage() = 0;
- virtual gl::Error generateMipmap(const gl::Context *context,
- ImageD3D *dest,
- ImageD3D *source) = 0;
- virtual gl::Error generateMipmapUsingD3D(const gl::Context *context,
- TextureStorage *storage,
- const gl::TextureState &textureState) = 0;
- virtual gl::Error copyImage(const gl::Context *context,
- ImageD3D *dest,
- ImageD3D *source,
- const gl::Rectangle &sourceRect,
- const gl::Offset &destOffset,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha) = 0;
+ virtual angle::Result generateMipmap(const gl::Context *context,
+ ImageD3D *dest,
+ ImageD3D *source) = 0;
+ virtual angle::Result generateMipmapUsingD3D(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::TextureState &textureState) = 0;
+ virtual angle::Result copyImage(const gl::Context *context,
+ ImageD3D *dest,
+ ImageD3D *source,
+ const gl::Rectangle &sourceRect,
+ const gl::Offset &destOffset,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha) = 0;
virtual TextureStorage *createTextureStorage2D(SwapChainD3D *swapChain) = 0;
virtual TextureStorage *createTextureStorageEGLImage(EGLImageD3D *eglImage,
RenderTargetD3D *renderTargetD3D) = 0;
@@ -327,13 +334,13 @@
// Buffer-to-texture and Texture-to-buffer copies
virtual bool supportsFastCopyBufferToTexture(GLenum internalFormat) const = 0;
- virtual gl::Error fastCopyBufferToTexture(const gl::Context *context,
- const gl::PixelUnpackState &unpack,
- unsigned int offset,
- RenderTargetD3D *destRenderTarget,
- GLenum destinationFormat,
- GLenum sourcePixelsType,
- const gl::Box &destArea) = 0;
+ virtual angle::Result fastCopyBufferToTexture(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ unsigned int offset,
+ RenderTargetD3D *destRenderTarget,
+ GLenum destinationFormat,
+ GLenum sourcePixelsType,
+ const gl::Box &destArea) = 0;
// Device lost
GLenum getResetStatus();
@@ -350,11 +357,11 @@
GLint getGPUDisjoint();
GLint64 getTimestamp();
- virtual gl::Error clearRenderTarget(const gl::Context *context,
- RenderTargetD3D *renderTarget,
- const gl::ColorF &clearColorValue,
- const float clearDepthValue,
- const unsigned int clearStencilValue) = 0;
+ virtual angle::Result clearRenderTarget(const gl::Context *context,
+ RenderTargetD3D *renderTarget,
+ const gl::ColorF &clearColorValue,
+ const float clearDepthValue,
+ const unsigned int clearStencilValue) = 0;
virtual DeviceImpl *createEGLDevice() = 0;
@@ -375,13 +382,13 @@
virtual gl::Version getMaxSupportedESVersion() const = 0;
- gl::Error initRenderTarget(const gl::Context *context, RenderTargetD3D *renderTarget);
+ angle::Result initRenderTarget(const gl::Context *context, RenderTargetD3D *renderTarget);
angle::WorkerThreadPool *getWorkerThreadPool();
- virtual gl::Error getIncompleteTexture(const gl::Context *context,
- gl::TextureType type,
- gl::Texture **textureOut) = 0;
+ virtual angle::Result getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut) = 0;
Serial generateSerial();
diff --git a/src/libANGLE/renderer/d3d/TextureD3D.cpp b/src/libANGLE/renderer/d3d/TextureD3D.cpp
index cb9b32a..554557c 100644
--- a/src/libANGLE/renderer/d3d/TextureD3D.cpp
+++ b/src/libANGLE/renderer/d3d/TextureD3D.cpp
@@ -20,10 +20,10 @@
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/BufferImpl.h"
#include "libANGLE/renderer/d3d/BufferD3D.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
#include "libANGLE/renderer/d3d/EGLImageD3D.h"
#include "libANGLE/renderer/d3d/ImageD3D.h"
#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
-#include "libANGLE/renderer/d3d/RendererD3D.h"
#include "libANGLE/renderer/d3d/SurfaceD3D.h"
#include "libANGLE/renderer/d3d/TextureStorage.h"
@@ -33,12 +33,12 @@
namespace
{
-gl::Error GetUnpackPointer(const gl::Context *context,
- const gl::PixelUnpackState &unpack,
- gl::Buffer *unpackBuffer,
- const uint8_t *pixels,
- ptrdiff_t layerOffset,
- const uint8_t **pointerOut)
+angle::Result GetUnpackPointer(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ gl::Buffer *unpackBuffer,
+ const uint8_t *pixels,
+ ptrdiff_t layerOffset,
+ const uint8_t **pointerOut)
{
if (unpackBuffer)
{
@@ -64,7 +64,7 @@
*pointerOut += layerOffset;
}
- return gl::NoError();
+ return angle::Result::Continue();
}
bool IsRenderTargetUsage(GLenum usage)
@@ -89,7 +89,7 @@
ASSERT(!mTexStorage);
}
-gl::Error TextureD3D::getNativeTexture(const gl::Context *context, TextureStorage **outStorage)
+angle::Result TextureD3D::getNativeTexture(const gl::Context *context, TextureStorage **outStorage)
{
// ensure the underlying texture is created
ANGLE_TRY(initializeStorage(context, false));
@@ -102,12 +102,12 @@
ASSERT(outStorage);
*outStorage = mTexStorage;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D::getImageAndSyncFromStorage(const gl::Context *context,
- const gl::ImageIndex &index,
- ImageD3D **outImage)
+angle::Result TextureD3D::getImageAndSyncFromStorage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ ImageD3D **outImage)
{
ImageD3D *image = getImage(index);
if (mTexStorage && mTexStorage->isRenderTarget())
@@ -116,7 +116,7 @@
mDirtyImages = true;
}
*outImage = image;
- return gl::NoError();
+ return angle::Result::Continue();
}
GLint TextureD3D::getLevelZeroWidth() const
@@ -209,12 +209,12 @@
return (mTexStorage && !internalFormat.compressed);
}
-gl::Error TextureD3D::setImageImpl(const gl::Context *context,
- const gl::ImageIndex &index,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels,
- ptrdiff_t layerOffset)
+angle::Result TextureD3D::setImageImpl(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels,
+ ptrdiff_t layerOffset)
{
ImageD3D *image = getImage(index);
gl::Buffer *unpackBuffer =
@@ -224,7 +224,7 @@
// No-op
if (image->getWidth() == 0 || image->getHeight() == 0 || image->getDepth() == 0)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
// We no longer need the "GLenum format" parameter to TexImage to determine what data format "pixels" contains.
@@ -249,17 +249,17 @@
mDirtyImages = true;
}
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D::subImage(const gl::Context *context,
- const gl::ImageIndex &index,
- const gl::Box &area,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels,
- ptrdiff_t layerOffset)
+angle::Result TextureD3D::subImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels,
+ ptrdiff_t layerOffset)
{
// CPU readback & copy where direct GPU copy is not supported
const uint8_t *pixelData = nullptr;
@@ -282,21 +282,21 @@
mDirtyImages = true;
}
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D::setCompressedImageImpl(const gl::Context *context,
- const gl::ImageIndex &index,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels,
- ptrdiff_t layerOffset)
+angle::Result TextureD3D::setCompressedImageImpl(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels,
+ ptrdiff_t layerOffset)
{
ImageD3D *image = getImage(index);
ASSERT(image);
if (image->getWidth() == 0 || image->getHeight() == 0 || image->getDepth() == 0)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
// We no longer need the "GLenum format" parameter to TexImage to determine what data format "pixels" contains.
@@ -314,16 +314,16 @@
mDirtyImages = true;
}
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D::subImageCompressed(const gl::Context *context,
- const gl::ImageIndex &index,
- const gl::Box &area,
- GLenum format,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels,
- ptrdiff_t layerOffset)
+angle::Result TextureD3D::subImageCompressed(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels,
+ ptrdiff_t layerOffset)
{
const uint8_t *pixelData = nullptr;
gl::Buffer *unpackBuffer =
@@ -340,7 +340,7 @@
mDirtyImages = true;
}
- return gl::NoError();
+ return angle::Result::Continue();
}
bool TextureD3D::isFastUnpackable(const gl::Buffer *unpackBuffer, GLenum sizedInternalFormat)
@@ -349,26 +349,23 @@
mRenderer->supportsFastCopyBufferToTexture(sizedInternalFormat);
}
-gl::Error TextureD3D::fastUnpackPixels(const gl::Context *context,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels,
- const gl::Box &destArea,
- GLenum sizedInternalFormat,
- GLenum type,
- RenderTargetD3D *destRenderTarget)
+angle::Result TextureD3D::fastUnpackPixels(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels,
+ const gl::Box &destArea,
+ GLenum sizedInternalFormat,
+ GLenum type,
+ RenderTargetD3D *destRenderTarget)
{
- if (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 ||
- unpack.skipImages != 0)
- {
- // TODO(jmadill): additional unpack parameters
- UNIMPLEMENTED();
- return gl::InternalError() << "Unimplemented pixel store parameters in fastUnpackPixels";
- }
+ bool check = (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 ||
+ unpack.skipImages != 0);
+ ANGLE_CHECK_HR(GetImplAs<ContextD3D>(context), !check,
+ "Unimplemented pixel store parameters in fastUnpackPixels", E_FAIL);
// No-op
if (destArea.width <= 0 && destArea.height <= 0 && destArea.depth <= 0)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
// In order to perform the fast copy through the shader, we must have the right format, and be able
@@ -381,7 +378,7 @@
destRenderTarget, sizedInternalFormat, type,
destArea));
- return gl::NoError();
+ return angle::Result::Continue();
}
GLint TextureD3D::creationLevels(GLsizei width, GLsizei height, GLsizei depth) const
@@ -457,7 +454,8 @@
return gl::NoError();
}
-gl::Error TextureD3D::generateMipmapUsingImages(const gl::Context *context, const GLuint maxLevel)
+angle::Result TextureD3D::generateMipmapUsingImages(const gl::Context *context,
+ const GLuint maxLevel)
{
// We know that all layers have the same dimension, for the texture to be complete
GLint layerCount = static_cast<GLint>(getLayerCount(mBaseLevel));
@@ -521,7 +519,7 @@
ANGLE_TRY(updateStorage(context));
}
- return gl::NoError();
+ return angle::Result::Continue();
}
bool TextureD3D::isBaseImageZeroSize() const
@@ -546,7 +544,7 @@
return false;
}
-gl::Error TextureD3D::ensureRenderTarget(const gl::Context *context)
+angle::Result TextureD3D::ensureRenderTarget(const gl::Context *context)
{
ANGLE_TRY(initializeStorage(context, true));
@@ -554,8 +552,8 @@
// an error for incomplete sampling, but it is a big problem for rendering.
if (!mTexStorage)
{
- UNREACHABLE();
- return gl::InternalError() << "Cannot render to incomplete texture.";
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Stop();
}
if (!isBaseImageZeroSize())
@@ -572,7 +570,7 @@
}
}
- return gl::NoError();
+ return angle::Result::Continue();
}
bool TextureD3D::canCreateRenderTargetForImage(const gl::ImageIndex &index) const
@@ -586,9 +584,9 @@
return (image->isRenderableFormat() && levelsComplete);
}
-gl::Error TextureD3D::commitRegion(const gl::Context *context,
- const gl::ImageIndex &index,
- const gl::Box ®ion)
+angle::Result TextureD3D::commitRegion(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box ®ion)
{
if (mTexStorage)
{
@@ -598,7 +596,7 @@
image->markClean();
}
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::Error TextureD3D::getAttachmentRenderTarget(const gl::Context *context,
@@ -643,11 +641,11 @@
return gl::NoError();
}
-gl::Error TextureD3D::releaseTexStorage(const gl::Context *context)
+angle::Result TextureD3D::releaseTexStorage(const gl::Context *context)
{
if (!mTexStorage)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
onStateChange(context, angle::SubjectMessage::DEPENDENT_DIRTY_BITS);
@@ -1277,7 +1275,7 @@
return gl::NoError();
}
-gl::Error TextureD3D_2D::initMipmapImages(const gl::Context *context)
+angle::Result TextureD3D_2D::initMipmapImages(const gl::Context *context)
{
const GLuint baseLevel = mState.getEffectiveBaseLevel();
const GLuint maxLevel = mState.getMipmapMaxLevel();
@@ -1290,7 +1288,7 @@
ANGLE_TRY(redefineImage(context, level, getBaseLevelInternalFormat(), levelSize, false));
}
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::Error TextureD3D_2D::getRenderTarget(const gl::Context *context,
@@ -1360,18 +1358,18 @@
}
// Constructs a native texture resource from the texture images
-gl::Error TextureD3D_2D::initializeStorage(const gl::Context *context, bool renderTarget)
+angle::Result TextureD3D_2D::initializeStorage(const gl::Context *context, bool renderTarget)
{
// Only initialize the first time this texture is used as a render target or shader resource
if (mTexStorage)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
// do not attempt to create storage for nonexistant data
if (!isLevelComplete(getBaseLevel()))
{
- return gl::NoError();
+ return angle::Result::Continue();
}
bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mState.getUsage()));
@@ -1387,11 +1385,11 @@
// flush image data to the storage
ANGLE_TRY(updateStorage(context));
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_2D::createCompleteStorage(bool renderTarget,
- TexStoragePointer *outStorage) const
+angle::Result TextureD3D_2D::createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outStorage) const
{
GLsizei width = getLevelZeroWidth();
GLsizei height = getLevelZeroHeight();
@@ -1419,11 +1417,11 @@
levels, hintLevelZeroOnly));
(*outStorage)->setSubject(this);
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_2D::setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage)
+angle::Result TextureD3D_2D::setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage)
{
if (newCompleteTexStorage && newCompleteTexStorage->isManaged())
{
@@ -1441,14 +1439,14 @@
mDirtyImages = true;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_2D::updateStorage(const gl::Context *context)
+angle::Result TextureD3D_2D::updateStorage(const gl::Context *context)
{
if (!mDirtyImages)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
ASSERT(mTexStorage != nullptr);
@@ -1462,10 +1460,10 @@
}
mDirtyImages = false;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_2D::updateStorageLevel(const gl::Context *context, int level)
+angle::Result TextureD3D_2D::updateStorageLevel(const gl::Context *context, int level)
{
ASSERT(level <= static_cast<int>(mImageArray.size()) && mImageArray[level] != nullptr);
ASSERT(isLevelComplete(level));
@@ -1477,14 +1475,14 @@
ANGLE_TRY(commitRegion(context, index, region));
}
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_2D::redefineImage(const gl::Context *context,
- size_t level,
- GLenum internalformat,
- const gl::Extents &size,
- bool forceRelease)
+angle::Result TextureD3D_2D::redefineImage(const gl::Context *context,
+ size_t level,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease)
{
ASSERT(size.depth == 1);
@@ -1520,7 +1518,7 @@
// Can't be an EGL image target after being redefined
mEGLImageTarget = false;
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::ImageIndexIterator TextureD3D_2D::imageIterator() const
@@ -1985,7 +1983,7 @@
return gl::InternalError();
}
-gl::Error TextureD3D_Cube::initMipmapImages(const gl::Context *context)
+angle::Result TextureD3D_Cube::initMipmapImages(const gl::Context *context)
{
const GLuint baseLevel = mState.getEffectiveBaseLevel();
const GLuint maxLevel = mState.getMipmapMaxLevel();
@@ -2002,7 +2000,7 @@
gl::Extents(faceLevelSize, faceLevelSize, 1), false));
}
}
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::Error TextureD3D_Cube::getRenderTarget(const gl::Context *context,
@@ -2018,18 +2016,18 @@
return mTexStorage->getRenderTarget(context, index, outRT);
}
-gl::Error TextureD3D_Cube::initializeStorage(const gl::Context *context, bool renderTarget)
+angle::Result TextureD3D_Cube::initializeStorage(const gl::Context *context, bool renderTarget)
{
// Only initialize the first time this texture is used as a render target or shader resource
if (mTexStorage)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
// do not attempt to create storage for nonexistant data
if (!isFaceLevelComplete(0, getBaseLevel()))
{
- return gl::NoError();
+ return angle::Result::Continue();
}
bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mState.getUsage()));
@@ -2045,11 +2043,11 @@
// flush image data to the storage
ANGLE_TRY(updateStorage(context));
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_Cube::createCompleteStorage(bool renderTarget,
- TexStoragePointer *outStorage) const
+angle::Result TextureD3D_Cube::createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outStorage) const
{
GLsizei size = getLevelZeroWidth();
@@ -2077,11 +2075,11 @@
outStorage->reset(mRenderer->createTextureStorageCube(
getBaseLevelInternalFormat(), renderTarget, size, levels, hintLevelZeroOnly));
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_Cube::setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage)
+angle::Result TextureD3D_Cube::setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage)
{
if (newCompleteTexStorage && newCompleteTexStorage->isManaged())
{
@@ -2099,14 +2097,14 @@
mTexStorage = newCompleteTexStorage;
mDirtyImages = true;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_Cube::updateStorage(const gl::Context *context)
+angle::Result TextureD3D_Cube::updateStorage(const gl::Context *context)
{
if (!mDirtyImages)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
ASSERT(mTexStorage != nullptr);
@@ -2123,7 +2121,7 @@
}
mDirtyImages = false;
- return gl::NoError();
+ return angle::Result::Continue();
}
bool TextureD3D_Cube::isValidFaceLevel(int faceIndex, int level) const
@@ -2181,9 +2179,9 @@
return isFaceLevelComplete(index.cubeMapFaceIndex(), index.getLevelIndex());
}
-gl::Error TextureD3D_Cube::updateStorageFaceLevel(const gl::Context *context,
- int faceIndex,
- int level)
+angle::Result TextureD3D_Cube::updateStorageFaceLevel(const gl::Context *context,
+ int faceIndex,
+ int level)
{
ASSERT(level >= 0 && faceIndex < 6 && level < static_cast<int>(mImageArray[faceIndex].size()) &&
mImageArray[faceIndex][level] != nullptr);
@@ -2197,15 +2195,15 @@
ANGLE_TRY(commitRegion(context, index, region));
}
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_Cube::redefineImage(const gl::Context *context,
- int faceIndex,
- GLint level,
- GLenum internalformat,
- const gl::Extents &size,
- bool forceRelease)
+angle::Result TextureD3D_Cube::redefineImage(const gl::Context *context,
+ int faceIndex,
+ GLint level,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease)
{
// If there currently is a corresponding storage texture image, it has these parameters
const int storageWidth = std::max(1, getLevelZeroWidth() >> level);
@@ -2229,7 +2227,7 @@
}
}
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::ImageIndexIterator TextureD3D_Cube::imageIterator() const
@@ -2560,7 +2558,7 @@
return gl::InternalError();
}
-gl::Error TextureD3D_3D::initMipmapImages(const gl::Context *context)
+angle::Result TextureD3D_3D::initMipmapImages(const gl::Context *context)
{
const GLuint baseLevel = mState.getEffectiveBaseLevel();
const GLuint maxLevel = mState.getMipmapMaxLevel();
@@ -2574,7 +2572,7 @@
ANGLE_TRY(redefineImage(context, level, getBaseLevelInternalFormat(), levelSize, false));
}
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::Error TextureD3D_3D::getRenderTarget(const gl::Context *context,
@@ -2596,18 +2594,18 @@
return mTexStorage->getRenderTarget(context, index, outRT);
}
-gl::Error TextureD3D_3D::initializeStorage(const gl::Context *context, bool renderTarget)
+angle::Result TextureD3D_3D::initializeStorage(const gl::Context *context, bool renderTarget)
{
// Only initialize the first time this texture is used as a render target or shader resource
if (mTexStorage)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
// do not attempt to create storage for nonexistant data
if (!isLevelComplete(getBaseLevel()))
{
- return gl::NoError();
+ return angle::Result::Continue();
}
bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mState.getUsage()));
@@ -2623,11 +2621,11 @@
// flush image data to the storage
ANGLE_TRY(updateStorage(context));
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_3D::createCompleteStorage(bool renderTarget,
- TexStoragePointer *outStorage) const
+angle::Result TextureD3D_3D::createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outStorage) const
{
GLsizei width = getLevelZeroWidth();
GLsizei height = getLevelZeroHeight();
@@ -2643,11 +2641,11 @@
outStorage->reset(mRenderer->createTextureStorage3D(internalFormat, renderTarget, width, height,
depth, levels));
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_3D::setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage)
+angle::Result TextureD3D_3D::setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage)
{
ANGLE_TRY(releaseTexStorage(context));
mTexStorage = newCompleteTexStorage;
@@ -2656,14 +2654,14 @@
// We do not support managed 3D storage, as that is D3D9/ES2-only
ASSERT(!mTexStorage->isManaged());
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_3D::updateStorage(const gl::Context *context)
+angle::Result TextureD3D_3D::updateStorage(const gl::Context *context)
{
if (!mDirtyImages)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
ASSERT(mTexStorage != nullptr);
@@ -2677,7 +2675,7 @@
}
mDirtyImages = false;
- return gl::NoError();
+ return angle::Result::Continue();
}
bool TextureD3D_3D::isValidLevel(int level) const
@@ -2739,7 +2737,7 @@
return isLevelComplete(index.getLevelIndex());
}
-gl::Error TextureD3D_3D::updateStorageLevel(const gl::Context *context, int level)
+angle::Result TextureD3D_3D::updateStorageLevel(const gl::Context *context, int level)
{
ASSERT(level >= 0 && level < static_cast<int>(mImageArray.size()) &&
mImageArray[level] != nullptr);
@@ -2752,14 +2750,14 @@
ANGLE_TRY(commitRegion(context, index, region));
}
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_3D::redefineImage(const gl::Context *context,
- GLint level,
- GLenum internalformat,
- const gl::Extents &size,
- bool forceRelease)
+angle::Result TextureD3D_3D::redefineImage(const gl::Context *context,
+ GLint level,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease)
{
// If there currently is a corresponding storage texture image, it has these parameters
const int storageWidth = std::max(1, getLevelZeroWidth() >> level);
@@ -2783,7 +2781,7 @@
}
}
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::ImageIndexIterator TextureD3D_3D::imageIterator() const
@@ -3132,7 +3130,7 @@
return gl::InternalError();
}
-gl::Error TextureD3D_2DArray::initMipmapImages(const gl::Context *context)
+angle::Result TextureD3D_2DArray::initMipmapImages(const gl::Context *context)
{
const GLuint baseLevel = mState.getEffectiveBaseLevel();
const GLuint maxLevel = mState.getMipmapMaxLevel();
@@ -3152,7 +3150,7 @@
ANGLE_TRY(redefineImage(context, level, baseFormat, levelLayerSize, false));
}
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::Error TextureD3D_2DArray::getRenderTarget(const gl::Context *context,
@@ -3165,18 +3163,18 @@
return mTexStorage->getRenderTarget(context, index, outRT);
}
-gl::Error TextureD3D_2DArray::initializeStorage(const gl::Context *context, bool renderTarget)
+angle::Result TextureD3D_2DArray::initializeStorage(const gl::Context *context, bool renderTarget)
{
// Only initialize the first time this texture is used as a render target or shader resource
if (mTexStorage)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
// do not attempt to create storage for nonexistant data
if (!isLevelComplete(getBaseLevel()))
{
- return gl::NoError();
+ return angle::Result::Continue();
}
bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mState.getUsage()));
@@ -3192,11 +3190,11 @@
// flush image data to the storage
ANGLE_TRY(updateStorage(context));
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_2DArray::createCompleteStorage(bool renderTarget,
- TexStoragePointer *outStorage) const
+angle::Result TextureD3D_2DArray::createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outStorage) const
{
GLsizei width = getLevelZeroWidth();
GLsizei height = getLevelZeroHeight();
@@ -3212,11 +3210,11 @@
outStorage->reset(mRenderer->createTextureStorage2DArray(internalFormat, renderTarget, width,
height, depth, levels));
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_2DArray::setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage)
+angle::Result TextureD3D_2DArray::setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage)
{
ANGLE_TRY(releaseTexStorage(context));
mTexStorage = newCompleteTexStorage;
@@ -3225,14 +3223,14 @@
// We do not support managed 2D array storage, as managed storage is ES2/D3D9 only
ASSERT(!mTexStorage->isManaged());
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_2DArray::updateStorage(const gl::Context *context)
+angle::Result TextureD3D_2DArray::updateStorage(const gl::Context *context)
{
if (!mDirtyImages)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
ASSERT(mTexStorage != nullptr);
@@ -3246,7 +3244,7 @@
}
mDirtyImages = false;
- return gl::NoError();
+ return angle::Result::Continue();
}
bool TextureD3D_2DArray::isValidLevel(int level) const
@@ -3313,7 +3311,7 @@
return isLevelComplete(index.getLevelIndex());
}
-gl::Error TextureD3D_2DArray::updateStorageLevel(const gl::Context *context, int level)
+angle::Result TextureD3D_2DArray::updateStorageLevel(const gl::Context *context, int level)
{
ASSERT(level >= 0 && level < static_cast<int>(ArraySize(mLayerCounts)));
ASSERT(isLevelComplete(level));
@@ -3329,7 +3327,7 @@
}
}
- return gl::NoError();
+ return angle::Result::Continue();
}
void TextureD3D_2DArray::deleteImages()
@@ -3346,11 +3344,11 @@
}
}
-gl::Error TextureD3D_2DArray::redefineImage(const gl::Context *context,
- GLint level,
- GLenum internalformat,
- const gl::Extents &size,
- bool forceRelease)
+angle::Result TextureD3D_2DArray::redefineImage(const gl::Context *context,
+ GLint level,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease)
{
// If there currently is a corresponding storage texture image, it has these parameters
const int storageWidth = std::max(1, getLevelZeroWidth() >> level);
@@ -3408,7 +3406,7 @@
}
}
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::ImageIndexIterator TextureD3D_2DArray::imageIterator() const
@@ -3598,10 +3596,10 @@
return gl::NoError();
}
-gl::Error TextureD3D_External::initMipmapImages(const gl::Context *context)
+angle::Result TextureD3D_External::initMipmapImages(const gl::Context *context)
{
- UNREACHABLE();
- return gl::InternalError();
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Stop();
}
gl::Error TextureD3D_External::getRenderTarget(const gl::Context *context,
@@ -3617,33 +3615,33 @@
return (index.getLevelIndex() == 0) ? (mTexStorage != nullptr) : false;
}
-gl::Error TextureD3D_External::initializeStorage(const gl::Context *context, bool renderTarget)
+angle::Result TextureD3D_External::initializeStorage(const gl::Context *context, bool renderTarget)
{
// Texture storage is created when an external image is bound
ASSERT(mTexStorage);
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_External::createCompleteStorage(bool renderTarget,
- TexStoragePointer *outStorage) const
+angle::Result TextureD3D_External::createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outStorage) const
{
UNREACHABLE();
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_External::setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage)
+angle::Result TextureD3D_External::setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage)
{
UNREACHABLE();
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_External::updateStorage(const gl::Context *context)
+angle::Result TextureD3D_External::updateStorage(const gl::Context *context)
{
// Texture storage does not need to be updated since it is already loaded with the latest
// external image
ASSERT(mTexStorage);
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::ImageIndexIterator TextureD3D_External::imageIterator() const
@@ -3833,12 +3831,13 @@
{
}
-gl::Error TextureD3D_2DMultisample::initializeStorage(const gl::Context *context, bool renderTarget)
+angle::Result TextureD3D_2DMultisample::initializeStorage(const gl::Context *context,
+ bool renderTarget)
{
// Only initialize the first time this texture is used as a render target or shader resource
if (mTexStorage)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mState.getUsage()));
@@ -3854,35 +3853,35 @@
// flush image data to the storage
ANGLE_TRY(updateStorage(context));
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_2DMultisample::createCompleteStorage(bool renderTarget,
- TexStoragePointer *outStorage) const
+angle::Result TextureD3D_2DMultisample::createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outStorage) const
{
outStorage->reset(mTexStorage);
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_2DMultisample::setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage)
+angle::Result TextureD3D_2DMultisample::setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage)
{
ANGLE_TRY(releaseTexStorage(context));
mTexStorage = newCompleteTexStorage;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_2DMultisample::updateStorage(const gl::Context *context)
+angle::Result TextureD3D_2DMultisample::updateStorage(const gl::Context *context)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureD3D_2DMultisample::initMipmapImages(const gl::Context *context)
+angle::Result TextureD3D_2DMultisample::initMipmapImages(const gl::Context *context)
{
UNIMPLEMENTED();
- return gl::NoError();
+ return angle::Result::Continue();
}
bool TextureD3D_2DMultisample::isImageComplete(const gl::ImageIndex &index) const
diff --git a/src/libANGLE/renderer/d3d/TextureD3D.h b/src/libANGLE/renderer/d3d/TextureD3D.h
index 5b4709d..18e670c 100644
--- a/src/libANGLE/renderer/d3d/TextureD3D.h
+++ b/src/libANGLE/renderer/d3d/TextureD3D.h
@@ -37,7 +37,7 @@
gl::Error onDestroy(const gl::Context *context) override;
- gl::Error getNativeTexture(const gl::Context *context, TextureStorage **outStorage);
+ angle::Result getNativeTexture(const gl::Context *context, TextureStorage **outStorage);
bool hasDirtyImages() const { return mDirtyImages; }
void resetDirty() { mDirtyImages = false; }
@@ -45,9 +45,9 @@
virtual ImageD3D *getImage(const gl::ImageIndex &index) const = 0;
virtual GLsizei getLayerCount(int level) const = 0;
- gl::Error getImageAndSyncFromStorage(const gl::Context *context,
- const gl::ImageIndex &index,
- ImageD3D **outImage);
+ angle::Result getImageAndSyncFromStorage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ ImageD3D **outImage);
GLint getBaseLevelWidth() const;
GLint getBaseLevelHeight() const;
@@ -102,62 +102,62 @@
const gl::ImageIndex &imageIndex) override;
protected:
- gl::Error setImageImpl(const gl::Context *context,
+ angle::Result setImageImpl(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels,
+ ptrdiff_t layerOffset);
+ angle::Result subImage(const gl::Context *context,
const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
GLenum type,
const gl::PixelUnpackState &unpack,
const uint8_t *pixels,
ptrdiff_t layerOffset);
- gl::Error subImage(const gl::Context *context,
- const gl::ImageIndex &index,
- const gl::Box &area,
- GLenum format,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels,
- ptrdiff_t layerOffset);
- gl::Error setCompressedImageImpl(const gl::Context *context,
+ angle::Result setCompressedImageImpl(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels,
+ ptrdiff_t layerOffset);
+ angle::Result subImageCompressed(const gl::Context *context,
const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
const gl::PixelUnpackState &unpack,
const uint8_t *pixels,
ptrdiff_t layerOffset);
- gl::Error subImageCompressed(const gl::Context *context,
- const gl::ImageIndex &index,
- const gl::Box &area,
- GLenum format,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels,
- ptrdiff_t layerOffset);
bool isFastUnpackable(const gl::Buffer *unpackBuffer, GLenum sizedInternalFormat);
- gl::Error fastUnpackPixels(const gl::Context *context,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixels,
- const gl::Box &destArea,
- GLenum sizedInternalFormat,
- GLenum type,
- RenderTargetD3D *destRenderTarget);
+ angle::Result fastUnpackPixels(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels,
+ const gl::Box &destArea,
+ GLenum sizedInternalFormat,
+ GLenum type,
+ RenderTargetD3D *destRenderTarget);
GLint getLevelZeroWidth() const;
GLint getLevelZeroHeight() const;
virtual GLint getLevelZeroDepth() const;
GLint creationLevels(GLsizei width, GLsizei height, GLsizei depth) const;
- virtual gl::Error initMipmapImages(const gl::Context *context) = 0;
+ virtual angle::Result initMipmapImages(const gl::Context *context) = 0;
bool isBaseImageZeroSize() const;
virtual bool isImageComplete(const gl::ImageIndex &index) const = 0;
bool canCreateRenderTargetForImage(const gl::ImageIndex &index) const;
- gl::Error ensureRenderTarget(const gl::Context *context);
+ angle::Result ensureRenderTarget(const gl::Context *context);
- virtual gl::Error createCompleteStorage(bool renderTarget,
- TexStoragePointer *outTexStorage) const = 0;
- virtual gl::Error setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage) = 0;
- gl::Error commitRegion(const gl::Context *context,
- const gl::ImageIndex &index,
- const gl::Box ®ion);
+ virtual angle::Result createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outTexStorage) const = 0;
+ virtual angle::Result setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage) = 0;
+ angle::Result commitRegion(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box ®ion);
- gl::Error releaseTexStorage(const gl::Context *context);
+ angle::Result releaseTexStorage(const gl::Context *context);
GLuint getBaseLevel() const { return mBaseLevel; };
@@ -173,13 +173,13 @@
TextureStorage *mTexStorage;
private:
- virtual gl::Error initializeStorage(const gl::Context *context, bool renderTarget) = 0;
+ virtual angle::Result initializeStorage(const gl::Context *context, bool renderTarget) = 0;
- virtual gl::Error updateStorage(const gl::Context *context) = 0;
+ virtual angle::Result updateStorage(const gl::Context *context) = 0;
bool shouldUseSetData(const ImageD3D *image) const;
- gl::Error generateMipmapUsingImages(const gl::Context *context, const GLuint maxLevel);
+ angle::Result generateMipmapUsingImages(const gl::Context *context, const GLuint maxLevel);
GLuint mBaseLevel;
};
@@ -289,26 +289,26 @@
void markAllImagesDirty() override;
private:
- gl::Error initializeStorage(const gl::Context *context, bool renderTarget) override;
- gl::Error createCompleteStorage(bool renderTarget,
- TexStoragePointer *outTexStorage) const override;
- gl::Error setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage) override;
+ angle::Result initializeStorage(const gl::Context *context, bool renderTarget) override;
+ angle::Result createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outTexStorage) const override;
+ angle::Result setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage) override;
- gl::Error updateStorage(const gl::Context *context) override;
- gl::Error initMipmapImages(const gl::Context *context) override;
+ angle::Result updateStorage(const gl::Context *context) override;
+ angle::Result initMipmapImages(const gl::Context *context) override;
bool isValidLevel(int level) const;
bool isLevelComplete(int level) const;
bool isImageComplete(const gl::ImageIndex &index) const override;
- gl::Error updateStorageLevel(const gl::Context *context, int level);
+ angle::Result updateStorageLevel(const gl::Context *context, int level);
- gl::Error redefineImage(const gl::Context *context,
- size_t level,
- GLenum internalformat,
- const gl::Extents &size,
- bool forceRelease);
+ angle::Result redefineImage(const gl::Context *context,
+ size_t level,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease);
bool mEGLImageTarget;
gl::TexLevelArray<std::unique_ptr<ImageD3D>> mImageArray;
@@ -416,27 +416,27 @@
void markAllImagesDirty() override;
private:
- gl::Error initializeStorage(const gl::Context *context, bool renderTarget) override;
- gl::Error createCompleteStorage(bool renderTarget,
- TexStoragePointer *outTexStorage) const override;
- gl::Error setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage) override;
+ angle::Result initializeStorage(const gl::Context *context, bool renderTarget) override;
+ angle::Result createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outTexStorage) const override;
+ angle::Result setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage) override;
- gl::Error updateStorage(const gl::Context *context) override;
- gl::Error initMipmapImages(const gl::Context *context) override;
+ angle::Result updateStorage(const gl::Context *context) override;
+ angle::Result initMipmapImages(const gl::Context *context) override;
bool isValidFaceLevel(int faceIndex, int level) const;
bool isFaceLevelComplete(int faceIndex, int level) const;
bool isCubeComplete() const;
bool isImageComplete(const gl::ImageIndex &index) const override;
- gl::Error updateStorageFaceLevel(const gl::Context *context, int faceIndex, int level);
+ angle::Result updateStorageFaceLevel(const gl::Context *context, int faceIndex, int level);
- gl::Error redefineImage(const gl::Context *context,
- int faceIndex,
- GLint level,
- GLenum internalformat,
- const gl::Extents &size,
- bool forceRelease);
+ angle::Result redefineImage(const gl::Context *context,
+ int faceIndex,
+ GLint level,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease);
std::array<gl::TexLevelArray<std::unique_ptr<ImageD3D>>, 6> mImageArray;
};
@@ -527,25 +527,25 @@
GLint getLevelZeroDepth() const override;
private:
- gl::Error initializeStorage(const gl::Context *context, bool renderTarget) override;
- gl::Error createCompleteStorage(bool renderTarget,
- TexStoragePointer *outStorage) const override;
- gl::Error setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage) override;
+ angle::Result initializeStorage(const gl::Context *context, bool renderTarget) override;
+ angle::Result createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outStorage) const override;
+ angle::Result setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage) override;
- gl::Error updateStorage(const gl::Context *context) override;
- gl::Error initMipmapImages(const gl::Context *context) override;
+ angle::Result updateStorage(const gl::Context *context) override;
+ angle::Result initMipmapImages(const gl::Context *context) override;
bool isValidLevel(int level) const;
bool isLevelComplete(int level) const;
bool isImageComplete(const gl::ImageIndex &index) const override;
- gl::Error updateStorageLevel(const gl::Context *context, int level);
+ angle::Result updateStorageLevel(const gl::Context *context, int level);
- gl::Error redefineImage(const gl::Context *context,
- GLint level,
- GLenum internalformat,
- const gl::Extents &size,
- bool forceRelease);
+ angle::Result redefineImage(const gl::Context *context,
+ GLint level,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease);
gl::TexLevelArray<std::unique_ptr<ImageD3D>> mImageArray;
};
@@ -634,26 +634,26 @@
void markAllImagesDirty() override;
private:
- gl::Error initializeStorage(const gl::Context *context, bool renderTarget) override;
- gl::Error createCompleteStorage(bool renderTarget,
- TexStoragePointer *outStorage) const override;
- gl::Error setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage) override;
+ angle::Result initializeStorage(const gl::Context *context, bool renderTarget) override;
+ angle::Result createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outStorage) const override;
+ angle::Result setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage) override;
- gl::Error updateStorage(const gl::Context *context) override;
- gl::Error initMipmapImages(const gl::Context *context) override;
+ angle::Result updateStorage(const gl::Context *context) override;
+ angle::Result initMipmapImages(const gl::Context *context) override;
bool isValidLevel(int level) const;
bool isLevelComplete(int level) const;
bool isImageComplete(const gl::ImageIndex &index) const override;
- gl::Error updateStorageLevel(const gl::Context *context, int level);
+ angle::Result updateStorageLevel(const gl::Context *context, int level);
void deleteImages();
- gl::Error redefineImage(const gl::Context *context,
- GLint level,
- GLenum internalformat,
- const gl::Extents &size,
- bool forceRelease);
+ angle::Result redefineImage(const gl::Context *context,
+ GLint level,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease);
// Storing images as an array of single depth textures since D3D11 treats each array level of a
// Texture2D object as a separate subresource. Each layer would have to be looped over
@@ -744,14 +744,14 @@
void markAllImagesDirty() override;
private:
- gl::Error initializeStorage(const gl::Context *context, bool renderTarget) override;
- gl::Error createCompleteStorage(bool renderTarget,
- TexStoragePointer *outTexStorage) const override;
- gl::Error setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage) override;
+ angle::Result initializeStorage(const gl::Context *context, bool renderTarget) override;
+ angle::Result createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outTexStorage) const override;
+ angle::Result setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage) override;
- gl::Error updateStorage(const gl::Context *context) override;
- gl::Error initMipmapImages(const gl::Context *context) override;
+ angle::Result updateStorage(const gl::Context *context) override;
+ angle::Result initMipmapImages(const gl::Context *context) override;
bool isImageComplete(const gl::ImageIndex &index) const override;
};
@@ -833,14 +833,14 @@
void markAllImagesDirty() override;
private:
- gl::Error initializeStorage(const gl::Context *context, bool renderTarget) override;
- gl::Error createCompleteStorage(bool renderTarget,
- TexStoragePointer *outTexStorage) const override;
- gl::Error setCompleteTexStorage(const gl::Context *context,
- TextureStorage *newCompleteTexStorage) override;
+ angle::Result initializeStorage(const gl::Context *context, bool renderTarget) override;
+ angle::Result createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outTexStorage) const override;
+ angle::Result setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage) override;
- gl::Error updateStorage(const gl::Context *context) override;
- gl::Error initMipmapImages(const gl::Context *context) override;
+ angle::Result updateStorage(const gl::Context *context) override;
+ angle::Result initMipmapImages(const gl::Context *context) override;
bool isImageComplete(const gl::ImageIndex &index) const override;
};
diff --git a/src/libANGLE/renderer/d3d/TextureStorage.h b/src/libANGLE/renderer/d3d/TextureStorage.h
index c801645..fc1e965 100644
--- a/src/libANGLE/renderer/d3d/TextureStorage.h
+++ b/src/libANGLE/renderer/d3d/TextureStorage.h
@@ -40,7 +40,7 @@
TextureStorage() : mSubject(nullptr) {}
virtual ~TextureStorage() {}
- virtual gl::Error onDestroy(const gl::Context *context);
+ virtual angle::Result onDestroy(const gl::Context *context);
virtual int getTopLevel() const = 0;
virtual bool isRenderTarget() const = 0;
@@ -48,25 +48,26 @@
virtual bool supportsNativeMipmapFunction() const = 0;
virtual int getLevelCount() const = 0;
- virtual gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) = 0;
- virtual gl::Error generateMipmap(const gl::Context *context,
- const gl::ImageIndex &sourceIndex,
- const gl::ImageIndex &destIndex) = 0;
+ virtual angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) = 0;
+ virtual angle::Result generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &sourceIndex,
+ const gl::ImageIndex &destIndex) = 0;
- virtual gl::Error copyToStorage(const gl::Context *context, TextureStorage *destStorage) = 0;
- virtual gl::Error setData(const gl::Context *context,
- const gl::ImageIndex &index,
- ImageD3D *image,
- const gl::Box *destBox,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixelData) = 0;
+ virtual angle::Result copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage) = 0;
+ virtual angle::Result setData(const gl::Context *context,
+ const gl::ImageIndex &index,
+ ImageD3D *image,
+ const gl::Box *destBox,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixelData) = 0;
// This is a no-op for most implementations of TextureStorage. Some (e.g. TextureStorage11_2D) might override it.
- virtual gl::Error useLevelZeroWorkaroundTexture(const gl::Context *context,
- bool useLevelZeroTexture);
+ virtual angle::Result useLevelZeroWorkaroundTexture(const gl::Context *context,
+ bool useLevelZeroTexture);
// Only used for D3D11.
void setSubject(const angle::Subject *subject);
@@ -75,15 +76,15 @@
const angle::Subject *mSubject;
};
-inline gl::Error TextureStorage::onDestroy(const gl::Context *context)
+inline angle::Result TextureStorage::onDestroy(const gl::Context *context)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
-inline gl::Error TextureStorage::useLevelZeroWorkaroundTexture(const gl::Context *context,
- bool useLevelZeroTexture)
+inline angle::Result TextureStorage::useLevelZeroWorkaroundTexture(const gl::Context *context,
+ bool useLevelZeroTexture)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
inline void TextureStorage::setSubject(const angle::Subject *subject)
diff --git a/src/libANGLE/renderer/d3d/VertexBuffer.cpp b/src/libANGLE/renderer/d3d/VertexBuffer.cpp
index f710b25..cfa6556 100644
--- a/src/libANGLE/renderer/d3d/VertexBuffer.cpp
+++ b/src/libANGLE/renderer/d3d/VertexBuffer.cpp
@@ -10,9 +10,10 @@
#include "libANGLE/renderer/d3d/VertexBuffer.h"
#include "common/mathutil.h"
-#include "libANGLE/renderer/d3d/BufferD3D.h"
-#include "libANGLE/renderer/d3d/RendererD3D.h"
+#include "libANGLE/Context.h"
#include "libANGLE/VertexAttribute.h"
+#include "libANGLE/renderer/d3d/BufferD3D.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
namespace rx
{
@@ -82,7 +83,7 @@
return mVertexBuffer->getBufferSize();
}
-gl::Error VertexBufferInterface::setBufferSize(const gl::Context *context, unsigned int size)
+angle::Result VertexBufferInterface::setBufferSize(const gl::Context *context, unsigned int size)
{
ASSERT(mVertexBuffer);
if (mVertexBuffer->getBufferSize() == 0)
@@ -93,12 +94,12 @@
return mVertexBuffer->setBufferSize(context, size);
}
-gl::Error VertexBufferInterface::getSpaceRequired(const gl::Context *context,
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- size_t count,
- GLsizei instances,
- unsigned int *spaceInBytesOut) const
+angle::Result VertexBufferInterface::getSpaceRequired(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances,
+ unsigned int *spaceInBytesOut) const
{
unsigned int spaceRequired = 0;
ANGLE_TRY(mFactory->getVertexSpaceRequired(context, attrib, binding, count, instances,
@@ -106,18 +107,13 @@
// Align to 16-byte boundary
unsigned int alignedSpaceRequired = roundUp(spaceRequired, 16u);
-
- if (alignedSpaceRequired < spaceRequired)
- {
- return gl::OutOfMemory()
- << "Vertex buffer overflow in VertexBufferInterface::getSpaceRequired.";
- }
+ ANGLE_CHECK_HR_ALLOC(GetImplAs<ContextD3D>(context), alignedSpaceRequired >= spaceRequired);
*spaceInBytesOut = alignedSpaceRequired;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error VertexBufferInterface::discard(const gl::Context *context)
+angle::Result VertexBufferInterface::discard(const gl::Context *context)
{
ASSERT(mVertexBuffer);
return mVertexBuffer->discard(context);
@@ -135,8 +131,8 @@
{
}
-gl::Error StreamingVertexBufferInterface::initialize(const gl::Context *context,
- std::size_t initialSize)
+angle::Result StreamingVertexBufferInterface::initialize(const gl::Context *context,
+ std::size_t initialSize)
{
return setBufferSize(context, static_cast<unsigned int>(initialSize));
}
@@ -154,8 +150,8 @@
{
}
-gl::Error StreamingVertexBufferInterface::reserveSpace(const gl::Context *context,
- unsigned int size)
+angle::Result StreamingVertexBufferInterface::reserveSpace(const gl::Context *context,
+ unsigned int size)
{
unsigned int curBufferSize = getBufferSize();
if (size > curBufferSize)
@@ -169,18 +165,19 @@
mWritePosition = 0;
}
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error StreamingVertexBufferInterface::storeDynamicAttribute(const gl::Context *context,
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLenum currentValueType,
- GLint start,
- size_t count,
- GLsizei instances,
- unsigned int *outStreamOffset,
- const uint8_t *sourceData)
+angle::Result StreamingVertexBufferInterface::storeDynamicAttribute(
+ const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ GLenum currentValueType,
+ GLint start,
+ size_t count,
+ GLsizei instances,
+ unsigned int *outStreamOffset,
+ const uint8_t *sourceData)
{
unsigned int spaceRequired = 0;
ANGLE_TRY(getSpaceRequired(context, attrib, binding, count, instances, &spaceRequired));
@@ -188,11 +185,7 @@
// Protect against integer overflow
angle::CheckedNumeric<unsigned int> checkedPosition(mWritePosition);
checkedPosition += spaceRequired;
- if (!checkedPosition.IsValid())
- {
- return gl::OutOfMemory()
- << "Internal error, new vertex buffer write position would overflow.";
- }
+ ANGLE_CHECK_HR_ALLOC(GetImplAs<ContextD3D>(context), checkedPosition.IsValid());
ANGLE_TRY(reserveSpace(context, mReservedSpace));
mReservedSpace = 0;
@@ -208,14 +201,14 @@
mWritePosition += spaceRequired;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error StreamingVertexBufferInterface::reserveVertexSpace(const gl::Context *context,
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- size_t count,
- GLsizei instances)
+angle::Result StreamingVertexBufferInterface::reserveVertexSpace(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances)
{
unsigned int requiredSpace = 0;
ANGLE_TRY(mFactory->getVertexSpaceRequired(context, attrib, binding, count, instances,
@@ -226,16 +219,11 @@
alignedRequiredSpace += mReservedSpace;
// Protect against integer overflow
- if (!alignedRequiredSpace.IsValid())
- {
- return gl::OutOfMemory()
- << "Unable to reserve " << requiredSpace
- << " extra bytes in internal vertex buffer, it would result in an overflow.";
- }
+ ANGLE_CHECK_HR_ALLOC(GetImplAs<ContextD3D>(context), alignedRequiredSpace.IsValid());
mReservedSpace = alignedRequiredSpace.ValueOrDie();
- return gl::NoError();
+ return angle::Result::Continue();
}
// StaticVertexBufferInterface Implementation
@@ -294,13 +282,13 @@
return mSignature.set(attrib, binding);
}
-gl::Error StaticVertexBufferInterface::storeStaticAttribute(const gl::Context *context,
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLint start,
- GLsizei count,
- GLsizei instances,
- const uint8_t *sourceData)
+angle::Result StaticVertexBufferInterface::storeStaticAttribute(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ GLint start,
+ GLsizei count,
+ GLsizei instances,
+ const uint8_t *sourceData)
{
unsigned int spaceRequired = 0;
ANGLE_TRY(getSpaceRequired(context, attrib, binding, count, instances, &spaceRequired));
@@ -312,7 +300,7 @@
mSignature.set(attrib, binding);
mVertexBuffer->hintUnmapResource();
- return gl::NoError();
+ return angle::Result::Continue();
}
} // namespace rx
diff --git a/src/libANGLE/renderer/d3d/VertexBuffer.h b/src/libANGLE/renderer/d3d/VertexBuffer.h
index dc78ee8..9196e2e 100644
--- a/src/libANGLE/renderer/d3d/VertexBuffer.h
+++ b/src/libANGLE/renderer/d3d/VertexBuffer.h
@@ -38,25 +38,25 @@
public:
VertexBuffer();
- virtual gl::Error initialize(const gl::Context *context,
- unsigned int size,
- bool dynamicUsage) = 0;
+ virtual angle::Result initialize(const gl::Context *context,
+ unsigned int size,
+ bool dynamicUsage) = 0;
// Warning: you should ensure binding really matches attrib.bindingIndex before using this
// function.
- virtual gl::Error storeVertexAttributes(const gl::Context *context,
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLenum currentValueType,
- GLint start,
- size_t count,
- GLsizei instances,
- unsigned int offset,
- const uint8_t *sourceData) = 0;
+ virtual angle::Result storeVertexAttributes(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ GLenum currentValueType,
+ GLint start,
+ size_t count,
+ GLsizei instances,
+ unsigned int offset,
+ const uint8_t *sourceData) = 0;
virtual unsigned int getBufferSize() const = 0;
- virtual gl::Error setBufferSize(const gl::Context *context, unsigned int size) = 0;
- virtual gl::Error discard(const gl::Context *context) = 0;
+ virtual angle::Result setBufferSize(const gl::Context *context, unsigned int size) = 0;
+ virtual angle::Result discard(const gl::Context *context) = 0;
unsigned int getSerial() const;
@@ -91,16 +91,16 @@
VertexBuffer *getVertexBuffer() const;
protected:
- gl::Error discard(const gl::Context *context);
+ angle::Result discard(const gl::Context *context);
- gl::Error setBufferSize(const gl::Context *context, unsigned int size);
+ angle::Result setBufferSize(const gl::Context *context, unsigned int size);
- gl::Error getSpaceRequired(const gl::Context *context,
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- size_t count,
- GLsizei instances,
- unsigned int *spaceInBytesOut) const;
+ angle::Result getSpaceRequired(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances,
+ unsigned int *spaceInBytesOut) const;
BufferFactoryD3D *const mFactory;
VertexBuffer *mVertexBuffer;
bool mDynamic;
@@ -112,27 +112,27 @@
StreamingVertexBufferInterface(BufferFactoryD3D *factory);
~StreamingVertexBufferInterface() override;
- gl::Error initialize(const gl::Context *context, std::size_t initialSize);
+ angle::Result initialize(const gl::Context *context, std::size_t initialSize);
void reset();
- gl::Error storeDynamicAttribute(const gl::Context *context,
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLenum currentValueType,
- GLint start,
- size_t count,
- GLsizei instances,
- unsigned int *outStreamOffset,
- const uint8_t *sourceData);
+ angle::Result storeDynamicAttribute(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ GLenum currentValueType,
+ GLint start,
+ size_t count,
+ GLsizei instances,
+ unsigned int *outStreamOffset,
+ const uint8_t *sourceData);
- gl::Error reserveVertexSpace(const gl::Context *context,
- const gl::VertexAttribute &attribute,
- const gl::VertexBinding &binding,
- size_t count,
- GLsizei instances);
+ angle::Result reserveVertexSpace(const gl::Context *context,
+ const gl::VertexAttribute &attribute,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances);
private:
- gl::Error reserveSpace(const gl::Context *context, unsigned int size);
+ angle::Result reserveSpace(const gl::Context *context, unsigned int size);
unsigned int mWritePosition;
unsigned int mReservedSpace;
@@ -146,13 +146,13 @@
// Warning: you should ensure binding really matches attrib.bindingIndex before using these
// functions.
- gl::Error storeStaticAttribute(const gl::Context *context,
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLint start,
- GLsizei count,
- GLsizei instances,
- const uint8_t *sourceData);
+ angle::Result storeStaticAttribute(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ GLint start,
+ GLsizei count,
+ GLsizei instances,
+ const uint8_t *sourceData);
bool matchesAttribute(const gl::VertexAttribute &attribute,
const gl::VertexBinding &binding) const;
diff --git a/src/libANGLE/renderer/d3d/VertexDataManager.cpp b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
index 9f254da..5c5e74b 100644
--- a/src/libANGLE/renderer/d3d/VertexDataManager.cpp
+++ b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
@@ -18,7 +18,7 @@
#include "libANGLE/VertexAttribute.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/d3d/BufferD3D.h"
-#include "libANGLE/renderer/d3d/RendererD3D.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
#include "libANGLE/renderer/d3d/VertexBuffer.h"
using namespace angle;
@@ -97,7 +97,7 @@
if (attrib.type != GL_FLOAT)
{
unsigned int elementSize = 0;
- gl::Error error =
+ angle::Result error =
factory->getVertexSpaceRequired(context, attrib, binding, 1, 0, &elementSize);
ASSERT(!error.isError());
alignment = std::min<size_t>(elementSize, 4);
@@ -127,21 +127,23 @@
TranslatedAttribute::TranslatedAttribute(const TranslatedAttribute &other) = default;
-gl::Error TranslatedAttribute::computeOffset(GLint startVertex, unsigned int *offsetOut) const
+angle::Result TranslatedAttribute::computeOffset(const gl::Context *context,
+ GLint startVertex,
+ unsigned int *offsetOut) const
{
if (!usesFirstVertexOffset)
{
*offsetOut = baseOffset;
- return gl::NoError();
+ return angle::Result::Continue();
}
CheckedNumeric<unsigned int> offset(baseOffset);
CheckedNumeric<unsigned int> checkedStride(stride);
offset += checkedStride * static_cast<unsigned int>(startVertex);
- ANGLE_TRY_CHECKED_MATH(offset.IsValid());
+ ANGLE_CHECK_HR_MATH(GetImplAs<ContextD3D>(context), offset.IsValid());
*offsetOut = offset.ValueOrDie();
- return gl::NoError();
+ return angle::Result::Continue();
}
// Warning: you should ensure binding really matches attrib.bindingIndex before using this function.
@@ -217,7 +219,7 @@
{
}
-gl::Error VertexDataManager::initialize(const gl::Context *context)
+angle::Result VertexDataManager::initialize(const gl::Context *context)
{
return mStreamingBuffer.initialize(context, INITIAL_STREAM_BUFFER_SIZE);
}
@@ -228,11 +230,12 @@
mCurrentValueCache.clear();
}
-gl::Error VertexDataManager::prepareVertexData(const gl::Context *context,
- GLint start,
- GLsizei count,
- std::vector<TranslatedAttribute> *translatedAttribs,
- GLsizei instances)
+angle::Result VertexDataManager::prepareVertexData(
+ const gl::Context *context,
+ GLint start,
+ GLsizei count,
+ std::vector<TranslatedAttribute> *translatedAttribs,
+ GLsizei instances)
{
const gl::State &state = context->getGLState();
const gl::VertexArray *vertexArray = state.getVertexArray();
@@ -295,7 +298,7 @@
if (mDynamicAttribsMaskCache.none())
{
- return gl::NoError();
+ return angle::Result::Continue();
}
ANGLE_TRY(storeDynamicAttribs(context, translatedAttribs, mDynamicAttribsMaskCache, start,
@@ -303,7 +306,7 @@
PromoteDynamicAttribs(context, *translatedAttribs, mDynamicAttribsMaskCache, count);
- return gl::NoError();
+ return angle::Result::Continue();
}
// static
@@ -331,8 +334,8 @@
}
// static
-gl::Error VertexDataManager::StoreStaticAttrib(const gl::Context *context,
- TranslatedAttribute *translated)
+angle::Result VertexDataManager::StoreStaticAttrib(const gl::Context *context,
+ TranslatedAttribute *translated)
{
ASSERT(translated->attribute && translated->binding);
const auto &attrib = *translated->attribute;
@@ -379,10 +382,7 @@
CheckedNumeric<unsigned int> checkedOffset(streamOffset);
checkedOffset += firstElementOffset;
- if (!checkedOffset.IsValid())
- {
- return gl::InternalError() << "Integer overflow in VertexDataManager::StoreStaticAttrib";
- }
+ ANGLE_CHECK_HR_MATH(GetImplAs<ContextD3D>(context), checkedOffset.IsValid());
translated->vertexBuffer.set(vertexBuffer);
translated->serial = vertexBuffer->getSerial();
@@ -391,10 +391,10 @@
// Instanced vertices do not apply the 'start' offset
translated->usesFirstVertexOffset = (binding.getDivisor() == 0);
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error VertexDataManager::storeDynamicAttribs(
+angle::Result VertexDataManager::storeDynamicAttribs(
const gl::Context *context,
std::vector<TranslatedAttribute> *translatedAttribs,
const gl::AttributesMask &dynamicAttribsMask,
@@ -434,7 +434,7 @@
ANGLE_TRY(storeDynamicAttrib(context, dynamicAttrib, start, count, instances));
}
- return gl::NoError();
+ return angle::Result::Continue();
}
void VertexDataManager::PromoteDynamicAttribs(
@@ -460,11 +460,11 @@
}
}
-gl::Error VertexDataManager::reserveSpaceForAttrib(const gl::Context *context,
- const TranslatedAttribute &translatedAttrib,
- GLint start,
- size_t count,
- GLsizei instances)
+angle::Result VertexDataManager::reserveSpaceForAttrib(const gl::Context *context,
+ const TranslatedAttribute &translatedAttrib,
+ GLint start,
+ size_t count,
+ GLsizei instances)
{
ASSERT(translatedAttrib.attribute && translatedAttrib.binding);
const auto &attrib = *translatedAttrib.attribute;
@@ -490,19 +490,17 @@
int elementsInBuffer =
ElementsInBuffer(attrib, binding, static_cast<unsigned int>(bufferD3D->getSize()));
- if (maxVertexCount > elementsInBuffer)
- {
- return gl::InvalidOperation() << "Vertex buffer is not big enough for the draw call.";
- }
+ ANGLE_CHECK_HR(GetImplAs<ContextD3D>(context), maxVertexCount <= elementsInBuffer,
+ "Vertex buffer is not big enough for the draw call.", E_FAIL);
}
return mStreamingBuffer.reserveVertexSpace(context, attrib, binding, totalCount, instances);
}
-gl::Error VertexDataManager::storeDynamicAttrib(const gl::Context *context,
- TranslatedAttribute *translated,
- GLint start,
- size_t count,
- GLsizei instances)
+angle::Result VertexDataManager::storeDynamicAttrib(const gl::Context *context,
+ TranslatedAttribute *translated,
+ GLint start,
+ size_t count,
+ GLsizei instances)
{
ASSERT(translated->attribute && translated->binding);
const auto &attrib = *translated->attribute;
@@ -552,13 +550,14 @@
translated->baseOffset = streamOffset;
translated->usesFirstVertexOffset = false;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error VertexDataManager::storeCurrentValue(const gl::Context *context,
- const gl::VertexAttribCurrentValueData ¤tValue,
- TranslatedAttribute *translated,
- size_t attribIndex)
+angle::Result VertexDataManager::storeCurrentValue(
+ const gl::Context *context,
+ const gl::VertexAttribCurrentValueData ¤tValue,
+ TranslatedAttribute *translated,
+ size_t attribIndex)
{
CurrentValueState *cachedState = &mCurrentValueCache[attribIndex];
StreamingVertexBufferInterface &buffer = *cachedState->buffer;
@@ -596,7 +595,7 @@
translated->baseOffset = static_cast<unsigned int>(cachedState->offset);
translated->usesFirstVertexOffset = false;
- return gl::NoError();
+ return angle::Result::Continue();
}
// VertexBufferBinding implementation
diff --git a/src/libANGLE/renderer/d3d/VertexDataManager.h b/src/libANGLE/renderer/d3d/VertexDataManager.h
index 6227c2a..388b1fe 100644
--- a/src/libANGLE/renderer/d3d/VertexDataManager.h
+++ b/src/libANGLE/renderer/d3d/VertexDataManager.h
@@ -53,7 +53,9 @@
// Computes the correct offset from baseOffset, usesFirstVertexOffset, stride and startVertex.
// Can throw an error on integer overflow.
- gl::Error computeOffset(GLint startVertex, unsigned int *offsetOut) const;
+ angle::Result computeOffset(const gl::Context *context,
+ GLint startVertex,
+ unsigned int *offsetOut) const;
bool active;
@@ -90,25 +92,26 @@
VertexDataManager(BufferFactoryD3D *factory);
virtual ~VertexDataManager();
- gl::Error initialize(const gl::Context *context);
+ angle::Result initialize(const gl::Context *context);
void deinitialize();
- gl::Error prepareVertexData(const gl::Context *context,
- GLint start,
- GLsizei count,
- std::vector<TranslatedAttribute> *translatedAttribs,
- GLsizei instances);
+ angle::Result prepareVertexData(const gl::Context *context,
+ GLint start,
+ GLsizei count,
+ std::vector<TranslatedAttribute> *translatedAttribs,
+ GLsizei instances);
static void StoreDirectAttrib(const gl::Context *context, TranslatedAttribute *directAttrib);
- static gl::Error StoreStaticAttrib(const gl::Context *context, TranslatedAttribute *translated);
+ static angle::Result StoreStaticAttrib(const gl::Context *context,
+ TranslatedAttribute *translated);
- gl::Error storeDynamicAttribs(const gl::Context *context,
- std::vector<TranslatedAttribute> *translatedAttribs,
- const gl::AttributesMask &dynamicAttribsMask,
- GLint start,
- size_t count,
- GLsizei instances);
+ angle::Result storeDynamicAttribs(const gl::Context *context,
+ std::vector<TranslatedAttribute> *translatedAttribs,
+ const gl::AttributesMask &dynamicAttribsMask,
+ GLint start,
+ size_t count,
+ GLsizei instances);
// Promote static usage of dynamic buffers.
static void PromoteDynamicAttribs(const gl::Context *context,
@@ -116,10 +119,10 @@
const gl::AttributesMask &dynamicAttribsMask,
size_t count);
- gl::Error storeCurrentValue(const gl::Context *context,
- const gl::VertexAttribCurrentValueData ¤tValue,
- TranslatedAttribute *translated,
- size_t attribIndex);
+ angle::Result storeCurrentValue(const gl::Context *context,
+ const gl::VertexAttribCurrentValueData ¤tValue,
+ TranslatedAttribute *translated,
+ size_t attribIndex);
private:
struct CurrentValueState final : angle::NonCopyable
@@ -133,17 +136,17 @@
size_t offset;
};
- gl::Error reserveSpaceForAttrib(const gl::Context *context,
- const TranslatedAttribute &translatedAttrib,
- GLint start,
- size_t count,
- GLsizei instances);
+ angle::Result reserveSpaceForAttrib(const gl::Context *context,
+ const TranslatedAttribute &translatedAttrib,
+ GLint start,
+ size_t count,
+ GLsizei instances);
- gl::Error storeDynamicAttrib(const gl::Context *context,
- TranslatedAttribute *translated,
- GLint start,
- size_t count,
- GLsizei instances);
+ angle::Result storeDynamicAttrib(const gl::Context *context,
+ TranslatedAttribute *translated,
+ GLint start,
+ size_t count,
+ GLsizei instances);
BufferFactoryD3D *const mFactory;
diff --git a/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp b/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp
index 5456b10..de74a8c 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp
@@ -346,7 +346,7 @@
return gl::NoError();
}
-gl::Error Buffer11::getData(const gl::Context *context, const uint8_t **outData)
+angle::Result Buffer11::getData(const gl::Context *context, const uint8_t **outData)
{
SystemMemoryStorage *systemMemoryStorage = nullptr;
ANGLE_TRY(getBufferStorage(context, BUFFER_USAGE_SYSTEM_MEMORY, &systemMemoryStorage));
@@ -354,7 +354,7 @@
ASSERT(systemMemoryStorage->getSize() >= mSize);
*outData = systemMemoryStorage->getSystemCopy()->data();
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::Error Buffer11::setSubData(const gl::Context *context,
@@ -542,7 +542,7 @@
return gl::NoError();
}
-gl::Error Buffer11::markTransformFeedbackUsage(const gl::Context *context)
+angle::Result Buffer11::markTransformFeedbackUsage(const gl::Context *context)
{
BufferStorage *transformFeedbackStorage = nullptr;
ANGLE_TRY(getBufferStorage(context, BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK,
@@ -554,7 +554,7 @@
}
invalidateStaticData(context);
- return gl::NoError();
+ return angle::Result::Continue();
}
void Buffer11::updateDeallocThreshold(BufferUsage usage)
@@ -1290,7 +1290,7 @@
if (!mBuffer.valid())
{
unsigned int offset = 0;
- ANGLE_TRY_HANDLE(context11, attribute.computeOffset(startVertex, &offset));
+ ANGLE_TRY(attribute.computeOffset(context, startVertex, &offset));
// Expand the memory storage upon request and cache the results.
unsigned int expandedDataSize =
diff --git a/src/libANGLE/renderer/d3d/d3d11/Buffer11.h b/src/libANGLE/renderer/d3d/d3d11/Buffer11.h
index 35ed13a..8d9e713 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Buffer11.h
+++ b/src/libANGLE/renderer/d3d/d3d11/Buffer11.h
@@ -79,7 +79,7 @@
// BufferD3D implementation
size_t getSize() const override;
bool supportsDirectBinding() const override;
- gl::Error getData(const gl::Context *context, const uint8_t **outData) override;
+ angle::Result getData(const gl::Context *context, const uint8_t **outData) override;
void initializeStaticData(const gl::Context *context) override;
void invalidateStaticData(const gl::Context *context) override;
@@ -106,7 +106,7 @@
GLbitfield access,
void **mapPtr) override;
gl::Error unmap(const gl::Context *context, GLboolean *result) override;
- gl::Error markTransformFeedbackUsage(const gl::Context *context) override;
+ angle::Result markTransformFeedbackUsage(const gl::Context *context) override;
private:
class BufferStorage;
diff --git a/src/libANGLE/renderer/d3d/d3d11/Context11.cpp b/src/libANGLE/renderer/d3d/d3d11/Context11.cpp
index d388b1f..bccdb74 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Context11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Context11.cpp
@@ -108,7 +108,7 @@
} // anonymous namespace
Context11::Context11(const gl::ContextState &state, Renderer11 *renderer)
- : ContextImpl(state), mRenderer(renderer)
+ : ContextD3D(state), mRenderer(renderer)
{
}
@@ -506,15 +506,15 @@
}
// Load the compiler if necessary and recompile the programs.
- ANGLE_TRY_HANDLE(context, mRenderer->ensureHLSLCompilerInitialized(context));
+ ANGLE_TRY(mRenderer->ensureHLSLCompilerInitialized(context));
gl::InfoLog infoLog;
if (recompileVS)
{
ShaderExecutableD3D *vertexExe = nullptr;
- ANGLE_TRY_HANDLE(context, programD3D->getVertexExecutableForCachedInputLayout(
- context, &vertexExe, &infoLog));
+ ANGLE_TRY(
+ programD3D->getVertexExecutableForCachedInputLayout(context, &vertexExe, &infoLog));
if (!programD3D->hasVertexExecutableForCachedInputLayout())
{
ASSERT(infoLog.getLength() > 0);
@@ -526,8 +526,8 @@
if (recompileGS)
{
ShaderExecutableD3D *geometryExe = nullptr;
- ANGLE_TRY_HANDLE(context, programD3D->getGeometryExecutableForPrimitiveType(
- context, drawMode, &geometryExe, &infoLog));
+ ANGLE_TRY(programD3D->getGeometryExecutableForPrimitiveType(context, drawMode, &geometryExe,
+ &infoLog));
if (!programD3D->hasGeometryExecutableForPrimitiveType(drawMode))
{
ASSERT(infoLog.getLength() > 0);
@@ -539,8 +539,8 @@
if (recompilePS)
{
ShaderExecutableD3D *pixelExe = nullptr;
- ANGLE_TRY_HANDLE(context, programD3D->getPixelExecutableForCachedOutputLayout(
- context, &pixelExe, &infoLog));
+ ANGLE_TRY(
+ programD3D->getPixelExecutableForCachedOutputLayout(context, &pixelExe, &infoLog));
if (!programD3D->hasPixelExecutableForCachedOutputLayout())
{
ASSERT(infoLog.getLength() > 0);
@@ -575,11 +575,13 @@
return gl::NoError();
}
-gl::Error Context11::getIncompleteTexture(const gl::Context *context,
- gl::TextureType type,
- gl::Texture **textureOut)
+angle::Result Context11::getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut)
{
- return mIncompleteTextures.getIncompleteTexture(context, type, this, textureOut);
+ ANGLE_TRY_HANDLE(context,
+ mIncompleteTextures.getIncompleteTexture(context, type, this, textureOut));
+ return angle::Result::Continue();
}
gl::Error Context11::initializeMultisampleTextureToBlack(const gl::Context *context,
diff --git a/src/libANGLE/renderer/d3d/d3d11/Context11.h b/src/libANGLE/renderer/d3d/d3d11/Context11.h
index 87cdaac..20ac8fd 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Context11.h
+++ b/src/libANGLE/renderer/d3d/d3d11/Context11.h
@@ -12,13 +12,13 @@
#include "libANGLE/renderer/ContextImpl.h"
-#include "libANGLE/renderer/d3d/RendererD3D.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
namespace rx
{
class Renderer11;
-class Context11 : public ContextImpl, public MultisampleTextureInitializer, public d3d::Context
+class Context11 : public ContextD3D, public MultisampleTextureInitializer
{
public:
Context11(const gl::ContextState &state, Renderer11 *renderer);
@@ -152,9 +152,9 @@
angle::Result triggerDrawCallProgramRecompilation(const gl::Context *context,
gl::PrimitiveMode drawMode);
- gl::Error getIncompleteTexture(const gl::Context *context,
- gl::TextureType type,
- gl::Texture **textureOut);
+ angle::Result getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut);
gl::Error initializeMultisampleTextureToBlack(const gl::Context *context,
gl::Texture *glTexture) override;
diff --git a/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp b/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp
index a08855d..3470f2b 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp
@@ -40,7 +40,7 @@
TextureD3D *textureD3D = GetImplAs<TextureD3D>(texture);
TextureStorage *texStorage = nullptr;
- ANGLE_TRY_HANDLE(context, textureD3D->getNativeTexture(context, &texStorage));
+ ANGLE_TRY(textureD3D->getNativeTexture(context, &texStorage));
if (texStorage)
{
@@ -84,7 +84,8 @@
return angle::Result::Continue();
}
-gl::Error Framebuffer11::clearImpl(const gl::Context *context, const ClearParameters &clearParams)
+angle::Result Framebuffer11::clearImpl(const gl::Context *context,
+ const ClearParameters &clearParams)
{
Clear11 *clearer = mRenderer->getClearer();
@@ -109,7 +110,7 @@
ANGLE_TRY(markAttachmentsDirty(context));
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::Error Framebuffer11::invalidate(const gl::Context *context,
@@ -126,17 +127,17 @@
return invalidateBase(context, count, attachments, true);
}
-gl::Error Framebuffer11::invalidateBase(const gl::Context *context,
- size_t count,
- const GLenum *attachments,
- bool useEXTBehavior) const
+angle::Result Framebuffer11::invalidateBase(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments,
+ bool useEXTBehavior) const
{
ID3D11DeviceContext1 *deviceContext1 = mRenderer->getDeviceContext1IfSupported();
if (!deviceContext1)
{
// DiscardView() is only supported on ID3D11DeviceContext1
- return gl::NoError();
+ return angle::Result::Continue();
}
bool foundDepth = false;
@@ -215,7 +216,7 @@
ANGLE_TRY(invalidateAttachment(context, mState.getStencilAttachment()));
}
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::Error Framebuffer11::invalidateSub(const gl::Context *context,
@@ -227,15 +228,15 @@
return gl::NoError();
}
-gl::Error Framebuffer11::invalidateAttachment(const gl::Context *context,
- const gl::FramebufferAttachment *attachment) const
+angle::Result Framebuffer11::invalidateAttachment(const gl::Context *context,
+ const gl::FramebufferAttachment *attachment) const
{
ID3D11DeviceContext1 *deviceContext1 = mRenderer->getDeviceContext1IfSupported();
ASSERT(deviceContext1);
ASSERT(attachment && attachment->isAttached());
RenderTarget11 *renderTarget = nullptr;
- ANGLE_TRY(attachment->getRenderTarget(context, &renderTarget));
+ ANGLE_TRY_HANDLE(context, attachment->getRenderTarget(context, &renderTarget));
const auto &rtv = renderTarget->getRenderTargetView();
if (rtv.valid())
@@ -243,16 +244,16 @@
deviceContext1->DiscardView(rtv.get());
}
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Framebuffer11::readPixelsImpl(const gl::Context *context,
- const gl::Rectangle &area,
- GLenum format,
- GLenum type,
- size_t outputPitch,
- const gl::PixelPackState &pack,
- uint8_t *pixels)
+angle::Result Framebuffer11::readPixelsImpl(const gl::Context *context,
+ const gl::Rectangle &area,
+ GLenum format,
+ GLenum type,
+ size_t outputPitch,
+ const gl::PixelPackState &pack,
+ uint8_t *pixels)
{
const gl::FramebufferAttachment *readAttachment = mState.getReadAttachment();
ASSERT(readAttachment);
@@ -272,15 +273,15 @@
static_cast<GLuint>(outputPitch), pack, pixels);
}
-gl::Error Framebuffer11::blitImpl(const gl::Context *context,
- const gl::Rectangle &sourceArea,
- const gl::Rectangle &destArea,
- const gl::Rectangle *scissor,
- bool blitRenderTarget,
- bool blitDepth,
- bool blitStencil,
- GLenum filter,
- const gl::Framebuffer *sourceFramebuffer)
+angle::Result Framebuffer11::blitImpl(const gl::Context *context,
+ const gl::Rectangle &sourceArea,
+ const gl::Rectangle &destArea,
+ const gl::Rectangle *scissor,
+ bool blitRenderTarget,
+ bool blitDepth,
+ bool blitStencil,
+ GLenum filter,
+ const gl::Framebuffer *sourceFramebuffer)
{
if (blitRenderTarget)
{
@@ -288,7 +289,7 @@
ASSERT(readBuffer);
RenderTargetD3D *readRenderTarget = nullptr;
- ANGLE_TRY(readBuffer->getRenderTarget(context, &readRenderTarget));
+ ANGLE_TRY_HANDLE(context, readBuffer->getRenderTarget(context, &readRenderTarget));
ASSERT(readRenderTarget);
const auto &colorAttachments = mState.getColorAttachments();
@@ -302,7 +303,7 @@
if (drawBuffer.isAttached() && drawBufferStates[colorAttachment] != GL_NONE)
{
RenderTargetD3D *drawRenderTarget = nullptr;
- ANGLE_TRY(drawBuffer.getRenderTarget(context, &drawRenderTarget));
+ ANGLE_TRY_HANDLE(context, drawBuffer.getRenderTarget(context, &drawRenderTarget));
ASSERT(drawRenderTarget);
const bool invertColorSource = UsePresentPathFast(mRenderer, readBuffer);
@@ -335,7 +336,7 @@
const gl::FramebufferAttachment *readBuffer = sourceFramebuffer->getDepthOrStencilbuffer();
ASSERT(readBuffer);
RenderTargetD3D *readRenderTarget = nullptr;
- ANGLE_TRY(readBuffer->getRenderTarget(context, &readRenderTarget));
+ ANGLE_TRY_HANDLE(context, readBuffer->getRenderTarget(context, &readRenderTarget));
ASSERT(readRenderTarget);
const bool invertSource = UsePresentPathFast(mRenderer, readBuffer);
@@ -350,7 +351,7 @@
const gl::FramebufferAttachment *drawBuffer = mState.getDepthOrStencilAttachment();
ASSERT(drawBuffer);
RenderTargetD3D *drawRenderTarget = nullptr;
- ANGLE_TRY(drawBuffer->getRenderTarget(context, &drawRenderTarget));
+ ANGLE_TRY_HANDLE(context, drawBuffer->getRenderTarget(context, &drawRenderTarget));
ASSERT(drawRenderTarget);
bool invertDest = UsePresentPathFast(mRenderer, drawBuffer);
@@ -368,7 +369,7 @@
}
ANGLE_TRY(markAttachmentsDirty(context));
- return gl::NoError();
+ return angle::Result::Continue();
}
GLenum Framebuffer11::getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const
diff --git a/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h b/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h
index 1caca95..d13d9f6 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h
+++ b/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h
@@ -55,32 +55,33 @@
GLfloat *xy) const override;
private:
- gl::Error clearImpl(const gl::Context *context, const ClearParameters &clearParams) override;
+ angle::Result clearImpl(const gl::Context *context,
+ const ClearParameters &clearParams) override;
- gl::Error readPixelsImpl(const gl::Context *context,
- const gl::Rectangle &area,
- GLenum format,
- GLenum type,
- size_t outputPitch,
- const gl::PixelPackState &pack,
- uint8_t *pixels) override;
+ angle::Result readPixelsImpl(const gl::Context *context,
+ const gl::Rectangle &area,
+ GLenum format,
+ GLenum type,
+ size_t outputPitch,
+ const gl::PixelPackState &pack,
+ uint8_t *pixels) override;
- gl::Error blitImpl(const gl::Context *context,
- const gl::Rectangle &sourceArea,
- const gl::Rectangle &destArea,
- const gl::Rectangle *scissor,
- bool blitRenderTarget,
- bool blitDepth,
- bool blitStencil,
- GLenum filter,
- const gl::Framebuffer *sourceFramebuffer) override;
+ angle::Result blitImpl(const gl::Context *context,
+ const gl::Rectangle &sourceArea,
+ const gl::Rectangle &destArea,
+ const gl::Rectangle *scissor,
+ bool blitRenderTarget,
+ bool blitDepth,
+ bool blitStencil,
+ GLenum filter,
+ const gl::Framebuffer *sourceFramebuffer) override;
- gl::Error invalidateBase(const gl::Context *context,
- size_t count,
- const GLenum *attachments,
- bool useEXTBehavior) const;
- gl::Error invalidateAttachment(const gl::Context *context,
- const gl::FramebufferAttachment *attachment) const;
+ angle::Result invalidateBase(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments,
+ bool useEXTBehavior) const;
+ angle::Result invalidateAttachment(const gl::Context *context,
+ const gl::FramebufferAttachment *attachment) const;
GLenum getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const override;
diff --git a/src/libANGLE/renderer/d3d/d3d11/Image11.cpp b/src/libANGLE/renderer/d3d/d3d11/Image11.cpp
index 29577ac..0ba096e 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Image11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Image11.cpp
@@ -140,10 +140,10 @@
return mDirty;
}
-gl::Error Image11::copyToStorage(const gl::Context *context,
- TextureStorage *storage,
- const gl::ImageIndex &index,
- const gl::Box ®ion)
+angle::Result Image11::copyToStorage(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::ImageIndex &index,
+ const gl::Box ®ion)
{
TextureStorage11 *storage11 = GetAs<TextureStorage11>(storage);
@@ -176,7 +176,7 @@
mAssociatedImageIndex = index;
}
- return gl::NoError();
+ return angle::Result::Continue();
}
void Image11::verifyAssociatedStorageValid(TextureStorage11 *textureStorage) const
@@ -264,23 +264,26 @@
// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as
// format/type at input
// into the target pixel rectangle.
-gl::Error Image11::loadData(const gl::Context *context,
- const gl::Box &area,
- const gl::PixelUnpackState &unpack,
- GLenum type,
- const void *input,
- bool applySkipImages)
+angle::Result Image11::loadData(const gl::Context *context,
+ const gl::Box &area,
+ const gl::PixelUnpackState &unpack,
+ GLenum type,
+ const void *input,
+ bool applySkipImages)
{
+ Context11 *context11 = GetImplAs<Context11>(context);
+
const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(mInternalFormat);
GLuint inputRowPitch = 0;
- ANGLE_TRY_CHECKED_MATH(formatInfo.computeRowPitch(type, area.width, unpack.alignment,
- unpack.rowLength, &inputRowPitch));
+ ANGLE_CHECK_HR_MATH(context11, formatInfo.computeRowPitch(type, area.width, unpack.alignment,
+ unpack.rowLength, &inputRowPitch));
GLuint inputDepthPitch = 0;
- ANGLE_TRY_CHECKED_MATH(formatInfo.computeDepthPitch(area.height, unpack.imageHeight,
- inputRowPitch, &inputDepthPitch));
+ ANGLE_CHECK_HR_MATH(context11, formatInfo.computeDepthPitch(area.height, unpack.imageHeight,
+ inputRowPitch, &inputDepthPitch));
GLuint inputSkipBytes = 0;
- ANGLE_TRY_CHECKED_MATH(formatInfo.computeSkipBytes(type, inputRowPitch, inputDepthPitch, unpack,
- applySkipImages, &inputSkipBytes));
+ ANGLE_CHECK_HR_MATH(context11,
+ formatInfo.computeSkipBytes(type, inputRowPitch, inputDepthPitch, unpack,
+ applySkipImages, &inputSkipBytes));
const d3d11::DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(mDXGIFormat);
GLuint outputPixelSize = dxgiFormatInfo.pixelBytes;
@@ -301,20 +304,22 @@
unmap();
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Image11::loadCompressedData(const gl::Context *context,
- const gl::Box &area,
- const void *input)
+angle::Result Image11::loadCompressedData(const gl::Context *context,
+ const gl::Box &area,
+ const void *input)
{
+ Context11 *context11 = GetImplAs<Context11>(context);
+
const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(mInternalFormat);
GLuint inputRowPitch = 0;
- ANGLE_TRY_CHECKED_MATH(
- formatInfo.computeRowPitch(GL_UNSIGNED_BYTE, area.width, 1, 0, &inputRowPitch));
+ ANGLE_CHECK_HR_MATH(
+ context11, formatInfo.computeRowPitch(GL_UNSIGNED_BYTE, area.width, 1, 0, &inputRowPitch));
GLuint inputDepthPitch = 0;
- ANGLE_TRY_CHECKED_MATH(
- formatInfo.computeDepthPitch(area.height, 0, inputRowPitch, &inputDepthPitch));
+ ANGLE_CHECK_HR_MATH(
+ context11, formatInfo.computeDepthPitch(area.height, 0, inputRowPitch, &inputDepthPitch));
const d3d11::DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(mDXGIFormat);
GLuint outputPixelSize = dxgiFormatInfo.pixelBytes;
@@ -343,12 +348,12 @@
unmap();
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Image11::copyFromTexStorage(const gl::Context *context,
- const gl::ImageIndex &imageIndex,
- TextureStorage *source)
+angle::Result Image11::copyFromTexStorage(const gl::Context *context,
+ const gl::ImageIndex &imageIndex,
+ TextureStorage *source)
{
TextureStorage11 *storage11 = GetAs<TextureStorage11>(source);
@@ -362,10 +367,10 @@
subresourceIndex);
}
-gl::Error Image11::copyFromFramebuffer(const gl::Context *context,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *sourceFBO)
+angle::Result Image11::copyFromFramebuffer(const gl::Context *context,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ const gl::Framebuffer *sourceFBO)
{
const gl::FramebufferAttachment *srcAttachment = sourceFBO->getReadColorbuffer();
ASSERT(srcAttachment);
@@ -377,7 +382,7 @@
if (d3d11Format.texFormat == mDXGIFormat && sourceInternalFormat == mInternalFormat)
{
RenderTarget11 *rt11 = nullptr;
- ANGLE_TRY(srcAttachment->getRenderTarget(context, &rt11));
+ ANGLE_TRY_HANDLE(context, srcAttachment->getRenderTarget(context, &rt11));
ASSERT(rt11->getTexture().get());
TextureHelper11 textureHelper = rt11->getTexture();
@@ -406,12 +411,13 @@
d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps());
auto loadFunction = destD3D11Format.getLoadFunctions()(destFormatInfo.type);
- gl::Error error = gl::NoError();
+ angle::Result error = angle::Result::Continue();
if (loadFunction.requiresConversion)
{
size_t bufferSize = destFormatInfo.pixelBytes * sourceArea.width * sourceArea.height;
angle::MemoryBuffer *memoryBuffer = nullptr;
- error = mRenderer->getScratchMemoryBuffer(bufferSize, &memoryBuffer);
+ error = mRenderer->getScratchMemoryBuffer(GetImplAs<Context11>(context), bufferSize,
+ &memoryBuffer);
if (!error.isError())
{
diff --git a/src/libANGLE/renderer/d3d/d3d11/Image11.h b/src/libANGLE/renderer/d3d/d3d11/Image11.h
index dd00a81..7d9b814 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Image11.h
+++ b/src/libANGLE/renderer/d3d/d3d11/Image11.h
@@ -55,10 +55,10 @@
bool isDirty() const override;
- gl::Error copyToStorage(const gl::Context *context,
- TextureStorage *storage,
- const gl::ImageIndex &index,
- const gl::Box ®ion) override;
+ angle::Result copyToStorage(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::ImageIndex &index,
+ const gl::Box ®ion) override;
bool redefine(gl::TextureType type,
GLenum internalformat,
@@ -67,23 +67,23 @@
DXGI_FORMAT getDXGIFormat() const;
- gl::Error loadData(const gl::Context *context,
- const gl::Box &area,
- const gl::PixelUnpackState &unpack,
- GLenum type,
- const void *input,
- bool applySkipImages) override;
- gl::Error loadCompressedData(const gl::Context *context,
- const gl::Box &area,
- const void *input) override;
+ angle::Result loadData(const gl::Context *context,
+ const gl::Box &area,
+ const gl::PixelUnpackState &unpack,
+ GLenum type,
+ const void *input,
+ bool applySkipImages) override;
+ angle::Result loadCompressedData(const gl::Context *context,
+ const gl::Box &area,
+ const void *input) override;
- gl::Error copyFromTexStorage(const gl::Context *context,
- const gl::ImageIndex &imageIndex,
- TextureStorage *source) override;
- gl::Error copyFromFramebuffer(const gl::Context *context,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source) override;
+ angle::Result copyFromTexStorage(const gl::Context *context,
+ const gl::ImageIndex &imageIndex,
+ TextureStorage *source) override;
+ angle::Result copyFromFramebuffer(const gl::Context *context,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ const gl::Framebuffer *source) override;
angle::Result recoverFromAssociatedStorage(const gl::Context *context);
void verifyAssociatedStorageValid(TextureStorage11 *textureStorage) const;
@@ -120,6 +120,6 @@
unsigned int mRecoveredFromStorageCount;
};
-}
+} // namespace rx
#endif // LIBANGLE_RENDERER_D3D_D3D11_IMAGE11_H_
diff --git a/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp b/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp
index 1fa3c67..f0ef399 100644
--- a/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp
@@ -25,10 +25,10 @@
{
}
-gl::Error IndexBuffer11::initialize(const gl::Context *context,
- unsigned int bufferSize,
- GLenum indexType,
- bool dynamic)
+angle::Result IndexBuffer11::initialize(const gl::Context *context,
+ unsigned int bufferSize,
+ GLenum indexType,
+ bool dynamic)
{
mBuffer.reset();
@@ -60,43 +60,40 @@
mIndexType = indexType;
mDynamicUsage = dynamic;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error IndexBuffer11::mapBuffer(const gl::Context *context,
- unsigned int offset,
- unsigned int size,
- void **outMappedMemory)
+angle::Result IndexBuffer11::mapBuffer(const gl::Context *context,
+ unsigned int offset,
+ unsigned int size,
+ void **outMappedMemory)
{
- if (!mBuffer.valid())
- {
- return gl::OutOfMemory() << "Internal index buffer is not initialized.";
- }
+ Context11 *context11 = GetImplAs<Context11>(context);
+ ANGLE_CHECK_HR(context11, mBuffer.valid(), "Internal index buffer is not initialized.",
+ E_OUTOFMEMORY);
// Check for integer overflows and out-out-bounds map requests
- if (offset + size < offset || offset + size > mBufferSize)
- {
- return gl::OutOfMemory() << "Index buffer map range is not inside the buffer.";
- }
+ bool outOfBounds = (offset + size < offset || offset + size > mBufferSize);
+ ANGLE_CHECK_HR(context11, !outOfBounds, "Index buffer map range is not inside the buffer.",
+ E_OUTOFMEMORY);
D3D11_MAPPED_SUBRESOURCE mappedResource;
ANGLE_TRY(mRenderer->mapResource(context, mBuffer.get(), 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0,
&mappedResource));
*outMappedMemory = static_cast<char *>(mappedResource.pData) + offset;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error IndexBuffer11::unmapBuffer(const gl::Context *context)
+angle::Result IndexBuffer11::unmapBuffer(const gl::Context *context)
{
- if (!mBuffer.valid())
- {
- return gl::OutOfMemory() << "Internal index buffer is not initialized.";
- }
+ Context11 *context11 = GetImplAs<Context11>(context);
+ ANGLE_CHECK_HR(context11, mBuffer.valid(), "Internal index buffer is not initialized.",
+ E_OUTOFMEMORY);
ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
dxContext->Unmap(mBuffer.get(), 0);
- return gl::NoError();
+ return angle::Result::Continue();
}
GLenum IndexBuffer11::getIndexType() const
@@ -109,26 +106,23 @@
return mBufferSize;
}
-gl::Error IndexBuffer11::setSize(const gl::Context *context,
- unsigned int bufferSize,
- GLenum indexType)
+angle::Result IndexBuffer11::setSize(const gl::Context *context,
+ unsigned int bufferSize,
+ GLenum indexType)
{
if (bufferSize > mBufferSize || indexType != mIndexType)
{
return initialize(context, bufferSize, indexType, mDynamicUsage);
}
- else
- {
- return gl::NoError();
- }
+
+ return angle::Result::Continue();
}
-gl::Error IndexBuffer11::discard(const gl::Context *context)
+angle::Result IndexBuffer11::discard(const gl::Context *context)
{
- if (!mBuffer.valid())
- {
- return gl::OutOfMemory() << "Internal index buffer is not initialized.";
- }
+ Context11 *context11 = GetImplAs<Context11>(context);
+ ANGLE_CHECK_HR(context11, mBuffer.valid(), "Internal index buffer is not initialized.",
+ E_OUTOFMEMORY);
ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
@@ -138,17 +132,22 @@
dxContext->Unmap(mBuffer.get(), 0);
- return gl::NoError();
+ return angle::Result::Continue();
}
DXGI_FORMAT IndexBuffer11::getIndexFormat() const
{
switch (mIndexType)
{
- case GL_UNSIGNED_BYTE: return DXGI_FORMAT_R16_UINT;
- case GL_UNSIGNED_SHORT: return DXGI_FORMAT_R16_UINT;
- case GL_UNSIGNED_INT: return DXGI_FORMAT_R32_UINT;
- default: UNREACHABLE(); return DXGI_FORMAT_UNKNOWN;
+ case GL_UNSIGNED_BYTE:
+ return DXGI_FORMAT_R16_UINT;
+ case GL_UNSIGNED_SHORT:
+ return DXGI_FORMAT_R16_UINT;
+ case GL_UNSIGNED_INT:
+ return DXGI_FORMAT_R32_UINT;
+ default:
+ UNREACHABLE();
+ return DXGI_FORMAT_UNKNOWN;
}
}
diff --git a/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.h b/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.h
index 80f7188..cfec0db 100644
--- a/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.h
+++ b/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.h
@@ -22,24 +22,24 @@
explicit IndexBuffer11(Renderer11 *const renderer);
~IndexBuffer11() override;
- gl::Error initialize(const gl::Context *context,
- unsigned int bufferSize,
- GLenum indexType,
- bool dynamic) override;
+ angle::Result initialize(const gl::Context *context,
+ unsigned int bufferSize,
+ GLenum indexType,
+ bool dynamic) override;
- gl::Error mapBuffer(const gl::Context *context,
- unsigned int offset,
- unsigned int size,
- void **outMappedMemory) override;
- gl::Error unmapBuffer(const gl::Context *context) override;
+ angle::Result mapBuffer(const gl::Context *context,
+ unsigned int offset,
+ unsigned int size,
+ void **outMappedMemory) override;
+ angle::Result unmapBuffer(const gl::Context *context) override;
GLenum getIndexType() const override;
unsigned int getBufferSize() const override;
- gl::Error setSize(const gl::Context *context,
- unsigned int bufferSize,
- GLenum indexType) override;
+ angle::Result setSize(const gl::Context *context,
+ unsigned int bufferSize,
+ GLenum indexType) override;
- gl::Error discard(const gl::Context *context) override;
+ angle::Result discard(const gl::Context *context) override;
DXGI_FORMAT getIndexFormat() const;
const d3d11::Buffer &getBuffer() const;
diff --git a/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp b/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
index 31ecdd5..934503f 100644
--- a/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
@@ -293,8 +293,7 @@
}
ShaderExecutableD3D *shader = nullptr;
- ANGLE_TRY_HANDLE(
- context, programD3D->getVertexExecutableForCachedInputLayout(context, &shader, nullptr));
+ ANGLE_TRY(programD3D->getVertexExecutableForCachedInputLayout(context, &shader, nullptr));
ShaderExecutableD3D *shader11 = GetAs<ShaderExecutable11>(shader);
diff --git a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
index 3c7e885..b99a36c 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -1188,13 +1188,13 @@
outExtensions->robustResourceInitialization = true;
}
-gl::Error Renderer11::flush(Context11 *context11)
+angle::Result Renderer11::flush(Context11 *context11)
{
mDeviceContext->Flush();
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::finish(Context11 *context11)
+angle::Result Renderer11::finish(Context11 *context11)
{
if (!mSyncQuery.valid())
{
@@ -1216,10 +1216,7 @@
attempt++;
result = mDeviceContext->GetData(mSyncQuery.get(), nullptr, 0, flags);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to get event query data, " << gl::FmtHR(result);
- }
+ ANGLE_TRY_HR(context11, result, "Failed to get event query data");
if (result == S_FALSE)
{
@@ -1233,11 +1230,12 @@
if (checkDeviceLost && testDeviceLost())
{
mDisplay->notifyDeviceLost();
- return gl::OutOfMemory() << "Device was lost while waiting for sync.";
+ ANGLE_CHECK_HR(context11, false, "Device was lost while waiting for sync.",
+ E_OUTOFMEMORY);
}
} while (result == S_FALSE);
- return gl::NoError();
+ return angle::Result::Continue();
}
bool Renderer11::isValidNativeWindow(EGLNativeWindowType window) const
@@ -1396,10 +1394,10 @@
return mDevice;
}
-gl::Error Renderer11::drawWithGeometryShaderAndTransformFeedback(const gl::Context *context,
- gl::PrimitiveMode mode,
- UINT instanceCount,
- UINT vertexCount)
+angle::Result Renderer11::drawWithGeometryShaderAndTransformFeedback(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ UINT instanceCount,
+ UINT vertexCount)
{
const gl::State &glState = context->getGLState();
ProgramD3D *programD3D = mStateManager.getProgramD3D();
@@ -1425,7 +1423,7 @@
// Skip the draw call if rasterizer discard is enabled (or no fragment shader).
if (!pixelExe || glState.getRasterizerState().rasterizerDiscard)
{
- return gl::NoError();
+ return angle::Result::Continue();
}
mStateManager.setPixelShader(&GetAs<ShaderExecutable11>(pixelExe)->getPixelShader());
@@ -1446,14 +1444,14 @@
mDeviceContext->Draw(vertexCount, 0);
}
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::drawArrays(const gl::Context *context, const gl::DrawCallParams ¶ms)
+angle::Result Renderer11::drawArrays(const gl::Context *context, const gl::DrawCallParams ¶ms)
{
if (mStateManager.getCullEverything())
{
- return gl::NoError();
+ return angle::Result::Continue();
}
ProgramD3D *programD3D = mStateManager.getProgramD3D();
@@ -1494,7 +1492,7 @@
if (adjustedInstanceCount == 0)
{
mDeviceContext->DrawIndexedInstanced(6, clampedVertexCount, 0, 0, 0);
- return gl::NoError();
+ return angle::Result::Continue();
}
// If pointsprite emulation is used with glDrawArraysInstanced then we need to take
@@ -1513,7 +1511,7 @@
// This required by updateVertexOffsets... above but is outside of the loop for
// speed.
mStateManager.invalidateVertexBuffer();
- return gl::NoError();
+ return angle::Result::Continue();
}
break;
default:
@@ -1529,14 +1527,14 @@
{
mDeviceContext->DrawInstanced(clampedVertexCount, adjustedInstanceCount, 0, 0);
}
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::drawElements(const gl::Context *context, const gl::DrawCallParams ¶ms)
+angle::Result Renderer11::drawElements(const gl::Context *context, const gl::DrawCallParams ¶ms)
{
if (mStateManager.getCullEverything())
{
- return gl::NoError();
+ return angle::Result::Continue();
}
// Transform feedback is not allowed for DrawElements, this error should have been caught at the
@@ -1576,7 +1574,7 @@
mDeviceContext->DrawIndexedInstanced(params.indexCount(), adjustedInstanceCount, 0,
baseVertex, 0);
}
- return gl::NoError();
+ return angle::Result::Continue();
}
// This code should not be reachable by multi-view programs.
@@ -1595,7 +1593,7 @@
if (params.instances() == 0)
{
mDeviceContext->DrawIndexedInstanced(6, params.indexCount(), 0, 0, 0);
- return gl::NoError();
+ return angle::Result::Continue();
}
// If pointsprite emulation is used with glDrawElementsInstanced then we need to take a less
@@ -1612,15 +1610,15 @@
mDeviceContext->DrawIndexedInstanced(6, clampedVertexCount, 0, 0, 0);
}
mStateManager.invalidateVertexBuffer();
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::drawArraysIndirect(const gl::Context *context,
- const gl::DrawCallParams ¶ms)
+angle::Result Renderer11::drawArraysIndirect(const gl::Context *context,
+ const gl::DrawCallParams ¶ms)
{
if (mStateManager.getCullEverything())
{
- return gl::NoError();
+ return angle::Result::Continue();
}
const gl::State &glState = context->getGLState();
@@ -1635,15 +1633,15 @@
ID3D11Buffer *buffer = nullptr;
ANGLE_TRY(storage->getBuffer(context, BUFFER_USAGE_INDIRECT, &buffer));
mDeviceContext->DrawInstancedIndirect(buffer, static_cast<unsigned int>(offset));
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::drawElementsIndirect(const gl::Context *context,
- const gl::DrawCallParams ¶ms)
+angle::Result Renderer11::drawElementsIndirect(const gl::Context *context,
+ const gl::DrawCallParams ¶ms)
{
if (mStateManager.getCullEverything())
{
- return gl::NoError();
+ return angle::Result::Continue();
}
const gl::State &glState = context->getGLState();
@@ -1657,15 +1655,15 @@
ID3D11Buffer *buffer = nullptr;
ANGLE_TRY(storage->getBuffer(context, BUFFER_USAGE_INDIRECT, &buffer));
mDeviceContext->DrawIndexedInstancedIndirect(buffer, static_cast<unsigned int>(offset));
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::drawLineLoop(const gl::Context *context,
- GLuint count,
- GLenum type,
- const void *indexPointer,
- int baseVertex,
- int instances)
+angle::Result Renderer11::drawLineLoop(const gl::Context *context,
+ GLuint count,
+ GLenum type,
+ const void *indexPointer,
+ int baseVertex,
+ int instances)
{
const gl::State &glState = context->getGLState();
gl::VertexArray *vao = glState.getVertexArray();
@@ -1693,12 +1691,12 @@
}
// Checked by Renderer11::applyPrimitiveType
- if (static_cast<unsigned int>(count) + 1 >
- (std::numeric_limits<unsigned int>::max() / sizeof(unsigned int)))
- {
- return gl::OutOfMemory() << "Failed to create a 32-bit looping index buffer for "
- "GL_LINE_LOOP, too many indices required.";
- }
+ bool indexCheck = static_cast<unsigned int>(count) + 1 >
+ (std::numeric_limits<unsigned int>::max() / sizeof(unsigned int));
+ ANGLE_CHECK_HR(GetImplAs<Context11>(context), !indexCheck,
+ "Failed to create a 32-bit looping index buffer for "
+ "GL_LINE_LOOP, too many indices required.",
+ E_OUTOFMEMORY);
GetLineLoopIndices(indices, type, static_cast<GLuint>(count),
glState.isPrimitiveRestartEnabled(), &mScratchIndexDataBuffer);
@@ -1734,15 +1732,15 @@
mDeviceContext->DrawIndexed(indexCount, 0, baseVertex);
}
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::drawTriangleFan(const gl::Context *context,
- GLuint count,
- GLenum type,
- const void *indices,
- int baseVertex,
- int instances)
+angle::Result Renderer11::drawTriangleFan(const gl::Context *context,
+ GLuint count,
+ GLenum type,
+ const void *indices,
+ int baseVertex,
+ int instances)
{
const gl::State &glState = context->getGLState();
gl::VertexArray *vao = glState.getVertexArray();
@@ -1774,11 +1772,12 @@
const GLuint numTris = count - 2;
- if (numTris > (std::numeric_limits<unsigned int>::max() / (sizeof(unsigned int) * 3)))
- {
- return gl::OutOfMemory() << "Failed to create a scratch index buffer for GL_TRIANGLE_FAN, "
- "too many indices required.";
- }
+ bool indexCheck =
+ (numTris > std::numeric_limits<unsigned int>::max() / (sizeof(unsigned int) * 3));
+ ANGLE_CHECK_HR(GetImplAs<Context11>(context), !indexCheck,
+ "Failed to create a scratch index buffer for GL_TRIANGLE_FAN, "
+ "too many indices required.",
+ E_OUTOFMEMORY);
GetTriFanIndices(indexPointer, type, count, glState.isPrimitiveRestartEnabled(),
&mScratchIndexDataBuffer);
@@ -1812,7 +1811,7 @@
mDeviceContext->DrawIndexed(indexCount, 0, baseVertex);
}
- return gl::NoError();
+ return angle::Result::Continue();
}
void Renderer11::releaseDeviceResources()
@@ -2164,18 +2163,18 @@
return mWorkarounds;
}
-gl::Error Renderer11::copyImageInternal(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- RenderTargetD3D *destRenderTarget)
+angle::Result Renderer11::copyImageInternal(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ RenderTargetD3D *destRenderTarget)
{
const gl::FramebufferAttachment *colorAttachment = framebuffer->getReadColorbuffer();
ASSERT(colorAttachment);
RenderTarget11 *sourceRenderTarget = nullptr;
- ANGLE_TRY(colorAttachment->getRenderTarget(context, &sourceRenderTarget));
+ ANGLE_TRY_HANDLE(context, colorAttachment->getRenderTarget(context, &sourceRenderTarget));
ASSERT(sourceRenderTarget);
const d3d11::RenderTargetView &dest =
@@ -2219,7 +2218,7 @@
destArea, destSize, nullptr, gl::GetUnsizedFormat(destFormat),
GL_NONE, GL_NEAREST, false, false, false));
- return gl::NoError();
+ return angle::Result::Continue();
}
ASSERT(!sourceRenderTarget->isMultisampled());
@@ -2231,16 +2230,16 @@
destArea, destSize, nullptr, gl::GetUnsizedFormat(destFormat),
GL_NONE, GL_NEAREST, false, false, false));
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::copyImage2D(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level)
+angle::Result Renderer11::copyImage2D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level)
{
TextureStorage11_2D *storage11 = GetAs<TextureStorage11_2D>(storage);
ASSERT(storage11);
@@ -2255,17 +2254,17 @@
storage11->markLevelDirty(level);
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::copyImageCube(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- gl::TextureTarget target,
- GLint level)
+angle::Result Renderer11::copyImageCube(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget target,
+ GLint level)
{
TextureStorage11_Cube *storage11 = GetAs<TextureStorage11_Cube>(storage);
ASSERT(storage11);
@@ -2280,16 +2279,16 @@
storage11->markLevelDirty(level);
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::copyImage3D(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level)
+angle::Result Renderer11::copyImage3D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level)
{
TextureStorage11_3D *storage11 = GetAs<TextureStorage11_3D>(storage);
ASSERT(storage11);
@@ -2304,16 +2303,16 @@
storage11->markLevelDirty(level);
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::copyImage2DArray(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level)
+angle::Result Renderer11::copyImage2DArray(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level)
{
TextureStorage11_2DArray *storage11 = GetAs<TextureStorage11_2DArray>(storage);
ASSERT(storage11);
@@ -2327,22 +2326,22 @@
destRenderTarget));
storage11->markLevelDirty(level);
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::copyTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- GLenum destType,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- gl::TextureTarget destTarget,
- GLint destLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha)
+angle::Result Renderer11::copyTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ GLenum destType,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget destTarget,
+ GLint destLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha)
{
TextureD3D *sourceD3D = GetImplAs<TextureD3D>(source);
@@ -2426,14 +2425,14 @@
destStorage11->markLevelDirty(destLevel);
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::copyCompressedTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- TextureStorage *storage,
- GLint destLevel)
+angle::Result Renderer11::copyCompressedTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ TextureStorage *storage,
+ GLint destLevel)
{
TextureStorage11_2D *destStorage11 = GetAs<TextureStorage11_2D>(storage);
ASSERT(destStorage11);
@@ -2462,15 +2461,15 @@
mDeviceContext->CopySubresourceRegion(destResource->get(), destSubresource, 0, 0, 0,
sourceResource->get(), sourceSubresource, nullptr);
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::createRenderTarget(const gl::Context *context,
- int width,
- int height,
- GLenum format,
- GLsizei samples,
- RenderTargetD3D **outRT)
+angle::Result Renderer11::createRenderTarget(const gl::Context *context,
+ int width,
+ int height,
+ GLenum format,
+ GLsizei samples,
+ RenderTargetD3D **outRT)
{
const d3d11::Format &formatInfo = d3d11::Format::Get(format, mRenderer11DeviceCaps);
@@ -2603,12 +2602,12 @@
width, height, 1, supportedSamples);
}
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::createRenderTargetCopy(const gl::Context *context,
- RenderTargetD3D *source,
- RenderTargetD3D **outRT)
+angle::Result Renderer11::createRenderTargetCopy(const gl::Context *context,
+ RenderTargetD3D *source,
+ RenderTargetD3D **outRT)
{
ASSERT(source != nullptr);
@@ -2623,16 +2622,16 @@
0, 0, 0, source11->getTexture().get(),
source11->getSubresourceIndex(), nullptr);
*outRT = newRT;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::loadExecutable(const gl::Context *context,
- const uint8_t *function,
- size_t length,
- gl::ShaderType type,
- const std::vector<D3DVarying> &streamOutVaryings,
- bool separatedOutputBuffers,
- ShaderExecutableD3D **outExecutable)
+angle::Result Renderer11::loadExecutable(const gl::Context *context,
+ const uint8_t *function,
+ size_t length,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ ShaderExecutableD3D **outExecutable)
{
ShaderData shaderData(function, length);
@@ -2694,21 +2693,20 @@
}
break;
default:
- UNREACHABLE();
- return gl::InternalError();
+ ANGLE_HR_UNREACHABLE(context11);
}
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::compileToExecutable(const gl::Context *context,
- gl::InfoLog &infoLog,
- const std::string &shaderHLSL,
- gl::ShaderType type,
- const std::vector<D3DVarying> &streamOutVaryings,
- bool separatedOutputBuffers,
- const angle::CompilerWorkaroundsD3D &workarounds,
- ShaderExecutableD3D **outExectuable)
+angle::Result Renderer11::compileToExecutable(const gl::Context *context,
+ gl::InfoLog &infoLog,
+ const std::string &shaderHLSL,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ const angle::CompilerWorkaroundsD3D &workarounds,
+ ShaderExecutableD3D **outExectuable)
{
std::stringstream profileStream;
@@ -2727,8 +2725,7 @@
profileStream << "cs";
break;
default:
- UNREACHABLE();
- return gl::InternalError();
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
}
profileStream << "_" << getMajorShaderModel() << "_" << getMinorShaderModel()
@@ -2780,15 +2777,15 @@
if (!binary)
{
*outExectuable = nullptr;
- return gl::NoError();
+ return angle::Result::Continue();
}
- gl::Error error = loadExecutable(
+ angle::Result error = loadExecutable(
context, static_cast<const uint8_t *>(binary->GetBufferPointer()), binary->GetBufferSize(),
type, streamOutVaryings, separatedOutputBuffers, outExectuable);
SafeRelease(binary);
- if (error.isError())
+ if (error == angle::Result::Stop())
{
return error;
}
@@ -2798,10 +2795,10 @@
(*outExectuable)->appendDebugInfo(debugInfo);
}
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::ensureHLSLCompilerInitialized(const gl::Context *context)
+angle::Result Renderer11::ensureHLSLCompilerInitialized(const gl::Context *context)
{
return mCompiler.ensureInitialized(context);
}
@@ -2875,13 +2872,13 @@
return true;
}
-gl::Error Renderer11::fastCopyBufferToTexture(const gl::Context *context,
- const gl::PixelUnpackState &unpack,
- unsigned int offset,
- RenderTargetD3D *destRenderTarget,
- GLenum destinationFormat,
- GLenum sourcePixelsType,
- const gl::Box &destArea)
+angle::Result Renderer11::fastCopyBufferToTexture(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ unsigned int offset,
+ RenderTargetD3D *destRenderTarget,
+ GLenum destinationFormat,
+ GLenum sourcePixelsType,
+ const gl::Box &destArea)
{
ASSERT(supportsFastCopyBufferToTexture(destinationFormat));
return mPixelTransfer->copyBufferToTexture(context, unpack, offset, destRenderTarget,
@@ -2893,16 +2890,16 @@
return new Image11(this);
}
-gl::Error Renderer11::generateMipmap(const gl::Context *context, ImageD3D *dest, ImageD3D *src)
+angle::Result Renderer11::generateMipmap(const gl::Context *context, ImageD3D *dest, ImageD3D *src)
{
Image11 *dest11 = GetAs<Image11>(dest);
Image11 *src11 = GetAs<Image11>(src);
return Image11::GenerateMipmap(context, dest11, src11, mRenderer11DeviceCaps);
}
-gl::Error Renderer11::generateMipmapUsingD3D(const gl::Context *context,
- TextureStorage *storage,
- const gl::TextureState &textureState)
+angle::Result Renderer11::generateMipmapUsingD3D(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::TextureState &textureState)
{
TextureStorage11 *storage11 = GetAs<TextureStorage11>(storage);
@@ -2915,17 +2912,17 @@
mDeviceContext->GenerateMips(srv->get());
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::copyImage(const gl::Context *context,
- ImageD3D *dest,
- ImageD3D *source,
- const gl::Rectangle &sourceRect,
- const gl::Offset &destOffset,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha)
+angle::Result Renderer11::copyImage(const gl::Context *context,
+ ImageD3D *dest,
+ ImageD3D *source,
+ const gl::Rectangle &sourceRect,
+ const gl::Offset &destOffset,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha)
{
Image11 *dest11 = GetAs<Image11>(dest);
Image11 *src11 = GetAs<Image11>(source);
@@ -3006,14 +3003,14 @@
fixedSampleLocations);
}
-gl::Error Renderer11::readFromAttachment(const gl::Context *context,
- const gl::FramebufferAttachment &srcAttachment,
- const gl::Rectangle &sourceArea,
- GLenum format,
- GLenum type,
- GLuint outputPitch,
- const gl::PixelPackState &pack,
- uint8_t *pixelsOut)
+angle::Result Renderer11::readFromAttachment(const gl::Context *context,
+ const gl::FramebufferAttachment &srcAttachment,
+ const gl::Rectangle &sourceArea,
+ GLenum format,
+ GLenum type,
+ GLuint outputPitch,
+ const gl::PixelPackState &pack,
+ uint8_t *pixelsOut)
{
ASSERT(sourceArea.width >= 0);
ASSERT(sourceArea.height >= 0);
@@ -3021,7 +3018,7 @@
const bool invertTexture = UsePresentPathFast(this, &srcAttachment);
RenderTarget11 *rt11 = nullptr;
- ANGLE_TRY(srcAttachment.getRenderTarget(context, &rt11));
+ ANGLE_TRY_HANDLE(context, srcAttachment.getRenderTarget(context, &rt11));
ASSERT(rt11->getTexture().valid());
const TextureHelper11 &textureHelper = rt11->getTexture();
@@ -3052,7 +3049,7 @@
if (safeArea.width == 0 || safeArea.height == 0)
{
// no work to do
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::Extents safeSize(safeArea.width, safeArea.height, 1);
@@ -3155,16 +3152,16 @@
return angle::Result::Continue();
}
-gl::Error Renderer11::blitRenderbufferRect(const gl::Context *context,
- const gl::Rectangle &readRectIn,
- const gl::Rectangle &drawRectIn,
- RenderTargetD3D *readRenderTarget,
- RenderTargetD3D *drawRenderTarget,
- GLenum filter,
- const gl::Rectangle *scissor,
- bool colorBlit,
- bool depthBlit,
- bool stencilBlit)
+angle::Result Renderer11::blitRenderbufferRect(const gl::Context *context,
+ const gl::Rectangle &readRectIn,
+ const gl::Rectangle &drawRectIn,
+ RenderTargetD3D *readRenderTarget,
+ RenderTargetD3D *drawRenderTarget,
+ GLenum filter,
+ const gl::Rectangle *scissor,
+ bool colorBlit,
+ bool depthBlit,
+ bool stencilBlit)
{
// Since blitRenderbufferRect is called for each render buffer that needs to be blitted,
// it should never be the case that both color and depth/stencil need to be blitted at
@@ -3172,21 +3169,13 @@
ASSERT(colorBlit != (depthBlit || stencilBlit));
RenderTarget11 *drawRenderTarget11 = GetAs<RenderTarget11>(drawRenderTarget);
- if (!drawRenderTarget11)
- {
- return gl::OutOfMemory()
- << "Failed to retrieve the internal draw render target from the draw framebuffer.";
- }
+ ASSERT(drawRenderTarget11);
const TextureHelper11 &drawTexture = drawRenderTarget11->getTexture();
unsigned int drawSubresource = drawRenderTarget11->getSubresourceIndex();
RenderTarget11 *readRenderTarget11 = GetAs<RenderTarget11>(readRenderTarget);
- if (!readRenderTarget11)
- {
- return gl::OutOfMemory()
- << "Failed to retrieve the internal read render target from the read framebuffer.";
- }
+ ASSERT(readRenderTarget11);
TextureHelper11 readTexture;
unsigned int readSubresource = 0;
@@ -3260,7 +3249,7 @@
gl::Rectangle inBoundsReadRect;
if (!gl::ClipRectangle(readRect, readBounds, &inBoundsReadRect))
{
- return gl::NoError();
+ return angle::Result::Continue();
}
{
@@ -3295,7 +3284,7 @@
gl::Rectangle scissoredDrawRect;
if (!gl::ClipRectangle(drawRect, *scissor, &scissoredDrawRect))
{
- return gl::NoError();
+ return angle::Result::Continue();
}
scissorNeeded = scissoredDrawRect != drawRect;
}
@@ -3430,7 +3419,7 @@
}
}
- return gl::NoError();
+ return angle::Result::Continue();
}
bool Renderer11::isES3Capable() const
@@ -3484,11 +3473,11 @@
mAliveBuffers.erase(deleted);
}
-gl::Error Renderer11::resolveMultisampledTexture(const gl::Context *context,
- RenderTarget11 *renderTarget,
- bool depth,
- bool stencil,
- TextureHelper11 *textureOut)
+angle::Result Renderer11::resolveMultisampledTexture(const gl::Context *context,
+ RenderTarget11 *renderTarget,
+ bool depth,
+ bool stencil,
+ TextureHelper11 *textureOut)
{
if (depth && !stencil)
{
@@ -3534,7 +3523,7 @@
renderTarget->getTexture().get(),
renderTarget->getSubresourceIndex(), formatSet.texFormat);
*textureOut = mCachedResolveTexture;
- return gl::NoError();
+ return angle::Result::Continue();
}
bool Renderer11::getLUID(LUID *adapterLuid) const
@@ -3571,17 +3560,17 @@
return d3d11::GetComponentType(format.nativeFormat);
}
-gl::Error Renderer11::getVertexSpaceRequired(const gl::Context *context,
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- size_t count,
- GLsizei instances,
- unsigned int *bytesRequiredOut) const
+angle::Result Renderer11::getVertexSpaceRequired(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances,
+ unsigned int *bytesRequiredOut) const
{
if (!attrib.enabled)
{
*bytesRequiredOut = 16u;
- return gl::NoError();
+ return angle::Result::Continue();
}
unsigned int elementCount = 0;
@@ -3606,13 +3595,12 @@
const d3d11::DXGIFormatSize &dxgiFormatInfo =
d3d11::GetDXGIFormatSizeInfo(vertexFormatInfo.nativeFormat);
unsigned int elementSize = dxgiFormatInfo.pixelBytes;
- if (elementSize > std::numeric_limits<unsigned int>::max() / elementCount)
- {
- return gl::OutOfMemory() << "New vertex buffer size would result in an overflow.";
- }
+ bool check = (elementSize > std::numeric_limits<unsigned int>::max() / elementCount);
+ ANGLE_CHECK_HR(GetImplAs<Context11>(context), !check,
+ "New vertex buffer size would result in an overflow.", E_OUTOFMEMORY);
*bytesRequiredOut = elementSize * elementCount;
- return gl::NoError();
+ return angle::Result::Continue();
}
void Renderer11::generateCaps(gl::Caps *outCaps,
@@ -3644,10 +3632,12 @@
return new Framebuffer11(state, this);
}
-gl::Error Renderer11::getScratchMemoryBuffer(size_t requestedSize, angle::MemoryBuffer **bufferOut)
+angle::Result Renderer11::getScratchMemoryBuffer(Context11 *context11,
+ size_t requestedSize,
+ angle::MemoryBuffer **bufferOut)
{
- ANGLE_TRY_ALLOCATION(mScratchMemoryBuffer.get(requestedSize, bufferOut));
- return gl::NoError();
+ ANGLE_CHECK_HR_ALLOC(context11, mScratchMemoryBuffer.get(requestedSize, bufferOut));
+ return angle::Result::Continue();
}
gl::Version Renderer11::getMaxSupportedESVersion() const
@@ -3660,7 +3650,7 @@
return mAnnotator;
}
-gl::Error Renderer11::applyComputeShader(const gl::Context *context)
+angle::Result Renderer11::applyComputeShader(const gl::Context *context)
{
ANGLE_TRY(ensureHLSLCompilerInitialized(context));
@@ -3674,20 +3664,20 @@
mStateManager.setComputeShader(&GetAs<ShaderExecutable11>(computeExe)->getComputeShader());
ANGLE_TRY(mStateManager.applyComputeUniforms(context, programD3D));
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer11::dispatchCompute(const gl::Context *context,
- GLuint numGroupsX,
- GLuint numGroupsY,
- GLuint numGroupsZ)
+angle::Result Renderer11::dispatchCompute(const gl::Context *context,
+ GLuint numGroupsX,
+ GLuint numGroupsY,
+ GLuint numGroupsZ)
{
ANGLE_TRY(mStateManager.updateStateForCompute(context, numGroupsX, numGroupsY, numGroupsZ));
ANGLE_TRY(applyComputeShader(context));
mDeviceContext->Dispatch(numGroupsX, numGroupsY, numGroupsZ);
- return gl::NoError();
+ return angle::Result::Continue();
}
angle::Result Renderer11::createStagingTexture(const gl::Context *context,
@@ -3793,11 +3783,11 @@
return mStateCache.getSamplerState(context, this, samplerState, outSamplerState);
}
-gl::Error Renderer11::clearRenderTarget(const gl::Context *context,
- RenderTargetD3D *renderTarget,
- const gl::ColorF &clearColorValue,
- const float clearDepthValue,
- const unsigned int clearStencilValue)
+angle::Result Renderer11::clearRenderTarget(const gl::Context *context,
+ RenderTargetD3D *renderTarget,
+ const gl::ColorF &clearColorValue,
+ const float clearDepthValue,
+ const unsigned int clearStencilValue)
{
RenderTarget11 *rt11 = GetAs<RenderTarget11>(renderTarget);
@@ -3811,7 +3801,7 @@
mDeviceContext->ClearDepthStencilView(rt11->getDepthStencilView().get(), clearFlags,
clearDepthValue,
static_cast<UINT8>(clearStencilValue));
- return gl::NoError();
+ return angle::Result::Continue();
}
ASSERT(rt11->getRenderTargetView().valid());
@@ -3832,7 +3822,7 @@
}
mDeviceContext->ClearRenderTargetView(rtv, &safeClearColor.red);
- return gl::NoError();
+ return angle::Result::Continue();
}
bool Renderer11::canSelectViewInVertexShader() const
@@ -3853,7 +3843,7 @@
return angle::Result::Continue();
}
-gl::Error Renderer11::markTransformFeedbackUsage(const gl::Context *context)
+angle::Result Renderer11::markTransformFeedbackUsage(const gl::Context *context)
{
const gl::State &glState = context->getGLState();
const gl::TransformFeedback *transformFeedback = glState.getCurrentTransformFeedback();
@@ -3868,7 +3858,7 @@
}
}
- return gl::NoError();
+ return angle::Result::Continue();
}
void Renderer11::onDirtyUniformBlockBinding(GLuint /*uniformBlockIndex*/)
@@ -3876,9 +3866,9 @@
mStateManager.invalidateProgramUniformBuffers();
}
-gl::Error Renderer11::getIncompleteTexture(const gl::Context *context,
- gl::TextureType type,
- gl::Texture **textureOut)
+angle::Result Renderer11::getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut)
{
return GetImplAs<Context11>(context)->getIncompleteTexture(context, type, textureOut);
}
diff --git a/src/libANGLE/renderer/d3d/d3d11/Renderer11.h b/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
index 847fb2a..565c7e5 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
+++ b/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
@@ -124,8 +124,8 @@
ContextImpl *createContext(const gl::ContextState &state) override;
- gl::Error flush(Context11 *context11);
- gl::Error finish(Context11 *context11);
+ angle::Result flush(Context11 *context11);
+ angle::Result finish(Context11 *context11);
bool isValidNativeWindow(EGLNativeWindowType window) const override;
NativeWindowD3D *createNativeWindow(EGLNativeWindowType window,
@@ -166,100 +166,102 @@
std::string getShaderModelSuffix() const override;
// Pixel operations
- gl::Error copyImage2D(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level) override;
- gl::Error copyImageCube(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- gl::TextureTarget target,
- GLint level) override;
- gl::Error copyImage3D(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level) override;
- gl::Error copyImage2DArray(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level) override;
+ angle::Result copyImage2D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) override;
+ angle::Result copyImageCube(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget target,
+ GLint level) override;
+ angle::Result copyImage3D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) override;
+ angle::Result copyImage2DArray(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) override;
- gl::Error copyTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- GLenum destType,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- gl::TextureTarget destTarget,
- GLint destLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha) override;
- gl::Error copyCompressedTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- TextureStorage *storage,
- GLint destLevel) override;
+ angle::Result copyTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ GLenum destType,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget destTarget,
+ GLint destLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha) override;
+ angle::Result copyCompressedTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ TextureStorage *storage,
+ GLint destLevel) override;
// RenderTarget creation
- gl::Error createRenderTarget(const gl::Context *context,
- int width,
- int height,
- GLenum format,
- GLsizei samples,
- RenderTargetD3D **outRT) override;
- gl::Error createRenderTargetCopy(const gl::Context *context,
- RenderTargetD3D *source,
+ angle::Result createRenderTarget(const gl::Context *context,
+ int width,
+ int height,
+ GLenum format,
+ GLsizei samples,
RenderTargetD3D **outRT) override;
+ angle::Result createRenderTargetCopy(const gl::Context *context,
+ RenderTargetD3D *source,
+ RenderTargetD3D **outRT) override;
// Shader operations
- gl::Error loadExecutable(const gl::Context *context,
- const uint8_t *function,
- size_t length,
- gl::ShaderType type,
- const std::vector<D3DVarying> &streamOutVaryings,
- bool separatedOutputBuffers,
- ShaderExecutableD3D **outExecutable) override;
- gl::Error compileToExecutable(const gl::Context *context,
- gl::InfoLog &infoLog,
- const std::string &shaderHLSL,
- gl::ShaderType type,
- const std::vector<D3DVarying> &streamOutVaryings,
- bool separatedOutputBuffers,
- const angle::CompilerWorkaroundsD3D &workarounds,
- ShaderExecutableD3D **outExectuable) override;
- gl::Error ensureHLSLCompilerInitialized(const gl::Context *context) override;
+ angle::Result loadExecutable(const gl::Context *context,
+ const uint8_t *function,
+ size_t length,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ ShaderExecutableD3D **outExecutable) override;
+ angle::Result compileToExecutable(const gl::Context *context,
+ gl::InfoLog &infoLog,
+ const std::string &shaderHLSL,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ const angle::CompilerWorkaroundsD3D &workarounds,
+ ShaderExecutableD3D **outExectuable) override;
+ angle::Result ensureHLSLCompilerInitialized(const gl::Context *context) override;
UniformStorageD3D *createUniformStorage(size_t storageSize) override;
// Image operations
ImageD3D *createImage() override;
- gl::Error generateMipmap(const gl::Context *context, ImageD3D *dest, ImageD3D *source) override;
- gl::Error generateMipmapUsingD3D(const gl::Context *context,
- TextureStorage *storage,
- const gl::TextureState &textureState) override;
- gl::Error copyImage(const gl::Context *context,
- ImageD3D *dest,
- ImageD3D *source,
- const gl::Rectangle &sourceRect,
- const gl::Offset &destOffset,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha) override;
+ angle::Result generateMipmap(const gl::Context *context,
+ ImageD3D *dest,
+ ImageD3D *source) override;
+ angle::Result generateMipmapUsingD3D(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::TextureState &textureState) override;
+ angle::Result copyImage(const gl::Context *context,
+ ImageD3D *dest,
+ ImageD3D *source,
+ const gl::Rectangle &sourceRect,
+ const gl::Offset &destOffset,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha) override;
TextureStorage *createTextureStorage2D(SwapChainD3D *swapChain) override;
TextureStorage *createTextureStorageEGLImage(EGLImageD3D *eglImage,
RenderTargetD3D *renderTargetD3D) override;
@@ -330,13 +332,13 @@
// Buffer-to-texture and Texture-to-buffer copies
bool supportsFastCopyBufferToTexture(GLenum internalFormat) const override;
- gl::Error fastCopyBufferToTexture(const gl::Context *context,
- const gl::PixelUnpackState &unpack,
- unsigned int offset,
- RenderTargetD3D *destRenderTarget,
- GLenum destinationFormat,
- GLenum sourcePixelsType,
- const gl::Box &destArea) override;
+ angle::Result fastCopyBufferToTexture(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ unsigned int offset,
+ RenderTargetD3D *destRenderTarget,
+ GLenum destinationFormat,
+ GLenum sourcePixelsType,
+ const gl::Box &destArea) override;
angle::Result packPixels(const gl::Context *context,
const TextureHelper11 &textureHelper,
@@ -350,32 +352,32 @@
// Warning: you should ensure binding really matches attrib.bindingIndex before using this
// function.
- gl::Error getVertexSpaceRequired(const gl::Context *context,
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- size_t count,
- GLsizei instances,
- unsigned int *bytesRequiredOut) const override;
+ angle::Result getVertexSpaceRequired(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances,
+ unsigned int *bytesRequiredOut) const override;
- gl::Error readFromAttachment(const gl::Context *context,
- const gl::FramebufferAttachment &srcAttachment,
- const gl::Rectangle &sourceArea,
- GLenum format,
- GLenum type,
- GLuint outputPitch,
- const gl::PixelPackState &pack,
- uint8_t *pixels);
+ angle::Result readFromAttachment(const gl::Context *context,
+ const gl::FramebufferAttachment &srcAttachment,
+ const gl::Rectangle &sourceArea,
+ GLenum format,
+ GLenum type,
+ GLuint outputPitch,
+ const gl::PixelPackState &pack,
+ uint8_t *pixels);
- gl::Error blitRenderbufferRect(const gl::Context *context,
- const gl::Rectangle &readRect,
- const gl::Rectangle &drawRect,
- RenderTargetD3D *readRenderTarget,
- RenderTargetD3D *drawRenderTarget,
- GLenum filter,
- const gl::Rectangle *scissor,
- bool colorBlit,
- bool depthBlit,
- bool stencilBlit);
+ angle::Result blitRenderbufferRect(const gl::Context *context,
+ const gl::Rectangle &readRect,
+ const gl::Rectangle &drawRect,
+ RenderTargetD3D *readRenderTarget,
+ RenderTargetD3D *drawRenderTarget,
+ GLenum filter,
+ const gl::Rectangle *scissor,
+ bool colorBlit,
+ bool depthBlit,
+ bool stencilBlit);
bool isES3Capable() const;
const Renderer11DeviceCaps &getRenderer11DeviceCaps() const { return mRenderer11DeviceCaps; };
@@ -389,23 +391,26 @@
DeviceImpl *createEGLDevice() override;
- gl::Error drawArrays(const gl::Context *context, const gl::DrawCallParams ¶ms);
- gl::Error drawElements(const gl::Context *context, const gl::DrawCallParams ¶ms);
- gl::Error drawArraysIndirect(const gl::Context *context, const gl::DrawCallParams ¶ms);
- gl::Error drawElementsIndirect(const gl::Context *context, const gl::DrawCallParams ¶ms);
+ angle::Result drawArrays(const gl::Context *context, const gl::DrawCallParams ¶ms);
+ angle::Result drawElements(const gl::Context *context, const gl::DrawCallParams ¶ms);
+ angle::Result drawArraysIndirect(const gl::Context *context, const gl::DrawCallParams ¶ms);
+ angle::Result drawElementsIndirect(const gl::Context *context,
+ const gl::DrawCallParams ¶ms);
// Necessary hack for default framebuffers in D3D.
FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) override;
- gl::Error getScratchMemoryBuffer(size_t requestedSize, angle::MemoryBuffer **bufferOut);
+ angle::Result getScratchMemoryBuffer(Context11 *context11,
+ size_t requestedSize,
+ angle::MemoryBuffer **bufferOut);
gl::Version getMaxSupportedESVersion() const override;
- gl::Error dispatchCompute(const gl::Context *context,
- GLuint numGroupsX,
- GLuint numGroupsY,
- GLuint numGroupsZ);
- gl::Error applyComputeShader(const gl::Context *context);
+ angle::Result dispatchCompute(const gl::Context *context,
+ GLuint numGroupsX,
+ GLuint numGroupsY,
+ GLuint numGroupsZ);
+ angle::Result applyComputeShader(const gl::Context *context);
angle::Result createStagingTexture(const gl::Context *context,
ResourceType textureType,
@@ -458,11 +463,11 @@
const D3D11_SUBRESOURCE_DATA *initData,
TextureHelper11 *textureOut);
- gl::Error clearRenderTarget(const gl::Context *context,
- RenderTargetD3D *renderTarget,
- const gl::ColorF &clearColorValue,
- const float clearDepthValue,
- const unsigned int clearStencilValue) override;
+ angle::Result clearRenderTarget(const gl::Context *context,
+ RenderTargetD3D *renderTarget,
+ const gl::ColorF &clearColorValue,
+ const float clearDepthValue,
+ const unsigned int clearStencilValue) override;
bool canSelectViewInVertexShader() const override;
@@ -475,9 +480,9 @@
UINT mapFlags,
D3D11_MAPPED_SUBRESOURCE *mappedResource);
- gl::Error getIncompleteTexture(const gl::Context *context,
- gl::TextureType type,
- gl::Texture **textureOut) override;
+ angle::Result getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut) override;
private:
void generateCaps(gl::Caps *outCaps,
@@ -487,35 +492,35 @@
angle::WorkaroundsD3D generateWorkarounds() const override;
- gl::Error drawLineLoop(const gl::Context *context,
- GLuint count,
- GLenum type,
- const void *indices,
- int baseVertex,
- int instances);
- gl::Error drawTriangleFan(const gl::Context *context,
- GLuint count,
- GLenum type,
- const void *indices,
- int baseVertex,
- int instances);
+ angle::Result drawLineLoop(const gl::Context *context,
+ GLuint count,
+ GLenum type,
+ const void *indices,
+ int baseVertex,
+ int instances);
+ angle::Result drawTriangleFan(const gl::Context *context,
+ GLuint count,
+ GLenum type,
+ const void *indices,
+ int baseVertex,
+ int instances);
- gl::Error resolveMultisampledTexture(const gl::Context *context,
- RenderTarget11 *renderTarget,
- bool depth,
- bool stencil,
- TextureHelper11 *textureOut);
+ angle::Result resolveMultisampledTexture(const gl::Context *context,
+ RenderTarget11 *renderTarget,
+ bool depth,
+ bool stencil,
+ TextureHelper11 *textureOut);
void populateRenderer11DeviceCaps();
void updateHistograms();
- gl::Error copyImageInternal(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- RenderTargetD3D *destRenderTarget);
+ angle::Result copyImageInternal(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ RenderTargetD3D *destRenderTarget);
gl::SupportedSampleSet generateSampleSetForEGLConfig(
const gl::TextureCaps &colorBufferFormatCaps,
@@ -529,11 +534,11 @@
d3d11::ANGLED3D11DeviceType getDeviceType() const;
- gl::Error markTransformFeedbackUsage(const gl::Context *context);
- gl::Error drawWithGeometryShaderAndTransformFeedback(const gl::Context *context,
- gl::PrimitiveMode mode,
- UINT instanceCount,
- UINT vertexCount);
+ angle::Result markTransformFeedbackUsage(const gl::Context *context);
+ angle::Result drawWithGeometryShaderAndTransformFeedback(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ UINT instanceCount,
+ UINT vertexCount);
HMODULE mD3d11Module;
HMODULE mDxgiModule;
diff --git a/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp b/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp
index 499cee4..bcc8574 100644
--- a/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp
@@ -1739,7 +1739,7 @@
mIsMultiviewEnabled = extensions.multiview;
mViewportOffsets.resize(1u);
- ANGLE_TRY_HANDLE(context, mVertexDataManager.initialize(context));
+ ANGLE_TRY(mVertexDataManager.initialize(context));
mCurrentAttributes.reserve(gl::MAX_VERTEX_ATTRIBS);
@@ -1879,9 +1879,8 @@
mDirtyVertexBufferRange.extend(static_cast<unsigned int>(attribIndex));
- ANGLE_TRY_HANDLE(
- context, mVertexDataManager.storeCurrentValue(context, currentValue, currentValueAttrib,
- static_cast<size_t>(attribIndex)));
+ ANGLE_TRY(mVertexDataManager.storeCurrentValue(context, currentValue, currentValueAttrib,
+ static_cast<size_t>(attribIndex)));
}
return angle::Result::Continue();
@@ -2403,8 +2402,7 @@
// Texture is not sampler complete or it is in use by the framebuffer. Bind the
// incomplete texture.
gl::Texture *incompleteTexture = nullptr;
- ANGLE_TRY_HANDLE(
- context, mRenderer->getIncompleteTexture(context, textureType, &incompleteTexture));
+ ANGLE_TRY(mRenderer->getIncompleteTexture(context, textureType, &incompleteTexture));
ANGLE_TRY(setSamplerState(context, shaderType, samplerIndex, incompleteTexture,
incompleteTexture->getSamplerState()));
ANGLE_TRY(setTexture(context, shaderType, samplerIndex, incompleteTexture));
@@ -2440,7 +2438,7 @@
// Storage should exist, texture should be complete. Only verified in Debug.
TextureD3D *textureD3D = GetImplAs<TextureD3D>(texture);
TextureStorage *storage = nullptr;
- ANGLE_TRY_HANDLE(context, textureD3D->getNativeTexture(context, &storage));
+ ANGLE_TRY(textureD3D->getNativeTexture(context, &storage));
ASSERT(storage);
#endif // !defined(NDEBUG)
@@ -2503,7 +2501,7 @@
TextureD3D *textureImpl = GetImplAs<TextureD3D>(texture);
TextureStorage *texStorage = nullptr;
- ANGLE_TRY_HANDLE(context, textureImpl->getNativeTexture(context, &texStorage));
+ ANGLE_TRY(textureImpl->getNativeTexture(context, &texStorage));
// Texture should be complete and have a storage
ASSERT(texStorage);
@@ -2582,7 +2580,7 @@
textureImpl = GetImplAs<TextureD3D>(imageUnit.texture.get());
TextureStorage *texStorage = nullptr;
- ANGLE_TRY_HANDLE(context, textureImpl->getNativeTexture(context, &texStorage));
+ ANGLE_TRY(textureImpl->getNativeTexture(context, &texStorage));
// Texture should be complete and have a storage
ASSERT(texStorage);
TextureStorage11 *storage11 = GetAs<TextureStorage11>(texStorage);
@@ -2636,16 +2634,14 @@
ASSERT(mProgramD3D->hasPixelExecutableForCachedOutputLayout());
ShaderExecutableD3D *vertexExe = nullptr;
- ANGLE_TRY_HANDLE(context, mProgramD3D->getVertexExecutableForCachedInputLayout(
- context, &vertexExe, nullptr));
+ ANGLE_TRY(mProgramD3D->getVertexExecutableForCachedInputLayout(context, &vertexExe, nullptr));
ShaderExecutableD3D *pixelExe = nullptr;
- ANGLE_TRY_HANDLE(
- context, mProgramD3D->getPixelExecutableForCachedOutputLayout(context, &pixelExe, nullptr));
+ ANGLE_TRY(mProgramD3D->getPixelExecutableForCachedOutputLayout(context, &pixelExe, nullptr));
ShaderExecutableD3D *geometryExe = nullptr;
- ANGLE_TRY_HANDLE(context, mProgramD3D->getGeometryExecutableForPrimitiveType(
- context, drawMode, &geometryExe, nullptr));
+ ANGLE_TRY(mProgramD3D->getGeometryExecutableForPrimitiveType(context, drawMode, &geometryExe,
+ nullptr));
const d3d11::VertexShader *vertexShader =
(vertexExe ? &GetAs<ShaderExecutable11>(vertexExe)->getVertexShader() : nullptr);
@@ -2759,8 +2755,7 @@
if (indexInfo.srcIndexData.srcBuffer != nullptr)
{
const uint8_t *bufferData = nullptr;
- ANGLE_TRY_HANDLE(
- context, indexInfo.srcIndexData.srcBuffer->getData(context, &bufferData));
+ ANGLE_TRY(indexInfo.srcIndexData.srcBuffer->getData(context, &bufferData));
ASSERT(bufferData != nullptr);
ptrdiff_t offset =
@@ -2782,8 +2777,7 @@
}
vertexStride = attrib.stride;
- ANGLE_TRY_HANDLE(context,
- attrib.computeOffset(drawCallParams.firstVertex(), &vertexOffset));
+ ANGLE_TRY(attrib.computeOffset(context, drawCallParams.firstVertex(), &vertexOffset));
}
size_t bufferIndex = reservedBuffers + attribIndex;
@@ -2881,9 +2875,9 @@
gl::Buffer *elementArrayBuffer = mVertexArray11->getState().getElementArrayBuffer().get();
TranslatedIndexData indexInfo;
- ANGLE_TRY_HANDLE(context, mIndexDataManager.prepareIndexData(
- context, params.type(), destElementType, params.indexCount(),
- elementArrayBuffer, params.indices(), &indexInfo));
+ ANGLE_TRY(mIndexDataManager.prepareIndexData(context, params.type(), destElementType,
+ params.indexCount(), elementArrayBuffer,
+ params.indices(), &indexInfo));
ID3D11Buffer *buffer = nullptr;
DXGI_FORMAT bufferFormat =
@@ -2952,7 +2946,7 @@
if (attrib.divisor > 0)
{
unsigned int offset = 0;
- ANGLE_TRY_HANDLE(context, attrib.computeOffset(startVertex, &offset));
+ ANGLE_TRY(attrib.computeOffset(context, startVertex, &offset));
offset += (attrib.stride * (emulatedInstanceId / attrib.divisor));
if (offset != mCurrentVertexOffsets[bufferIndex])
{
@@ -2978,7 +2972,7 @@
ASSERT(textureD3D);
TextureStorage *texStorage = nullptr;
- ANGLE_TRY_HANDLE(context, textureD3D->getNativeTexture(context, &texStorage));
+ ANGLE_TRY(textureD3D->getNativeTexture(context, &texStorage));
if (texStorage)
{
diff --git a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
index 1ad75c1..e9bff3c 100644
--- a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
@@ -232,7 +232,7 @@
if (mRenderer->getWorkarounds().zeroMaxLodWorkaround)
{
// We must ensure that the level zero texture is in sync with mipped texture.
- ANGLE_TRY_HANDLE(context, useLevelZeroWorkaroundTexture(context, mipLevels == 1));
+ ANGLE_TRY(useLevelZeroWorkaroundTexture(context, mipLevels == 1));
}
if (swizzleRequired)
@@ -368,7 +368,7 @@
if (mRenderer->getWorkarounds().zeroMaxLodWorkaround)
{
// We must ensure that the level zero texture is in sync with mipped texture.
- ANGLE_TRY_HANDLE(context, useLevelZeroWorkaroundTexture(context, mipLevels == 1));
+ ANGLE_TRY(useLevelZeroWorkaroundTexture(context, mipLevels == 1));
}
// TODO(jmadill): Assert we don't need to drop stencil.
@@ -627,9 +627,9 @@
return angle::Result::Continue();
}
-gl::Error TextureStorage11::generateMipmap(const gl::Context *context,
- const gl::ImageIndex &sourceIndex,
- const gl::ImageIndex &destIndex)
+angle::Result TextureStorage11::generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &sourceIndex,
+ const gl::ImageIndex &destIndex)
{
ASSERT(sourceIndex.getLayerIndex() == destIndex.getLayerIndex());
@@ -681,7 +681,8 @@
}
}
-gl::Error TextureStorage11::copyToStorage(const gl::Context *context, TextureStorage *destStorage)
+angle::Result TextureStorage11::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
{
ASSERT(destStorage);
@@ -697,16 +698,16 @@
dest11->markDirty();
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureStorage11::setData(const gl::Context *context,
- const gl::ImageIndex &index,
- ImageD3D *image,
- const gl::Box *destBox,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixelData)
+angle::Result TextureStorage11::setData(const gl::Context *context,
+ const gl::ImageIndex &index,
+ ImageD3D *image,
+ const gl::Box *destBox,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixelData)
{
ASSERT(!image->isDirty());
@@ -732,18 +733,22 @@
// with compressed formats in the calling logic.
ASSERT(!internalFormatInfo.compressed);
+ Context11 *context11 = GetImplAs<Context11>(context);
+
const int width = destBox ? destBox->width : static_cast<int>(image->getWidth());
const int height = destBox ? destBox->height : static_cast<int>(image->getHeight());
const int depth = destBox ? destBox->depth : static_cast<int>(image->getDepth());
GLuint srcRowPitch = 0;
- ANGLE_TRY_CHECKED_MATH(internalFormatInfo.computeRowPitch(type, width, unpack.alignment,
- unpack.rowLength, &srcRowPitch));
+ ANGLE_CHECK_HR_MATH(context11,
+ internalFormatInfo.computeRowPitch(type, width, unpack.alignment,
+ unpack.rowLength, &srcRowPitch));
GLuint srcDepthPitch = 0;
- ANGLE_TRY_CHECKED_MATH(internalFormatInfo.computeDepthPitch(height, unpack.imageHeight,
- srcRowPitch, &srcDepthPitch));
+ ANGLE_CHECK_HR_MATH(context11, internalFormatInfo.computeDepthPitch(
+ height, unpack.imageHeight, srcRowPitch, &srcDepthPitch));
GLuint srcSkipBytes = 0;
- ANGLE_TRY_CHECKED_MATH(internalFormatInfo.computeSkipBytes(
- type, srcRowPitch, srcDepthPitch, unpack, index.usesTex3D(), &srcSkipBytes));
+ ANGLE_CHECK_HR_MATH(
+ context11, internalFormatInfo.computeSkipBytes(type, srcRowPitch, srcDepthPitch, unpack,
+ index.usesTex3D(), &srcSkipBytes));
const d3d11::Format &d3d11Format =
d3d11::Format::Get(image->getInternalFormat(), mRenderer->getRenderer11DeviceCaps());
@@ -762,7 +767,7 @@
LoadImageFunctionInfo loadFunctionInfo = d3d11Format.getLoadFunctions()(type);
if (loadFunctionInfo.requiresConversion)
{
- ANGLE_TRY(mRenderer->getScratchMemoryBuffer(neededSize, &conversionBuffer));
+ ANGLE_TRY(mRenderer->getScratchMemoryBuffer(context11, neededSize, &conversionBuffer));
loadFunctionInfo.loadFunction(width, height, depth, pixelData + srcSkipBytes, srcRowPitch,
srcDepthPitch, conversionBuffer->data(), bufferRowPitch,
bufferDepthPitch);
@@ -798,7 +803,7 @@
bufferRowPitch, bufferDepthPitch);
}
- return gl::NoError();
+ return angle::Result::Continue();
}
angle::Result TextureStorage11::ensureDropStencilTexture(
@@ -897,7 +902,7 @@
ASSERT(!mUseLevelZeroTexture || mRenderer->getWorkarounds().zeroMaxLodWorkaround);
}
-gl::Error TextureStorage11_2D::onDestroy(const gl::Context *context)
+angle::Result TextureStorage11_2D::onDestroy(const gl::Context *context)
{
for (unsigned i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
{
@@ -918,15 +923,15 @@
mRenderer->getStateManager()->invalidateBoundViews();
}
- return gl::NoError();
+ return angle::Result::Continue();
}
TextureStorage11_2D::~TextureStorage11_2D()
{
}
-gl::Error TextureStorage11_2D::copyToStorage(const gl::Context *context,
- TextureStorage *destStorage)
+angle::Result TextureStorage11_2D::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
{
ASSERT(destStorage);
@@ -957,7 +962,7 @@
immediateContext->CopyResource(destResource->get(), mLevelZeroTexture.get());
}
- return gl::NoError();
+ return angle::Result::Continue();
}
const TextureHelper11 *sourceResouce = nullptr;
@@ -969,11 +974,11 @@
immediateContext->CopyResource(destResource->get(), sourceResouce->get());
dest11->markDirty();
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureStorage11_2D::useLevelZeroWorkaroundTexture(const gl::Context *context,
- bool useLevelZeroTexture)
+angle::Result TextureStorage11_2D::useLevelZeroWorkaroundTexture(const gl::Context *context,
+ bool useLevelZeroTexture)
{
bool lastSetting = mUseLevelZeroTexture;
@@ -1014,7 +1019,7 @@
mSubject->onStateChange(context, angle::SubjectMessage::DEPENDENT_DIRTY_BITS);
}
- return gl::NoError();
+ return angle::Result::Continue();
}
void TextureStorage11_2D::associateImage(Image11 *image, const gl::ImageIndex &index)
@@ -1148,9 +1153,9 @@
return angle::Result::Continue();
}
-gl::Error TextureStorage11_2D::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
+angle::Result TextureStorage11_2D::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
{
ASSERT(!index.hasLayer());
@@ -1170,7 +1175,7 @@
if (mRenderTarget[level])
{
*outRT = mRenderTarget[level].get();
- return gl::NoError();
+ return angle::Result::Continue();
}
if (mRenderer->getWorkarounds().zeroMaxLodWorkaround)
@@ -1211,7 +1216,7 @@
}
*outRT = mLevelZeroRenderTarget.get();
- return gl::NoError();
+ return angle::Result::Continue();
}
if (mFormatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN)
@@ -1230,7 +1235,7 @@
getLevelWidth(level), getLevelHeight(level), 1, 0));
*outRT = mRenderTarget[level].get();
- return gl::NoError();
+ return angle::Result::Continue();
}
ASSERT(mFormatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN);
@@ -1250,7 +1255,7 @@
getLevelWidth(level), getLevelHeight(level), 1, 0));
*outRT = mRenderTarget[level].get();
- return gl::NoError();
+ return angle::Result::Continue();
}
angle::Result TextureStorage11_2D::createSRVForSampler(const gl::Context *context,
@@ -1446,7 +1451,7 @@
mHasKeyedMutex = (desc.MiscFlags & D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX) != 0;
}
-gl::Error TextureStorage11_External::onDestroy(const gl::Context *context)
+angle::Result TextureStorage11_External::onDestroy(const gl::Context *context)
{
if (mHasKeyedMutex)
{
@@ -1455,18 +1460,18 @@
mRenderer->getStateManager()->invalidateBoundViews();
}
- return gl::NoError();
+ return angle::Result::Continue();
}
TextureStorage11_External::~TextureStorage11_External()
{
}
-gl::Error TextureStorage11_External::copyToStorage(const gl::Context *context,
- TextureStorage *destStorage)
+angle::Result TextureStorage11_External::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
{
UNIMPLEMENTED();
- return gl::NoError();
+ return angle::Result::Continue();
}
void TextureStorage11_External::associateImage(Image11 *image, const gl::ImageIndex &index)
@@ -1519,13 +1524,13 @@
return angle::Result::Continue();
}
-gl::Error TextureStorage11_External::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
+angle::Result TextureStorage11_External::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
{
// Render targets are not supported for external textures
- UNREACHABLE();
- return gl::InternalError();
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop();
}
angle::Result TextureStorage11_External::createSRVForSampler(const gl::Context *context,
@@ -1649,9 +1654,9 @@
return angle::Result::Stop();
}
-gl::Error TextureStorage11_EGLImage::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
+angle::Result TextureStorage11_EGLImage::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
{
ASSERT(!index.hasLayer());
ASSERT(index.getLevelIndex() == 0);
@@ -1661,8 +1666,8 @@
return mImage->getRenderTarget(context, outRT);
}
-gl::Error TextureStorage11_EGLImage::copyToStorage(const gl::Context *context,
- TextureStorage *destStorage)
+angle::Result TextureStorage11_EGLImage::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
{
const TextureHelper11 *sourceResouce = nullptr;
ANGLE_TRY(getResource(context, &sourceResouce));
@@ -1677,7 +1682,7 @@
dest11->markDirty();
- return gl::NoError();
+ return angle::Result::Continue();
}
void TextureStorage11_EGLImage::associateImage(Image11 *, const gl::ImageIndex &)
@@ -1699,10 +1704,11 @@
return angle::Result::Continue();
}
-gl::Error TextureStorage11_EGLImage::useLevelZeroWorkaroundTexture(const gl::Context *context, bool)
+angle::Result TextureStorage11_EGLImage::useLevelZeroWorkaroundTexture(const gl::Context *context,
+ bool)
{
- UNREACHABLE();
- return gl::InternalError();
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop();
}
angle::Result TextureStorage11_EGLImage::getSwizzleTexture(const gl::Context *context,
@@ -1842,7 +1848,7 @@
RenderTarget11 **outRT) const
{
RenderTargetD3D *renderTargetD3D = nullptr;
- ANGLE_TRY_HANDLE(context, mImage->getRenderTarget(context, &renderTargetD3D));
+ ANGLE_TRY(mImage->getRenderTarget(context, &renderTargetD3D));
*outRT = GetAs<RenderTarget11>(renderTargetD3D);
return angle::Result::Continue();
}
@@ -1893,7 +1899,7 @@
ASSERT(!mUseLevelZeroTexture || mRenderer->getWorkarounds().zeroMaxLodWorkaround);
}
-gl::Error TextureStorage11_Cube::onDestroy(const gl::Context *context)
+angle::Result TextureStorage11_Cube::onDestroy(const gl::Context *context)
{
for (unsigned int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
{
@@ -1910,7 +1916,7 @@
}
}
- return gl::NoError();
+ return angle::Result::Continue();
}
TextureStorage11_Cube::~TextureStorage11_Cube()
@@ -1936,8 +1942,8 @@
}
}
-gl::Error TextureStorage11_Cube::copyToStorage(const gl::Context *context,
- TextureStorage *destStorage)
+angle::Result TextureStorage11_Cube::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
{
ASSERT(destStorage);
@@ -1983,11 +1989,11 @@
dest11->markDirty();
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureStorage11_Cube::useLevelZeroWorkaroundTexture(const gl::Context *context,
- bool useLevelZeroTexture)
+angle::Result TextureStorage11_Cube::useLevelZeroWorkaroundTexture(const gl::Context *context,
+ bool useLevelZeroTexture)
{
if (useLevelZeroTexture && mMipLevels > 1)
{
@@ -2030,7 +2036,7 @@
mUseLevelZeroTexture = false;
}
- return gl::NoError();
+ return angle::Result::Continue();
}
void TextureStorage11_Cube::associateImage(Image11 *image, const gl::ImageIndex &index)
@@ -2199,9 +2205,9 @@
return angle::Result::Continue();
}
-gl::Error TextureStorage11_Cube::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
+angle::Result TextureStorage11_Cube::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
{
const int faceIndex = index.cubeMapFaceIndex();
const int level = index.getLevelIndex();
@@ -2245,7 +2251,7 @@
ASSERT(outRT);
*outRT = mLevelZeroRenderTarget[faceIndex].get();
- return gl::NoError();
+ return angle::Result::Continue();
}
d3d11::SharedSRV srv;
@@ -2306,7 +2312,7 @@
ASSERT(outRT);
*outRT = mRenderTarget[faceIndex][level].get();
- return gl::NoError();
+ return angle::Result::Continue();
}
angle::Result TextureStorage11_Cube::createSRVForSampler(const gl::Context *context,
@@ -2533,7 +2539,7 @@
mTextureDepth = depth;
}
-gl::Error TextureStorage11_3D::onDestroy(const gl::Context *context)
+angle::Result TextureStorage11_3D::onDestroy(const gl::Context *context)
{
for (unsigned i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
{
@@ -2547,7 +2553,7 @@
}
}
- return gl::NoError();
+ return angle::Result::Continue();
}
TextureStorage11_3D::~TextureStorage11_3D()
@@ -2702,9 +2708,9 @@
return angle::Result::Continue();
}
-gl::Error TextureStorage11_3D::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
+angle::Result TextureStorage11_3D::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
{
const int mipLevel = index.getLevelIndex();
ASSERT(mipLevel >= 0 && mipLevel < getLevelCount());
@@ -2745,7 +2751,7 @@
ASSERT(outRT);
*outRT = mLevelRenderTargets[mipLevel].get();
- return gl::NoError();
+ return angle::Result::Continue();
}
const int layer = index.getLayerIndex();
@@ -2778,7 +2784,7 @@
ASSERT(outRT);
*outRT = mLevelLayerRenderTargets[key].get();
- return gl::NoError();
+ return angle::Result::Continue();
}
angle::Result TextureStorage11_3D::getSwizzleTexture(const gl::Context *context,
@@ -2865,7 +2871,7 @@
mTextureDepth = depth;
}
-gl::Error TextureStorage11_2DArray::onDestroy(const gl::Context *context)
+angle::Result TextureStorage11_2DArray::onDestroy(const gl::Context *context)
{
for (auto iter : mAssociatedImages)
{
@@ -2880,7 +2886,7 @@
}
mAssociatedImages.clear();
- return gl::NoError();
+ return angle::Result::Continue();
}
TextureStorage11_2DArray::~TextureStorage11_2DArray()
@@ -3074,9 +3080,9 @@
return angle::Result::Continue();
}
-gl::Error TextureStorage11_2DArray::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
+angle::Result TextureStorage11_2DArray::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
{
ASSERT(index.hasLayer());
@@ -3149,7 +3155,7 @@
ASSERT(outRT);
*outRT = mRenderTargets[key].get();
- return gl::NoError();
+ return angle::Result::Continue();
}
angle::Result TextureStorage11_2DArray::getSwizzleTexture(const gl::Context *context,
@@ -3274,21 +3280,21 @@
mFixedSampleLocations = fixedSampleLocations;
}
-gl::Error TextureStorage11_2DMultisample::onDestroy(const gl::Context *context)
+angle::Result TextureStorage11_2DMultisample::onDestroy(const gl::Context *context)
{
mRenderTarget.reset();
- return gl::NoError();
+ return angle::Result::Continue();
}
TextureStorage11_2DMultisample::~TextureStorage11_2DMultisample()
{
}
-gl::Error TextureStorage11_2DMultisample::copyToStorage(const gl::Context *context,
- TextureStorage *destStorage)
+angle::Result TextureStorage11_2DMultisample::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
{
- UNIMPLEMENTED();
- return gl::InternalError() << "copyToStorage is unimplemented";
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop();
}
void TextureStorage11_2DMultisample::associateImage(Image11 *image, const gl::ImageIndex &index)
@@ -3357,9 +3363,9 @@
return angle::Result::Continue();
}
-gl::Error TextureStorage11_2DMultisample::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
+angle::Result TextureStorage11_2DMultisample::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
{
ASSERT(!index.hasLayer());
@@ -3370,7 +3376,7 @@
if (mRenderTarget)
{
*outRT = mRenderTarget.get();
- return gl::NoError();
+ return angle::Result::Continue();
}
const TextureHelper11 *texture = nullptr;
@@ -3398,7 +3404,7 @@
getLevelWidth(level), getLevelHeight(level), 1, mSamples));
*outRT = mRenderTarget.get();
- return gl::NoError();
+ return angle::Result::Continue();
}
ASSERT(mFormatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN);
@@ -3416,7 +3422,7 @@
getLevelWidth(level), getLevelHeight(level), 1, mSamples));
*outRT = mRenderTarget.get();
- return gl::NoError();
+ return angle::Result::Continue();
}
angle::Result TextureStorage11_2DMultisample::createSRVForSampler(const gl::Context *context,
diff --git a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h
index 50a4831..fac511a 100644
--- a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h
+++ b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h
@@ -81,17 +81,17 @@
bool isManaged() const override;
bool supportsNativeMipmapFunction() const override;
int getLevelCount() const override;
- gl::Error generateMipmap(const gl::Context *context,
- const gl::ImageIndex &sourceIndex,
- const gl::ImageIndex &destIndex) override;
- gl::Error copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
- gl::Error setData(const gl::Context *context,
- const gl::ImageIndex &index,
- ImageD3D *image,
- const gl::Box *destBox,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixelData) override;
+ angle::Result generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &sourceIndex,
+ const gl::ImageIndex &destIndex) override;
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+ angle::Result setData(const gl::Context *context,
+ const gl::ImageIndex &index,
+ ImageD3D *image,
+ const gl::Box *destBox,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixelData) override;
virtual angle::Result getSRVForSampler(const gl::Context *context,
const gl::TextureState &textureState,
@@ -244,17 +244,17 @@
bool hintLevelZeroOnly = false);
~TextureStorage11_2D() override;
- gl::Error onDestroy(const gl::Context *context) override;
+ angle::Result onDestroy(const gl::Context *context) override;
angle::Result getResource(const gl::Context *context,
const TextureHelper11 **outResource) override;
angle::Result getMippedResource(const gl::Context *context,
const TextureHelper11 **outResource) override;
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
- gl::Error copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
void associateImage(Image11 *image, const gl::ImageIndex &index) override;
void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
@@ -263,8 +263,8 @@
const gl::ImageIndex &index,
Image11 *incomingImage) override;
- gl::Error useLevelZeroWorkaroundTexture(const gl::Context *context,
- bool useLevelZeroTexture) override;
+ angle::Result useLevelZeroWorkaroundTexture(const gl::Context *context,
+ bool useLevelZeroTexture) override;
protected:
angle::Result getSwizzleTexture(const gl::Context *context,
@@ -330,17 +330,17 @@
const egl::Stream::GLTextureDescription &glDesc);
~TextureStorage11_External() override;
- gl::Error onDestroy(const gl::Context *context) override;
+ angle::Result onDestroy(const gl::Context *context) override;
angle::Result getResource(const gl::Context *context,
const TextureHelper11 **outResource) override;
angle::Result getMippedResource(const gl::Context *context,
const TextureHelper11 **outResource) override;
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
- gl::Error copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
void associateImage(Image11 *image, const gl::ImageIndex &index) override;
void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
@@ -396,11 +396,11 @@
const d3d11::SharedSRV **outSRV) override;
angle::Result getMippedResource(const gl::Context *context,
const TextureHelper11 **outResource) override;
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
- gl::Error copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
void associateImage(Image11 *image, const gl::ImageIndex &index) override;
void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
@@ -409,8 +409,8 @@
const gl::ImageIndex &index,
Image11 *incomingImage) override;
- gl::Error useLevelZeroWorkaroundTexture(const gl::Context *context,
- bool useLevelZeroTexture) override;
+ angle::Result useLevelZeroWorkaroundTexture(const gl::Context *context,
+ bool useLevelZeroTexture) override;
protected:
angle::Result getSwizzleTexture(const gl::Context *context,
@@ -462,7 +462,7 @@
bool hintLevelZeroOnly);
~TextureStorage11_Cube() override;
- gl::Error onDestroy(const gl::Context *context) override;
+ angle::Result onDestroy(const gl::Context *context) override;
UINT getSubresourceIndex(const gl::ImageIndex &index) const override;
@@ -470,11 +470,11 @@
const TextureHelper11 **outResource) override;
angle::Result getMippedResource(const gl::Context *context,
const TextureHelper11 **outResource) override;
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
- gl::Error copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
void associateImage(Image11 *image, const gl::ImageIndex &index) override;
void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
@@ -483,8 +483,8 @@
const gl::ImageIndex &index,
Image11 *incomingImage) override;
- gl::Error useLevelZeroWorkaroundTexture(const gl::Context *context,
- bool useLevelZeroTexture) override;
+ angle::Result useLevelZeroWorkaroundTexture(const gl::Context *context,
+ bool useLevelZeroTexture) override;
protected:
angle::Result getSwizzleTexture(const gl::Context *context,
@@ -548,15 +548,15 @@
int levels);
~TextureStorage11_3D() override;
- gl::Error onDestroy(const gl::Context *context) override;
+ angle::Result onDestroy(const gl::Context *context) override;
angle::Result getResource(const gl::Context *context,
const TextureHelper11 **outResource) override;
// Handles both layer and non-layer RTs
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
void associateImage(Image11 *image, const gl::ImageIndex &index) override;
void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
@@ -614,13 +614,13 @@
int levels);
~TextureStorage11_2DArray() override;
- gl::Error onDestroy(const gl::Context *context) override;
+ angle::Result onDestroy(const gl::Context *context) override;
angle::Result getResource(const gl::Context *context,
const TextureHelper11 **outResource) override;
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
void associateImage(Image11 *image, const gl::ImageIndex &index) override;
void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
@@ -709,15 +709,15 @@
bool fixedSampleLocations);
~TextureStorage11_2DMultisample() override;
- gl::Error onDestroy(const gl::Context *context) override;
+ angle::Result onDestroy(const gl::Context *context) override;
angle::Result getResource(const gl::Context *context,
const TextureHelper11 **outResource) override;
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
- gl::Error copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
void associateImage(Image11 *image, const gl::ImageIndex &index) override;
void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
diff --git a/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp b/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp
index 54885cd..176755f 100644
--- a/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp
@@ -192,9 +192,8 @@
bool usePrimitiveRestartWorkaround =
UsePrimitiveRestartWorkaround(restartEnabled, drawCallParams.type());
- ANGLE_TRY_HANDLE(
- context, GetIndexTranslationDestType(context, drawCallParams, usePrimitiveRestartWorkaround,
- &mCachedDestinationIndexType));
+ ANGLE_TRY(GetIndexTranslationDestType(context, drawCallParams, usePrimitiveRestartWorkaround,
+ &mCachedDestinationIndexType));
unsigned int offset =
static_cast<unsigned int>(reinterpret_cast<uintptr_t>(drawCallParams.indices()));
@@ -266,8 +265,7 @@
break;
case VertexStorageType::STATIC:
{
- ANGLE_TRY_HANDLE(context,
- VertexDataManager::StoreStaticAttrib(context, translatedAttrib));
+ ANGLE_TRY(VertexDataManager::StoreStaticAttrib(context, translatedAttrib));
break;
}
case VertexStorageType::CURRENT_VALUE:
@@ -305,10 +303,9 @@
dynamicAttrib->divisor = dynamicAttrib->binding->getDivisor() * mAppliedNumViewsToDivisor;
}
- ANGLE_TRY_HANDLE(context, vertexDataManager->storeDynamicAttribs(
- context, &mTranslatedAttribs, activeDynamicAttribs,
- drawCallParams.firstVertex(), drawCallParams.vertexCount(),
- drawCallParams.instances()));
+ ANGLE_TRY(vertexDataManager->storeDynamicAttribs(
+ context, &mTranslatedAttribs, activeDynamicAttribs, drawCallParams.firstVertex(),
+ drawCallParams.vertexCount(), drawCallParams.instances()));
VertexDataManager::PromoteDynamicAttribs(context, mTranslatedAttribs, activeDynamicAttribs,
drawCallParams.vertexCount());
diff --git a/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp b/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp
index d74a98c..234cd36 100644
--- a/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp
@@ -35,9 +35,9 @@
ASSERT(mMappedResourceData == nullptr);
}
-gl::Error VertexBuffer11::initialize(const gl::Context *context,
- unsigned int size,
- bool dynamicUsage)
+angle::Result VertexBuffer11::initialize(const gl::Context *context,
+ unsigned int size,
+ bool dynamicUsage)
{
mBuffer.reset();
updateSerial();
@@ -67,10 +67,10 @@
mBufferSize = size;
mDynamicUsage = dynamicUsage;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error VertexBuffer11::mapResource(const gl::Context *context)
+angle::Result VertexBuffer11::mapResource(const gl::Context *context)
{
if (mMappedResourceData == nullptr)
{
@@ -82,7 +82,7 @@
mMappedResourceData = static_cast<uint8_t *>(mappedResource.pData);
}
- return gl::NoError();
+ return angle::Result::Continue();
}
void VertexBuffer11::hintUnmapResource()
@@ -96,20 +96,17 @@
}
}
-gl::Error VertexBuffer11::storeVertexAttributes(const gl::Context *context,
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLenum currentValueType,
- GLint start,
- size_t count,
- GLsizei instances,
- unsigned int offset,
- const uint8_t *sourceData)
+angle::Result VertexBuffer11::storeVertexAttributes(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ GLenum currentValueType,
+ GLint start,
+ size_t count,
+ GLsizei instances,
+ unsigned int offset,
+ const uint8_t *sourceData)
{
- if (!mBuffer.valid())
- {
- return gl::OutOfMemory() << "Internal vertex buffer is not initialized.";
- }
+ ASSERT(mBuffer.valid());
int inputStride = static_cast<int>(ComputeVertexAttributeStride(attrib, binding));
@@ -132,7 +129,7 @@
ASSERT(vertexFormatInfo.copyFunction != nullptr);
vertexFormatInfo.copyFunction(input, inputStride, count, output);
- return gl::NoError();
+ return angle::Result::Continue();
}
unsigned int VertexBuffer11::getBufferSize() const
@@ -140,24 +137,19 @@
return mBufferSize;
}
-gl::Error VertexBuffer11::setBufferSize(const gl::Context *context, unsigned int size)
+angle::Result VertexBuffer11::setBufferSize(const gl::Context *context, unsigned int size)
{
if (size > mBufferSize)
{
return initialize(context, size, mDynamicUsage);
}
- else
- {
- return gl::NoError();
- }
+
+ return angle::Result::Continue();
}
-gl::Error VertexBuffer11::discard(const gl::Context *context)
+angle::Result VertexBuffer11::discard(const gl::Context *context)
{
- if (!mBuffer.valid())
- {
- return gl::OutOfMemory() << "Internal vertex buffer is not initialized.";
- }
+ ASSERT(mBuffer.valid());
D3D11_MAPPED_SUBRESOURCE mappedResource;
ANGLE_TRY(mRenderer->mapResource(context, mBuffer.get(), 0, D3D11_MAP_WRITE_DISCARD, 0,
@@ -165,7 +157,7 @@
mRenderer->getDeviceContext()->Unmap(mBuffer.get(), 0);
- return gl::NoError();
+ return angle::Result::Continue();
}
const d3d11::Buffer &VertexBuffer11::getBuffer() const
diff --git a/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h b/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h
index e5d7f26..5f386b1 100644
--- a/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h
+++ b/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h
@@ -23,23 +23,25 @@
public:
explicit VertexBuffer11(Renderer11 *const renderer);
- gl::Error initialize(const gl::Context *context, unsigned int size, bool dynamicUsage) override;
+ angle::Result initialize(const gl::Context *context,
+ unsigned int size,
+ bool dynamicUsage) override;
// Warning: you should ensure binding really matches attrib.bindingIndex before using this
// function.
- gl::Error storeVertexAttributes(const gl::Context *context,
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLenum currentValueType,
- GLint start,
- size_t count,
- GLsizei instances,
- unsigned int offset,
- const uint8_t *sourceData) override;
+ angle::Result storeVertexAttributes(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ GLenum currentValueType,
+ GLint start,
+ size_t count,
+ GLsizei instances,
+ unsigned int offset,
+ const uint8_t *sourceData) override;
unsigned int getBufferSize() const override;
- gl::Error setBufferSize(const gl::Context *context, unsigned int size) override;
- gl::Error discard(const gl::Context *context) override;
+ angle::Result setBufferSize(const gl::Context *context, unsigned int size) override;
+ angle::Result discard(const gl::Context *context) override;
void hintUnmapResource() override;
@@ -47,7 +49,7 @@
private:
~VertexBuffer11() override;
- gl::Error mapResource(const gl::Context *context);
+ angle::Result mapResource(const gl::Context *context);
Renderer11 *const mRenderer;
diff --git a/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp b/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp
index dcdba6c..a7c5605 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp
@@ -310,7 +310,7 @@
TextureD3D *sourceD3D = GetImplAs<TextureD3D>(source);
TextureStorage *sourceStorage = nullptr;
- ANGLE_TRY_HANDLE(context, sourceD3D->getNativeTexture(context, &sourceStorage));
+ ANGLE_TRY(sourceD3D->getNativeTexture(context, &sourceStorage));
TextureStorage9_2D *sourceStorage9 = GetAs<TextureStorage9_2D>(sourceStorage);
ASSERT(sourceStorage9);
diff --git a/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp b/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp
index dc308e7..be239b6 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp
@@ -7,6 +7,8 @@
// Buffer9.cpp Defines the Buffer9 class.
#include "libANGLE/renderer/d3d/d3d9/Buffer9.h"
+
+#include "libANGLE/Context.h"
#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
namespace rx
@@ -59,10 +61,10 @@
return gl::NoError();
}
-gl::Error Buffer9::getData(const gl::Context *context, const uint8_t **outData)
+angle::Result Buffer9::getData(const gl::Context *context, const uint8_t **outData)
{
*outData = mMemory.data();
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::Error Buffer9::setSubData(const gl::Context *context,
@@ -130,10 +132,10 @@
return gl::InternalError();
}
-gl::Error Buffer9::markTransformFeedbackUsage(const gl::Context *context)
+angle::Result Buffer9::markTransformFeedbackUsage(const gl::Context *context)
{
- UNREACHABLE();
- return gl::InternalError();
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop();
}
} // namespace rx
diff --git a/src/libANGLE/renderer/d3d/d3d9/Buffer9.h b/src/libANGLE/renderer/d3d/d3d9/Buffer9.h
index 960b2a2..d5e8e5e 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Buffer9.h
+++ b/src/libANGLE/renderer/d3d/d3d9/Buffer9.h
@@ -26,7 +26,7 @@
// BufferD3D implementation
size_t getSize() const override;
bool supportsDirectBinding() const override;
- gl::Error getData(const gl::Context *context, const uint8_t **outData) override;
+ angle::Result getData(const gl::Context *context, const uint8_t **outData) override;
// BufferImpl implementation
gl::Error setData(const gl::Context *context,
@@ -51,7 +51,7 @@
GLbitfield access,
void **mapPtr) override;
gl::Error unmap(const gl::Context *context, GLboolean *result) override;
- gl::Error markTransformFeedbackUsage(const gl::Context *context) override;
+ angle::Result markTransformFeedbackUsage(const gl::Context *context) override;
private:
angle::MemoryBuffer mMemory;
diff --git a/src/libANGLE/renderer/d3d/d3d9/Context9.cpp b/src/libANGLE/renderer/d3d/d3d9/Context9.cpp
index f7343a3..a239773 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Context9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/Context9.cpp
@@ -28,7 +28,7 @@
{
Context9::Context9(const gl::ContextState &state, Renderer9 *renderer)
- : ContextImpl(state), mRenderer(renderer)
+ : ContextD3D(state), mRenderer(renderer)
{
}
@@ -328,11 +328,13 @@
return gl::InternalError() << "D3D9 doesn't support ES 3.1 memoryBarrierByRegion API";
}
-gl::Error Context9::getIncompleteTexture(const gl::Context *context,
- gl::TextureType type,
- gl::Texture **textureOut)
+angle::Result Context9::getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut)
{
- return mIncompleteTextures.getIncompleteTexture(context, type, nullptr, textureOut);
+ ANGLE_TRY_HANDLE(context,
+ mIncompleteTextures.getIncompleteTexture(context, type, nullptr, textureOut));
+ return angle::Result::Continue();
}
void Context9::handleError(HRESULT hr,
diff --git a/src/libANGLE/renderer/d3d/d3d9/Context9.h b/src/libANGLE/renderer/d3d/d3d9/Context9.h
index 7326748..31a6b77 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Context9.h
+++ b/src/libANGLE/renderer/d3d/d3d9/Context9.h
@@ -10,13 +10,13 @@
#ifndef LIBANGLE_RENDERER_D3D_D3D9_CONTEXT9_H_
#define LIBANGLE_RENDERER_D3D_D3D9_CONTEXT9_H_
-#include "libANGLE/renderer/ContextImpl.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
namespace rx
{
class Renderer9;
-class Context9 : public ContextImpl
+class Context9 : public ContextD3D
{
public:
Context9(const gl::ContextState &state, Renderer9 *renderer);
@@ -147,15 +147,15 @@
Renderer9 *getRenderer() const { return mRenderer; }
- gl::Error getIncompleteTexture(const gl::Context *context,
- gl::TextureType type,
- gl::Texture **textureOut);
+ angle::Result getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut);
void handleError(HRESULT hr,
const char *message,
const char *file,
const char *function,
- unsigned int line);
+ unsigned int line) override;
private:
Renderer9 *mRenderer;
diff --git a/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp b/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp
index 16d735a..c5e1dbd 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp
@@ -58,7 +58,8 @@
return gl::NoError();
}
-gl::Error Framebuffer9::clearImpl(const gl::Context *context, const ClearParameters &clearParams)
+angle::Result Framebuffer9::clearImpl(const gl::Context *context,
+ const ClearParameters &clearParams)
{
ANGLE_TRY(mRenderer->applyRenderTarget(context, mRenderTargetCache.getColors()[0],
mRenderTargetCache.getDepthStencil()));
@@ -73,22 +74,22 @@
mRenderer->clear(clearParams, mRenderTargetCache.getColors()[0],
mRenderTargetCache.getDepthStencil());
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Framebuffer9::readPixelsImpl(const gl::Context *context,
- const gl::Rectangle &area,
- GLenum format,
- GLenum type,
- size_t outputPitch,
- const gl::PixelPackState &pack,
- uint8_t *pixels)
+angle::Result Framebuffer9::readPixelsImpl(const gl::Context *context,
+ const gl::Rectangle &area,
+ GLenum format,
+ GLenum type,
+ size_t outputPitch,
+ const gl::PixelPackState &pack,
+ uint8_t *pixels)
{
const gl::FramebufferAttachment *colorbuffer = mState.getColorAttachment(0);
ASSERT(colorbuffer);
RenderTarget9 *renderTarget = nullptr;
- ANGLE_TRY(colorbuffer->getRenderTarget(context, &renderTarget));
+ ANGLE_TRY_HANDLE(context, colorbuffer->getRenderTarget(context, &renderTarget));
ASSERT(renderTarget);
IDirect3DSurface9 *surface = renderTarget->getSurface();
@@ -97,13 +98,15 @@
D3DSURFACE_DESC desc;
surface->GetDesc(&desc);
+ Context9 *context9 = GetImplAs<Context9>(context);
+
if (desc.MultiSampleType != D3DMULTISAMPLE_NONE)
{
UNIMPLEMENTED(); // FIXME: Requires resolve using StretchRect into non-multisampled render
// target
SafeRelease(surface);
- return gl::OutOfMemory()
- << "ReadPixels is unimplemented for multisampled framebuffer attachments.";
+ ANGLE_TRY_HR(context9, E_OUTOFMEMORY,
+ "ReadPixels is unimplemented for multisampled framebuffer attachments.");
}
IDirect3DDevice9 *device = mRenderer->getDevice();
@@ -137,7 +140,8 @@
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
SafeRelease(surface);
- return gl::OutOfMemory() << "Failed to allocate internal texture for ReadPixels.";
+ ANGLE_TRY_HR(context9, E_OUTOFMEMORY,
+ "Failed to allocate internal texture for ReadPixels.");
}
}
@@ -159,13 +163,13 @@
UNREACHABLE();
}
- return gl::OutOfMemory() << "Failed to read internal render target data.";
+ ANGLE_TRY_HR(context9, E_OUTOFMEMORY, "Failed to read internal render target data.");
}
if (directToPixels)
{
SafeRelease(systemSurface);
- return gl::NoError();
+ return angle::Result::Continue();
}
RECT rect;
@@ -182,7 +186,7 @@
UNREACHABLE();
SafeRelease(systemSurface);
- return gl::OutOfMemory() << "Failed to lock internal render target.";
+ ANGLE_TRY_HR(context9, E_OUTOFMEMORY, "Failed to lock internal render target.");
}
uint8_t *source = static_cast<uint8_t *>(lock.pBits);
@@ -206,18 +210,18 @@
systemSurface->UnlockRect();
SafeRelease(systemSurface);
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Framebuffer9::blitImpl(const gl::Context *context,
- const gl::Rectangle &sourceArea,
- const gl::Rectangle &destArea,
- const gl::Rectangle *scissor,
- bool blitRenderTarget,
- bool blitDepth,
- bool blitStencil,
- GLenum filter,
- const gl::Framebuffer *sourceFramebuffer)
+angle::Result Framebuffer9::blitImpl(const gl::Context *context,
+ const gl::Rectangle &sourceArea,
+ const gl::Rectangle &destArea,
+ const gl::Rectangle *scissor,
+ bool blitRenderTarget,
+ bool blitDepth,
+ bool blitStencil,
+ GLenum filter,
+ const gl::Framebuffer *sourceFramebuffer)
{
ASSERT(filter == GL_NEAREST);
@@ -226,28 +230,22 @@
mRenderer->endScene();
+ Context9 *context9 = GetImplAs<Context9>(context);
+
if (blitRenderTarget)
{
const gl::FramebufferAttachment *readBuffer = sourceFramebuffer->getColorbuffer(0);
ASSERT(readBuffer);
RenderTarget9 *readRenderTarget = nullptr;
- gl::Error error = readBuffer->getRenderTarget(context, &readRenderTarget);
- if (error.isError())
- {
- return error;
- }
+ ANGLE_TRY_HANDLE(context, readBuffer->getRenderTarget(context, &readRenderTarget));
ASSERT(readRenderTarget);
const gl::FramebufferAttachment *drawBuffer = mState.getColorAttachment(0);
ASSERT(drawBuffer);
RenderTarget9 *drawRenderTarget = nullptr;
- error = drawBuffer->getRenderTarget(context, &drawRenderTarget);
- if (error.isError())
- {
- return error;
- }
+ ANGLE_TRY_HANDLE(context, drawBuffer->getRenderTarget(context, &drawRenderTarget));
ASSERT(drawRenderTarget);
// The getSurface calls do an AddRef so save them until after no errors are possible
@@ -347,10 +345,7 @@
SafeRelease(readSurface);
SafeRelease(drawSurface);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Internal blit failed, StretchRect " << gl::FmtHR(result);
- }
+ ANGLE_TRY_HR(context9, result, "Internal blit failed.");
}
if (blitDepth || blitStencil)
@@ -359,22 +354,14 @@
ASSERT(readBuffer);
RenderTarget9 *readDepthStencil = nullptr;
- gl::Error error = readBuffer->getRenderTarget(context, &readDepthStencil);
- if (error.isError())
- {
- return error;
- }
+ ANGLE_TRY_HANDLE(context, readBuffer->getRenderTarget(context, &readDepthStencil));
ASSERT(readDepthStencil);
const gl::FramebufferAttachment *drawBuffer = mState.getDepthOrStencilAttachment();
ASSERT(drawBuffer);
RenderTarget9 *drawDepthStencil = nullptr;
- error = drawBuffer->getRenderTarget(context, &drawDepthStencil);
- if (error.isError())
- {
- return error;
- }
+ ANGLE_TRY_HANDLE(context, drawBuffer->getRenderTarget(context, &drawDepthStencil));
ASSERT(drawDepthStencil);
// The getSurface calls do an AddRef so save them until after no errors are possible
@@ -390,13 +377,10 @@
SafeRelease(readSurface);
SafeRelease(drawSurface);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Internal blit failed, StretchRect " << gl::FmtHR(result);
- }
+ ANGLE_TRY_HR(context9, result, "Internal blit failed.");
}
- return gl::NoError();
+ return angle::Result::Continue();
}
GLenum Framebuffer9::getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const
diff --git a/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h b/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h
index 8e13551..c2b7569 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h
+++ b/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h
@@ -50,25 +50,26 @@
}
private:
- gl::Error clearImpl(const gl::Context *context, const ClearParameters &clearParams) override;
+ angle::Result clearImpl(const gl::Context *context,
+ const ClearParameters &clearParams) override;
- gl::Error readPixelsImpl(const gl::Context *context,
- const gl::Rectangle &area,
- GLenum format,
- GLenum type,
- size_t outputPitch,
- const gl::PixelPackState &pack,
- uint8_t *pixels) override;
+ angle::Result readPixelsImpl(const gl::Context *context,
+ const gl::Rectangle &area,
+ GLenum format,
+ GLenum type,
+ size_t outputPitch,
+ const gl::PixelPackState &pack,
+ uint8_t *pixels) override;
- gl::Error blitImpl(const gl::Context *context,
- const gl::Rectangle &sourceArea,
- const gl::Rectangle &destArea,
- const gl::Rectangle *scissor,
- bool blitRenderTarget,
- bool blitDepth,
- bool blitStencil,
- GLenum filter,
- const gl::Framebuffer *sourceFramebuffer) override;
+ angle::Result blitImpl(const gl::Context *context,
+ const gl::Rectangle &sourceArea,
+ const gl::Rectangle &destArea,
+ const gl::Rectangle *scissor,
+ bool blitRenderTarget,
+ bool blitDepth,
+ bool blitStencil,
+ GLenum filter,
+ const gl::Framebuffer *sourceFramebuffer) override;
GLenum getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const override;
diff --git a/src/libANGLE/renderer/d3d/d3d9/Image9.cpp b/src/libANGLE/renderer/d3d/d3d9/Image9.cpp
index 7626919..539f546 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Image9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/Image9.cpp
@@ -361,9 +361,9 @@
return angle::Result::Continue();
}
-gl::Error Image9::setManagedSurface2D(const gl::Context *context,
- TextureStorage *storage,
- int level)
+angle::Result Image9::setManagedSurface2D(const gl::Context *context,
+ TextureStorage *storage,
+ int level)
{
IDirect3DSurface9 *surface = nullptr;
TextureStorage9 *storage9 = GetAs<TextureStorage9>(storage);
@@ -371,10 +371,10 @@
return setManagedSurface(GetImplAs<Context9>(context), surface);
}
-gl::Error Image9::setManagedSurfaceCube(const gl::Context *context,
- TextureStorage *storage,
- int face,
- int level)
+angle::Result Image9::setManagedSurfaceCube(const gl::Context *context,
+ TextureStorage *storage,
+ int face,
+ int level)
{
IDirect3DSurface9 *surface = nullptr;
TextureStorage9 *storage9 = GetAs<TextureStorage9>(storage);
@@ -405,10 +405,10 @@
return angle::Result::Continue();
}
-gl::Error Image9::copyToStorage(const gl::Context *context,
- TextureStorage *storage,
- const gl::ImageIndex &index,
- const gl::Box ®ion)
+angle::Result Image9::copyToStorage(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::ImageIndex &index,
+ const gl::Box ®ion)
{
ANGLE_TRY(createSurface(GetImplAs<Context9>(context)));
@@ -474,20 +474,22 @@
// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
// into the target pixel rectangle.
-gl::Error Image9::loadData(const gl::Context *context,
- const gl::Box &area,
- const gl::PixelUnpackState &unpack,
- GLenum type,
- const void *input,
- bool applySkipImages)
+angle::Result Image9::loadData(const gl::Context *context,
+ const gl::Box &area,
+ const gl::PixelUnpackState &unpack,
+ GLenum type,
+ const void *input,
+ bool applySkipImages)
{
// 3D textures are not supported by the D3D9 backend.
ASSERT(area.z == 0 && area.depth == 1);
+ Context9 *context9 = GetImplAs<Context9>(context);
+
const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(mInternalFormat);
GLuint inputRowPitch = 0;
- ANGLE_TRY_CHECKED_MATH(formatInfo.computeRowPitch(type, area.width, unpack.alignment,
- unpack.rowLength, &inputRowPitch));
+ ANGLE_CHECK_HR_MATH(context9, formatInfo.computeRowPitch(type, area.width, unpack.alignment,
+ unpack.rowLength, &inputRowPitch));
ASSERT(!applySkipImages);
ASSERT(unpack.skipPixels == 0);
ASSERT(unpack.skipRows == 0);
@@ -510,24 +512,26 @@
unlock();
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Image9::loadCompressedData(const gl::Context *context,
- const gl::Box &area,
- const void *input)
+angle::Result Image9::loadCompressedData(const gl::Context *context,
+ const gl::Box &area,
+ const void *input)
{
// 3D textures are not supported by the D3D9 backend.
ASSERT(area.z == 0 && area.depth == 1);
+ Context9 *context9 = GetImplAs<Context9>(context);
+
const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(mInternalFormat);
GLuint inputRowPitch = 0;
- ANGLE_TRY_CHECKED_MATH(
- formatInfo.computeRowPitch(GL_UNSIGNED_BYTE, area.width, 1, 0, &inputRowPitch));
+ ANGLE_CHECK_HR_MATH(
+ context9, formatInfo.computeRowPitch(GL_UNSIGNED_BYTE, area.width, 1, 0, &inputRowPitch));
GLuint inputDepthPitch = 0;
- ANGLE_TRY_CHECKED_MATH(
- formatInfo.computeDepthPitch(area.height, 0, inputRowPitch, &inputDepthPitch));
+ ANGLE_CHECK_HR_MATH(
+ context9, formatInfo.computeDepthPitch(area.height, 0, inputRowPitch, &inputDepthPitch));
const d3d9::TextureFormat &d3d9FormatInfo = d3d9::GetTextureFormatInfo(mInternalFormat);
@@ -551,7 +555,7 @@
unlock();
- return gl::NoError();
+ return angle::Result::Continue();
}
// This implements glCopyTex[Sub]Image2D for non-renderable internal texture formats and incomplete textures
@@ -769,9 +773,9 @@
return angle::Result::Continue();
}
-gl::Error Image9::copyFromTexStorage(const gl::Context *context,
- const gl::ImageIndex &imageIndex,
- TextureStorage *source)
+angle::Result Image9::copyFromTexStorage(const gl::Context *context,
+ const gl::ImageIndex &imageIndex,
+ TextureStorage *source)
{
RenderTargetD3D *renderTarget = nullptr;
ANGLE_TRY(source->getRenderTarget(context, imageIndex, &renderTarget));
@@ -780,16 +784,16 @@
return copyFromRTInternal(GetImplAs<Context9>(context), gl::Offset(), sourceArea, renderTarget);
}
-gl::Error Image9::copyFromFramebuffer(const gl::Context *context,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source)
+angle::Result Image9::copyFromFramebuffer(const gl::Context *context,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ const gl::Framebuffer *source)
{
const gl::FramebufferAttachment *srcAttachment = source->getReadColorbuffer();
ASSERT(srcAttachment);
RenderTargetD3D *renderTarget = nullptr;
- ANGLE_TRY(srcAttachment->getRenderTarget(context, &renderTarget));
+ ANGLE_TRY_HANDLE(context, srcAttachment->getRenderTarget(context, &renderTarget));
ASSERT(renderTarget);
return copyFromRTInternal(GetImplAs<Context9>(context), destOffset, sourceArea, renderTarget);
}
diff --git a/src/libANGLE/renderer/d3d/d3d9/Image9.h b/src/libANGLE/renderer/d3d/d3d9/Image9.h
index 63d202b..3989136 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Image9.h
+++ b/src/libANGLE/renderer/d3d/d3d9/Image9.h
@@ -54,35 +54,35 @@
bool isDirty() const override;
- gl::Error setManagedSurface2D(const gl::Context *context,
- TextureStorage *storage,
- int level) override;
- gl::Error setManagedSurfaceCube(const gl::Context *context,
- TextureStorage *storage,
- int face,
- int level) override;
- gl::Error copyToStorage(const gl::Context *context,
- TextureStorage *storage,
- const gl::ImageIndex &index,
- const gl::Box ®ion) override;
+ angle::Result setManagedSurface2D(const gl::Context *context,
+ TextureStorage *storage,
+ int level) override;
+ angle::Result setManagedSurfaceCube(const gl::Context *context,
+ TextureStorage *storage,
+ int face,
+ int level) override;
+ angle::Result copyToStorage(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::ImageIndex &index,
+ const gl::Box ®ion) override;
- gl::Error loadData(const gl::Context *context,
- const gl::Box &area,
- const gl::PixelUnpackState &unpack,
- GLenum type,
- const void *input,
- bool applySkipImages) override;
- gl::Error loadCompressedData(const gl::Context *context,
- const gl::Box &area,
- const void *input) override;
+ angle::Result loadData(const gl::Context *context,
+ const gl::Box &area,
+ const gl::PixelUnpackState &unpack,
+ GLenum type,
+ const void *input,
+ bool applySkipImages) override;
+ angle::Result loadCompressedData(const gl::Context *context,
+ const gl::Box &area,
+ const void *input) override;
- gl::Error copyFromTexStorage(const gl::Context *context,
- const gl::ImageIndex &imageIndex,
- TextureStorage *source) override;
- gl::Error copyFromFramebuffer(const gl::Context *context,
- const gl::Offset &destOffset,
- const gl::Rectangle &sourceArea,
- const gl::Framebuffer *source) override;
+ angle::Result copyFromTexStorage(const gl::Context *context,
+ const gl::ImageIndex &imageIndex,
+ TextureStorage *source) override;
+ angle::Result copyFromFramebuffer(const gl::Context *context,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ const gl::Framebuffer *source) override;
private:
angle::Result getSurface(Context9 *context9, IDirect3DSurface9 **outSurface);
diff --git a/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp b/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp
index f1928fe..881d5f5 100644
--- a/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp
@@ -7,6 +7,8 @@
// Indexffer9.cpp: Defines the D3D9 IndexBuffer implementation.
#include "libANGLE/renderer/d3d/d3d9/IndexBuffer9.h"
+
+#include "libANGLE/Context.h"
#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
namespace rx
@@ -25,10 +27,10 @@
SafeRelease(mIndexBuffer);
}
-gl::Error IndexBuffer9::initialize(const gl::Context *context,
- unsigned int bufferSize,
- GLenum indexType,
- bool dynamic)
+angle::Result IndexBuffer9::initialize(const gl::Context *context,
+ unsigned int bufferSize,
+ GLenum indexType,
+ bool dynamic)
{
SafeRelease(mIndexBuffer);
@@ -55,57 +57,41 @@
}
HRESULT result = mRenderer->createIndexBuffer(bufferSize, usageFlags, format, &mIndexBuffer);
- if (FAILED(result))
- {
- return gl::OutOfMemory()
- << "Failed to allocate internal index buffer of size " << bufferSize;
- }
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result,
+ "Failed to allocate internal index buffer");
}
mBufferSize = bufferSize;
mIndexType = indexType;
mDynamic = dynamic;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error IndexBuffer9::mapBuffer(const gl::Context *context,
- unsigned int offset,
- unsigned int size,
- void **outMappedMemory)
+angle::Result IndexBuffer9::mapBuffer(const gl::Context *context,
+ unsigned int offset,
+ unsigned int size,
+ void **outMappedMemory)
{
- if (!mIndexBuffer)
- {
- return gl::OutOfMemory() << "Internal index buffer is not initialized.";
- }
+ ASSERT(mIndexBuffer);
DWORD lockFlags = mDynamic ? D3DLOCK_NOOVERWRITE : 0;
void *mapPtr = nullptr;
HRESULT result = mIndexBuffer->Lock(offset, size, &mapPtr, lockFlags);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to lock internal index buffer, " << gl::FmtHR(result);
- }
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to lock internal index buffer");
*outMappedMemory = mapPtr;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error IndexBuffer9::unmapBuffer(const gl::Context *context)
+angle::Result IndexBuffer9::unmapBuffer(const gl::Context *context)
{
- if (!mIndexBuffer)
- {
- return gl::OutOfMemory() << "Internal index buffer is not initialized.";
- }
-
+ ASSERT(mIndexBuffer);
HRESULT result = mIndexBuffer->Unlock();
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to unlock internal index buffer, " << gl::FmtHR(result);
- }
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to unlock internal index buffer");
- return gl::NoError();
+ return angle::Result::Continue();
}
GLenum IndexBuffer9::getIndexType() const
@@ -118,43 +104,34 @@
return mBufferSize;
}
-gl::Error IndexBuffer9::setSize(const gl::Context *context,
- unsigned int bufferSize,
- GLenum indexType)
+angle::Result IndexBuffer9::setSize(const gl::Context *context,
+ unsigned int bufferSize,
+ GLenum indexType)
{
if (bufferSize > mBufferSize || indexType != mIndexType)
{
return initialize(context, bufferSize, indexType, mDynamic);
}
- else
- {
- return gl::NoError();
- }
+
+ return angle::Result::Continue();
}
-gl::Error IndexBuffer9::discard(const gl::Context *context)
+angle::Result IndexBuffer9::discard(const gl::Context *context)
{
- if (!mIndexBuffer)
- {
- return gl::OutOfMemory() << "Internal index buffer is not initialized.";
- }
+ ASSERT(mIndexBuffer);
void *dummy;
HRESULT result;
+ Context9 *context9 = GetImplAs<Context9>(context);
+
result = mIndexBuffer->Lock(0, 1, &dummy, D3DLOCK_DISCARD);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to lock internal index buffer, " << gl::FmtHR(result);
- }
+ ANGLE_TRY_HR(context9, result, "Failed to lock internal index buffer");
result = mIndexBuffer->Unlock();
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to unlock internal index buffer, " << gl::FmtHR(result);
- }
+ ANGLE_TRY_HR(context9, result, "Failed to unlock internal index buffer");
- return gl::NoError();
+ return angle::Result::Continue();
}
D3DFORMAT IndexBuffer9::getIndexFormat() const
diff --git a/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.h b/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.h
index 0f75949..45f567f 100644
--- a/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.h
+++ b/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.h
@@ -21,24 +21,24 @@
explicit IndexBuffer9(Renderer9 *const renderer);
~IndexBuffer9() override;
- gl::Error initialize(const gl::Context *context,
- unsigned int bufferSize,
- GLenum indexType,
- bool dynamic) override;
+ angle::Result initialize(const gl::Context *context,
+ unsigned int bufferSize,
+ GLenum indexType,
+ bool dynamic) override;
- gl::Error mapBuffer(const gl::Context *context,
- unsigned int offset,
- unsigned int size,
- void **outMappedMemory) override;
- gl::Error unmapBuffer(const gl::Context *context) override;
+ angle::Result mapBuffer(const gl::Context *context,
+ unsigned int offset,
+ unsigned int size,
+ void **outMappedMemory) override;
+ angle::Result unmapBuffer(const gl::Context *context) override;
GLenum getIndexType() const override;
unsigned int getBufferSize() const override;
- gl::Error setSize(const gl::Context *context,
- unsigned int bufferSize,
- GLenum indexType) override;
+ angle::Result setSize(const gl::Context *context,
+ unsigned int bufferSize,
+ GLenum indexType) override;
- gl::Error discard(const gl::Context *context) override;
+ angle::Result discard(const gl::Context *context) override;
D3DFORMAT getIndexFormat() const;
IDirect3DIndexBuffer9 *getBuffer() const;
diff --git a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
index d54268f..9f9d832 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
@@ -612,58 +612,41 @@
}
}
-gl::Error Renderer9::flush(const gl::Context *context)
+angle::Result Renderer9::flush(const gl::Context *context)
{
IDirect3DQuery9 *query = nullptr;
ANGLE_TRY(allocateEventQuery(context, &query));
+ Context9 *context9 = GetImplAs<Context9>(context);
+
HRESULT result = query->Issue(D3DISSUE_END);
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- return gl::OutOfMemory() << "Failed to issue event query, " << gl::FmtHR(result);
- }
+ ANGLE_TRY_HR(context9, result, "Failed to issue event query");
// Grab the query data once
result = query->GetData(nullptr, 0, D3DGETDATA_FLUSH);
freeEventQuery(query);
- if (FAILED(result))
- {
- if (d3d9::isDeviceLostError(result))
- {
- notifyDeviceLost();
- }
+ ANGLE_TRY_HR(context9, result, "Failed to get event query data");
- return gl::OutOfMemory() << "Failed to get event query data, " << gl::FmtHR(result);
- }
-
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer9::finish(const gl::Context *context)
+angle::Result Renderer9::finish(const gl::Context *context)
{
IDirect3DQuery9 *query = nullptr;
ANGLE_TRY(allocateEventQuery(context, &query));
+ Context9 *context9 = GetImplAs<Context9>(context);
+
HRESULT result = query->Issue(D3DISSUE_END);
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- return gl::OutOfMemory() << "Failed to issue event query, " << gl::FmtHR(result);
- }
+ ANGLE_TRY_HR(context9, result, "Failed to issue event query");
// Grab the query data once
result = query->GetData(nullptr, 0, D3DGETDATA_FLUSH);
if (FAILED(result))
{
- if (d3d9::isDeviceLostError(result))
- {
- notifyDeviceLost();
- }
-
freeEventQuery(query);
- return gl::OutOfMemory() << "Failed to get event query data, " << gl::FmtHR(result);
}
+ ANGLE_TRY_HR(context9, result, "Failed to get event query data");
// Loop until the query completes
unsigned int attempt = 0;
@@ -689,19 +672,14 @@
if (FAILED(result))
{
- if (d3d9::isDeviceLostError(result))
- {
- notifyDeviceLost();
- }
-
freeEventQuery(query);
- return gl::OutOfMemory() << "Failed to get event query data, " << gl::FmtHR(result);
}
+ ANGLE_TRY_HR(context9, result, "Failed to get event query data");
}
freeEventQuery(query);
- return gl::NoError();
+ return angle::Result::Continue();
}
bool Renderer9::isValidNativeWindow(EGLNativeWindowType window) const
@@ -923,17 +901,17 @@
return false;
}
-gl::Error Renderer9::fastCopyBufferToTexture(const gl::Context *context,
- const gl::PixelUnpackState &unpack,
- unsigned int offset,
- RenderTargetD3D *destRenderTarget,
- GLenum destinationFormat,
- GLenum sourcePixelsType,
- const gl::Box &destArea)
+angle::Result Renderer9::fastCopyBufferToTexture(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ unsigned int offset,
+ RenderTargetD3D *destRenderTarget,
+ GLenum destinationFormat,
+ GLenum sourcePixelsType,
+ const gl::Box &destArea)
{
// Pixel buffer objects are not supported in D3D9, since D3D9 is ES2-only and PBOs are ES3.
- UNREACHABLE();
- return gl::InternalError();
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop();
}
angle::Result Renderer9::setSamplerState(const gl::Context *context,
@@ -950,7 +928,7 @@
TextureD3D *textureD3D = GetImplAs<TextureD3D>(texture);
TextureStorage *storage = nullptr;
- ANGLE_TRY_HANDLE(context, textureD3D->getNativeTexture(context, &storage));
+ ANGLE_TRY(textureD3D->getNativeTexture(context, &storage));
// Storage should exist, texture should be complete
ASSERT(storage);
@@ -1013,13 +991,13 @@
TextureD3D *textureImpl = GetImplAs<TextureD3D>(texture);
TextureStorage *texStorage = nullptr;
- ANGLE_TRY_HANDLE(context, textureImpl->getNativeTexture(context, &texStorage));
+ ANGLE_TRY(textureImpl->getNativeTexture(context, &texStorage));
// Texture should be complete and have a storage
ASSERT(texStorage);
TextureStorage9 *storage9 = GetAs<TextureStorage9>(texStorage);
- ANGLE_TRY_HANDLE(context, storage9->getBaseTexture(context, &d3dTexture));
+ ANGLE_TRY(storage9->getBaseTexture(context, &d3dTexture));
// If we get NULL back from getBaseTexture here, something went wrong
// in the texture class and we're unexpectedly missing the d3d texture
@@ -1189,8 +1167,7 @@
}
RenderTargetD3D *nullRenderTarget = nullptr;
- ANGLE_TRY_HANDLE(context, createRenderTarget(context, size.width, size.height, GL_NONE, 0,
- &nullRenderTarget));
+ ANGLE_TRY(createRenderTarget(context, size.width, size.height, GL_NONE, 0, &nullRenderTarget));
// add nullbuffer to the cache
NullRenderTargetCacheEntry *oldest = &mNullRenderTargetCache[0];
@@ -1305,8 +1282,8 @@
TranslatedIndexData * /*indexInfo*/)
{
const gl::State &state = context->getGLState();
- ANGLE_TRY_HANDLE(context, mVertexDataManager->prepareVertexData(
- context, first, count, &mTranslatedAttribCache, instances));
+ ANGLE_TRY(mVertexDataManager->prepareVertexData(context, first, count, &mTranslatedAttribCache,
+ instances));
return mVertexDeclarationCache.applyDeclaration(context, mDevice, mTranslatedAttribCache,
state.getProgram(), first, instances,
@@ -1326,12 +1303,10 @@
const gl::DrawCallParams &drawCallParams = context->getParams<gl::DrawCallParams>();
GLenum dstType = GL_NONE;
- ANGLE_TRY_HANDLE(context,
- GetIndexTranslationDestType(context, drawCallParams, false, &dstType));
+ ANGLE_TRY(GetIndexTranslationDestType(context, drawCallParams, false, &dstType));
- ANGLE_TRY_HANDLE(context,
- mIndexDataManager->prepareIndexData(context, type, dstType, count,
- elementArrayBuffer, indices, indexInfo));
+ ANGLE_TRY(mIndexDataManager->prepareIndexData(context, type, dstType, count, elementArrayBuffer,
+ indices, indexInfo));
// Directly binding the storage buffer is not supported for d3d9
ASSERT(indexInfo->storage == nullptr);
@@ -1446,7 +1421,7 @@
BufferD3D *storage = GetImplAs<BufferD3D>(elementArrayBuffer);
intptr_t offset = reinterpret_cast<intptr_t>(indices);
const uint8_t *bufferData = nullptr;
- ANGLE_TRY_HANDLE(context, storage->getData(context, &bufferData));
+ ANGLE_TRY(storage->getData(context, &bufferData));
indices = bufferData + offset;
}
@@ -1458,8 +1433,8 @@
if (!mLineLoopIB)
{
mLineLoopIB = new StreamingIndexBufferInterface(this);
- ANGLE_TRY_HANDLE(context, mLineLoopIB->reserveBufferSpace(
- context, INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_INT));
+ ANGLE_TRY(mLineLoopIB->reserveBufferSpace(context, INITIAL_INDEX_BUFFER_SIZE,
+ GL_UNSIGNED_INT));
}
// Checked by Renderer9::applyPrimitiveType
@@ -1474,13 +1449,11 @@
const unsigned int spaceNeeded =
(static_cast<unsigned int>(count) + 1) * sizeof(unsigned int);
- ANGLE_TRY_HANDLE(context,
- mLineLoopIB->reserveBufferSpace(context, spaceNeeded, GL_UNSIGNED_INT));
+ ANGLE_TRY(mLineLoopIB->reserveBufferSpace(context, spaceNeeded, GL_UNSIGNED_INT));
void *mappedMemory = nullptr;
unsigned int offset = 0;
- ANGLE_TRY_HANDLE(context,
- mLineLoopIB->mapBuffer(context, spaceNeeded, &mappedMemory, &offset));
+ ANGLE_TRY(mLineLoopIB->mapBuffer(context, spaceNeeded, &mappedMemory, &offset));
startIndex = static_cast<unsigned int>(offset) / 4;
unsigned int *data = static_cast<unsigned int *>(mappedMemory);
@@ -1519,15 +1492,15 @@
UNREACHABLE();
}
- ANGLE_TRY_HANDLE(context, mLineLoopIB->unmapBuffer(context));
+ ANGLE_TRY(mLineLoopIB->unmapBuffer(context));
}
else
{
if (!mLineLoopIB)
{
mLineLoopIB = new StreamingIndexBufferInterface(this);
- ANGLE_TRY_HANDLE(context, mLineLoopIB->reserveBufferSpace(
- context, INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_SHORT));
+ ANGLE_TRY(mLineLoopIB->reserveBufferSpace(context, INITIAL_INDEX_BUFFER_SIZE,
+ GL_UNSIGNED_SHORT));
}
// Checked by Renderer9::applyPrimitiveType
@@ -1542,13 +1515,11 @@
const unsigned int spaceNeeded =
(static_cast<unsigned int>(count) + 1) * sizeof(unsigned short);
- ANGLE_TRY_HANDLE(context,
- mLineLoopIB->reserveBufferSpace(context, spaceNeeded, GL_UNSIGNED_SHORT));
+ ANGLE_TRY(mLineLoopIB->reserveBufferSpace(context, spaceNeeded, GL_UNSIGNED_SHORT));
void *mappedMemory = nullptr;
unsigned int offset;
- ANGLE_TRY_HANDLE(context,
- mLineLoopIB->mapBuffer(context, spaceNeeded, &mappedMemory, &offset));
+ ANGLE_TRY(mLineLoopIB->mapBuffer(context, spaceNeeded, &mappedMemory, &offset));
startIndex = static_cast<unsigned int>(offset) / 2;
unsigned short *data = static_cast<unsigned short *>(mappedMemory);
@@ -1587,7 +1558,7 @@
UNREACHABLE();
}
- ANGLE_TRY_HANDLE(context, mLineLoopIB->unmapBuffer(context));
+ ANGLE_TRY(mLineLoopIB->unmapBuffer(context));
}
if (mAppliedIBSerial != mLineLoopIB->getSerial())
@@ -1619,7 +1590,7 @@
intptr_t offset = reinterpret_cast<intptr_t>(indices);
const uint8_t *bufferData = nullptr;
- ANGLE_TRY_HANDLE(context, storage->getData(context, &bufferData));
+ ANGLE_TRY(storage->getData(context, &bufferData));
indices = bufferData + offset;
}
@@ -1654,12 +1625,10 @@
{
SafeDelete(mCountingIB);
mCountingIB = new StaticIndexBufferInterface(this);
- ANGLE_TRY_HANDLE(
- context, mCountingIB->reserveBufferSpace(context, spaceNeeded, GL_UNSIGNED_SHORT));
+ ANGLE_TRY(mCountingIB->reserveBufferSpace(context, spaceNeeded, GL_UNSIGNED_SHORT));
void *mappedMemory = nullptr;
- ANGLE_TRY_HANDLE(context,
- mCountingIB->mapBuffer(context, spaceNeeded, &mappedMemory, nullptr));
+ ANGLE_TRY(mCountingIB->mapBuffer(context, spaceNeeded, &mappedMemory, nullptr));
unsigned short *data = static_cast<unsigned short *>(mappedMemory);
for (size_t i = 0; i < count; i++)
@@ -1667,7 +1636,7 @@
data[i] = static_cast<unsigned short>(i);
}
- ANGLE_TRY_HANDLE(context, mCountingIB->unmapBuffer(context));
+ ANGLE_TRY(mCountingIB->unmapBuffer(context));
}
}
else if (getNativeExtensions().elementIndexUint)
@@ -1678,12 +1647,10 @@
{
SafeDelete(mCountingIB);
mCountingIB = new StaticIndexBufferInterface(this);
- ANGLE_TRY_HANDLE(
- context, mCountingIB->reserveBufferSpace(context, spaceNeeded, GL_UNSIGNED_INT));
+ ANGLE_TRY(mCountingIB->reserveBufferSpace(context, spaceNeeded, GL_UNSIGNED_INT));
void *mappedMemory = nullptr;
- ANGLE_TRY_HANDLE(context,
- mCountingIB->mapBuffer(context, spaceNeeded, &mappedMemory, nullptr));
+ ANGLE_TRY(mCountingIB->mapBuffer(context, spaceNeeded, &mappedMemory, nullptr));
unsigned int *data = static_cast<unsigned int *>(mappedMemory);
for (unsigned int i = 0; i < count; i++)
@@ -1691,7 +1658,7 @@
data[i] = i;
}
- ANGLE_TRY_HANDLE(context, mCountingIB->unmapBuffer(context));
+ ANGLE_TRY(mCountingIB->unmapBuffer(context));
}
}
else
@@ -1708,22 +1675,20 @@
{
const gl::State &state = context->getContextState().getState();
// This method is called single-threaded.
- ANGLE_TRY_HANDLE(context, ensureHLSLCompilerInitialized(context));
+ ANGLE_TRY(ensureHLSLCompilerInitialized(context));
ProgramD3D *programD3D = GetImplAs<ProgramD3D>(state.getProgram());
VertexArray9 *vao = GetImplAs<VertexArray9>(state.getVertexArray());
programD3D->updateCachedInputLayout(vao->getCurrentStateSerial(), state);
ShaderExecutableD3D *vertexExe = nullptr;
- ANGLE_TRY_HANDLE(
- context, programD3D->getVertexExecutableForCachedInputLayout(context, &vertexExe, nullptr));
+ ANGLE_TRY(programD3D->getVertexExecutableForCachedInputLayout(context, &vertexExe, nullptr));
const gl::Framebuffer *drawFramebuffer = state.getDrawFramebuffer();
programD3D->updateCachedOutputLayout(context, drawFramebuffer);
ShaderExecutableD3D *pixelExe = nullptr;
- ANGLE_TRY_HANDLE(
- context, programD3D->getPixelExecutableForCachedOutputLayout(context, &pixelExe, nullptr));
+ ANGLE_TRY(programD3D->getPixelExecutableForCachedOutputLayout(context, &pixelExe, nullptr));
IDirect3DVertexShader9 *vertexShader =
(vertexExe ? GetAs<ShaderExecutable9>(vertexExe)->getVertexShader() : nullptr);
@@ -2398,13 +2363,13 @@
return D3DPOOL_DEFAULT;
}
-gl::Error Renderer9::copyImage2D(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level)
+angle::Result Renderer9::copyImage2D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level)
{
RECT rect;
rect.left = sourceRect.x;
@@ -2415,14 +2380,14 @@
return mBlit->copy2D(context, framebuffer, rect, destFormat, destOffset, storage, level);
}
-gl::Error Renderer9::copyImageCube(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- gl::TextureTarget target,
- GLint level)
+angle::Result Renderer9::copyImageCube(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget target,
+ GLint level)
{
RECT rect;
rect.left = sourceRect.x;
@@ -2434,45 +2399,45 @@
level);
}
-gl::Error Renderer9::copyImage3D(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level)
+angle::Result Renderer9::copyImage3D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level)
{
// 3D textures are not available in the D3D9 backend.
- UNREACHABLE();
- return gl::InternalError();
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop();
}
-gl::Error Renderer9::copyImage2DArray(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level)
+angle::Result Renderer9::copyImage2DArray(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level)
{
// 2D array textures are not available in the D3D9 backend.
- UNREACHABLE();
- return gl::InternalError();
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop();
}
-gl::Error Renderer9::copyTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- GLenum destType,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- gl::TextureTarget destTarget,
- GLint destLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha)
+angle::Result Renderer9::copyTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ GLenum destType,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget destTarget,
+ GLint destLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha)
{
RECT rect;
rect.left = sourceRect.x;
@@ -2485,22 +2450,22 @@
unpackUnmultiplyAlpha);
}
-gl::Error Renderer9::copyCompressedTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- TextureStorage *storage,
- GLint destLevel)
+angle::Result Renderer9::copyCompressedTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ TextureStorage *storage,
+ GLint destLevel)
{
- UNIMPLEMENTED();
- return gl::InternalError();
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop();
}
-gl::Error Renderer9::createRenderTarget(const gl::Context *context,
- int width,
- int height,
- GLenum format,
- GLsizei samples,
- RenderTargetD3D **outRT)
+angle::Result Renderer9::createRenderTarget(const gl::Context *context,
+ int width,
+ int height,
+ GLenum format,
+ GLsizei samples,
+ RenderTargetD3D **outRT)
{
const d3d9::TextureFormat &d3d9FormatInfo = d3d9::GetTextureFormatInfo(format);
@@ -2542,11 +2507,7 @@
}
}
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- return gl::OutOfMemory() << "Failed to create render target, " << gl::FmtHR(result);
- }
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to create render target");
if (requiresInitialization)
{
@@ -2563,12 +2524,12 @@
*outRT = new TextureRenderTarget9(texture, 0, renderTarget, format, width, height, 1,
supportedSamples);
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer9::createRenderTargetCopy(const gl::Context *context,
- RenderTargetD3D *source,
- RenderTargetD3D **outRT)
+angle::Result Renderer9::createRenderTargetCopy(const gl::Context *context,
+ RenderTargetD3D *source,
+ RenderTargetD3D **outRT)
{
ASSERT(source != nullptr);
@@ -2581,23 +2542,19 @@
HRESULT result = mDevice->StretchRect(source9->getSurface(), nullptr, dest9->getSurface(),
nullptr, D3DTEXF_NONE);
- if (FAILED(result))
- {
- ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
- return gl::OutOfMemory() << "Failed to copy render target, " << gl::FmtHR(result);
- }
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to copy render target");
*outRT = newRT;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer9::loadExecutable(const gl::Context *context,
- const uint8_t *function,
- size_t length,
- gl::ShaderType type,
- const std::vector<D3DVarying> &streamOutVaryings,
- bool separatedOutputBuffers,
- ShaderExecutableD3D **outExecutable)
+angle::Result Renderer9::loadExecutable(const gl::Context *context,
+ const uint8_t *function,
+ size_t length,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ ShaderExecutableD3D **outExecutable)
{
// Transform feedback is not supported in ES2 or D3D9
ASSERT(streamOutVaryings.empty());
@@ -2621,21 +2578,20 @@
}
break;
default:
- UNREACHABLE();
- return gl::InternalError();
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
}
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer9::compileToExecutable(const gl::Context *context,
- gl::InfoLog &infoLog,
- const std::string &shaderHLSL,
- gl::ShaderType type,
- const std::vector<D3DVarying> &streamOutVaryings,
- bool separatedOutputBuffers,
- const angle::CompilerWorkaroundsD3D &workarounds,
- ShaderExecutableD3D **outExectuable)
+angle::Result Renderer9::compileToExecutable(const gl::Context *context,
+ gl::InfoLog &infoLog,
+ const std::string &shaderHLSL,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ const angle::CompilerWorkaroundsD3D &workarounds,
+ ShaderExecutableD3D **outExectuable)
{
// Transform feedback is not supported in ES2 or D3D9
ASSERT(streamOutVaryings.empty());
@@ -2651,8 +2607,7 @@
profileStream << "ps";
break;
default:
- UNREACHABLE();
- return gl::InternalError();
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
}
profileStream << "_" << ((getMajorShaderModel() >= 3) ? 3 : 2);
@@ -2691,12 +2646,9 @@
ID3DBlob *binary = nullptr;
std::string debugInfo;
- gl::Error error = mCompiler.compileToBinary(context, infoLog, shaderHLSL, profile, configs,
- nullptr, &binary, &debugInfo);
- if (error.isError())
- {
- return error;
- }
+ angle::Result error = mCompiler.compileToBinary(context, infoLog, shaderHLSL, profile, configs,
+ nullptr, &binary, &debugInfo);
+ ANGLE_TRY(error);
// It's possible that binary is NULL if the compiler failed in all configurations. Set the
// executable to NULL and return GL_NO_ERROR to signify that there was a link error but the
@@ -2704,7 +2656,7 @@
if (!binary)
{
*outExectuable = nullptr;
- return gl::NoError();
+ return angle::Result::Continue();
}
error = loadExecutable(context, reinterpret_cast<const uint8_t *>(binary->GetBufferPointer()),
@@ -2712,20 +2664,17 @@
outExectuable);
SafeRelease(binary);
- if (error.isError())
- {
- return error;
- }
+ ANGLE_TRY(error);
if (!debugInfo.empty())
{
(*outExectuable)->appendDebugInfo(debugInfo);
}
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error Renderer9::ensureHLSLCompilerInitialized(const gl::Context *context)
+angle::Result Renderer9::ensureHLSLCompilerInitialized(const gl::Context *context)
{
return mCompiler.ensureInitialized(context);
}
@@ -2806,29 +2755,29 @@
return new Image9(this);
}
-gl::Error Renderer9::generateMipmap(const gl::Context *context, ImageD3D *dest, ImageD3D *src)
+angle::Result Renderer9::generateMipmap(const gl::Context *context, ImageD3D *dest, ImageD3D *src)
{
Image9 *src9 = GetAs<Image9>(src);
Image9 *dst9 = GetAs<Image9>(dest);
return Image9::GenerateMipmap(GetImplAs<Context9>(context), dst9, src9);
}
-gl::Error Renderer9::generateMipmapUsingD3D(const gl::Context *context,
- TextureStorage *storage,
- const gl::TextureState &textureState)
+angle::Result Renderer9::generateMipmapUsingD3D(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::TextureState &textureState)
{
- UNREACHABLE();
- return gl::NoError();
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop();
}
-gl::Error Renderer9::copyImage(const gl::Context *context,
- ImageD3D *dest,
- ImageD3D *source,
- const gl::Rectangle &sourceRect,
- const gl::Offset &destOffset,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha)
+angle::Result Renderer9::copyImage(const gl::Context *context,
+ ImageD3D *dest,
+ ImageD3D *source,
+ const gl::Rectangle &sourceRect,
+ const gl::Offset &destOffset,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha)
{
Image9 *dest9 = GetAs<Image9>(dest);
Image9 *src9 = GetAs<Image9>(source);
@@ -2939,17 +2888,17 @@
return d3d9::GetVertexFormatInfo(getCapsDeclTypes(), vertexFormatType).componentType;
}
-gl::Error Renderer9::getVertexSpaceRequired(const gl::Context *context,
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- size_t count,
- GLsizei instances,
- unsigned int *bytesRequiredOut) const
+angle::Result Renderer9::getVertexSpaceRequired(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances,
+ unsigned int *bytesRequiredOut) const
{
if (!attrib.enabled)
{
*bytesRequiredOut = 16u;
- return gl::NoError();
+ return angle::Result::Continue();
}
gl::VertexFormatType vertexFormatType = gl::GetVertexFormatType(attrib, GL_FLOAT);
@@ -2968,13 +2917,13 @@
elementCount = UnsignedCeilDivide(static_cast<unsigned int>(instances), divisor);
}
- if (d3d9VertexInfo.outputElementSize > std::numeric_limits<unsigned int>::max() / elementCount)
- {
- return gl::OutOfMemory() << "New vertex buffer size would result in an overflow.";
- }
+ bool check = (d3d9VertexInfo.outputElementSize >
+ std::numeric_limits<unsigned int>::max() / elementCount);
+ ANGLE_CHECK_HR(GetImplAs<Context9>(context), !check,
+ "New vertex buffer size would result in an overflow.", E_OUTOFMEMORY);
*bytesRequiredOut = static_cast<unsigned int>(d3d9VertexInfo.outputElementSize) * elementCount;
- return gl::NoError();
+ return angle::Result::Continue();
}
void Renderer9::generateCaps(gl::Caps *outCaps,
@@ -3074,11 +3023,11 @@
return gl::Version(2, 0);
}
-gl::Error Renderer9::clearRenderTarget(const gl::Context *context,
- RenderTargetD3D *renderTarget,
- const gl::ColorF &clearColorValue,
- const float clearDepthValue,
- const unsigned int clearStencilValue)
+angle::Result Renderer9::clearRenderTarget(const gl::Context *context,
+ RenderTargetD3D *renderTarget,
+ const gl::ColorF &clearColorValue,
+ const float clearDepthValue,
+ const unsigned int clearStencilValue)
{
D3DCOLOR color =
D3DCOLOR_ARGB(gl::unorm<8>(clearColorValue.alpha), gl::unorm<8>(clearColorValue.red),
@@ -3126,7 +3075,7 @@
markAllStateDirty();
- return gl::NoError();
+ return angle::Result::Continue();
}
bool Renderer9::canSelectViewInVertexShader() const
@@ -3175,8 +3124,7 @@
// Texture is not sampler complete or it is in use by the framebuffer. Bind the
// incomplete texture.
gl::Texture *incompleteTexture = nullptr;
- ANGLE_TRY_HANDLE(context,
- getIncompleteTexture(context, textureType, &incompleteTexture));
+ ANGLE_TRY(getIncompleteTexture(context, textureType, &incompleteTexture));
ANGLE_TRY(setSamplerState(context, shaderType, samplerIndex, incompleteTexture,
incompleteTexture->getSamplerState()));
ANGLE_TRY(setTexture(context, shaderType, samplerIndex, incompleteTexture));
@@ -3204,9 +3152,9 @@
return angle::Result::Continue();
}
-gl::Error Renderer9::getIncompleteTexture(const gl::Context *context,
- gl::TextureType type,
- gl::Texture **textureOut)
+angle::Result Renderer9::getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut)
{
return GetImplAs<Context9>(context)->getIncompleteTexture(context, type, textureOut);
}
@@ -3216,7 +3164,7 @@
if (!mVertexDataManager)
{
mVertexDataManager = new VertexDataManager(this);
- ANGLE_TRY_HANDLE(context, mVertexDataManager->initialize(context));
+ ANGLE_TRY(mVertexDataManager->initialize(context));
}
return angle::Result::Continue();
diff --git a/src/libANGLE/renderer/d3d/d3d9/Renderer9.h b/src/libANGLE/renderer/d3d/d3d9/Renderer9.h
index b664d97..f311302 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Renderer9.h
+++ b/src/libANGLE/renderer/d3d/d3d9/Renderer9.h
@@ -79,8 +79,8 @@
void startScene();
void endScene();
- gl::Error flush(const gl::Context *context);
- gl::Error finish(const gl::Context *context);
+ angle::Result flush(const gl::Context *context);
+ angle::Result finish(const gl::Context *context);
bool isValidNativeWindow(EGLNativeWindowType window) const override;
NativeWindowD3D *createNativeWindow(EGLNativeWindowType window,
@@ -191,100 +191,102 @@
DWORD getCapsDeclTypes() const;
// Pixel operations
- gl::Error copyImage2D(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level) override;
- gl::Error copyImageCube(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- gl::TextureTarget target,
- GLint level) override;
- gl::Error copyImage3D(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level) override;
- gl::Error copyImage2DArray(const gl::Context *context,
- const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level) override;
+ angle::Result copyImage2D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) override;
+ angle::Result copyImageCube(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget target,
+ GLint level) override;
+ angle::Result copyImage3D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) override;
+ angle::Result copyImage2DArray(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) override;
- gl::Error copyTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- GLenum destType,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- gl::TextureTarget destTarget,
- GLint destLevel,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha) override;
- gl::Error copyCompressedTexture(const gl::Context *context,
- const gl::Texture *source,
- GLint sourceLevel,
- TextureStorage *storage,
- GLint destLevel) override;
+ angle::Result copyTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ GLenum destType,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget destTarget,
+ GLint destLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha) override;
+ angle::Result copyCompressedTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ TextureStorage *storage,
+ GLint destLevel) override;
// RenderTarget creation
- gl::Error createRenderTarget(const gl::Context *context,
- int width,
- int height,
- GLenum format,
- GLsizei samples,
- RenderTargetD3D **outRT) override;
- gl::Error createRenderTargetCopy(const gl::Context *context,
- RenderTargetD3D *source,
+ angle::Result createRenderTarget(const gl::Context *context,
+ int width,
+ int height,
+ GLenum format,
+ GLsizei samples,
RenderTargetD3D **outRT) override;
+ angle::Result createRenderTargetCopy(const gl::Context *context,
+ RenderTargetD3D *source,
+ RenderTargetD3D **outRT) override;
// Shader operations
- gl::Error loadExecutable(const gl::Context *context,
- const uint8_t *function,
- size_t length,
- gl::ShaderType type,
- const std::vector<D3DVarying> &streamOutVaryings,
- bool separatedOutputBuffers,
- ShaderExecutableD3D **outExecutable) override;
- gl::Error compileToExecutable(const gl::Context *context,
- gl::InfoLog &infoLog,
- const std::string &shaderHLSL,
- gl::ShaderType type,
- const std::vector<D3DVarying> &streamOutVaryings,
- bool separatedOutputBuffers,
- const angle::CompilerWorkaroundsD3D &workarounds,
- ShaderExecutableD3D **outExectuable) override;
- gl::Error ensureHLSLCompilerInitialized(const gl::Context *context) override;
+ angle::Result loadExecutable(const gl::Context *context,
+ const uint8_t *function,
+ size_t length,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ ShaderExecutableD3D **outExecutable) override;
+ angle::Result compileToExecutable(const gl::Context *context,
+ gl::InfoLog &infoLog,
+ const std::string &shaderHLSL,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ const angle::CompilerWorkaroundsD3D &workarounds,
+ ShaderExecutableD3D **outExectuable) override;
+ angle::Result ensureHLSLCompilerInitialized(const gl::Context *context) override;
UniformStorageD3D *createUniformStorage(size_t storageSize) override;
// Image operations
ImageD3D *createImage() override;
- gl::Error generateMipmap(const gl::Context *context, ImageD3D *dest, ImageD3D *source) override;
- gl::Error generateMipmapUsingD3D(const gl::Context *context,
- TextureStorage *storage,
- const gl::TextureState &textureState) override;
- gl::Error copyImage(const gl::Context *context,
- ImageD3D *dest,
- ImageD3D *source,
- const gl::Rectangle &sourceRect,
- const gl::Offset &destOffset,
- bool unpackFlipY,
- bool unpackPremultiplyAlpha,
- bool unpackUnmultiplyAlpha) override;
+ angle::Result generateMipmap(const gl::Context *context,
+ ImageD3D *dest,
+ ImageD3D *source) override;
+ angle::Result generateMipmapUsingD3D(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::TextureState &textureState) override;
+ angle::Result copyImage(const gl::Context *context,
+ ImageD3D *dest,
+ ImageD3D *source,
+ const gl::Rectangle &sourceRect,
+ const gl::Offset &destOffset,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha) override;
TextureStorage *createTextureStorage2D(SwapChainD3D *swapChain) override;
TextureStorage *createTextureStorageEGLImage(EGLImageD3D *eglImage,
RenderTargetD3D *renderTargetD3D) override;
@@ -332,13 +334,13 @@
// Buffer-to-texture and Texture-to-buffer copies
bool supportsFastCopyBufferToTexture(GLenum internalFormat) const override;
- gl::Error fastCopyBufferToTexture(const gl::Context *context,
- const gl::PixelUnpackState &unpack,
- unsigned int offset,
- RenderTargetD3D *destRenderTarget,
- GLenum destinationFormat,
- GLenum sourcePixelsType,
- const gl::Box &destArea) override;
+ angle::Result fastCopyBufferToTexture(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ unsigned int offset,
+ RenderTargetD3D *destRenderTarget,
+ GLenum destinationFormat,
+ GLenum sourcePixelsType,
+ const gl::Box &destArea) override;
// D3D9-renderer specific methods
angle::Result boxFilter(Context9 *context9, IDirect3DSurface9 *source, IDirect3DSurface9 *dest);
@@ -352,12 +354,12 @@
// Warning: you should ensure binding really matches attrib.bindingIndex before using this
// function.
- gl::Error getVertexSpaceRequired(const gl::Context *context,
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- size_t count,
- GLsizei instances,
- unsigned int *bytesRequiredOut) const override;
+ angle::Result getVertexSpaceRequired(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances,
+ unsigned int *bytesRequiredOut) const override;
angle::Result copyToRenderTarget(const gl::Context *context,
IDirect3DSurface9 *dest,
@@ -392,17 +394,17 @@
gl::Version getMaxSupportedESVersion() const override;
- gl::Error clearRenderTarget(const gl::Context *context,
- RenderTargetD3D *renderTarget,
- const gl::ColorF &clearColorValue,
- const float clearDepthValue,
- const unsigned int clearStencilValue) override;
+ angle::Result clearRenderTarget(const gl::Context *context,
+ RenderTargetD3D *renderTarget,
+ const gl::ColorF &clearColorValue,
+ const float clearDepthValue,
+ const unsigned int clearStencilValue) override;
bool canSelectViewInVertexShader() const override;
- gl::Error getIncompleteTexture(const gl::Context *context,
- gl::TextureType type,
- gl::Texture **textureOut) override;
+ angle::Result getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut) override;
angle::Result ensureVertexDataManagerInitialized(const gl::Context *context);
diff --git a/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp b/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp
index e804868..cdf61c9 100644
--- a/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp
@@ -95,16 +95,16 @@
return static_cast<int>(mMipLevels) - mTopLevel;
}
-gl::Error TextureStorage9::setData(const gl::Context *context,
- const gl::ImageIndex &index,
- ImageD3D *image,
- const gl::Box *destBox,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixelData)
+angle::Result TextureStorage9::setData(const gl::Context *context,
+ const gl::ImageIndex &index,
+ ImageD3D *image,
+ const gl::Box *destBox,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixelData)
{
- UNREACHABLE();
- return gl::InternalError();
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop();
}
TextureStorage9_2D::TextureStorage9_2D(Renderer9 *renderer, SwapChain9 *swapchain)
@@ -179,9 +179,9 @@
return angle::Result::Continue();
}
-gl::Error TextureStorage9_2D::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
+angle::Result TextureStorage9_2D::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
{
ASSERT(index.getLevelIndex() < getLevelCount());
@@ -206,12 +206,12 @@
ASSERT(outRT);
*outRT = mRenderTargets[index.getLevelIndex()];
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureStorage9_2D::generateMipmap(const gl::Context *context,
- const gl::ImageIndex &sourceIndex,
- const gl::ImageIndex &destIndex)
+angle::Result TextureStorage9_2D::generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &sourceIndex,
+ const gl::ImageIndex &destIndex)
{
angle::ComPtr<IDirect3DSurface9> upper = nullptr;
ANGLE_TRY(getSurfaceLevel(context, gl::TextureTarget::_2D, sourceIndex.getLevelIndex(), false,
@@ -246,7 +246,8 @@
return angle::Result::Continue();
}
-gl::Error TextureStorage9_2D::copyToStorage(const gl::Context *context, TextureStorage *destStorage)
+angle::Result TextureStorage9_2D::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
{
ASSERT(destStorage);
@@ -265,7 +266,7 @@
mRenderer->copyToRenderTarget(context, dstSurf.Get(), srcSurf.Get(), isManaged()));
}
- return gl::NoError();
+ return angle::Result::Continue();
}
TextureStorage9_EGLImage::TextureStorage9_EGLImage(Renderer9 *renderer,
@@ -295,7 +296,7 @@
ASSERT(level == 0);
RenderTargetD3D *renderTargetD3D = nullptr;
- ANGLE_TRY_HANDLE(context, mImage->getRenderTarget(context, &renderTargetD3D));
+ ANGLE_TRY(mImage->getRenderTarget(context, &renderTargetD3D));
RenderTarget9 *renderTarget9 = GetAs<RenderTarget9>(renderTargetD3D);
@@ -303,9 +304,9 @@
return angle::Result::Continue();
}
-gl::Error TextureStorage9_EGLImage::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
+angle::Result TextureStorage9_EGLImage::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
{
ASSERT(!index.hasLayer());
ASSERT(index.getLevelIndex() == 0);
@@ -317,7 +318,7 @@
IDirect3DBaseTexture9 **outTexture)
{
RenderTargetD3D *renderTargetD3D = nullptr;
- ANGLE_TRY_HANDLE(context, mImage->getRenderTarget(context, &renderTargetD3D));
+ ANGLE_TRY(mImage->getRenderTarget(context, &renderTargetD3D));
RenderTarget9 *renderTarget9 = GetAs<RenderTarget9>(renderTargetD3D);
*outTexture = renderTarget9->getTexture();
@@ -326,16 +327,16 @@
return angle::Result::Continue();
}
-gl::Error TextureStorage9_EGLImage::generateMipmap(const gl::Context *context,
- const gl::ImageIndex &,
- const gl::ImageIndex &)
+angle::Result TextureStorage9_EGLImage::generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &,
+ const gl::ImageIndex &)
{
- UNREACHABLE();
- return gl::InternalError();
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop();
}
-gl::Error TextureStorage9_EGLImage::copyToStorage(const gl::Context *context,
- TextureStorage *destStorage)
+angle::Result TextureStorage9_EGLImage::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
{
ASSERT(destStorage);
ASSERT(getLevelCount() == 1);
@@ -349,11 +350,7 @@
angle::ComPtr<IDirect3DSurface9> destSurface = nullptr;
HRESULT result = destTexture9->GetSurfaceLevel(destStorage->getTopLevel(), &destSurface);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to get the surface from a texture, "
- << gl::FmtHR(result);
- }
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to get the surface from a texture");
RenderTargetD3D *sourceRenderTarget = nullptr;
ANGLE_TRY(mImage->getRenderTarget(context, &sourceRenderTarget));
@@ -367,7 +364,7 @@
destTexture9->AddDirtyRect(nullptr);
}
- return gl::NoError();
+ return angle::Result::Continue();
}
TextureStorage9_Cube::TextureStorage9_Cube(Renderer9 *renderer, GLenum internalformat, bool renderTarget, int size, int levels, bool hintLevelZeroOnly)
@@ -427,9 +424,9 @@
return angle::Result::Continue();
}
-gl::Error TextureStorage9_Cube::getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT)
+angle::Result TextureStorage9_Cube::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
{
ASSERT(outRT);
ASSERT(index.getLevelIndex() == 0);
@@ -454,12 +451,12 @@
}
*outRT = mRenderTarget[renderTargetIndex];
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error TextureStorage9_Cube::generateMipmap(const gl::Context *context,
- const gl::ImageIndex &sourceIndex,
- const gl::ImageIndex &destIndex)
+angle::Result TextureStorage9_Cube::generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &sourceIndex,
+ const gl::ImageIndex &destIndex)
{
angle::ComPtr<IDirect3DSurface9> upper = nullptr;
ANGLE_TRY(getSurfaceLevel(context, sourceIndex.getTarget(), sourceIndex.getLevelIndex(), false,
@@ -494,8 +491,8 @@
return angle::Result::Continue();
}
-gl::Error TextureStorage9_Cube::copyToStorage(const gl::Context *context,
- TextureStorage *destStorage)
+angle::Result TextureStorage9_Cube::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
{
ASSERT(destStorage);
@@ -517,6 +514,6 @@
}
}
- return gl::NoError();
+ return angle::Result::Continue();
}
} // namespace rx
diff --git a/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h b/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h
index 36b9724..25b5cb8 100644
--- a/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h
+++ b/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h
@@ -46,13 +46,13 @@
bool supportsNativeMipmapFunction() const override;
int getLevelCount() const override;
- gl::Error setData(const gl::Context *context,
- const gl::ImageIndex &index,
- ImageD3D *image,
- const gl::Box *destBox,
- GLenum type,
- const gl::PixelUnpackState &unpack,
- const uint8_t *pixelData) override;
+ angle::Result setData(const gl::Context *context,
+ const gl::ImageIndex &index,
+ ImageD3D *image,
+ const gl::Box *destBox,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixelData) override;
protected:
int mTopLevel;
@@ -83,15 +83,15 @@
int level,
bool dirty,
IDirect3DSurface9 **outSurface) override;
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
angle::Result getBaseTexture(const gl::Context *context,
IDirect3DBaseTexture9 **outTexture) override;
- gl::Error generateMipmap(const gl::Context *context,
- const gl::ImageIndex &sourceIndex,
- const gl::ImageIndex &destIndex) override;
- gl::Error copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+ angle::Result generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &sourceIndex,
+ const gl::ImageIndex &destIndex) override;
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
private:
IDirect3DTexture9 *mTexture;
@@ -109,15 +109,15 @@
int level,
bool dirty,
IDirect3DSurface9 **outSurface) override;
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
angle::Result getBaseTexture(const gl::Context *context,
IDirect3DBaseTexture9 **outTexture) override;
- gl::Error generateMipmap(const gl::Context *context,
- const gl::ImageIndex &sourceIndex,
- const gl::ImageIndex &destIndex) override;
- gl::Error copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+ angle::Result generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &sourceIndex,
+ const gl::ImageIndex &destIndex) override;
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
private:
EGLImageD3D *mImage;
@@ -134,15 +134,15 @@
int level,
bool dirty,
IDirect3DSurface9 **outSurface) override;
- gl::Error getRenderTarget(const gl::Context *context,
- const gl::ImageIndex &index,
- RenderTargetD3D **outRT) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
angle::Result getBaseTexture(const gl::Context *context,
IDirect3DBaseTexture9 **outTexture) override;
- gl::Error generateMipmap(const gl::Context *context,
- const gl::ImageIndex &sourceIndex,
- const gl::ImageIndex &destIndex) override;
- gl::Error copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+ angle::Result generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &sourceIndex,
+ const gl::ImageIndex &destIndex) override;
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
private:
IDirect3DCubeTexture9 *mTexture;
diff --git a/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp b/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp
index 9f72cd5..491645a 100644
--- a/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp
@@ -7,12 +7,14 @@
// VertexBuffer9.cpp: Defines the D3D9 VertexBuffer implementation.
#include "libANGLE/renderer/d3d/d3d9/VertexBuffer9.h"
+
+#include "libANGLE/Buffer.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/VertexAttribute.h"
+#include "libANGLE/renderer/d3d/BufferD3D.h"
#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
#include "libANGLE/renderer/d3d/d3d9/vertexconversion.h"
-#include "libANGLE/renderer/d3d/BufferD3D.h"
-#include "libANGLE/VertexAttribute.h"
-#include "libANGLE/Buffer.h"
namespace rx
{
@@ -29,9 +31,9 @@
SafeRelease(mVertexBuffer);
}
-gl::Error VertexBuffer9::initialize(const gl::Context *context,
- unsigned int size,
- bool dynamicUsage)
+angle::Result VertexBuffer9::initialize(const gl::Context *context,
+ unsigned int size,
+ bool dynamicUsage)
{
SafeRelease(mVertexBuffer);
@@ -46,33 +48,26 @@
}
HRESULT result = mRenderer->createVertexBuffer(size, flags, &mVertexBuffer);
-
- if (FAILED(result))
- {
- return gl::OutOfMemory()
- << "Failed to allocate internal vertex buffer of size " << size;
- }
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result,
+ "Failed to allocate internal vertex buffer");
}
mBufferSize = size;
mDynamicUsage = dynamicUsage;
- return gl::NoError();
+ return angle::Result::Continue();
}
-gl::Error VertexBuffer9::storeVertexAttributes(const gl::Context *context,
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLenum currentValueType,
- GLint start,
- size_t count,
- GLsizei instances,
- unsigned int offset,
- const uint8_t *sourceData)
+angle::Result VertexBuffer9::storeVertexAttributes(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ GLenum currentValueType,
+ GLint start,
+ size_t count,
+ GLsizei instances,
+ unsigned int offset,
+ const uint8_t *sourceData)
{
- if (!mVertexBuffer)
- {
- return gl::OutOfMemory() << "Internal vertex buffer is not initialized.";
- }
+ ASSERT(mVertexBuffer);
size_t inputStride = gl::ComputeVertexAttributeStride(attrib, binding);
size_t elementSize = gl::ComputeVertexAttributeTypeSize(attrib);
@@ -86,10 +81,7 @@
mRenderer->getVertexSpaceRequired(context, attrib, binding, count, instances, &mapSize));
HRESULT result = mVertexBuffer->Lock(offset, mapSize, reinterpret_cast<void**>(&mapPtr), lockFlags);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to lock internal vertex buffer, " << gl::FmtHR(result);
- }
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to lock internal vertex buffer");
const uint8_t *input = sourceData;
@@ -114,7 +106,7 @@
mVertexBuffer->Unlock();
- return gl::NoError();
+ return angle::Result::Continue();
}
unsigned int VertexBuffer9::getBufferSize() const
@@ -122,7 +114,7 @@
return mBufferSize;
}
-gl::Error VertexBuffer9::setBufferSize(const gl::Context *context, unsigned int size)
+angle::Result VertexBuffer9::setBufferSize(const gl::Context *context, unsigned int size)
{
if (size > mBufferSize)
{
@@ -130,35 +122,26 @@
}
else
{
- return gl::NoError();
+ return angle::Result::Continue();
}
}
-gl::Error VertexBuffer9::discard(const gl::Context *context)
+angle::Result VertexBuffer9::discard(const gl::Context *context)
{
- if (!mVertexBuffer)
- {
- return gl::OutOfMemory() << "Internal vertex buffer is not initialized.";
- }
+ ASSERT(mVertexBuffer);
void *dummy;
HRESULT result;
+ Context9 *context9 = GetImplAs<Context9>(context);
+
result = mVertexBuffer->Lock(0, 1, &dummy, D3DLOCK_DISCARD);
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to lock internal buffer for discarding, "
- << gl::FmtHR(result);
- }
+ ANGLE_TRY_HR(context9, result, "Failed to lock internal vertex buffer for discarding");
result = mVertexBuffer->Unlock();
- if (FAILED(result))
- {
- return gl::OutOfMemory() << "Failed to unlock internal buffer for discarding, "
- << gl::FmtHR(result);
- }
+ ANGLE_TRY_HR(context9, result, "Failed to unlock internal vertex buffer for discarding");
- return gl::NoError();
+ return angle::Result::Continue();
}
IDirect3DVertexBuffer9 * VertexBuffer9::getBuffer() const
diff --git a/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h b/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h
index f6813a1..4f6eb3c 100644
--- a/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h
+++ b/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h
@@ -20,23 +20,25 @@
public:
explicit VertexBuffer9(Renderer9 *renderer);
- gl::Error initialize(const gl::Context *context, unsigned int size, bool dynamicUsage) override;
+ angle::Result initialize(const gl::Context *context,
+ unsigned int size,
+ bool dynamicUsage) override;
// Warning: you should ensure binding really matches attrib.bindingIndex before using this
// function.
- gl::Error storeVertexAttributes(const gl::Context *context,
- const gl::VertexAttribute &attrib,
- const gl::VertexBinding &binding,
- GLenum currentValueType,
- GLint start,
- size_t count,
- GLsizei instances,
- unsigned int offset,
- const uint8_t *sourceData) override;
+ angle::Result storeVertexAttributes(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ GLenum currentValueType,
+ GLint start,
+ size_t count,
+ GLsizei instances,
+ unsigned int offset,
+ const uint8_t *sourceData) override;
unsigned int getBufferSize() const override;
- gl::Error setBufferSize(const gl::Context *context, unsigned int size) override;
- gl::Error discard(const gl::Context *context) override;
+ angle::Result setBufferSize(const gl::Context *context, unsigned int size) override;
+ angle::Result discard(const gl::Context *context) override;
IDirect3DVertexBuffer9 *getBuffer() const;
diff --git a/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp b/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp
index 63829b5..9be9346 100644
--- a/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp
@@ -155,7 +155,7 @@
VertexBuffer9 *vertexBuffer = GetAs<VertexBuffer9>(attributes[i].vertexBuffer.get());
unsigned int offset = 0;
- ANGLE_TRY_HANDLE(context, attributes[i].computeOffset(start, &offset));
+ ANGLE_TRY(attributes[i].computeOffset(context, start, &offset));
if (mAppliedVBs[stream].serial != attributes[i].serial ||
mAppliedVBs[stream].stride != attributes[i].stride ||