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())
......
......@@ -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