Commit 7efe747c by Jamie Madill Committed by Commit Bot

D3D11: Fix style in the entire back-end.

BUG=None Change-Id: I32cbcd4daa1f386654ea5e8f0a25d8635b5df731 Reviewed-on: https://chromium-review.googlesource.com/402016Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent a284f2ff
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
// found in the LICENSE file. // found in the LICENSE file.
// //
// Fence11.cpp: Defines the rx::FenceNV11 and rx::FenceSync11 classes which implement rx::FenceNVImpl and rx::FenceSyncImpl. // Fence11.cpp: Defines the rx::FenceNV11 and rx::FenceSync11 classes which implement
// rx::FenceNVImpl and rx::FenceSyncImpl.
#include "libANGLE/renderer/d3d/d3d11/Fence11.h" #include "libANGLE/renderer/d3d/d3d11/Fence11.h"
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h" #include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
...@@ -20,19 +21,20 @@ static const int kDeviceLostCheckPeriod = 64; ...@@ -20,19 +21,20 @@ static const int kDeviceLostCheckPeriod = 64;
// Template helpers for set and test operations. // Template helpers for set and test operations.
// //
template<class FenceClass> template <class FenceClass>
gl::Error FenceSetHelper(FenceClass *fence) gl::Error FenceSetHelper(FenceClass *fence)
{ {
if (!fence->mQuery) if (!fence->mQuery)
{ {
D3D11_QUERY_DESC queryDesc; D3D11_QUERY_DESC queryDesc;
queryDesc.Query = D3D11_QUERY_EVENT; queryDesc.Query = D3D11_QUERY_EVENT;
queryDesc.MiscFlags = 0; queryDesc.MiscFlags = 0;
HRESULT result = fence->mRenderer->getDevice()->CreateQuery(&queryDesc, &fence->mQuery); HRESULT result = fence->mRenderer->getDevice()->CreateQuery(&queryDesc, &fence->mQuery);
if (FAILED(result)) if (FAILED(result))
{ {
return gl::Error(GL_OUT_OF_MEMORY, "Failed to create event query, result: 0x%X.", result); return gl::Error(GL_OUT_OF_MEMORY, "Failed to create event query, result: 0x%X.",
result);
} }
} }
...@@ -46,7 +48,8 @@ gl::Error FenceTestHelper(FenceClass *fence, bool flushCommandBuffer, GLboolean ...@@ -46,7 +48,8 @@ gl::Error FenceTestHelper(FenceClass *fence, bool flushCommandBuffer, GLboolean
ASSERT(fence->mQuery); ASSERT(fence->mQuery);
UINT getDataFlags = (flushCommandBuffer ? 0 : D3D11_ASYNC_GETDATA_DONOTFLUSH); UINT getDataFlags = (flushCommandBuffer ? 0 : D3D11_ASYNC_GETDATA_DONOTFLUSH);
HRESULT result = fence->mRenderer->getDeviceContext()->GetData(fence->mQuery, NULL, 0, getDataFlags); HRESULT result =
fence->mRenderer->getDeviceContext()->GetData(fence->mQuery, NULL, 0, getDataFlags);
if (FAILED(result)) if (FAILED(result))
{ {
...@@ -62,10 +65,7 @@ gl::Error FenceTestHelper(FenceClass *fence, bool flushCommandBuffer, GLboolean ...@@ -62,10 +65,7 @@ gl::Error FenceTestHelper(FenceClass *fence, bool flushCommandBuffer, GLboolean
// FenceNV11 // FenceNV11
// //
FenceNV11::FenceNV11(Renderer11 *renderer) FenceNV11::FenceNV11(Renderer11 *renderer) : FenceNVImpl(), mRenderer(renderer), mQuery(NULL)
: FenceNVImpl(),
mRenderer(renderer),
mQuery(NULL)
{ {
} }
...@@ -121,13 +121,10 @@ gl::Error FenceNV11::finish() ...@@ -121,13 +121,10 @@ gl::Error FenceNV11::finish()
// We still opt to use QPC. In the present and moving forward, most newer systems will not suffer // We still opt to use QPC. In the present and moving forward, most newer systems will not suffer
// from buggy implementations. // from buggy implementations.
FenceSync11::FenceSync11(Renderer11 *renderer) FenceSync11::FenceSync11(Renderer11 *renderer) : FenceSyncImpl(), mRenderer(renderer), mQuery(NULL)
: FenceSyncImpl(),
mRenderer(renderer),
mQuery(NULL)
{ {
LARGE_INTEGER counterFreqency = {}; LARGE_INTEGER counterFreqency = {};
BOOL success = QueryPerformanceFrequency(&counterFreqency); BOOL success = QueryPerformanceFrequency(&counterFreqency);
UNUSED_ASSERTION_VARIABLE(success); UNUSED_ASSERTION_VARIABLE(success);
ASSERT(success); ASSERT(success);
...@@ -152,7 +149,7 @@ gl::Error FenceSync11::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *ou ...@@ -152,7 +149,7 @@ gl::Error FenceSync11::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *ou
bool flushCommandBuffer = ((flags & GL_SYNC_FLUSH_COMMANDS_BIT) != 0); bool flushCommandBuffer = ((flags & GL_SYNC_FLUSH_COMMANDS_BIT) != 0);
GLboolean result = GL_FALSE; GLboolean result = GL_FALSE;
gl::Error error = FenceTestHelper(this, flushCommandBuffer, &result); gl::Error error = FenceTestHelper(this, flushCommandBuffer, &result);
if (error.isError()) if (error.isError())
{ {
*outResult = GL_WAIT_FAILED; *outResult = GL_WAIT_FAILED;
...@@ -172,12 +169,12 @@ gl::Error FenceSync11::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *ou ...@@ -172,12 +169,12 @@ gl::Error FenceSync11::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *ou
} }
LARGE_INTEGER currentCounter = {}; LARGE_INTEGER currentCounter = {};
BOOL success = QueryPerformanceCounter(&currentCounter); BOOL success = QueryPerformanceCounter(&currentCounter);
UNUSED_ASSERTION_VARIABLE(success); UNUSED_ASSERTION_VARIABLE(success);
ASSERT(success); ASSERT(success);
LONGLONG timeoutInSeconds = static_cast<LONGLONG>(timeout) * static_cast<LONGLONG>(1000000ll); LONGLONG timeoutInSeconds = static_cast<LONGLONG>(timeout) * static_cast<LONGLONG>(1000000ll);
LONGLONG endCounter = currentCounter.QuadPart + mCounterFrequency * timeoutInSeconds; LONGLONG endCounter = currentCounter.QuadPart + mCounterFrequency * timeoutInSeconds;
int loopCount = 0; int loopCount = 0;
while (currentCounter.QuadPart < endCounter && !result) while (currentCounter.QuadPart < endCounter && !result)
...@@ -218,19 +215,19 @@ gl::Error FenceSync11::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *ou ...@@ -218,19 +215,19 @@ gl::Error FenceSync11::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *ou
gl::Error FenceSync11::serverWait(GLbitfield flags, GLuint64 timeout) gl::Error FenceSync11::serverWait(GLbitfield flags, GLuint64 timeout)
{ {
// Because our API is currently designed to be called from a single thread, we don't need to do // Because our API is currently designed to be called from a single thread, we don't need to do
// extra work for a server-side fence. GPU commands issued after the fence is created will always // extra work for a server-side fence. GPU commands issued after the fence is created will
// be processed after the fence is signaled. // always be processed after the fence is signaled.
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
} }
gl::Error FenceSync11::getStatus(GLint *outResult) gl::Error FenceSync11::getStatus(GLint *outResult)
{ {
GLboolean result = GL_FALSE; GLboolean result = GL_FALSE;
gl::Error error = FenceTestHelper(this, false, &result); gl::Error error = FenceTestHelper(this, false, &result);
if (error.isError()) if (error.isError())
{ {
// The spec does not specify any way to report errors during the status test (e.g. device lost) // The spec does not specify any way to report errors during the status test (e.g. device
// so we report the fence is unblocked in case of error or signaled. // lost) so we report the fence is unblocked in case of error or signaled.
*outResult = GL_SIGNALED; *outResult = GL_SIGNALED;
return error; return error;
...@@ -240,4 +237,4 @@ gl::Error FenceSync11::getStatus(GLint *outResult) ...@@ -240,4 +237,4 @@ gl::Error FenceSync11::getStatus(GLint *outResult)
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
} }
} // namespace rx } // namespace rx
...@@ -181,7 +181,7 @@ gl::Error Query11::resume() ...@@ -181,7 +181,7 @@ gl::Error Query11::resume()
D3D11_QUERY_DESC desc; D3D11_QUERY_DESC desc;
desc.Query = D3D11_QUERY_TIMESTAMP; desc.Query = D3D11_QUERY_TIMESTAMP;
desc.MiscFlags = 0; desc.MiscFlags = 0;
result = device->CreateQuery(&desc, &mActiveQuery->beginTimestamp); result = device->CreateQuery(&desc, &mActiveQuery->beginTimestamp);
if (FAILED(result)) if (FAILED(result))
{ {
return gl::Error(GL_OUT_OF_MEMORY, "Internal query creation failed, result: 0x%X.", return gl::Error(GL_OUT_OF_MEMORY, "Internal query creation failed, result: 0x%X.",
...@@ -241,8 +241,8 @@ gl::Error Query11::testQuery(QueryState *queryState) ...@@ -241,8 +241,8 @@ gl::Error Query11::testQuery(QueryState *queryState)
ID3D11DeviceContext *context = mRenderer->getDeviceContext(); ID3D11DeviceContext *context = mRenderer->getDeviceContext();
switch (getType()) switch (getType())
{ {
case GL_ANY_SAMPLES_PASSED_EXT: case GL_ANY_SAMPLES_PASSED_EXT:
case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT: case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
{ {
ASSERT(queryState->query); ASSERT(queryState->query);
UINT64 numPixels = 0; UINT64 numPixels = 0;
...@@ -250,31 +250,35 @@ gl::Error Query11::testQuery(QueryState *queryState) ...@@ -250,31 +250,35 @@ gl::Error Query11::testQuery(QueryState *queryState)
context->GetData(queryState->query, &numPixels, sizeof(numPixels), 0); context->GetData(queryState->query, &numPixels, sizeof(numPixels), 0);
if (FAILED(result)) if (FAILED(result))
{ {
return gl::Error(GL_OUT_OF_MEMORY, "Failed to get the data of an internal query, result: 0x%X.", result); return gl::Error(GL_OUT_OF_MEMORY,
"Failed to get the data of an internal query, result: 0x%X.",
result);
} }
if (result == S_OK) if (result == S_OK)
{ {
queryState->finished = true; queryState->finished = true;
mResult = (numPixels > 0) ? GL_TRUE : GL_FALSE; mResult = (numPixels > 0) ? GL_TRUE : GL_FALSE;
} }
} }
break; break;
case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
{ {
ASSERT(queryState->query); ASSERT(queryState->query);
D3D11_QUERY_DATA_SO_STATISTICS soStats = { 0 }; D3D11_QUERY_DATA_SO_STATISTICS soStats = {0};
HRESULT result = context->GetData(queryState->query, &soStats, sizeof(soStats), 0); HRESULT result = context->GetData(queryState->query, &soStats, sizeof(soStats), 0);
if (FAILED(result)) if (FAILED(result))
{ {
return gl::Error(GL_OUT_OF_MEMORY, "Failed to get the data of an internal query, result: 0x%X.", result); return gl::Error(GL_OUT_OF_MEMORY,
"Failed to get the data of an internal query, result: 0x%X.",
result);
} }
if (result == S_OK) if (result == S_OK)
{ {
queryState->finished = true; queryState->finished = true;
mResult = static_cast<GLuint64>(soStats.NumPrimitivesWritten); mResult = static_cast<GLuint64>(soStats.NumPrimitivesWritten);
} }
} }
break; break;
...@@ -351,7 +355,7 @@ gl::Error Query11::testQuery(QueryState *queryState) ...@@ -351,7 +355,7 @@ gl::Error Query11::testQuery(QueryState *queryState)
// to have any sort of continuity outside of a disjoint timestamp query block, which // to have any sort of continuity outside of a disjoint timestamp query block, which
// GL depends on // GL depends on
ASSERT(queryState->query == nullptr); ASSERT(queryState->query == nullptr);
mResult = 0; mResult = 0;
queryState->finished = true; queryState->finished = true;
} }
break; break;
...@@ -378,9 +382,9 @@ gl::Error Query11::testQuery(QueryState *queryState) ...@@ -378,9 +382,9 @@ gl::Error Query11::testQuery(QueryState *queryState)
} }
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
break; break;
} }
if (!queryState->finished && mRenderer->testDeviceLost()) if (!queryState->finished && mRenderer->testDeviceLost())
......
...@@ -185,8 +185,8 @@ gl::Error TextureStorage11::getSRV(const gl::TextureState &textureState, ...@@ -185,8 +185,8 @@ gl::Error TextureStorage11::getSRV(const gl::TextureState &textureState,
{ {
// Make sure to add the level offset for our tiny compressed texture workaround // Make sure to add the level offset for our tiny compressed texture workaround
const GLuint effectiveBaseLevel = textureState.getEffectiveBaseLevel(); const GLuint effectiveBaseLevel = textureState.getEffectiveBaseLevel();
bool swizzleRequired = textureState.swizzleRequired(); bool swizzleRequired = textureState.swizzleRequired();
bool mipmapping = gl::IsMipmapFiltered(textureState.getSamplerState()); bool mipmapping = gl::IsMipmapFiltered(textureState.getSamplerState());
unsigned int mipLevels = unsigned int mipLevels =
mipmapping ? (textureState.getEffectiveMaxLevel() - effectiveBaseLevel + 1) : 1; mipmapping ? (textureState.getEffectiveMaxLevel() - effectiveBaseLevel + 1) : 1;
...@@ -426,7 +426,7 @@ gl::Error TextureStorage11::updateSubresourceLevel(ID3D11Resource *srcTexture, ...@@ -426,7 +426,7 @@ gl::Error TextureStorage11::updateSubresourceLevel(ID3D11Resource *srcTexture,
if (!fullCopy && mFormatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN) if (!fullCopy && mFormatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN)
{ {
// CopySubresourceRegion cannot copy partial depth stencils, use the blitter instead // CopySubresourceRegion cannot copy partial depth stencils, use the blitter instead
Blit11 *blitter = mRenderer->getBlitter(); Blit11 *blitter = mRenderer->getBlitter();
TextureHelper11 source = TextureHelper11::MakeAndReference(srcTexture, getFormatSet()); TextureHelper11 source = TextureHelper11::MakeAndReference(srcTexture, getFormatSet());
TextureHelper11 dest = TextureHelper11::MakeAndReference(dstTexture, getFormatSet()); TextureHelper11 dest = TextureHelper11::MakeAndReference(dstTexture, getFormatSet());
return blitter->copyDepthStencil(source, sourceSubresource, copyArea, texSize, dest, return blitter->copyDepthStencil(source, sourceSubresource, copyArea, texSize, dest,
...@@ -516,7 +516,7 @@ gl::Error TextureStorage11::generateMipmap(const gl::ImageIndex &sourceIndex, ...@@ -516,7 +516,7 @@ gl::Error TextureStorage11::generateMipmap(const gl::ImageIndex &sourceIndex,
ID3D11ShaderResourceView *sourceSRV = ID3D11ShaderResourceView *sourceSRV =
GetAs<RenderTarget11>(source)->getBlitShaderResourceView(); GetAs<RenderTarget11>(source)->getBlitShaderResourceView();
ID3D11RenderTargetView *destRTV = GetAs<RenderTarget11>(dest)->getRenderTargetView(); ID3D11RenderTargetView *destRTV = GetAs<RenderTarget11>(dest)->getRenderTargetView();
gl::Box sourceArea(0, 0, 0, source->getWidth(), source->getHeight(), source->getDepth()); gl::Box sourceArea(0, 0, 0, source->getWidth(), source->getHeight(), source->getDepth());
gl::Extents sourceSize(source->getWidth(), source->getHeight(), source->getDepth()); gl::Extents sourceSize(source->getWidth(), source->getHeight(), source->getDepth());
...@@ -614,9 +614,9 @@ gl::Error TextureStorage11::setData(const gl::ImageIndex &index, ...@@ -614,9 +614,9 @@ gl::Error TextureStorage11::setData(const gl::ImageIndex &index,
// with compressed formats in the calling logic. // with compressed formats in the calling logic.
ASSERT(!internalFormatInfo.compressed); ASSERT(!internalFormatInfo.compressed);
const int width = destBox ? destBox->width : static_cast<int>(image->getWidth()); const int width = destBox ? destBox->width : static_cast<int>(image->getWidth());
const int height = destBox ? destBox->height : static_cast<int>(image->getHeight()); const int height = destBox ? destBox->height : static_cast<int>(image->getHeight());
const int depth = destBox ? destBox->depth : static_cast<int>(image->getDepth()); const int depth = destBox ? destBox->depth : static_cast<int>(image->getDepth());
GLuint srcRowPitch = 0; GLuint srcRowPitch = 0;
ANGLE_TRY_RESULT( ANGLE_TRY_RESULT(
internalFormatInfo.computeRowPitch(type, width, unpack.alignment, unpack.rowLength), internalFormatInfo.computeRowPitch(type, width, unpack.alignment, unpack.rowLength),
...@@ -1349,15 +1349,15 @@ TextureStorage11_External::TextureStorage11_External( ...@@ -1349,15 +1349,15 @@ TextureStorage11_External::TextureStorage11_External(
ASSERT(stream->getProducerType() == egl::Stream::ProducerType::D3D11TextureNV12); ASSERT(stream->getProducerType() == egl::Stream::ProducerType::D3D11TextureNV12);
StreamProducerNV12 *producer = static_cast<StreamProducerNV12 *>(stream->getImplementation()); StreamProducerNV12 *producer = static_cast<StreamProducerNV12 *>(stream->getImplementation());
mTexture = producer->getD3DTexture(); mTexture = producer->getD3DTexture();
mSubresourceIndex = producer->getArraySlice(); mSubresourceIndex = producer->getArraySlice();
mTexture->AddRef(); mTexture->AddRef();
mMipLevels = 1; mMipLevels = 1;
D3D11_TEXTURE2D_DESC desc; D3D11_TEXTURE2D_DESC desc;
mTexture->GetDesc(&desc); mTexture->GetDesc(&desc);
mTextureWidth = desc.Width; mTextureWidth = desc.Width;
mTextureHeight = desc.Height; mTextureHeight = desc.Height;
mTextureDepth = 1; mTextureDepth = 1;
mHasKeyedMutex = (desc.MiscFlags & D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX) != 0; mHasKeyedMutex = (desc.MiscFlags & D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX) != 0;
} }
...@@ -1501,10 +1501,10 @@ TextureStorage11_EGLImage::TextureStorage11_EGLImage(Renderer11 *renderer, ...@@ -1501,10 +1501,10 @@ TextureStorage11_EGLImage::TextureStorage11_EGLImage(Renderer11 *renderer,
{ {
mCurrentRenderTarget = reinterpret_cast<uintptr_t>(renderTarget11); mCurrentRenderTarget = reinterpret_cast<uintptr_t>(renderTarget11);
mMipLevels = 1; mMipLevels = 1;
mTextureWidth = renderTarget11->getWidth(); mTextureWidth = renderTarget11->getWidth();
mTextureHeight = renderTarget11->getHeight(); mTextureHeight = renderTarget11->getHeight();
mTextureDepth = 1; mTextureDepth = 1;
} }
TextureStorage11_EGLImage::~TextureStorage11_EGLImage() TextureStorage11_EGLImage::~TextureStorage11_EGLImage()
...@@ -2795,7 +2795,7 @@ gl::Error TextureStorage11_3D::getRenderTarget(const gl::ImageIndex &index, Rend ...@@ -2795,7 +2795,7 @@ gl::Error TextureStorage11_3D::getRenderTarget(const gl::ImageIndex &index, Rend
ANGLE_TRY(getResource(&texture)); ANGLE_TRY(getResource(&texture));
// TODO, what kind of SRV is expected here? // TODO, what kind of SRV is expected here?
ID3D11ShaderResourceView *srv = nullptr; ID3D11ShaderResourceView *srv = nullptr;
ID3D11ShaderResourceView *blitSRV = nullptr; ID3D11ShaderResourceView *blitSRV = nullptr;
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc; D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
......
...@@ -21,9 +21,9 @@ namespace rx ...@@ -21,9 +21,9 @@ namespace rx
VertexBuffer11::VertexBuffer11(Renderer11 *const renderer) : mRenderer(renderer) VertexBuffer11::VertexBuffer11(Renderer11 *const renderer) : mRenderer(renderer)
{ {
mBuffer = NULL; mBuffer = NULL;
mBufferSize = 0; mBufferSize = 0;
mDynamicUsage = false; mDynamicUsage = false;
mMappedResourceData = NULL; mMappedResourceData = NULL;
} }
...@@ -41,20 +41,21 @@ gl::Error VertexBuffer11::initialize(unsigned int size, bool dynamicUsage) ...@@ -41,20 +41,21 @@ gl::Error VertexBuffer11::initialize(unsigned int size, bool dynamicUsage)
if (size > 0) if (size > 0)
{ {
ID3D11Device* dxDevice = mRenderer->getDevice(); ID3D11Device *dxDevice = mRenderer->getDevice();
D3D11_BUFFER_DESC bufferDesc; D3D11_BUFFER_DESC bufferDesc;
bufferDesc.ByteWidth = size; bufferDesc.ByteWidth = size;
bufferDesc.Usage = D3D11_USAGE_DYNAMIC; bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
bufferDesc.MiscFlags = 0; bufferDesc.MiscFlags = 0;
bufferDesc.StructureByteStride = 0; bufferDesc.StructureByteStride = 0;
HRESULT result = dxDevice->CreateBuffer(&bufferDesc, NULL, &mBuffer); HRESULT result = dxDevice->CreateBuffer(&bufferDesc, NULL, &mBuffer);
if (FAILED(result)) if (FAILED(result))
{ {
return gl::Error(GL_OUT_OF_MEMORY, "Failed to allocate internal vertex buffer of size, %lu.", size); return gl::Error(GL_OUT_OF_MEMORY,
"Failed to allocate internal vertex buffer of size, %lu.", size);
} }
if (dynamicUsage) if (dynamicUsage)
...@@ -67,7 +68,7 @@ gl::Error VertexBuffer11::initialize(unsigned int size, bool dynamicUsage) ...@@ -67,7 +68,7 @@ gl::Error VertexBuffer11::initialize(unsigned int size, bool dynamicUsage)
} }
} }
mBufferSize = size; mBufferSize = size;
mDynamicUsage = dynamicUsage; mDynamicUsage = dynamicUsage;
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
...@@ -81,13 +82,15 @@ gl::Error VertexBuffer11::mapResource() ...@@ -81,13 +82,15 @@ gl::Error VertexBuffer11::mapResource()
D3D11_MAPPED_SUBRESOURCE mappedResource; D3D11_MAPPED_SUBRESOURCE mappedResource;
HRESULT result = dxContext->Map(mBuffer, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mappedResource); HRESULT result =
dxContext->Map(mBuffer, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mappedResource);
if (FAILED(result)) if (FAILED(result))
{ {
return gl::Error(GL_OUT_OF_MEMORY, "Failed to map internal vertex buffer, HRESULT: 0x%08x.", result); return gl::Error(GL_OUT_OF_MEMORY,
"Failed to map internal vertex buffer, HRESULT: 0x%08x.", result);
} }
mMappedResourceData = reinterpret_cast<uint8_t*>(mappedResource.pData); mMappedResourceData = reinterpret_cast<uint8_t *>(mappedResource.pData);
} }
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
...@@ -132,8 +135,9 @@ gl::Error VertexBuffer11::storeVertexAttributes(const gl::VertexAttribute &attri ...@@ -132,8 +135,9 @@ gl::Error VertexBuffer11::storeVertexAttributes(const gl::VertexAttribute &attri
} }
gl::VertexFormatType vertexFormatType = gl::GetVertexFormatType(attrib, currentValueType); gl::VertexFormatType vertexFormatType = gl::GetVertexFormatType(attrib, currentValueType);
const D3D_FEATURE_LEVEL featureLevel = mRenderer->getRenderer11DeviceCaps().featureLevel; const D3D_FEATURE_LEVEL featureLevel = mRenderer->getRenderer11DeviceCaps().featureLevel;
const d3d11::VertexFormat &vertexFormatInfo = d3d11::GetVertexFormatInfo(vertexFormatType, featureLevel); const d3d11::VertexFormat &vertexFormatInfo =
d3d11::GetVertexFormatInfo(vertexFormatType, featureLevel);
ASSERT(vertexFormatInfo.copyFunction != NULL); ASSERT(vertexFormatInfo.copyFunction != NULL);
vertexFormatInfo.copyFunction(input, inputStride, count, output); vertexFormatInfo.copyFunction(input, inputStride, count, output);
...@@ -170,7 +174,8 @@ gl::Error VertexBuffer11::discard() ...@@ -170,7 +174,8 @@ gl::Error VertexBuffer11::discard()
HRESULT result = dxContext->Map(mBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); HRESULT result = dxContext->Map(mBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result)) if (FAILED(result))
{ {
return gl::Error(GL_OUT_OF_MEMORY, "Failed to map internal buffer for discarding, HRESULT: 0x%08x", result); return gl::Error(GL_OUT_OF_MEMORY,
"Failed to map internal buffer for discarding, HRESULT: 0x%08x", result);
} }
dxContext->Unmap(mBuffer, 0); dxContext->Unmap(mBuffer, 0);
......
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