Commit 8234e7b3 by Jamie Madill Committed by Commit Bot

Refactor some errors into ANGLE_TRY macros.

BUG=None Change-Id: I00ff2523995cb49d1af60cae62c2bba0d020eed4 Reviewed-on: https://chromium-review.googlesource.com/395569 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent ef300b15
...@@ -179,11 +179,7 @@ gl::Error BufferD3D::getIndexRange(GLenum type, ...@@ -179,11 +179,7 @@ gl::Error BufferD3D::getIndexRange(GLenum type,
gl::IndexRange *outRange) gl::IndexRange *outRange)
{ {
const uint8_t *data = nullptr; const uint8_t *data = nullptr;
gl::Error error = getData(&data); ANGLE_TRY(getData(&data));
if (error.isError())
{
return error;
}
*outRange = gl::ComputeIndexRange(type, data + offset, count, primitiveRestartEnabled); *outRange = gl::ComputeIndexRange(type, data + offset, count, primitiveRestartEnabled);
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
......
...@@ -275,11 +275,7 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams, ...@@ -275,11 +275,7 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams,
drawBufferStates[colorAttachmentIndex] != GL_NONE) drawBufferStates[colorAttachmentIndex] != GL_NONE)
{ {
RenderTarget11 *renderTarget = nullptr; RenderTarget11 *renderTarget = nullptr;
gl::Error error = attachment.getRenderTarget(&renderTarget); ANGLE_TRY(attachment.getRenderTarget(&renderTarget));
if (error.isError())
{
return error;
}
const gl::InternalFormat &formatInfo = *attachment.getFormat().info; const gl::InternalFormat &formatInfo = *attachment.getFormat().info;
...@@ -385,11 +381,7 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams, ...@@ -385,11 +381,7 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams,
ASSERT(attachment != nullptr); ASSERT(attachment != nullptr);
RenderTarget11 *renderTarget = nullptr; RenderTarget11 *renderTarget = nullptr;
gl::Error error = attachment->getRenderTarget(&renderTarget); ANGLE_TRY(attachment->getRenderTarget(&renderTarget));
if (error.isError())
{
return error;
}
const auto &nativeFormat = renderTarget->getFormatSet().format; const auto &nativeFormat = renderTarget->getFormatSet().format;
......
...@@ -92,11 +92,7 @@ gl::Error FenceNV11::finish() ...@@ -92,11 +92,7 @@ gl::Error FenceNV11::finish()
while (finished != GL_TRUE) while (finished != GL_TRUE)
{ {
loopCount++; loopCount++;
gl::Error error = FenceTestHelper(this, true, &finished); ANGLE_TRY(FenceTestHelper(this, true, &finished));
if (error.isError())
{
return error;
}
if (loopCount % kDeviceLostCheckPeriod == 0 && mRenderer->testDeviceLost()) if (loopCount % kDeviceLostCheckPeriod == 0 && mRenderer->testDeviceLost())
{ {
...@@ -107,7 +103,7 @@ gl::Error FenceNV11::finish() ...@@ -107,7 +103,7 @@ gl::Error FenceNV11::finish()
ScheduleYield(); ScheduleYield();
} }
return gl::Error(GL_NO_ERROR); return gl::NoError();
} }
// //
......
...@@ -50,14 +50,10 @@ gl::Error Image11::generateMipmap(Image11 *dest, ...@@ -50,14 +50,10 @@ gl::Error Image11::generateMipmap(Image11 *dest,
ASSERT(src->getHeight() == 1 || src->getHeight() / 2 == dest->getHeight()); ASSERT(src->getHeight() == 1 || src->getHeight() / 2 == dest->getHeight());
D3D11_MAPPED_SUBRESOURCE destMapped; D3D11_MAPPED_SUBRESOURCE destMapped;
gl::Error error = dest->map(D3D11_MAP_WRITE, &destMapped); ANGLE_TRY(dest->map(D3D11_MAP_WRITE, &destMapped));
if (error.isError())
{
return error;
}
D3D11_MAPPED_SUBRESOURCE srcMapped; D3D11_MAPPED_SUBRESOURCE srcMapped;
error = src->map(D3D11_MAP_READ, &srcMapped); gl::Error error = src->map(D3D11_MAP_READ, &srcMapped);
if (error.isError()) if (error.isError())
{ {
dest->unmap(); dest->unmap();
...@@ -78,7 +74,7 @@ gl::Error Image11::generateMipmap(Image11 *dest, ...@@ -78,7 +74,7 @@ gl::Error Image11::generateMipmap(Image11 *dest,
dest->markDirty(); dest->markDirty();
return gl::Error(GL_NO_ERROR); return gl::NoError();
} }
bool Image11::isDirty() const bool Image11::isDirty() const
...@@ -113,26 +109,14 @@ gl::Error Image11::copyToStorage(TextureStorage *storage, const gl::ImageIndex & ...@@ -113,26 +109,14 @@ gl::Error Image11::copyToStorage(TextureStorage *storage, const gl::ImageIndex &
if (attemptToReleaseStagingTexture) if (attemptToReleaseStagingTexture)
{ {
// If another image is relying on this Storage for its data, then we must let it recover its data before we overwrite it. // If another image is relying on this Storage for its data, then we must let it recover its data before we overwrite it.
gl::Error error = storage11->releaseAssociatedImage(index, this); ANGLE_TRY(storage11->releaseAssociatedImage(index, this));
if (error.isError())
{
return error;
}
} }
ID3D11Resource *stagingTexture = NULL; ID3D11Resource *stagingTexture = NULL;
unsigned int stagingSubresourceIndex = 0; unsigned int stagingSubresourceIndex = 0;
gl::Error error = getStagingTexture(&stagingTexture, &stagingSubresourceIndex); ANGLE_TRY(getStagingTexture(&stagingTexture, &stagingSubresourceIndex));
if (error.isError()) ANGLE_TRY(
{ storage11->updateSubresourceLevel(stagingTexture, stagingSubresourceIndex, index, region));
return error;
}
error = storage11->updateSubresourceLevel(stagingTexture, stagingSubresourceIndex, index, region);
if (error.isError())
{
return error;
}
// Once the image data has been copied into the Storage, we can release it locally. // Once the image data has been copied into the Storage, we can release it locally.
if (attemptToReleaseStagingTexture) if (attemptToReleaseStagingTexture)
...@@ -144,7 +128,7 @@ gl::Error Image11::copyToStorage(TextureStorage *storage, const gl::ImageIndex & ...@@ -144,7 +128,7 @@ gl::Error Image11::copyToStorage(TextureStorage *storage, const gl::ImageIndex &
mAssociatedImageIndex = index; mAssociatedImageIndex = index;
} }
return gl::Error(GL_NO_ERROR); return gl::NoError();
} }
bool Image11::isAssociatedStorageValid(TextureStorage11* textureStorage) const bool Image11::isAssociatedStorageValid(TextureStorage11* textureStorage) const
...@@ -156,11 +140,7 @@ gl::Error Image11::recoverFromAssociatedStorage() ...@@ -156,11 +140,7 @@ gl::Error Image11::recoverFromAssociatedStorage()
{ {
if (mRecoverFromStorage) if (mRecoverFromStorage)
{ {
gl::Error error = createStagingTexture(); ANGLE_TRY(createStagingTexture());
if (error.isError())
{
return error;
}
bool textureStorageCorrect = mAssociatedStorage->isAssociatedImageValid(mAssociatedImageIndex, this); bool textureStorageCorrect = mAssociatedStorage->isAssociatedImageValid(mAssociatedImageIndex, this);
...@@ -172,12 +152,8 @@ gl::Error Image11::recoverFromAssociatedStorage() ...@@ -172,12 +152,8 @@ gl::Error Image11::recoverFromAssociatedStorage()
{ {
// CopySubResource from the Storage to the Staging texture // CopySubResource from the Storage to the Staging texture
gl::Box region(0, 0, 0, mWidth, mHeight, mDepth); gl::Box region(0, 0, 0, mWidth, mHeight, mDepth);
error = mAssociatedStorage->copySubresourceLevel(mStagingTexture, mStagingSubresource, mAssociatedImageIndex, region); ANGLE_TRY(mAssociatedStorage->copySubresourceLevel(mStagingTexture, mStagingSubresource,
if (error.isError()) mAssociatedImageIndex, region));
{
return error;
}
mRecoveredFromStorageCount += 1; mRecoveredFromStorageCount += 1;
} }
...@@ -185,7 +161,7 @@ gl::Error Image11::recoverFromAssociatedStorage() ...@@ -185,7 +161,7 @@ gl::Error Image11::recoverFromAssociatedStorage()
disassociateStorage(); disassociateStorage();
} }
return gl::Error(GL_NO_ERROR); return gl::NoError();
} }
void Image11::disassociateStorage() void Image11::disassociateStorage()
...@@ -272,11 +248,7 @@ gl::Error Image11::loadData(const gl::Box &area, ...@@ -272,11 +248,7 @@ gl::Error Image11::loadData(const gl::Box &area,
LoadImageFunction loadFunction = d3dFormatInfo.loadFunctions(type).loadFunction; LoadImageFunction loadFunction = d3dFormatInfo.loadFunctions(type).loadFunction;
D3D11_MAPPED_SUBRESOURCE mappedImage; D3D11_MAPPED_SUBRESOURCE mappedImage;
gl::Error error = map(D3D11_MAP_WRITE, &mappedImage); ANGLE_TRY(map(D3D11_MAP_WRITE, &mappedImage));
if (error.isError())
{
return error;
}
uint8_t *offsetMappedData = (reinterpret_cast<uint8_t*>(mappedImage.pData) + (area.y * mappedImage.RowPitch + area.x * outputPixelSize + area.z * mappedImage.DepthPitch)); uint8_t *offsetMappedData = (reinterpret_cast<uint8_t*>(mappedImage.pData) + (area.y * mappedImage.RowPitch + area.x * outputPixelSize + area.z * mappedImage.DepthPitch));
loadFunction(area.width, area.height, area.depth, loadFunction(area.width, area.height, area.depth,
...@@ -285,7 +257,7 @@ gl::Error Image11::loadData(const gl::Box &area, ...@@ -285,7 +257,7 @@ gl::Error Image11::loadData(const gl::Box &area,
unmap(); unmap();
return gl::Error(GL_NO_ERROR); return gl::NoError();
} }
gl::Error Image11::loadCompressedData(const gl::Box &area, const void *input) gl::Error Image11::loadCompressedData(const gl::Box &area, const void *input)
...@@ -309,11 +281,7 @@ gl::Error Image11::loadCompressedData(const gl::Box &area, const void *input) ...@@ -309,11 +281,7 @@ gl::Error Image11::loadCompressedData(const gl::Box &area, const void *input)
LoadImageFunction loadFunction = d3dFormatInfo.loadFunctions(GL_UNSIGNED_BYTE).loadFunction; LoadImageFunction loadFunction = d3dFormatInfo.loadFunctions(GL_UNSIGNED_BYTE).loadFunction;
D3D11_MAPPED_SUBRESOURCE mappedImage; D3D11_MAPPED_SUBRESOURCE mappedImage;
gl::Error error = map(D3D11_MAP_WRITE, &mappedImage); ANGLE_TRY(map(D3D11_MAP_WRITE, &mappedImage));
if (error.isError())
{
return error;
}
uint8_t* offsetMappedData = reinterpret_cast<uint8_t*>(mappedImage.pData) + ((area.y / outputBlockHeight) * mappedImage.RowPitch + uint8_t* offsetMappedData = reinterpret_cast<uint8_t*>(mappedImage.pData) + ((area.y / outputBlockHeight) * mappedImage.RowPitch +
(area.x / outputBlockWidth) * outputPixelSize + (area.x / outputBlockWidth) * outputPixelSize +
...@@ -325,7 +293,7 @@ gl::Error Image11::loadCompressedData(const gl::Box &area, const void *input) ...@@ -325,7 +293,7 @@ gl::Error Image11::loadCompressedData(const gl::Box &area, const void *input)
unmap(); unmap();
return gl::Error(GL_NO_ERROR); return gl::NoError();
} }
gl::Error Image11::copyFromTexStorage(const gl::ImageIndex &imageIndex, TextureStorage *source) gl::Error Image11::copyFromTexStorage(const gl::ImageIndex &imageIndex, TextureStorage *source)
...@@ -333,11 +301,7 @@ gl::Error Image11::copyFromTexStorage(const gl::ImageIndex &imageIndex, TextureS ...@@ -333,11 +301,7 @@ gl::Error Image11::copyFromTexStorage(const gl::ImageIndex &imageIndex, TextureS
TextureStorage11 *storage11 = GetAs<TextureStorage11>(source); TextureStorage11 *storage11 = GetAs<TextureStorage11>(source);
ID3D11Resource *resource = nullptr; ID3D11Resource *resource = nullptr;
gl::Error error = storage11->getResource(&resource); ANGLE_TRY(storage11->getResource(&resource));
if (error.isError())
{
return error;
}
UINT subresourceIndex = storage11->getSubresourceIndex(imageIndex); UINT subresourceIndex = storage11->getSubresourceIndex(imageIndex);
TextureHelper11 textureHelper = TextureHelper11 textureHelper =
...@@ -361,11 +325,7 @@ gl::Error Image11::copyFromFramebuffer(const gl::Offset &destOffset, ...@@ -361,11 +325,7 @@ gl::Error Image11::copyFromFramebuffer(const gl::Offset &destOffset,
if (d3d11Format.texFormat == mDXGIFormat && sourceInternalFormat == mInternalFormat) if (d3d11Format.texFormat == mDXGIFormat && sourceInternalFormat == mInternalFormat)
{ {
RenderTargetD3D *renderTarget = nullptr; RenderTargetD3D *renderTarget = nullptr;
gl::Error error = srcAttachment->getRenderTarget(&renderTarget); ANGLE_TRY(srcAttachment->getRenderTarget(&renderTarget));
if (error.isError())
{
return error;
}
RenderTarget11 *rt11 = GetAs<RenderTarget11>(renderTarget); RenderTarget11 *rt11 = GetAs<RenderTarget11>(renderTarget);
ASSERT(rt11->getTexture()); ASSERT(rt11->getTexture());
...@@ -381,11 +341,7 @@ gl::Error Image11::copyFromFramebuffer(const gl::Offset &destOffset, ...@@ -381,11 +341,7 @@ gl::Error Image11::copyFromFramebuffer(const gl::Offset &destOffset,
// This format requires conversion, so we must copy the texture to staging and manually convert // This format requires conversion, so we must copy the texture to staging and manually convert
// via readPixels // via readPixels
D3D11_MAPPED_SUBRESOURCE mappedImage; D3D11_MAPPED_SUBRESOURCE mappedImage;
gl::Error error = map(D3D11_MAP_WRITE, &mappedImage); ANGLE_TRY(map(D3D11_MAP_WRITE, &mappedImage));
if (error.isError())
{
return error;
}
// determine the offset coordinate into the destination buffer // determine the offset coordinate into the destination buffer
const auto &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(mDXGIFormat); const auto &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(mDXGIFormat);
...@@ -400,6 +356,7 @@ gl::Error Image11::copyFromFramebuffer(const gl::Offset &destOffset, ...@@ -400,6 +356,7 @@ gl::Error Image11::copyFromFramebuffer(const gl::Offset &destOffset,
d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps()); d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps());
auto loadFunction = destD3D11Format.loadFunctions(destFormatInfo.type); auto loadFunction = destD3D11Format.loadFunctions(destFormatInfo.type);
gl::Error error = gl::NoError();
if (loadFunction.requiresConversion) if (loadFunction.requiresConversion)
{ {
size_t bufferSize = destFormatInfo.pixelBytes * sourceArea.width * sourceArea.height; size_t bufferSize = destFormatInfo.pixelBytes * sourceArea.width * sourceArea.height;
...@@ -436,11 +393,7 @@ gl::Error Image11::copyWithoutConversion(const gl::Offset &destOffset, ...@@ -436,11 +393,7 @@ gl::Error Image11::copyWithoutConversion(const gl::Offset &destOffset,
// No conversion needed-- use copyback fastpath // No conversion needed-- use copyback fastpath
ID3D11Resource *stagingTexture = nullptr; ID3D11Resource *stagingTexture = nullptr;
unsigned int stagingSubresourceIndex = 0; unsigned int stagingSubresourceIndex = 0;
gl::Error error = getStagingTexture(&stagingTexture, &stagingSubresourceIndex); ANGLE_TRY(getStagingTexture(&stagingTexture, &stagingSubresourceIndex));
if (error.isError())
{
return error;
}
ID3D11Device *device = mRenderer->getDevice(); ID3D11Device *device = mRenderer->getDevice();
ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext(); ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
...@@ -505,20 +458,16 @@ gl::Error Image11::copyWithoutConversion(const gl::Offset &destOffset, ...@@ -505,20 +458,16 @@ gl::Error Image11::copyWithoutConversion(const gl::Offset &destOffset,
} }
mDirty = true; mDirty = true;
return gl::Error(GL_NO_ERROR); return gl::NoError();
} }
gl::Error Image11::getStagingTexture(ID3D11Resource **outStagingTexture, unsigned int *outSubresourceIndex) gl::Error Image11::getStagingTexture(ID3D11Resource **outStagingTexture, unsigned int *outSubresourceIndex)
{ {
gl::Error error = createStagingTexture(); ANGLE_TRY(createStagingTexture());
if (error.isError())
{
return error;
}
*outStagingTexture = mStagingTexture; *outStagingTexture = mStagingTexture;
*outSubresourceIndex = mStagingSubresource; *outSubresourceIndex = mStagingSubresource;
return gl::Error(GL_NO_ERROR); return gl::NoError();
} }
void Image11::releaseStagingTexture() void Image11::releaseStagingTexture()
...@@ -639,19 +588,11 @@ gl::Error Image11::createStagingTexture() ...@@ -639,19 +588,11 @@ gl::Error Image11::createStagingTexture()
gl::Error Image11::map(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map) gl::Error Image11::map(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map)
{ {
// We must recover from the TextureStorage if necessary, even for D3D11_MAP_WRITE. // We must recover from the TextureStorage if necessary, even for D3D11_MAP_WRITE.
gl::Error error = recoverFromAssociatedStorage(); ANGLE_TRY(recoverFromAssociatedStorage());
if (error.isError())
{
return error;
}
ID3D11Resource *stagingTexture = NULL; ID3D11Resource *stagingTexture = NULL;
unsigned int subresourceIndex = 0; unsigned int subresourceIndex = 0;
error = getStagingTexture(&stagingTexture, &subresourceIndex); ANGLE_TRY(getStagingTexture(&stagingTexture, &subresourceIndex));
if (error.isError())
{
return error;
}
ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext(); ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
......
...@@ -96,17 +96,11 @@ template <typename T> ...@@ -96,17 +96,11 @@ template <typename T>
gl::Error Query11::getResultBase(T *params) gl::Error Query11::getResultBase(T *params)
{ {
ASSERT(mActiveQuery->query == nullptr); ASSERT(mActiveQuery->query == nullptr);
ANGLE_TRY(flush(true));
gl::Error error = flush(true);
if (error.isError())
{
return error;
}
ASSERT(mPendingQueries.empty()); ASSERT(mPendingQueries.empty());
*params = static_cast<T>(mResultSum); *params = static_cast<T>(mResultSum);
return gl::Error(GL_NO_ERROR); return gl::NoError();
} }
gl::Error Query11::getResult(GLint *params) gl::Error Query11::getResult(GLint *params)
...@@ -131,14 +125,10 @@ gl::Error Query11::getResult(GLuint64 *params) ...@@ -131,14 +125,10 @@ gl::Error Query11::getResult(GLuint64 *params)
gl::Error Query11::isResultAvailable(bool *available) gl::Error Query11::isResultAvailable(bool *available)
{ {
gl::Error error = flush(false); ANGLE_TRY(flush(false));
if (error.isError())
{
return error;
}
*available = mPendingQueries.empty(); *available = mPendingQueries.empty();
return gl::Error(GL_NO_ERROR); return gl::NoError();
} }
gl::Error Query11::pause() gl::Error Query11::pause()
...@@ -167,11 +157,7 @@ gl::Error Query11::resume() ...@@ -167,11 +157,7 @@ gl::Error Query11::resume()
{ {
if (mActiveQuery->query == nullptr) if (mActiveQuery->query == nullptr)
{ {
gl::Error error = flush(false); ANGLE_TRY(flush(false));
if (error.isError())
{
return error;
}
GLenum queryType = getType(); GLenum queryType = getType();
D3D11_QUERY d3dQueryType = gl_d3d11::ConvertQueryType(queryType); D3D11_QUERY d3dQueryType = gl_d3d11::ConvertQueryType(queryType);
...@@ -234,11 +220,7 @@ gl::Error Query11::flush(bool force) ...@@ -234,11 +220,7 @@ gl::Error Query11::flush(bool force)
do do
{ {
gl::Error error = testQuery(query); ANGLE_TRY(testQuery(query));
if (error.isError())
{
return error;
}
if (!query->finished && !force) if (!query->finished && !force)
{ {
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
...@@ -249,7 +231,7 @@ gl::Error Query11::flush(bool force) ...@@ -249,7 +231,7 @@ gl::Error Query11::flush(bool force)
mPendingQueries.pop_front(); mPendingQueries.pop_front();
} }
return gl::Error(GL_NO_ERROR); return gl::NoError();
} }
gl::Error Query11::testQuery(QueryState *queryState) gl::Error Query11::testQuery(QueryState *queryState)
...@@ -408,7 +390,7 @@ gl::Error Query11::testQuery(QueryState *queryState) ...@@ -408,7 +390,7 @@ gl::Error Query11::testQuery(QueryState *queryState)
} }
} }
return gl::Error(GL_NO_ERROR); return gl::NoError();
} }
} } // namespace rx
...@@ -182,12 +182,8 @@ gl::Error VertexArray11::updateDirtyAndDynamicAttribs(VertexDataManager *vertexD ...@@ -182,12 +182,8 @@ gl::Error VertexArray11::updateDirtyAndDynamicAttribs(VertexDataManager *vertexD
break; break;
case VertexStorageType::STATIC: case VertexStorageType::STATIC:
{ {
auto error = ANGLE_TRY(
VertexDataManager::StoreStaticAttrib(translatedAttrib, count, instances); VertexDataManager::StoreStaticAttrib(translatedAttrib, count, instances));
if (error.isError())
{
return error;
}
break; break;
} }
case VertexStorageType::CURRENT_VALUE: case VertexStorageType::CURRENT_VALUE:
......
...@@ -120,11 +120,7 @@ gl::Error VertexBuffer11::storeVertexAttributes(const gl::VertexAttribute &attri ...@@ -120,11 +120,7 @@ gl::Error VertexBuffer11::storeVertexAttributes(const gl::VertexAttribute &attri
int inputStride = static_cast<int>(ComputeVertexAttributeStride(attrib)); int inputStride = static_cast<int>(ComputeVertexAttributeStride(attrib));
// This will map the resource if it isn't already mapped. // This will map the resource if it isn't already mapped.
gl::Error error = mapResource(); ANGLE_TRY(mapResource());
if (error.isError())
{
return error;
}
uint8_t *output = mMappedResourceData + offset; uint8_t *output = mMappedResourceData + offset;
...@@ -141,7 +137,7 @@ gl::Error VertexBuffer11::storeVertexAttributes(const gl::VertexAttribute &attri ...@@ -141,7 +137,7 @@ gl::Error VertexBuffer11::storeVertexAttributes(const gl::VertexAttribute &attri
ASSERT(vertexFormatInfo.copyFunction != NULL); ASSERT(vertexFormatInfo.copyFunction != NULL);
vertexFormatInfo.copyFunction(input, inputStride, count, output); vertexFormatInfo.copyFunction(input, inputStride, count, output);
return gl::Error(GL_NO_ERROR); return gl::NoError();
} }
unsigned int VertexBuffer11::getBufferSize() const unsigned int VertexBuffer11::getBufferSize() const
......
...@@ -145,13 +145,7 @@ gl::Error Blit9::setShader(ShaderId source, const char *profile, ...@@ -145,13 +145,7 @@ gl::Error Blit9::setShader(ShaderId source, const char *profile,
{ {
const BYTE* shaderCode = g_shaderCode[source]; const BYTE* shaderCode = g_shaderCode[source];
size_t shaderSize = g_shaderSize[source]; size_t shaderSize = g_shaderSize[source];
ANGLE_TRY((mRenderer->*createShader)(reinterpret_cast<const DWORD*>(shaderCode), shaderSize, &shader));
gl::Error error = (mRenderer->*createShader)(reinterpret_cast<const DWORD*>(shaderCode), shaderSize, &shader);
if (error.isError())
{
return error;
}
mCompiledShaders[source] = shader; mCompiledShaders[source] = shader;
} }
...@@ -190,18 +184,10 @@ RECT Blit9::getSurfaceRect(IDirect3DSurface9 *surface) const ...@@ -190,18 +184,10 @@ RECT Blit9::getSurfaceRect(IDirect3DSurface9 *surface) const
gl::Error Blit9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest) gl::Error Blit9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
{ {
gl::Error error = initialize(); ANGLE_TRY(initialize());
if (error.isError())
{
return error;
}
IDirect3DTexture9 *texture = NULL; IDirect3DTexture9 *texture = NULL;
error = copySurfaceToTexture(source, getSurfaceRect(source), &texture); ANGLE_TRY(copySurfaceToTexture(source, getSurfaceRect(source), &texture));
if (error.isError())
{
return error;
}
IDirect3DDevice9 *device = mRenderer->getDevice(); IDirect3DDevice9 *device = mRenderer->getDevice();
...@@ -230,21 +216,13 @@ gl::Error Blit9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest) ...@@ -230,21 +216,13 @@ gl::Error Blit9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
gl::Error Blit9::copy2D(const gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, const gl::Offset &destOffset, TextureStorage *storage, GLint level) gl::Error Blit9::copy2D(const gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, const gl::Offset &destOffset, TextureStorage *storage, GLint level)
{ {
gl::Error error = initialize(); ANGLE_TRY(initialize());
if (error.isError())
{
return error;
}
const gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0); const gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
ASSERT(colorbuffer); ASSERT(colorbuffer);
RenderTarget9 *renderTarget9 = nullptr; RenderTarget9 *renderTarget9 = nullptr;
error = colorbuffer->getRenderTarget(&renderTarget9); ANGLE_TRY(colorbuffer->getRenderTarget(&renderTarget9));
if (error.isError())
{
return error;
}
ASSERT(renderTarget9); ASSERT(renderTarget9);
IDirect3DSurface9 *source = renderTarget9->getSurface(); IDirect3DSurface9 *source = renderTarget9->getSurface();
...@@ -252,7 +230,7 @@ gl::Error Blit9::copy2D(const gl::Framebuffer *framebuffer, const RECT &sourceRe ...@@ -252,7 +230,7 @@ gl::Error Blit9::copy2D(const gl::Framebuffer *framebuffer, const RECT &sourceRe
IDirect3DSurface9 *destSurface = NULL; IDirect3DSurface9 *destSurface = NULL;
TextureStorage9 *storage9 = GetAs<TextureStorage9>(storage); TextureStorage9 *storage9 = GetAs<TextureStorage9>(storage);
error = storage9->getSurfaceLevel(GL_TEXTURE_2D, level, true, &destSurface); gl::Error error = storage9->getSurfaceLevel(GL_TEXTURE_2D, level, true, &destSurface);
if (error.isError()) if (error.isError())
{ {
SafeRelease(source); SafeRelease(source);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment