Commit 50cf2be0 by Jamie Madill Committed by Commit Bot

Reformat some style in touched files.

This was triggered by running the code generation script. Bug: angleproject:2665 Change-Id: Id639c78eb618182ee1859678590cf0f559b572c2 Reviewed-on: https://chromium-review.googlesource.com/1101564Reviewed-by: 's avatarOlli Etuaho <oetuaho@nvidia.com> Reviewed-by: 's avatarLuc Ferron <lucferron@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 57707e5f
...@@ -251,52 +251,52 @@ bool TParseContext::parseVectorFields(const TSourceLoc &line, ...@@ -251,52 +251,52 @@ bool TParseContext::parseVectorFields(const TSourceLoc &line,
{ {
case 'x': case 'x':
(*fieldOffsets)[i] = 0; (*fieldOffsets)[i] = 0;
fieldSet[i] = exyzw; fieldSet[i] = exyzw;
break; break;
case 'r': case 'r':
(*fieldOffsets)[i] = 0; (*fieldOffsets)[i] = 0;
fieldSet[i] = ergba; fieldSet[i] = ergba;
break; break;
case 's': case 's':
(*fieldOffsets)[i] = 0; (*fieldOffsets)[i] = 0;
fieldSet[i] = estpq; fieldSet[i] = estpq;
break; break;
case 'y': case 'y':
(*fieldOffsets)[i] = 1; (*fieldOffsets)[i] = 1;
fieldSet[i] = exyzw; fieldSet[i] = exyzw;
break; break;
case 'g': case 'g':
(*fieldOffsets)[i] = 1; (*fieldOffsets)[i] = 1;
fieldSet[i] = ergba; fieldSet[i] = ergba;
break; break;
case 't': case 't':
(*fieldOffsets)[i] = 1; (*fieldOffsets)[i] = 1;
fieldSet[i] = estpq; fieldSet[i] = estpq;
break; break;
case 'z': case 'z':
(*fieldOffsets)[i] = 2; (*fieldOffsets)[i] = 2;
fieldSet[i] = exyzw; fieldSet[i] = exyzw;
break; break;
case 'b': case 'b':
(*fieldOffsets)[i] = 2; (*fieldOffsets)[i] = 2;
fieldSet[i] = ergba; fieldSet[i] = ergba;
break; break;
case 'p': case 'p':
(*fieldOffsets)[i] = 2; (*fieldOffsets)[i] = 2;
fieldSet[i] = estpq; fieldSet[i] = estpq;
break; break;
case 'w': case 'w':
(*fieldOffsets)[i] = 3; (*fieldOffsets)[i] = 3;
fieldSet[i] = exyzw; fieldSet[i] = exyzw;
break; break;
case 'a': case 'a':
(*fieldOffsets)[i] = 3; (*fieldOffsets)[i] = 3;
fieldSet[i] = ergba; fieldSet[i] = ergba;
break; break;
case 'q': case 'q':
(*fieldOffsets)[i] = 3; (*fieldOffsets)[i] = 3;
fieldSet[i] = estpq; fieldSet[i] = estpq;
break; break;
default: default:
error(line, "illegal vector field selection", compString); error(line, "illegal vector field selection", compString);
...@@ -1852,7 +1852,7 @@ TIntermTyped *TParseContext::parseVariableIdentifier(const TSourceLoc &location, ...@@ -1852,7 +1852,7 @@ TIntermTyped *TParseContext::parseVariableIdentifier(const TSourceLoc &location,
} }
const TType &variableType = variable->getType(); const TType &variableType = variable->getType();
TIntermTyped *node = nullptr; TIntermTyped *node = nullptr;
if (variable->getConstPointer() && variableType.canReplaceWithConstantUnion()) if (variable->getConstPointer() && variableType.canReplaceWithConstantUnion())
{ {
...@@ -2435,7 +2435,7 @@ TIntermDeclaration *TParseContext::parseSingleDeclaration( ...@@ -2435,7 +2435,7 @@ TIntermDeclaration *TParseContext::parseSingleDeclaration(
declarationQualifierErrorCheck(publicType.qualifier, publicType.layoutQualifier, declarationQualifierErrorCheck(publicType.qualifier, publicType.layoutQualifier,
identifierOrTypeLocation); identifierOrTypeLocation);
bool emptyDeclaration = (identifier == ""); bool emptyDeclaration = (identifier == "");
mDeferredNonEmptyDeclarationErrorCheck = emptyDeclaration; mDeferredNonEmptyDeclarationErrorCheck = emptyDeclaration;
TIntermSymbol *symbol = nullptr; TIntermSymbol *symbol = nullptr;
...@@ -5545,8 +5545,8 @@ void TParseContext::checkTextureOffsetConst(TIntermAggregate *functionCall) ...@@ -5545,8 +5545,8 @@ void TParseContext::checkTextureOffsetConst(TIntermAggregate *functionCall)
{ {
ASSERT(functionCall->getOp() == EOpCallBuiltInFunction); ASSERT(functionCall->getOp() == EOpCallBuiltInFunction);
const TFunction *func = functionCall->getFunction(); const TFunction *func = functionCall->getFunction();
TIntermNode *offset = nullptr; TIntermNode *offset = nullptr;
TIntermSequence *arguments = functionCall->getSequence(); TIntermSequence *arguments = functionCall->getSequence();
bool useTextureGatherOffsetConstraints = false; bool useTextureGatherOffsetConstraints = false;
if (BuiltInGroup::isTextureOffsetNoBias(func)) if (BuiltInGroup::isTextureOffsetNoBias(func))
{ {
......
...@@ -199,9 +199,9 @@ struct TParameter ...@@ -199,9 +199,9 @@ struct TParameter
const TVariable *createVariable(TSymbolTable *symbolTable) const TVariable *createVariable(TSymbolTable *symbolTable)
{ {
const ImmutableString constName(name); const ImmutableString constName(name);
const TType *constType = type; const TType *constType = type;
name = nullptr; name = nullptr;
type = nullptr; type = nullptr;
return new TVariable(symbolTable, constName, constType, return new TVariable(symbolTable, constName, constType,
constName.empty() ? SymbolType::Empty : SymbolType::UserDefined); constName.empty() ? SymbolType::Empty : SymbolType::UserDefined);
} }
......
...@@ -22,7 +22,7 @@ class TSymbolUniqueId ...@@ -22,7 +22,7 @@ class TSymbolUniqueId
POOL_ALLOCATOR_NEW_DELETE(); POOL_ALLOCATOR_NEW_DELETE();
explicit TSymbolUniqueId(const TSymbol &symbol); explicit TSymbolUniqueId(const TSymbol &symbol);
constexpr TSymbolUniqueId(const TSymbolUniqueId &) = default; constexpr TSymbolUniqueId(const TSymbolUniqueId &) = default;
TSymbolUniqueId &operator=(const TSymbolUniqueId &); TSymbolUniqueId &operator =(const TSymbolUniqueId &);
bool operator==(const TSymbolUniqueId &) const; bool operator==(const TSymbolUniqueId &) const;
constexpr int get() const { return mId; } constexpr int get() const { return mId; }
......
...@@ -268,7 +268,7 @@ void TranslatorVulkan::translate(TIntermBlock *root, ...@@ -268,7 +268,7 @@ void TranslatorVulkan::translate(TIntermBlock *root,
sink << "#version 450 core\n"; sink << "#version 450 core\n";
// Write out default uniforms into a uniform block assigned to a specific set/binding. // Write out default uniforms into a uniform block assigned to a specific set/binding.
int defaultUniformCount = 0; int defaultUniformCount = 0;
int structTypesUsedForUniforms = 0; int structTypesUsedForUniforms = 0;
for (const auto &uniform : getUniforms()) for (const auto &uniform : getUniforms())
{ {
......
...@@ -191,9 +191,10 @@ class TType ...@@ -191,9 +191,10 @@ class TType
const TVector<unsigned int> *getArraySizes() const { return mArraySizes; } const TVector<unsigned int> *getArraySizes() const { return mArraySizes; }
unsigned int getArraySizeProduct() const; unsigned int getArraySizeProduct() const;
bool isUnsizedArray() const; bool isUnsizedArray() const;
unsigned int getOutermostArraySize() const { unsigned int getOutermostArraySize() const
ASSERT(isArray()); {
return mArraySizes->back(); ASSERT(isArray());
return mArraySizes->back();
} }
void makeArray(unsigned int s); void makeArray(unsigned int s);
......
...@@ -67,13 +67,13 @@ LinkedUniform::LinkedUniform(GLenum typeIn, ...@@ -67,13 +67,13 @@ LinkedUniform::LinkedUniform(GLenum typeIn,
const sh::BlockMemberInfo &blockInfoIn) const sh::BlockMemberInfo &blockInfoIn)
: typeInfo(&GetUniformTypeInfo(typeIn)), bufferIndex(bufferIndexIn), blockInfo(blockInfoIn) : typeInfo(&GetUniformTypeInfo(typeIn)), bufferIndex(bufferIndexIn), blockInfo(blockInfoIn)
{ {
type = typeIn; type = typeIn;
precision = precisionIn; precision = precisionIn;
name = nameIn; name = nameIn;
arraySizes = arraySizesIn; arraySizes = arraySizesIn;
binding = bindingIn; binding = bindingIn;
offset = offsetIn; offset = offsetIn;
location = locationIn; location = locationIn;
ASSERT(!isArrayOfArrays()); ASSERT(!isArrayOfArrays());
ASSERT(!isArray() || !isStruct()); ASSERT(!isArray() || !isStruct());
} }
...@@ -99,11 +99,11 @@ LinkedUniform::LinkedUniform(const LinkedUniform &uniform) ...@@ -99,11 +99,11 @@ LinkedUniform::LinkedUniform(const LinkedUniform &uniform)
LinkedUniform &LinkedUniform::operator=(const LinkedUniform &uniform) LinkedUniform &LinkedUniform::operator=(const LinkedUniform &uniform)
{ {
sh::Uniform::operator=(uniform); sh::Uniform::operator =(uniform);
ActiveVariable::operator=(uniform); ActiveVariable::operator=(uniform);
typeInfo = uniform.typeInfo; typeInfo = uniform.typeInfo;
bufferIndex = uniform.bufferIndex; bufferIndex = uniform.bufferIndex;
blockInfo = uniform.blockInfo; blockInfo = uniform.blockInfo;
return *this; return *this;
} }
...@@ -159,9 +159,9 @@ BufferVariable::BufferVariable(GLenum typeIn, ...@@ -159,9 +159,9 @@ BufferVariable::BufferVariable(GLenum typeIn,
const sh::BlockMemberInfo &blockInfoIn) const sh::BlockMemberInfo &blockInfoIn)
: bufferIndex(bufferIndexIn), blockInfo(blockInfoIn), topLevelArraySize(-1) : bufferIndex(bufferIndexIn), blockInfo(blockInfoIn), topLevelArraySize(-1)
{ {
type = typeIn; type = typeIn;
precision = precisionIn; precision = precisionIn;
name = nameIn; name = nameIn;
arraySizes = arraySizesIn; arraySizes = arraySizesIn;
} }
......
...@@ -148,12 +148,12 @@ gl::Error ContextVk::setupDraw(const gl::Context *context, ...@@ -148,12 +148,12 @@ gl::Error ContextVk::setupDraw(const gl::Context *context,
ANGLE_TRY(initPipeline()); ANGLE_TRY(initPipeline());
} }
const auto &state = mState.getState(); const auto &state = mState.getState();
const gl::Program *programGL = state.getProgram(); const gl::Program *programGL = state.getProgram();
ProgramVk *programVk = vk::GetImpl(programGL); ProgramVk *programVk = vk::GetImpl(programGL);
const gl::Framebuffer *framebuffer = state.getDrawFramebuffer(); const gl::Framebuffer *framebuffer = state.getDrawFramebuffer();
FramebufferVk *framebufferVk = vk::GetImpl(framebuffer); FramebufferVk *framebufferVk = vk::GetImpl(framebuffer);
Serial queueSerial = mRenderer->getCurrentQueueSerial(); Serial queueSerial = mRenderer->getCurrentQueueSerial();
vk::RecordingMode mode = vk::RecordingMode::Start; vk::RecordingMode mode = vk::RecordingMode::Start;
ANGLE_TRY(framebufferVk->getCommandBufferForDraw(this, commandBufferOut, &mode)); ANGLE_TRY(framebufferVk->getCommandBufferForDraw(this, commandBufferOut, &mode));
...@@ -165,7 +165,7 @@ gl::Error ContextVk::setupDraw(const gl::Context *context, ...@@ -165,7 +165,7 @@ gl::Error ContextVk::setupDraw(const gl::Context *context,
} }
else else
{ {
*shouldApplyVertexArrayOut = mVertexArrayBindingHasChanged; *shouldApplyVertexArrayOut = mVertexArrayBindingHasChanged;
} }
mVertexArrayBindingHasChanged = false; mVertexArrayBindingHasChanged = false;
......
...@@ -113,7 +113,7 @@ gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask) ...@@ -113,7 +113,7 @@ gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask)
Serial currentSerial = renderer->getCurrentQueueSerial(); Serial currentSerial = renderer->getCurrentQueueSerial();
// This command buffer is only started once. // This command buffer is only started once.
vk::CommandBuffer *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
const gl::FramebufferAttachment *depthAttachment = mState.getDepthAttachment(); const gl::FramebufferAttachment *depthAttachment = mState.getDepthAttachment();
bool clearDepth = (depthAttachment && (mask & GL_DEPTH_BUFFER_BIT) != 0); bool clearDepth = (depthAttachment && (mask & GL_DEPTH_BUFFER_BIT) != 0);
...@@ -203,7 +203,7 @@ gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask) ...@@ -203,7 +203,7 @@ gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask)
} }
// TODO(jmadill): Support gaps in RenderTargets. http://anglebug.com/2394 // TODO(jmadill): Support gaps in RenderTargets. http://anglebug.com/2394
const auto &colorRenderTargets = mRenderTargetCache.getColors(); const auto &colorRenderTargets = mRenderTargetCache.getColors();
const VkClearColorValue &clearColorValue = contextVk->getClearColorValue().color; const VkClearColorValue &clearColorValue = contextVk->getClearColorValue().color;
for (size_t colorIndex : mState.getEnabledDrawBuffers()) for (size_t colorIndex : mState.getEnabledDrawBuffers())
{ {
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
#include <ShaderLang.h> #include <ShaderLang.h>
// Other glslang includes. // Other glslang includes.
#include <StandAlone/ResourceLimits.h>
#include <SPIRV/GlslangToSpv.h> #include <SPIRV/GlslangToSpv.h>
#include <StandAlone/ResourceLimits.h>
#include <array> #include <array>
...@@ -148,7 +148,7 @@ gl::LinkResult GlslangWrapper::linkProgram(const gl::Context *glContext, ...@@ -148,7 +148,7 @@ gl::LinkResult GlslangWrapper::linkProgram(const gl::Context *glContext,
// Assign varying locations. // Assign varying locations.
for (const gl::PackedVaryingRegister &varyingReg : resources.varyingPacking.getRegisterList()) for (const gl::PackedVaryingRegister &varyingReg : resources.varyingPacking.getRegisterList())
{ {
const auto &varying = *varyingReg.packedVarying; const auto &varying = *varyingReg.packedVarying;
std::string locationString = "location = " + Str(varyingReg.registerRow); std::string locationString = "location = " + Str(varyingReg.registerRow);
if (varyingReg.registerColumn > 0) if (varyingReg.registerColumn > 0)
...@@ -193,7 +193,7 @@ gl::LinkResult GlslangWrapper::linkProgram(const gl::Context *glContext, ...@@ -193,7 +193,7 @@ gl::LinkResult GlslangWrapper::linkProgram(const gl::Context *glContext,
for (unsigned int uniformIndex : programState.getSamplerUniformRange()) for (unsigned int uniformIndex : programState.getSamplerUniformRange())
{ {
const gl::LinkedUniform &samplerUniform = uniforms[uniformIndex]; const gl::LinkedUniform &samplerUniform = uniforms[uniformIndex];
std::string setBindingString = "set = 1, binding = " + Str(textureCount); std::string setBindingString = "set = 1, binding = " + Str(textureCount);
std::string samplerName = gl::ParseResourceName(samplerUniform.name, nullptr); std::string samplerName = gl::ParseResourceName(samplerUniform.name, nullptr);
...@@ -233,7 +233,7 @@ gl::LinkResult GlslangWrapper::linkProgram(const gl::Context *glContext, ...@@ -233,7 +233,7 @@ gl::LinkResult GlslangWrapper::linkProgram(const gl::Context *glContext,
} }
std::array<const char *, 2> strings = {{vertexSource.c_str(), fragmentSource.c_str()}}; std::array<const char *, 2> strings = {{vertexSource.c_str(), fragmentSource.c_str()}};
std::array<int, 2> lengths = { std::array<int, 2> lengths = {
{static_cast<int>(vertexSource.length()), static_cast<int>(fragmentSource.length())}}; {static_cast<int>(vertexSource.length()), static_cast<int>(fragmentSource.length())}};
// Enable SPIR-V and Vulkan rules when parsing GLSL // Enable SPIR-V and Vulkan rules when parsing GLSL
......
...@@ -193,7 +193,7 @@ vk::Error ProgramVk::reset(ContextVk *contextVk) ...@@ -193,7 +193,7 @@ vk::Error ProgramVk::reset(ContextVk *contextVk)
mDescriptorSets.clear(); mDescriptorSets.clear();
mUsedDescriptorSetRange.invalidate(); mUsedDescriptorSetRange.invalidate();
mDirtyTextures = false; mDirtyTextures = false;
return vk::NoError(); return vk::NoError();
} }
...@@ -359,8 +359,8 @@ gl::Error ProgramVk::initDefaultUniformBlocks(const gl::Context *glContext) ...@@ -359,8 +359,8 @@ gl::Error ProgramVk::initDefaultUniformBlocks(const gl::Context *glContext)
auto it = layoutMap[shaderType].find(uniformName); auto it = layoutMap[shaderType].find(uniformName);
if (it != layoutMap[shaderType].end()) if (it != layoutMap[shaderType].end())
{ {
found = true; found = true;
layoutInfo[shaderType] = it->second; layoutInfo[shaderType] = it->second;
} }
} }
...@@ -523,7 +523,7 @@ void ProgramVk::getUniformImpl(GLint location, T *v, GLenum entryPointType) cons ...@@ -523,7 +523,7 @@ void ProgramVk::getUniformImpl(GLint location, T *v, GLenum entryPointType) cons
const DefaultUniformBlock &uniformBlock = const DefaultUniformBlock &uniformBlock =
mDefaultUniformBlocks[static_cast<vk::ShaderType>(shaderType)]; mDefaultUniformBlocks[static_cast<vk::ShaderType>(shaderType)];
const sh::BlockMemberInfo &layoutInfo = uniformBlock.uniformLayout[location]; const sh::BlockMemberInfo &layoutInfo = uniformBlock.uniformLayout[location];
ASSERT(linkedUniform.typeInfo->componentType == entryPointType || ASSERT(linkedUniform.typeInfo->componentType == entryPointType ||
linkedUniform.typeInfo->componentType == gl::VariableBoolVectorType(entryPointType)); linkedUniform.typeInfo->componentType == gl::VariableBoolVectorType(entryPointType));
......
...@@ -494,11 +494,11 @@ vk::Error RendererVk::initializeDevice(uint32_t queueFamilyIndex) ...@@ -494,11 +494,11 @@ vk::Error RendererVk::initializeDevice(uint32_t queueFamilyIndex)
// Initialize the device // Initialize the device
VkDeviceCreateInfo createInfo; VkDeviceCreateInfo createInfo;
createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
createInfo.pNext = nullptr; createInfo.pNext = nullptr;
createInfo.flags = 0; createInfo.flags = 0;
createInfo.queueCreateInfoCount = 1; createInfo.queueCreateInfoCount = 1;
createInfo.pQueueCreateInfos = &queueCreateInfo; createInfo.pQueueCreateInfos = &queueCreateInfo;
createInfo.enabledLayerCount = enabledLayerCount; createInfo.enabledLayerCount = enabledLayerCount;
createInfo.ppEnabledLayerNames = enabledLayerNames; createInfo.ppEnabledLayerNames = enabledLayerNames;
createInfo.enabledExtensionCount = static_cast<uint32_t>(enabledDeviceExtensions.size()); createInfo.enabledExtensionCount = static_cast<uint32_t>(enabledDeviceExtensions.size());
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
#ifndef LIBANGLE_RENDERER_VULKAN_RENDERERVK_H_ #ifndef LIBANGLE_RENDERER_VULKAN_RENDERERVK_H_
#define LIBANGLE_RENDERER_VULKAN_RENDERERVK_H_ #define LIBANGLE_RENDERER_VULKAN_RENDERERVK_H_
#include <memory>
#include <vulkan/vulkan.h> #include <vulkan/vulkan.h>
#include <memory>
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libANGLE/Caps.h" #include "libANGLE/Caps.h"
......
...@@ -418,7 +418,7 @@ gl::Error LineLoopHelper::getIndexBufferForElementArrayBuffer(RendererVk *render ...@@ -418,7 +418,7 @@ gl::Error LineLoopHelper::getIndexBufferForElementArrayBuffer(RendererVk *render
{ {
ASSERT(indexType == VK_INDEX_TYPE_UINT16 || indexType == VK_INDEX_TYPE_UINT32); ASSERT(indexType == VK_INDEX_TYPE_UINT16 || indexType == VK_INDEX_TYPE_UINT32);
uint32_t *indices = nullptr; uint32_t *indices = nullptr;
uint32_t destinationOffset = 0; uint32_t destinationOffset = 0;
auto unitSize = (indexType == VK_INDEX_TYPE_UINT16 ? sizeof(uint16_t) : sizeof(uint32_t)); auto unitSize = (indexType == VK_INDEX_TYPE_UINT16 ? sizeof(uint16_t) : sizeof(uint32_t));
...@@ -605,12 +605,12 @@ Error ImageHelper::initImageView(VkDevice device, ...@@ -605,12 +605,12 @@ Error ImageHelper::initImageView(VkDevice device,
uint32_t levelCount) uint32_t levelCount)
{ {
VkImageViewCreateInfo viewInfo; VkImageViewCreateInfo viewInfo;
viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
viewInfo.pNext = nullptr; viewInfo.pNext = nullptr;
viewInfo.flags = 0; viewInfo.flags = 0;
viewInfo.image = mImage.getHandle(); viewInfo.image = mImage.getHandle();
viewInfo.viewType = gl_vk::GetImageViewType(textureType); viewInfo.viewType = gl_vk::GetImageViewType(textureType);
viewInfo.format = mFormat->vkTextureFormat; viewInfo.format = mFormat->vkTextureFormat;
if (swizzleMap.swizzleRequired()) if (swizzleMap.swizzleRequired())
{ {
viewInfo.components.r = gl_vk::GetSwizzle(swizzleMap.swizzleRed); viewInfo.components.r = gl_vk::GetSwizzle(swizzleMap.swizzleRed);
......
...@@ -26,10 +26,7 @@ class GLSLTest : public ANGLETest ...@@ -26,10 +26,7 @@ class GLSLTest : public ANGLETest
setConfigAlphaBits(8); setConfigAlphaBits(8);
} }
virtual void SetUp() virtual void SetUp() { ANGLETest::SetUp(); }
{
ANGLETest::SetUp();
}
std::string GenerateVaryingType(GLint vectorSize) std::string GenerateVaryingType(GLint vectorSize)
{ {
...@@ -57,7 +54,8 @@ class GLSLTest : public ANGLETest ...@@ -57,7 +54,8 @@ class GLSLTest : public ANGLETest
} }
else else
{ {
sprintf(buff, "varying %s v%d[%d];\n", GenerateVaryingType(vectorSize).c_str(), id, arraySize); sprintf(buff, "varying %s v%d[%d];\n", GenerateVaryingType(vectorSize).c_str(), id,
arraySize);
} }
return std::string(buff); return std::string(buff);
...@@ -77,7 +75,8 @@ class GLSLTest : public ANGLETest ...@@ -77,7 +75,8 @@ class GLSLTest : public ANGLETest
{ {
for (int i = 0; i < arraySize; i++) for (int i = 0; i < arraySize; i++)
{ {
sprintf(buff, "\t v%d[%d] = %s(1.0);\n", id, i, GenerateVaryingType(vectorSize).c_str()); sprintf(buff, "\t v%d[%d] = %s(1.0);\n", id, i,
GenerateVaryingType(vectorSize).c_str());
returnString += buff; returnString += buff;
} }
} }
...@@ -106,11 +105,22 @@ class GLSLTest : public ANGLETest ...@@ -106,11 +105,22 @@ class GLSLTest : public ANGLETest
} }
} }
void GenerateGLSLWithVaryings(GLint floatCount, GLint floatArrayCount, GLint vec2Count, GLint vec2ArrayCount, GLint vec3Count, GLint vec3ArrayCount, void GenerateGLSLWithVaryings(GLint floatCount,
GLint vec4Count, GLint vec4ArrayCount, bool useFragCoord, bool usePointCoord, bool usePointSize, GLint floatArrayCount,
std::string* fragmentShader, std::string* vertexShader) GLint vec2Count,
GLint vec2ArrayCount,
GLint vec3Count,
GLint vec3ArrayCount,
GLint vec4Count,
GLint vec4ArrayCount,
bool useFragCoord,
bool usePointCoord,
bool usePointSize,
std::string *fragmentShader,
std::string *vertexShader)
{ {
// Generate a string declaring the varyings, to share between the fragment shader and the vertex shader. // Generate a string declaring the varyings, to share between the fragment shader and the
// vertex shader.
std::string varyingDeclaration; std::string varyingDeclaration;
unsigned int varyingCount = 0; unsigned int varyingCount = 0;
...@@ -303,7 +313,7 @@ class GLSLTest : public ANGLETest ...@@ -303,7 +313,7 @@ class GLSLTest : public ANGLETest
// Set gl_FragColor, and use special variables if requested // Set gl_FragColor, and use special variables if requested
fragmentShader->append("\tgl_FragColor = retColor"); fragmentShader->append("\tgl_FragColor = retColor");
if (useFragCoord) if (useFragCoord)
{ {
fragmentShader->append(" + gl_FragCoord"); fragmentShader->append(" + gl_FragCoord");
...@@ -317,15 +327,26 @@ class GLSLTest : public ANGLETest ...@@ -317,15 +327,26 @@ class GLSLTest : public ANGLETest
fragmentShader->append(";\n}"); fragmentShader->append(";\n}");
} }
void VaryingTestBase(GLint floatCount, GLint floatArrayCount, GLint vec2Count, GLint vec2ArrayCount, GLint vec3Count, GLint vec3ArrayCount, void VaryingTestBase(GLint floatCount,
GLint vec4Count, GLint vec4ArrayCount, bool useFragCoord, bool usePointCoord, bool usePointSize, bool expectSuccess) GLint floatArrayCount,
GLint vec2Count,
GLint vec2ArrayCount,
GLint vec3Count,
GLint vec3ArrayCount,
GLint vec4Count,
GLint vec4ArrayCount,
bool useFragCoord,
bool usePointCoord,
bool usePointSize,
bool expectSuccess)
{ {
std::string fragmentShaderSource; std::string fragmentShaderSource;
std::string vertexShaderSource; std::string vertexShaderSource;
GenerateGLSLWithVaryings(floatCount, floatArrayCount, vec2Count, vec2ArrayCount, vec3Count, vec3ArrayCount, GenerateGLSLWithVaryings(floatCount, floatArrayCount, vec2Count, vec2ArrayCount, vec3Count,
vec4Count, vec4ArrayCount, useFragCoord, usePointCoord, usePointSize, vec3ArrayCount, vec4Count, vec4ArrayCount, useFragCoord,
&fragmentShaderSource, &vertexShaderSource); usePointCoord, usePointSize, &fragmentShaderSource,
&vertexShaderSource);
GLuint program = CompileProgram(vertexShaderSource, fragmentShaderSource); GLuint program = CompileProgram(vertexShaderSource, fragmentShaderSource);
...@@ -478,18 +499,12 @@ class GLSLTestNoValidation : public GLSLTest ...@@ -478,18 +499,12 @@ class GLSLTestNoValidation : public GLSLTest
class GLSLTest_ES3 : public GLSLTest class GLSLTest_ES3 : public GLSLTest
{ {
void SetUp() override void SetUp() override { ANGLETest::SetUp(); }
{
ANGLETest::SetUp();
}
}; };
class GLSLTest_ES31 : public GLSLTest class GLSLTest_ES31 : public GLSLTest
{ {
void SetUp() override void SetUp() override { ANGLETest::SetUp(); }
{
ANGLETest::SetUp();
}
}; };
TEST_P(GLSLTest, NamelessScopedStructs) TEST_P(GLSLTest, NamelessScopedStructs)
...@@ -638,7 +653,7 @@ TEST_P(GLSLTest, ElseIfRewriting) ...@@ -638,7 +653,7 @@ TEST_P(GLSLTest, ElseIfRewriting)
drawQuad(program, "a_position", 0.5f); drawQuad(program, "a_position", 0.5f);
EXPECT_PIXEL_EQ(0, 0, 255, 0, 0, 255); EXPECT_PIXEL_EQ(0, 0, 255, 0, 0, 255);
EXPECT_PIXEL_EQ(getWindowWidth()-1, 0, 0, 255, 0, 255); EXPECT_PIXEL_EQ(getWindowWidth() - 1, 0, 0, 255, 0, 255);
} }
TEST_P(GLSLTest, TwoElseIfRewriting) TEST_P(GLSLTest, TwoElseIfRewriting)
...@@ -1308,15 +1323,16 @@ TEST_P(GLSLTest, MaxVaryingVec2Arrays) ...@@ -1308,15 +1323,16 @@ TEST_P(GLSLTest, MaxVaryingVec2Arrays)
VaryingTestBase(0, 0, 0, maxVec2Arrays, 0, 0, 0, 0, false, false, false, true); VaryingTestBase(0, 0, 0, maxVec2Arrays, 0, 0, 0, 0, false, false, false, true);
} }
// Verify shader source with a fixed length that is less than the null-terminated length will compile. // Verify shader source with a fixed length that is less than the null-terminated length will
// compile.
TEST_P(GLSLTest, FixedShaderLength) TEST_P(GLSLTest, FixedShaderLength)
{ {
GLuint shader = glCreateShader(GL_FRAGMENT_SHADER); GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
const std::string appendGarbage = "abcasdfasdfasdfasdfasdf"; const std::string appendGarbage = "abcasdfasdfasdfasdfasdf";
const std::string source = "void main() { gl_FragColor = vec4(0, 0, 0, 0); }" + appendGarbage; const std::string source = "void main() { gl_FragColor = vec4(0, 0, 0, 0); }" + appendGarbage;
const char *sourceArray[1] = { source.c_str() }; const char *sourceArray[1] = {source.c_str()};
GLint lengths[1] = { static_cast<GLint>(source.length() - appendGarbage.length()) }; GLint lengths[1] = {static_cast<GLint>(source.length() - appendGarbage.length())};
glShaderSource(shader, static_cast<GLsizei>(ArraySize(sourceArray)), sourceArray, lengths); glShaderSource(shader, static_cast<GLsizei>(ArraySize(sourceArray)), sourceArray, lengths);
glCompileShader(shader); glCompileShader(shader);
...@@ -1331,7 +1347,7 @@ TEST_P(GLSLTest, NegativeShaderLength) ...@@ -1331,7 +1347,7 @@ TEST_P(GLSLTest, NegativeShaderLength)
GLuint shader = glCreateShader(GL_FRAGMENT_SHADER); GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
const char *sourceArray[1] = {essl1_shaders::fs::Red()}; const char *sourceArray[1] = {essl1_shaders::fs::Red()};
GLint lengths[1] = { -10 }; GLint lengths[1] = {-10};
glShaderSource(shader, static_cast<GLsizei>(ArraySize(sourceArray)), sourceArray, lengths); glShaderSource(shader, static_cast<GLsizei>(ArraySize(sourceArray)), sourceArray, lengths);
glCompileShader(shader); glCompileShader(shader);
...@@ -1358,19 +1374,11 @@ TEST_P(GLSLTest, MixedShaderLengths) ...@@ -1358,19 +1374,11 @@ TEST_P(GLSLTest, MixedShaderLengths)
{ {
GLuint shader = glCreateShader(GL_FRAGMENT_SHADER); GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
const char *sourceArray[] = const char *sourceArray[] = {
{ "void main()", "{", " gl_FragColor = vec4(0, 0, 0, 0);", "}",
"void main()",
"{",
" gl_FragColor = vec4(0, 0, 0, 0);",
"}",
}; };
GLint lengths[] = GLint lengths[] = {
{ -10, 1, static_cast<GLint>(strlen(sourceArray[2])), -1,
-10,
1,
static_cast<GLint>(strlen(sourceArray[2])),
-1,
}; };
ASSERT_EQ(ArraySize(sourceArray), ArraySize(lengths)); ASSERT_EQ(ArraySize(sourceArray), ArraySize(lengths));
...@@ -1387,21 +1395,11 @@ TEST_P(GLSLTest, ZeroShaderLength) ...@@ -1387,21 +1395,11 @@ TEST_P(GLSLTest, ZeroShaderLength)
{ {
GLuint shader = glCreateShader(GL_FRAGMENT_SHADER); GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
const char *sourceArray[] = const char *sourceArray[] = {
{ "adfasdf", "34534", "void main() { gl_FragColor = vec4(0, 0, 0, 0); }", "", "asdfasdfsdsdf",
"adfasdf",
"34534",
"void main() { gl_FragColor = vec4(0, 0, 0, 0); }",
"",
"asdfasdfsdsdf",
}; };
GLint lengths[] = GLint lengths[] = {
{ 0, 0, -1, 0, 0,
0,
0,
-1,
0,
0,
}; };
ASSERT_EQ(ArraySize(sourceArray), ArraySize(lengths)); ASSERT_EQ(ArraySize(sourceArray), ArraySize(lengths));
...@@ -4292,7 +4290,8 @@ ANGLE_INSTANTIATE_TEST(GLSLTest, ...@@ -4292,7 +4290,8 @@ ANGLE_INSTANTIATE_TEST(GLSLTest,
ES2_OPENGLES(), ES2_OPENGLES(),
ES3_OPENGLES()); ES3_OPENGLES());
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against.
ANGLE_INSTANTIATE_TEST(GLSLTest_ES3, ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES()); ANGLE_INSTANTIATE_TEST(GLSLTest_ES3, ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES());
ANGLE_INSTANTIATE_TEST(WebGLGLSLTest, ES2_D3D11(), ES2_OPENGL(), ES2_OPENGLES()); ANGLE_INSTANTIATE_TEST(WebGLGLSLTest, ES2_D3D11(), ES2_OPENGL(), ES2_OPENGLES());
......
...@@ -200,6 +200,7 @@ class Texture2DTest : public TexCoordDrawTest ...@@ -200,6 +200,7 @@ class Texture2DTest : public TexCoordDrawTest
!extensionEnabled("GL_CHROMIUM_color_buffer_float_rgb")); !extensionEnabled("GL_CHROMIUM_color_buffer_float_rgb"));
} }
// clang-format off
GLfloat sourceImageData[4][16] = GLfloat sourceImageData[4][16] =
{ {
{ // R { // R
...@@ -227,31 +228,24 @@ class Texture2DTest : public TexCoordDrawTest ...@@ -227,31 +228,24 @@ class Texture2DTest : public TexCoordDrawTest
1.0f, 1.0f, 0.0f, 1.0f 1.0f, 1.0f, 0.0f, 1.0f
}, },
}; };
// clang-format on
GLenum imageFormats[] = GLenum imageFormats[] = {
{ GL_R32F, GL_RG32F, GL_RGB32F, GL_RGBA32F,
GL_R32F,
GL_RG32F,
GL_RGB32F,
GL_RGBA32F,
}; };
GLenum sourceUnsizedFormats[] = GLenum sourceUnsizedFormats[] = {
{ GL_RED, GL_RG, GL_RGB, GL_RGBA,
GL_RED,
GL_RG,
GL_RGB,
GL_RGBA,
}; };
GLuint textures[2]; GLuint textures[2];
glGenTextures(2, textures); glGenTextures(2, textures);
GLfloat *imageData = sourceImageData[sourceImageChannels - 1]; GLfloat *imageData = sourceImageData[sourceImageChannels - 1];
GLenum sourceImageFormat = imageFormats[sourceImageChannels - 1]; GLenum sourceImageFormat = imageFormats[sourceImageChannels - 1];
GLenum sourceUnsizedFormat = sourceUnsizedFormats[sourceImageChannels - 1]; GLenum sourceUnsizedFormat = sourceUnsizedFormats[sourceImageChannels - 1];
GLenum destImageFormat = imageFormats[destImageChannels - 1]; GLenum destImageFormat = imageFormats[destImageChannels - 1];
glBindTexture(GL_TEXTURE_2D, textures[0]); glBindTexture(GL_TEXTURE_2D, textures[0]);
if (getClientMajorVersion() >= 3) if (getClientMajorVersion() >= 3)
...@@ -661,7 +655,6 @@ class SamplerArrayTest : public TexCoordDrawTest ...@@ -661,7 +655,6 @@ class SamplerArrayTest : public TexCoordDrawTest
GLint mTexture1UniformLocation; GLint mTexture1UniformLocation;
}; };
class SamplerArrayAsFunctionParameterTest : public SamplerArrayTest class SamplerArrayAsFunctionParameterTest : public SamplerArrayTest
{ {
protected: protected:
...@@ -1190,7 +1183,7 @@ TEST_P(Texture2DTest, NegativeAPISubImage) ...@@ -1190,7 +1183,7 @@ TEST_P(Texture2DTest, NegativeAPISubImage)
setUpProgram(); setUpProgram();
const GLubyte *pixels[20] = { 0 }; const GLubyte *pixels[20] = {0};
glTexSubImage2D(GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels); glTexSubImage2D(GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
EXPECT_GL_ERROR(GL_INVALID_VALUE); EXPECT_GL_ERROR(GL_INVALID_VALUE);
...@@ -1241,7 +1234,7 @@ TEST_P(Texture2DTest, ZeroSizedUploads) ...@@ -1241,7 +1234,7 @@ TEST_P(Texture2DTest, ZeroSizedUploads)
glUniform1i(mTexture2DUniformLocation, 0); glUniform1i(mTexture2DUniformLocation, 0);
drawQuad(mProgram, "position", 0.5f); drawQuad(mProgram, "position", 0.5f);
const GLubyte *pixel[4] = { 0 }; const GLubyte *pixel[4] = {0};
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixel); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
...@@ -1389,7 +1382,8 @@ TEST_P(TextureCubeTest, CubeMapFBO) ...@@ -1389,7 +1382,8 @@ TEST_P(TextureCubeTest, CubeMapFBO)
glBindFramebuffer(GL_FRAMEBUFFER, fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glBindTexture(GL_TEXTURE_CUBE_MAP, mTextureCube); glBindTexture(GL_TEXTURE_CUBE_MAP, mTextureCube);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, mTextureCube, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
mTextureCube, 0);
EXPECT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER)); EXPECT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER));
...@@ -1398,12 +1392,13 @@ TEST_P(TextureCubeTest, CubeMapFBO) ...@@ -1398,12 +1392,13 @@ TEST_P(TextureCubeTest, CubeMapFBO)
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
} }
// Test that glTexSubImage2D works properly when glTexStorage2DEXT has initialized the image with a default color. // Test that glTexSubImage2D works properly when glTexStorage2DEXT has initialized the image with a
// default color.
TEST_P(Texture2DTest, TexStorage) TEST_P(Texture2DTest, TexStorage)
{ {
ANGLE_SKIP_TEST_IF(getClientMajorVersion() < 3 && !extensionEnabled("GL_EXT_texture_storage")); ANGLE_SKIP_TEST_IF(getClientMajorVersion() < 3 && !extensionEnabled("GL_EXT_texture_storage"));
int width = getWindowWidth(); int width = getWindowWidth();
int height = getWindowHeight(); int height = getWindowHeight();
GLuint tex2D; GLuint tex2D;
...@@ -1421,8 +1416,8 @@ TEST_P(Texture2DTest, TexStorage) ...@@ -1421,8 +1416,8 @@ TEST_P(Texture2DTest, TexStorage)
} }
// ANGLE internally uses RGBA as the DirectX format for RGB images // ANGLE internally uses RGBA as the DirectX format for RGB images
// therefore glTexStorage2DEXT initializes the image to a default color to get a consistent alpha color. // therefore glTexStorage2DEXT initializes the image to a default color to get a consistent
// The data is kept in a CPU-side image and the image is marked as dirty. // alpha color. The data is kept in a CPU-side image and the image is marked as dirty.
if (getClientMajorVersion() >= 3) if (getClientMajorVersion() >= 3)
{ {
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGB8, 16, 16); glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGB8, 16, 16);
...@@ -1452,12 +1447,13 @@ TEST_P(Texture2DTest, TexStorage) ...@@ -1452,12 +1447,13 @@ TEST_P(Texture2DTest, TexStorage)
EXPECT_EQ(255, pixel.A); EXPECT_EQ(255, pixel.A);
} }
// Test that glTexSubImage2D combined with a PBO works properly when glTexStorage2DEXT has initialized the image with a default color. // Test that glTexSubImage2D combined with a PBO works properly when glTexStorage2DEXT has
// initialized the image with a default color.
TEST_P(Texture2DTest, TexStorageWithPBO) TEST_P(Texture2DTest, TexStorageWithPBO)
{ {
if (extensionEnabled("NV_pixel_buffer_object")) if (extensionEnabled("NV_pixel_buffer_object"))
{ {
int width = getWindowWidth(); int width = getWindowWidth();
int height = getWindowHeight(); int height = getWindowHeight();
GLuint tex2D; GLuint tex2D;
...@@ -1481,8 +1477,8 @@ TEST_P(Texture2DTest, TexStorageWithPBO) ...@@ -1481,8 +1477,8 @@ TEST_P(Texture2DTest, TexStorageWithPBO)
glBufferData(GL_PIXEL_UNPACK_BUFFER, 3 * 16 * 16, pixels.data(), GL_STATIC_DRAW); glBufferData(GL_PIXEL_UNPACK_BUFFER, 3 * 16 * 16, pixels.data(), GL_STATIC_DRAW);
// ANGLE internally uses RGBA as the DirectX format for RGB images // ANGLE internally uses RGBA as the DirectX format for RGB images
// therefore glTexStorage2DEXT initializes the image to a default color to get a consistent alpha color. // therefore glTexStorage2DEXT initializes the image to a default color to get a consistent
// The data is kept in a CPU-side image and the image is marked as dirty. // alpha color. The data is kept in a CPU-side image and the image is marked as dirty.
glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGB8, 16, 16); glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGB8, 16, 16);
// Initializes the color of the upper-left 8x8 pixels, leaves the other pixels untouched. // Initializes the color of the upper-left 8x8 pixels, leaves the other pixels untouched.
...@@ -1571,15 +1567,17 @@ TEST_P(Texture2DTest, CopySubImageFloat_RGBA_RGBA) ...@@ -1571,15 +1567,17 @@ TEST_P(Texture2DTest, CopySubImageFloat_RGBA_RGBA)
testFloatCopySubImage(4, 4); testFloatCopySubImage(4, 4);
} }
// Port of https://www.khronos.org/registry/webgl/conformance-suites/1.0.3/conformance/textures/texture-npot.html // Port of
// Run against GL_ALPHA/UNSIGNED_BYTE format, to ensure that D3D11 Feature Level 9_3 correctly handles GL_ALPHA // https://www.khronos.org/registry/webgl/conformance-suites/1.0.3/conformance/textures/texture-npot.html
// Run against GL_ALPHA/UNSIGNED_BYTE format, to ensure that D3D11 Feature Level 9_3 correctly
// handles GL_ALPHA
TEST_P(Texture2DTest, TextureNPOT_GL_ALPHA_UBYTE) TEST_P(Texture2DTest, TextureNPOT_GL_ALPHA_UBYTE)
{ {
// TODO(lucferron): DIRTY_BIT_UNPACK_STATE isn't implemented on Vulkan yet. // TODO(lucferron): DIRTY_BIT_UNPACK_STATE isn't implemented on Vulkan yet.
ANGLE_SKIP_TEST_IF(IsVulkan()); ANGLE_SKIP_TEST_IF(IsVulkan());
const int npotTexSize = 5; const int npotTexSize = 5;
const int potTexSize = 4; // Should be less than npotTexSize const int potTexSize = 4; // Should be less than npotTexSize
GLuint tex2D; GLuint tex2D;
if (extensionEnabled("GL_OES_texture_npot")) if (extensionEnabled("GL_OES_texture_npot"))
...@@ -1609,11 +1607,13 @@ TEST_P(Texture2DTest, TextureNPOT_GL_ALPHA_UBYTE) ...@@ -1609,11 +1607,13 @@ TEST_P(Texture2DTest, TextureNPOT_GL_ALPHA_UBYTE)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// Check that an NPOT texture not on level 0 generates INVALID_VALUE // Check that an NPOT texture not on level 0 generates INVALID_VALUE
glTexImage2D(GL_TEXTURE_2D, 1, GL_ALPHA, npotTexSize, npotTexSize, 0, GL_ALPHA, GL_UNSIGNED_BYTE, pixels.data()); glTexImage2D(GL_TEXTURE_2D, 1, GL_ALPHA, npotTexSize, npotTexSize, 0, GL_ALPHA,
GL_UNSIGNED_BYTE, pixels.data());
EXPECT_GL_ERROR(GL_INVALID_VALUE); EXPECT_GL_ERROR(GL_INVALID_VALUE);
// Check that an NPOT texture on level 0 succeeds // Check that an NPOT texture on level 0 succeeds
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, npotTexSize, npotTexSize, 0, GL_ALPHA, GL_UNSIGNED_BYTE, pixels.data()); glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, npotTexSize, npotTexSize, 0, GL_ALPHA,
GL_UNSIGNED_BYTE, pixels.data());
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
// Check that generateMipmap fails on NPOT // Check that generateMipmap fails on NPOT
...@@ -1644,7 +1644,8 @@ TEST_P(Texture2DTest, TextureNPOT_GL_ALPHA_UBYTE) ...@@ -1644,7 +1644,8 @@ TEST_P(Texture2DTest, TextureNPOT_GL_ALPHA_UBYTE)
EXPECT_PIXEL_EQ(getWindowWidth() / 2, getWindowHeight() / 2, 0, 0, 0, 64); EXPECT_PIXEL_EQ(getWindowWidth() / 2, getWindowHeight() / 2, 0, 0, 0, 64);
// Check that glTexImage2D for POT texture succeeds // Check that glTexImage2D for POT texture succeeds
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, potTexSize, potTexSize, 0, GL_ALPHA, GL_UNSIGNED_BYTE, pixels.data()); glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, potTexSize, potTexSize, 0, GL_ALPHA, GL_UNSIGNED_BYTE,
pixels.data());
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
// Check that generateMipmap for an POT texture succeeds // Check that generateMipmap for an POT texture succeeds
...@@ -2192,9 +2193,9 @@ TEST_P(Texture2DTestES3, SetImageWhenBaseLevelOutOfRange) ...@@ -2192,9 +2193,9 @@ TEST_P(Texture2DTestES3, SetImageWhenBaseLevelOutOfRange)
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green); EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
} }
// In the D3D11 renderer, we need to initialize some texture formats, to fill empty channels. EG RBA->RGBA8, with 1.0 // In the D3D11 renderer, we need to initialize some texture formats, to fill empty channels. EG
// in the alpha channel. This test covers a bug where redefining array textures with these formats does not work as // RBA->RGBA8, with 1.0 in the alpha channel. This test covers a bug where redefining array textures
// expected. // with these formats does not work as expected.
TEST_P(Texture2DArrayTestES3, RedefineInittableArray) TEST_P(Texture2DArrayTestES3, RedefineInittableArray)
{ {
std::vector<GLubyte> pixelData; std::vector<GLubyte> pixelData;
...@@ -2210,7 +2211,8 @@ TEST_P(Texture2DArrayTestES3, RedefineInittableArray) ...@@ -2210,7 +2211,8 @@ TEST_P(Texture2DArrayTestES3, RedefineInittableArray)
glUniform1i(mTextureArrayLocation, 0); glUniform1i(mTextureArrayLocation, 0);
// The first draw worked correctly. // The first draw worked correctly.
glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB, 4, 4, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, &pixelData[0]); glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB, 4, 4, 2, 0, GL_RGB, GL_UNSIGNED_BYTE,
&pixelData[0]);
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
...@@ -2220,7 +2222,8 @@ TEST_P(Texture2DArrayTestES3, RedefineInittableArray) ...@@ -2220,7 +2222,8 @@ TEST_P(Texture2DArrayTestES3, RedefineInittableArray)
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green); EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
// The dimension of the respecification must match the original exactly to trigger the bug. // The dimension of the respecification must match the original exactly to trigger the bug.
glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB, 4, 4, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, &pixelData[0]); glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB, 4, 4, 2, 0, GL_RGB, GL_UNSIGNED_BYTE,
&pixelData[0]);
drawQuad(mProgram, "position", 1.0f); drawQuad(mProgram, "position", 1.0f);
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green); EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
...@@ -2876,7 +2879,7 @@ class TextureLimitsTest : public ANGLETest ...@@ -2876,7 +2879,7 @@ class TextureLimitsTest : public ANGLETest
std::stringstream uniformNameStr; std::stringstream uniformNameStr;
uniformNameStr << vertexTexturePrefix << texIndex; uniformNameStr << vertexTexturePrefix << texIndex;
const std::string &uniformName = uniformNameStr.str(); const std::string &uniformName = uniformNameStr.str();
GLint location = glGetUniformLocation(mProgram, uniformName.c_str()); GLint location = glGetUniformLocation(mProgram, uniformName.c_str());
ASSERT_NE(-1, location); ASSERT_NE(-1, location);
glUniform1i(location, texIndex); glUniform1i(location, texIndex);
...@@ -2890,7 +2893,7 @@ class TextureLimitsTest : public ANGLETest ...@@ -2890,7 +2893,7 @@ class TextureLimitsTest : public ANGLETest
std::stringstream uniformNameStr; std::stringstream uniformNameStr;
uniformNameStr << fragmentTexturePrefix << texIndex; uniformNameStr << fragmentTexturePrefix << texIndex;
const std::string &uniformName = uniformNameStr.str(); const std::string &uniformName = uniformNameStr.str();
GLint location = glGetUniformLocation(mProgram, uniformName.c_str()); GLint location = glGetUniformLocation(mProgram, uniformName.c_str());
ASSERT_NE(-1, location); ASSERT_NE(-1, location);
glUniform1i(location, texIndex + vertexTextureCount); glUniform1i(location, texIndex + vertexTextureCount);
...@@ -3098,9 +3101,9 @@ class Texture2DNorm16TestES3 : public Texture2DTestES3 ...@@ -3098,9 +3101,9 @@ class Texture2DNorm16TestES3 : public Texture2DTestES3
GLubyte expectedValue = (type == GL_SHORT) ? 0xFF : static_cast<GLubyte>(pixelValue >> 8); GLubyte expectedValue = (type == GL_SHORT) ? 0xFF : static_cast<GLubyte>(pixelValue >> 8);
EXPECT_PIXEL_COLOR_EQ( EXPECT_PIXEL_COLOR_EQ(0, 0,
0, 0, SliceFormatColor( SliceFormatColor(format, GLColor(expectedValue, expectedValue,
format, GLColor(expectedValue, expectedValue, expectedValue, expectedValue))); expectedValue, expectedValue)));
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
...@@ -3109,7 +3112,7 @@ class Texture2DNorm16TestES3 : public Texture2DTestES3 ...@@ -3109,7 +3112,7 @@ class Texture2DNorm16TestES3 : public Texture2DTestES3
void testNorm16Render(GLint internalformat, GLenum format, GLenum type) void testNorm16Render(GLint internalformat, GLenum format, GLenum type)
{ {
GLushort pixelValue = 0x6A35; GLushort pixelValue = 0x6A35;
GLushort imageData[] = {pixelValue, pixelValue, pixelValue, pixelValue}; GLushort imageData[] = {pixelValue, pixelValue, pixelValue, pixelValue};
setUpProgram(); setUpProgram();
...@@ -3129,9 +3132,9 @@ class Texture2DNorm16TestES3 : public Texture2DTestES3 ...@@ -3129,9 +3132,9 @@ class Texture2DNorm16TestES3 : public Texture2DTestES3
drawQuad(mProgram, "position", 0.5f); drawQuad(mProgram, "position", 0.5f);
GLubyte expectedValue = static_cast<GLubyte>(pixelValue >> 8); GLubyte expectedValue = static_cast<GLubyte>(pixelValue >> 8);
EXPECT_PIXEL_COLOR_EQ( EXPECT_PIXEL_COLOR_EQ(0, 0,
0, 0, SliceFormatColor( SliceFormatColor(format, GLColor(expectedValue, expectedValue,
format, GLColor(expectedValue, expectedValue, expectedValue, expectedValue))); expectedValue, expectedValue)));
glBindRenderbuffer(GL_RENDERBUFFER, mRenderbuffer); glBindRenderbuffer(GL_RENDERBUFFER, mRenderbuffer);
glRenderbufferStorage(GL_RENDERBUFFER, internalformat, 1, 1); glRenderbufferStorage(GL_RENDERBUFFER, internalformat, 1, 1);
...@@ -3758,7 +3761,8 @@ TEST_P(Texture2DTestES3, GenerateMipmapAndBaseLevelLUMA) ...@@ -3758,7 +3761,8 @@ TEST_P(Texture2DTestES3, GenerateMipmapAndBaseLevelLUMA)
EXPECT_PIXEL_COLOR_EQ(0, 0, angle::GLColor::white); EXPECT_PIXEL_COLOR_EQ(0, 0, angle::GLColor::white);
} }
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against.
ANGLE_INSTANTIATE_TEST(Texture2DTest, ANGLE_INSTANTIATE_TEST(Texture2DTest,
ES2_D3D9(), ES2_D3D9(),
ES2_D3D11(), ES2_D3D11(),
......
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