Commit e4634a13 by Jamie Madill Committed by Commit Bot

Apply code formatting.

Several files were formatted by the code generation script. Bug: angleproject:2957 Change-Id: I8a5cbf2c17297a3644686004a8981ab2305c1ada Reviewed-on: https://chromium-review.googlesource.com/c/1334428Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent b56ddbb7
......@@ -173,7 +173,6 @@ class TextureImpl : public FramebufferAttachmentObjectImpl
protected:
const gl::TextureState &mState;
};
}
#endif // LIBANGLE_RENDERER_TEXTUREIMPL_H_
......@@ -126,7 +126,6 @@ class MockTextureImpl : public TextureImpl
protected:
gl::TextureState mMockState;
};
}
#endif // LIBANGLE_RENDERER_TEXTUREIMPLMOCK_H_
......@@ -304,7 +304,8 @@ bool FramebufferD3D::checkStatus(const gl::Context *context) const
// D3D11 does not allow for overlapping RenderTargetViews.
// If WebGL compatibility is enabled, this has already been checked at a higher level.
ASSERT(!context->getExtensions().webglCompatibility || mState.colorAttachmentsAreUniqueImages());
ASSERT(!context->getExtensions().webglCompatibility ||
mState.colorAttachmentsAreUniqueImages());
if (!context->getExtensions().webglCompatibility)
{
if (!mState.colorAttachmentsAreUniqueImages())
......
......@@ -42,11 +42,13 @@ angle::Result GetUnpackPointer(const gl::Context *context,
{
if (unpackBuffer)
{
// Do a CPU readback here, if we have an unpack buffer bound and the fast GPU path is not supported
// Do a CPU readback here, if we have an unpack buffer bound and the fast GPU path is not
// supported
ptrdiff_t offset = reinterpret_cast<ptrdiff_t>(pixels);
// TODO: this is the only place outside of renderer that asks for a buffers raw data.
// This functionality should be moved into renderer and the getData method of BufferImpl removed.
// This functionality should be moved into renderer and the getData method of BufferImpl
// removed.
BufferD3D *bufferD3D = GetImplAs<BufferD3D>(unpackBuffer);
ASSERT(bufferD3D);
const uint8_t *bufferData = nullptr;
......@@ -71,7 +73,6 @@ bool IsRenderTargetUsage(GLenum usage)
{
return (usage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
}
}
TextureD3D::TextureD3D(const gl::TextureState &state, RendererD3D *renderer)
......@@ -227,8 +228,9 @@ angle::Result TextureD3D::setImageImpl(const gl::Context *context,
return angle::Result::Continue();
}
// We no longer need the "GLenum format" parameter to TexImage to determine what data format "pixels" contains.
// From our image internal format we know how many channels to expect, and "type" gives the format of pixel's components.
// We no longer need the "GLenum format" parameter to TexImage to determine what data format
// "pixels" contains. From our image internal format we know how many channels to expect, and
// "type" gives the format of pixel's components.
const uint8_t *pixelData = nullptr;
ANGLE_TRY(GetUnpackPointer(context, unpack, unpackBuffer, pixels, layerOffset, &pixelData));
......@@ -241,7 +243,8 @@ angle::Result TextureD3D::setImageImpl(const gl::Context *context,
}
else
{
gl::Box fullImageArea(0, 0, 0, image->getWidth(), image->getHeight(), image->getDepth());
gl::Box fullImageArea(0, 0, 0, image->getWidth(), image->getHeight(),
image->getDepth());
ANGLE_TRY(image->loadData(context, fullImageArea, unpack, type, pixelData,
index.usesTex3D()));
}
......@@ -298,8 +301,9 @@ angle::Result TextureD3D::setCompressedImageImpl(const gl::Context *context,
return angle::Result::Continue();
}
// We no longer need the "GLenum format" parameter to TexImage to determine what data format "pixels" contains.
// From our image internal format we know how many channels to expect, and "type" gives the format of pixel's components.
// We no longer need the "GLenum format" parameter to TexImage to determine what data format
// "pixels" contains. From our image internal format we know how many channels to expect, and
// "type" gives the format of pixel's components.
const uint8_t *pixelData = nullptr;
gl::Buffer *unpackBuffer =
context->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack);
......@@ -367,8 +371,8 @@ angle::Result TextureD3D::fastUnpackPixels(const gl::Context *context,
return angle::Result::Continue();
}
// In order to perform the fast copy through the shader, we must have the right format, and be able
// to create a render target.
// In order to perform the fast copy through the shader, we must have the right format, and be
// able to create a render target.
ASSERT(mRenderer->supportsFastCopyBufferToTexture(sizedInternalFormat));
uintptr_t offset = reinterpret_cast<uintptr_t>(pixels);
......@@ -481,12 +485,15 @@ angle::Result TextureD3D::generateMipmapUsingImages(const gl::Context *context,
}
}
// TODO: Decouple this from zeroMaxLodWorkaround. This is a 9_3 restriction, unrelated to zeroMaxLodWorkaround.
// The restriction is because Feature Level 9_3 can't create SRVs on individual levels of the texture.
// As a result, even if the storage is a rendertarget, we can't use the GPU to generate the mipmaps without further work.
// The D3D9 renderer works around this by copying each level of the texture into its own single-layer GPU texture (in Blit9::boxFilter).
// Feature Level 9_3 could do something similar, or it could continue to use CPU-side mipmap generation, or something else.
bool renderableStorage = (mTexStorage && mTexStorage->isRenderTarget() && !(mRenderer->getWorkarounds().zeroMaxLodWorkaround));
// TODO: Decouple this from zeroMaxLodWorkaround. This is a 9_3 restriction, unrelated to
// zeroMaxLodWorkaround. The restriction is because Feature Level 9_3 can't create SRVs on
// individual levels of the texture. As a result, even if the storage is a rendertarget, we
// can't use the GPU to generate the mipmaps without further work. The D3D9 renderer works
// around this by copying each level of the texture into its own single-layer GPU texture (in
// Blit9::boxFilter). Feature Level 9_3 could do something similar, or it could continue to use
// CPU-side mipmap generation, or something else.
bool renderableStorage = (mTexStorage && mTexStorage->isRenderTarget() &&
!(mRenderer->getWorkarounds().zeroMaxLodWorkaround));
for (GLint layer = 0; layer < layerCount; ++layer)
{
......@@ -929,7 +936,8 @@ angle::Result TextureD3D_2D::setCompressedImage(const gl::Context *context,
{
ASSERT(index.getTarget() == gl::TextureTarget::_2D && size.depth == 1);
// compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
// compressed formats don't have separate sized internal formats-- we can just use the
// compressed format directly
ANGLE_TRY(redefineImage(context, index.getLevelIndex(), internalFormat, size, false));
return setCompressedImageImpl(context, index, unpack, pixels, 0);
......@@ -988,8 +996,8 @@ angle::Result TextureD3D_2D::copyImage(const gl::Context *context,
gl::Offset destOffset(clippedArea.x - sourceArea.x, clippedArea.y - sourceArea.y, 0);
// If the zero max LOD workaround is active, then we can't sample from individual layers of the framebuffer in shaders,
// so we should use the non-rendering copy path.
// If the zero max LOD workaround is active, then we can't sample from individual layers of the
// framebuffer in shaders, so we should use the non-rendering copy path.
if (!canCreateRenderTargetForImage(index) || mRenderer->getWorkarounds().zeroMaxLodWorkaround)
{
ANGLE_TRY(mImageArray[index.getLevelIndex()]->copyFromFramebuffer(context, destOffset,
......@@ -1029,11 +1037,12 @@ angle::Result TextureD3D_2D::copySubImage(const gl::Context *context,
const gl::Offset clippedOffset(destOffset.x + clippedArea.x - sourceArea.x,
destOffset.y + clippedArea.y - sourceArea.y, 0);
// can only make our texture storage to a render target if level 0 is defined (with a width & height) and
// the current level we're copying to is defined (with appropriate format, width & height)
// can only make our texture storage to a render target if level 0 is defined (with a width &
// height) and the current level we're copying to is defined (with appropriate format, width &
// height)
// If the zero max LOD workaround is active, then we can't sample from individual layers of the framebuffer in shaders,
// so we should use the non-rendering copy path.
// If the zero max LOD workaround is active, then we can't sample from individual layers of the
// framebuffer in shaders, so we should use the non-rendering copy path.
if (!canCreateRenderTargetForImage(index) || mRenderer->getWorkarounds().zeroMaxLodWorkaround)
{
ANGLE_TRY(mImageArray[index.getLevelIndex()]->copyFromFramebuffer(context, clippedOffset,
......@@ -1196,8 +1205,7 @@ angle::Result TextureD3D_2D::setStorage(const gl::Context *context,
for (size_t level = 0; level < levels; level++)
{
gl::Extents levelSize(std::max(1, size.width >> level),
std::max(1, size.height >> level),
gl::Extents levelSize(std::max(1, size.width >> level), std::max(1, size.height >> level),
1);
ANGLE_TRY(redefineImage(context, level, internalFormat, levelSize, true));
}
......@@ -1417,8 +1425,8 @@ angle::Result TextureD3D_2D::createCompleteStorage(bool renderTarget,
bool hintLevelZeroOnly = false;
if (mRenderer->getWorkarounds().zeroMaxLodWorkaround)
{
// If any of the CPU images (levels >= 1) are dirty, then the textureStorage2D should use the mipped texture to begin with.
// Otherwise, it should use the level-zero-only texture.
// If any of the CPU images (levels >= 1) are dirty, then the textureStorage2D should use
// the mipped texture to begin with. Otherwise, it should use the level-zero-only texture.
hintLevelZeroOnly = true;
for (int level = 1; level < levels && hintLevelZeroOnly; level++)
{
......@@ -1677,7 +1685,8 @@ angle::Result TextureD3D_Cube::setCompressedImage(const gl::Context *context,
{
ASSERT(size.depth == 1);
// compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
// compressed formats don't have separate sized internal formats-- we can just use the
// compressed format directly
ANGLE_TRY(redefineImage(context, index.cubeMapFaceIndex(), index.getLevelIndex(),
internalFormat, size, false));
......@@ -1737,8 +1746,8 @@ angle::Result TextureD3D_Cube::copyImage(const gl::Context *context,
gl::Offset destOffset(clippedArea.x - sourceArea.x, clippedArea.y - sourceArea.y, 0);
// If the zero max LOD workaround is active, then we can't sample from individual layers of the framebuffer in shaders,
// so we should use the non-rendering copy path.
// If the zero max LOD workaround is active, then we can't sample from individual layers of the
// framebuffer in shaders, so we should use the non-rendering copy path.
if (!canCreateRenderTargetForImage(index) || mRenderer->getWorkarounds().zeroMaxLodWorkaround)
{
ANGLE_TRY(mImageArray[faceIndex][index.getLevelIndex()]->copyFromFramebuffer(
......@@ -1780,8 +1789,8 @@ angle::Result TextureD3D_Cube::copySubImage(const gl::Context *context,
GLint faceIndex = index.cubeMapFaceIndex();
// If the zero max LOD workaround is active, then we can't sample from individual layers of the framebuffer in shaders,
// so we should use the non-rendering copy path.
// If the zero max LOD workaround is active, then we can't sample from individual layers of the
// framebuffer in shaders, so we should use the non-rendering copy path.
if (!canCreateRenderTargetForImage(index) || mRenderer->getWorkarounds().zeroMaxLodWorkaround)
{
ANGLE_TRY(mImageArray[faceIndex][index.getLevelIndex()]->copyFromFramebuffer(
......@@ -1974,9 +1983,8 @@ bool TextureD3D_Cube::isCubeComplete() const
{
const ImageD3D &faceBaseImage = *mImageArray[faceIndex][getBaseLevel()];
if (faceBaseImage.getWidth() != baseWidth ||
faceBaseImage.getHeight() != baseHeight ||
faceBaseImage.getInternalFormat() != baseFormat )
if (faceBaseImage.getWidth() != baseWidth || faceBaseImage.getHeight() != baseHeight ||
faceBaseImage.getInternalFormat() != baseFormat)
{
return false;
}
......@@ -2073,14 +2081,15 @@ angle::Result TextureD3D_Cube::createCompleteStorage(bool renderTarget,
bool hintLevelZeroOnly = false;
if (mRenderer->getWorkarounds().zeroMaxLodWorkaround)
{
// If any of the CPU images (levels >= 1) are dirty, then the textureStorage should use the mipped texture to begin with.
// Otherwise, it should use the level-zero-only texture.
// If any of the CPU images (levels >= 1) are dirty, then the textureStorage should use the
// mipped texture to begin with. Otherwise, it should use the level-zero-only texture.
hintLevelZeroOnly = true;
for (size_t faceIndex = 0; faceIndex < gl::kCubeFaceCount && hintLevelZeroOnly; faceIndex++)
{
for (int level = 1; level < levels && hintLevelZeroOnly; level++)
{
hintLevelZeroOnly = !(mImageArray[faceIndex][level]->isDirty() && isFaceLevelComplete(faceIndex, level));
hintLevelZeroOnly = !(mImageArray[faceIndex][level]->isDirty() &&
isFaceLevelComplete(faceIndex, level));
}
}
}
......@@ -2457,7 +2466,8 @@ angle::Result TextureD3D_3D::setCompressedImage(const gl::Context *context,
{
ASSERT(index.getTarget() == gl::TextureTarget::_3D);
// compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
// compressed formats don't have separate sized internal formats-- we can just use the
// compressed format directly
ANGLE_TRY(redefineImage(context, index.getLevelIndex(), internalFormat, size, false));
return setCompressedImageImpl(context, index, unpack, pixels, 0);
......@@ -2650,8 +2660,7 @@ angle::Result TextureD3D_3D::setStorage(const gl::Context *context,
for (size_t level = 0; level < levels; level++)
{
gl::Extents levelSize(std::max(1, size.width >> level),
std::max(1, size.height >> level),
gl::Extents levelSize(std::max(1, size.width >> level), std::max(1, size.height >> level),
std::max(1, size.depth >> level));
mImageArray[level]->redefine(gl::TextureType::_3D, internalFormat, levelSize, true);
}
......@@ -2767,7 +2776,8 @@ angle::Result TextureD3D_3D::createCompleteStorage(bool renderTarget,
ASSERT(width > 0 && height > 0 && depth > 0);
// use existing storage level count, when previously specified by TexStorage*D
GLint levels = (mTexStorage ? mTexStorage->getLevelCount() : creationLevels(width, height, depth));
GLint levels =
(mTexStorage ? mTexStorage->getLevelCount() : creationLevels(width, height, depth));
// TODO: Verify creation of the storage succeeded
outStorage->reset(mRenderer->createTextureStorage3D(internalFormat, renderTarget, width, height,
......@@ -2976,8 +2986,7 @@ TextureD3D_2DArray::~TextureD3D_2DArray()
ImageD3D *TextureD3D_2DArray::getImage(int level, int layer) const
{
ASSERT(level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
ASSERT((layer == 0 && mLayerCounts[level] == 0) ||
layer < mLayerCounts[level]);
ASSERT((layer == 0 && mLayerCounts[level] == 0) || layer < mLayerCounts[level]);
return (mImageArray[level] ? mImageArray[level][layer] : nullptr);
}
......@@ -3001,17 +3010,23 @@ GLsizei TextureD3D_2DArray::getLayerCount(int level) const
GLsizei TextureD3D_2DArray::getWidth(GLint level) const
{
return (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0) ? mImageArray[level][0]->getWidth() : 0;
return (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0)
? mImageArray[level][0]->getWidth()
: 0;
}
GLsizei TextureD3D_2DArray::getHeight(GLint level) const
{
return (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0) ? mImageArray[level][0]->getHeight() : 0;
return (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0)
? mImageArray[level][0]->getHeight()
: 0;
}
GLenum TextureD3D_2DArray::getInternalFormat(GLint level) const
{
return (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0) ? mImageArray[level][0]->getInternalFormat() : GL_NONE;
return (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0)
? mImageArray[level][0]->getInternalFormat()
: GL_NONE;
}
bool TextureD3D_2DArray::isDepth(GLint level) const
......@@ -3111,7 +3126,8 @@ angle::Result TextureD3D_2DArray::setCompressedImage(const gl::Context *context,
ContextD3D *contextD3D = GetImplAs<ContextD3D>(context);
// compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
// compressed formats don't have separate sized internal formats-- we can just use the
// compressed format directly
ANGLE_TRY(redefineImage(context, index.getLevelIndex(), internalFormat, size, false));
const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalFormat);
......@@ -3367,15 +3383,14 @@ angle::Result TextureD3D_2DArray::setStorage(const gl::Context *context,
for (size_t level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
{
gl::Extents levelLayerSize(std::max(1, size.width >> level),
std::max(1, size.height >> level),
1);
std::max(1, size.height >> level), 1);
mLayerCounts[level] = (level < levels ? size.depth : 0);
if (mLayerCounts[level] > 0)
{
// Create new images for this level
mImageArray[level] = new ImageD3D*[mLayerCounts[level]];
mImageArray[level] = new ImageD3D *[mLayerCounts[level]];
for (int layer = 0; layer < mLayerCounts[level]; layer++)
{
......@@ -3430,8 +3445,7 @@ angle::Result TextureD3D_2DArray::initMipmapImages(const gl::Context *context)
{
ASSERT((baseWidth >> level) > 0 || (baseHeight >> level) > 0);
gl::Extents levelLayerSize(std::max(baseWidth >> level, 1),
std::max(baseHeight >> level, 1),
baseDepth);
std::max(baseHeight >> level, 1), baseDepth);
ANGLE_TRY(redefineImage(context, level, baseFormat, levelLayerSize, false));
}
......@@ -3659,7 +3673,7 @@ angle::Result TextureD3D_2DArray::redefineImage(const gl::Context *context,
if (size.depth > 0)
{
mImageArray[level] = new ImageD3D*[size.depth];
mImageArray[level] = new ImageD3D *[size.depth];
for (int layer = 0; layer < mLayerCounts[level]; layer++)
{
mImageArray[level][layer] = mRenderer->createImage();
......
......@@ -703,8 +703,9 @@ class TextureD3D_2DArray : public TextureD3D
// 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
// to update all the texture layers since they cannot all be updated at once and it makes the most
// sense for the Image class to not have to worry about layer subresource as well as mip subresources.
// to update all the texture layers since they cannot all be updated at once and it makes the
// most sense for the Image class to not have to worry about layer subresource as well as mip
// subresources.
GLsizei mLayerCounts[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
ImageD3D **mImageArray[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
};
......
......@@ -22,14 +22,14 @@
namespace
{
// Precompiled shaders
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/standardvs.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/passthroughps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/luminancepremultps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceunmultps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskpremultps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskunmultps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/luminancepremultps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceunmultps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/passthroughps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/standardvs.h"
const BYTE *const g_shaderCode[] = {
g_vs20_standardvs,
......@@ -88,13 +88,7 @@ angle::Result Blit9::initialize(Context9 *context9)
return angle::Result::Continue();
}
static const float quad[] =
{
-1, -1,
-1, 1,
1, -1,
1, 1
};
static const float quad[] = {-1, -1, -1, 1, 1, -1, 1, 1};
IDirect3DDevice9 *device = mRenderer->getDevice();
......@@ -112,11 +106,8 @@ angle::Result Blit9::initialize(Context9 *context9)
memcpy(lockPtr, quad, sizeof(quad));
mQuadVertexBuffer->Unlock();
static const D3DVERTEXELEMENT9 elements[] =
{
{ 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
D3DDECL_END()
};
static const D3DVERTEXELEMENT9 elements[] = {
{0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, D3DDECL_END()};
result = device->CreateVertexDeclaration(elements, &mQuadVertexDeclaration);
ANGLE_TRY_HR(context9, result, "Failed to create internal blit vertex shader declaration");
......@@ -141,11 +132,11 @@ angle::Result Blit9::setShader(Context9 *context9,
if (mCompiledShaders[source] != nullptr)
{
shader = static_cast<D3DShaderType*>(mCompiledShaders[source]);
shader = static_cast<D3DShaderType *>(mCompiledShaders[source]);
}
else
{
const BYTE* shaderCode = g_shaderCode[source];
const BYTE *shaderCode = g_shaderCode[source];
size_t shaderSize = g_shaderSize[source];
ANGLE_TRY((mRenderer->*createShader)(context9, reinterpret_cast<const DWORD *>(shaderCode),
shaderSize, &shader));
......@@ -358,7 +349,9 @@ angle::Result Blit9::copy(Context9 *context9,
d3d9_gl::IsFormatChannelEquivalent(destDesc.Format, destFormat) && !flipY &&
premultiplyAlpha == unmultiplyAlpha)
{
RECT destRect = { destOffset.x, destOffset.y, destOffset.x + (sourceRect.right - sourceRect.left), destOffset.y + (sourceRect.bottom - sourceRect.top)};
RECT destRect = {destOffset.x, destOffset.y,
destOffset.x + (sourceRect.right - sourceRect.left),
destOffset.y + (sourceRect.bottom - sourceRect.top)};
HRESULT result = device->StretchRect(source, &sourceRect, dest, &destRect, D3DTEXF_POINT);
ANGLE_TRY_HR(context9, result, "StretchRect failed to blit between textures");
return angle::Result::Continue();
......@@ -482,12 +475,18 @@ angle::Result Blit9::setFormatConvertShaders(Context9 *context9,
UNREACHABLE();
}
enum { X = 0, Y = 1, Z = 2, W = 3 };
enum
{
X = 0,
Y = 1,
Z = 2,
W = 3
};
// The meaning of this constant depends on the shader that was selected.
// See the shader assembly code above for details.
// Allocate one array for both registers and split it into two float4's.
float psConst[8] = { 0 };
float psConst[8] = {0};
float *multConst = &psConst[0];
float *addConst = &psConst[4];
......@@ -571,7 +570,8 @@ angle::Result Blit9::setFormatConvertShaders(Context9 *context9,
addConst[W] = 0;
break;
default: UNREACHABLE();
default:
UNREACHABLE();
}
mRenderer->getDevice()->SetPixelShaderConstantF(0, psConst, 2);
......@@ -652,7 +652,9 @@ void Blit9::setCommonBlitState()
device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
device->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED);
device->SetRenderState(D3DRS_COLORWRITEENABLE,
D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE |
D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED);
device->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE);
device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
......@@ -662,10 +664,11 @@ void Blit9::setCommonBlitState()
device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
RECT scissorRect = {0}; // Scissoring is disabled for flipping, but we need this to capture and restore the old rectangle
RECT scissorRect = {0}; // Scissoring is disabled for flipping, but we need this to capture and
// restore the old rectangle
device->SetScissorRect(&scissorRect);
for(int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
for (int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
{
device->SetStreamSourceFreq(i, 1);
}
......@@ -698,7 +701,7 @@ void Blit9::saveState()
setCommonBlitState();
static const float dummyConst[8] = { 0 };
static const float dummyConst[8] = {0};
device->SetVertexShader(nullptr);
device->SetVertexShaderConstantF(0, dummyConst, 2);
......@@ -751,5 +754,4 @@ void Blit9::restoreState()
mSavedStateBlock->Apply();
}
}
}
......@@ -139,9 +139,10 @@ angle::Result Image9::CopyLockableSurfaces(Context9 *context9,
ASSERT(bytes <= static_cast<unsigned int>(sourceLock.Pitch) &&
bytes <= static_cast<unsigned int>(destLock.Pitch));
for(unsigned int i = 0; i < rows; i++)
for (unsigned int i = 0; i < rows; i++)
{
memcpy((char*)destLock.pBits + destLock.Pitch * i, (char*)sourceLock.pBits + sourceLock.Pitch * i, bytes);
memcpy((char *)destLock.pBits + destLock.Pitch * i,
(char *)sourceLock.pBits + sourceLock.Pitch * i, bytes);
}
source->UnlockRect();
......@@ -227,11 +228,8 @@ bool Image9::redefine(gl::TextureType type,
// Only 2D and cube texture are supported by the D3D9 backend.
ASSERT(type == gl::TextureType::_2D || type == gl::TextureType::CubeMap);
if (mWidth != size.width ||
mHeight != size.height ||
mDepth != size.depth ||
mInternalFormat != internalformat ||
forceRelease)
if (mWidth != size.width || mHeight != size.height || mDepth != size.depth ||
mInternalFormat != internalformat || forceRelease)
{
mWidth = size.width;
mHeight = size.height;
......@@ -347,8 +345,8 @@ D3DFORMAT Image9::getD3DFormat() const
bool Image9::isDirty() const
{
// Make sure to that this image is marked as dirty even if the staging texture hasn't been created yet
// if initialization is required before use.
// Make sure to that this image is marked as dirty even if the staging texture hasn't been
// created yet if initialization is required before use.
return (mSurface ||
d3d9::GetTextureFormatInfo(mInternalFormat).dataInitializerFunction != nullptr) &&
mDirty;
......@@ -472,8 +470,8 @@ angle::Result Image9::copyToSurface(Context9 *context9,
return angle::Result::Continue();
}
// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
// into the target pixel rectangle.
// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as
// format/type at input into the target pixel rectangle.
angle::Result Image9::loadData(const gl::Context *context,
const gl::Box &area,
const gl::PixelUnpackState &unpack,
......@@ -497,11 +495,7 @@ angle::Result Image9::loadData(const gl::Context *context,
const d3d9::TextureFormat &d3dFormatInfo = d3d9::GetTextureFormatInfo(mInternalFormat);
ASSERT(d3dFormatInfo.loadFunction != nullptr);
RECT lockRect =
{
area.x, area.y,
area.x + area.width, area.y + area.height
};
RECT lockRect = {area.x, area.y, area.x + area.width, area.y + area.height};
D3DLOCKED_RECT locked;
ANGLE_TRY(lock(GetImplAs<Context9>(context), &locked, lockRect));
......@@ -540,11 +534,7 @@ angle::Result Image9::loadCompressedData(const gl::Context *context,
ASSERT(d3d9FormatInfo.loadFunction != nullptr);
RECT lockRect =
{
area.x, area.y,
area.x + area.width, area.y + area.height
};
RECT lockRect = {area.x, area.y, area.x + area.width, area.y + area.height};
D3DLOCKED_RECT locked;
ANGLE_TRY(lock(GetImplAs<Context9>(context), &locked, lockRect));
......@@ -558,7 +548,8 @@ angle::Result Image9::loadCompressedData(const gl::Context *context,
return angle::Result::Continue();
}
// This implements glCopyTex[Sub]Image2D for non-renderable internal texture formats and incomplete textures
// This implements glCopyTex[Sub]Image2D for non-renderable internal texture formats and incomplete
// textures
angle::Result Image9::copyFromRTInternal(Context9 *context9,
const gl::Offset &destOffset,
const gl::Rectangle &sourceArea,
......@@ -593,8 +584,8 @@ angle::Result Image9::copyFromRTInternal(Context9 *context9,
int width = sourceArea.width;
int height = sourceArea.height;
RECT sourceRect = { sourceArea.x, sourceArea.y, sourceArea.x + width, sourceArea.y + height };
RECT destRect = { destOffset.x, destOffset.y, destOffset.x + width, destOffset.y + height };
RECT sourceRect = {sourceArea.x, sourceArea.y, sourceArea.x + width, sourceArea.y + height};
RECT destRect = {destOffset.x, destOffset.y, destOffset.x + width, destOffset.y + height};
D3DLOCKED_RECT sourceLock = {0};
hr = renderTargetData->LockRect(&sourceLock, &sourceRect, 0);
......@@ -611,8 +602,8 @@ angle::Result Image9::copyFromRTInternal(Context9 *context9,
ASSERT(destLock.pBits && sourceLock.pBits);
unsigned char *sourcePixels = (unsigned char*)sourceLock.pBits;
unsigned char *destPixels = (unsigned char*)destLock.pBits;
unsigned char *sourcePixels = (unsigned char *)sourceLock.pBits;
unsigned char *destPixels = (unsigned char *)destLock.pBits;
switch (description.Format)
{
......@@ -664,7 +655,7 @@ angle::Result Image9::copyFromRTInternal(Context9 *context9,
{
for (int x = 0; x < width; x++)
{
unsigned short rgb = ((unsigned short*)sourcePixels)[x];
unsigned short rgb = ((unsigned short *)sourcePixels)[x];
unsigned char red = static_cast<unsigned char>((rgb & 0xF800) >> 8);
unsigned char green = static_cast<unsigned char>((rgb & 0x07E0) >> 3);
unsigned char blue = static_cast<unsigned char>((rgb & 0x001F) << 3);
......@@ -701,7 +692,7 @@ angle::Result Image9::copyFromRTInternal(Context9 *context9,
{
for (int x = 0; x < width; x++)
{
unsigned short argb = ((unsigned short*)sourcePixels)[x];
unsigned short argb = ((unsigned short *)sourcePixels)[x];
unsigned char red = static_cast<unsigned char>((argb & 0x7C00) >> 7);
unsigned char green = static_cast<unsigned char>((argb & 0x03E0) >> 2);
unsigned char blue = static_cast<unsigned char>((argb & 0x001F) << 3);
......@@ -719,7 +710,7 @@ angle::Result Image9::copyFromRTInternal(Context9 *context9,
{
for (int x = 0; x < width; x++)
{
unsigned short argb = ((unsigned short*)sourcePixels)[x];
unsigned short argb = ((unsigned short *)sourcePixels)[x];
unsigned char red = static_cast<unsigned char>((argb & 0x7C00) >> 7);
unsigned char green = static_cast<unsigned char>((argb & 0x03E0) >> 2);
unsigned char blue = static_cast<unsigned char>((argb & 0x001F) << 3);
......
......@@ -80,8 +80,9 @@ angle::Result RenderbufferGL::setStorageMultisample(const gl::Context *context,
const gl::TextureCaps &formatCaps = mTextureCaps.get(internalformat);
if (samples > formatCaps.getMaxSamples())
{
// Before version 4.2, it is unknown if the specific internal format can support the requested number
// of samples. It is expected that GL_OUT_OF_MEMORY is returned if the renderbuffer cannot be created.
// Before version 4.2, it is unknown if the specific internal format can support the
// requested number of samples. It is expected that GL_OUT_OF_MEMORY is returned if the
// renderbuffer cannot be created.
GLenum error = GL_NO_ERROR;
do
{
......
......@@ -9,9 +9,9 @@
#ifndef LIBANGLE_RENDERER_GL_TEXTUREGL_H_
#define LIBANGLE_RENDERER_GL_TEXTUREGL_H_
#include "libANGLE/Texture.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/renderer/TextureImpl.h"
#include "libANGLE/Texture.h"
namespace rx
{
......@@ -246,7 +246,6 @@ class TextureGL : public TextureImpl
GLuint mTextureID;
};
}
#endif // LIBANGLE_RENDERER_GL_TEXTUREGL_H_
......@@ -8,12 +8,12 @@
// vertex buffer.
//
#include "libANGLE/angletypes.h"
#include "libANGLE/Context.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/renderer/d3d/IndexDataManager.h"
#include "libANGLE/renderer/d3d/d3d11/Buffer11.h"
#include "libANGLE/renderer/d3d/d3d11/Context11.h"
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
#include "libANGLE/renderer/d3d/IndexDataManager.h"
#include "test_utils/ANGLETest.h"
#include "test_utils/angle_test_instantiate.h"
......@@ -25,7 +25,6 @@ namespace
class D3D11EmulatedIndexedBufferTest : public ANGLETest
{
protected:
void SetUp() override
{
ANGLETest::SetUp();
......@@ -36,7 +35,7 @@ class D3D11EmulatedIndexedBufferTest : public ANGLETest
mRenderer = context11->getRenderer();
mSourceBuffer = new rx::Buffer11(mBufferState, mRenderer);
GLfloat testData[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f };
GLfloat testData[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f};
angle::Result error = mSourceBuffer->setData(nullptr, gl::BufferBinding::Array, testData,
sizeof(testData), gl::BufferUsage::StaticDraw);
ASSERT_EQ(angle::Result::Continue(), error);
......@@ -62,7 +61,9 @@ class D3D11EmulatedIndexedBufferTest : public ANGLETest
ANGLETest::TearDown();
}
void createMappableCompareBufferFromEmulatedBuffer(ID3D11Buffer *sourceBuffer, GLuint size, ID3D11Buffer **mappableBuffer)
void createMappableCompareBufferFromEmulatedBuffer(ID3D11Buffer *sourceBuffer,
GLuint size,
ID3D11Buffer **mappableBuffer)
{
*mappableBuffer = nullptr;
......@@ -85,7 +86,8 @@ class D3D11EmulatedIndexedBufferTest : public ANGLETest
srcBox.front = 0;
srcBox.back = 1;
mRenderer->getDeviceContext()->CopySubresourceRegion(*mappableBuffer, 0, 0, 0, 0, sourceBuffer, 0, &srcBox);
mRenderer->getDeviceContext()->CopySubresourceRegion(*mappableBuffer, 0, 0, 0, 0,
sourceBuffer, 0, &srcBox);
}
void compareContents(ID3D11Buffer *actual)
......@@ -96,10 +98,11 @@ class D3D11EmulatedIndexedBufferTest : public ANGLETest
&compareBuffer);
D3D11_MAPPED_SUBRESOURCE mappedResource;
HRESULT hr = mRenderer->getDeviceContext()->Map(compareBuffer, 0, D3D11_MAP_READ, 0, &mappedResource);
HRESULT hr = mRenderer->getDeviceContext()->Map(compareBuffer, 0, D3D11_MAP_READ, 0,
&mappedResource);
ASSERT_TRUE(SUCCEEDED(hr));
GLfloat* compareData = static_cast<GLfloat*>(mappedResource.pData);
GLfloat *compareData = static_cast<GLfloat *>(mappedResource.pData);
for (size_t i = 0; i < mExpectedExpandedData.size(); i++)
{
EXPECT_EQ(mExpectedExpandedData[i], compareData[i]);
......@@ -161,7 +164,8 @@ TEST_P(D3D11EmulatedIndexedBufferTest, TestNativeToExpandedUsingGLuintIndices)
emulateAndCompare(&srcData);
}
// This tests verifies that a Buffer11 contents remain unchanged after calling getEmulatedIndexedBuffer
// This tests verifies that a Buffer11 contents remain unchanged after calling
// getEmulatedIndexedBuffer
TEST_P(D3D11EmulatedIndexedBufferTest, TestSourceBufferRemainsUntouchedAfterExpandOperation)
{
// Copy the original source buffer before any expand calls have been made
......@@ -192,7 +196,6 @@ TEST_P(D3D11EmulatedIndexedBufferTest, TestSourceBufferRemainsUntouchedAfterExpa
SafeDelete(cleanSourceBuffer);
}
ANGLE_INSTANTIATE_TEST(D3D11EmulatedIndexedBufferTest,
ES2_D3D11());
ANGLE_INSTANTIATE_TEST(D3D11EmulatedIndexedBufferTest, ES2_D3D11());
} // anonymous namespace
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