Add basic initialization code for ContextNULL so it can run some tests.

BUG=angleproject:1468

Change-Id: I8dfc9a3c71e5638de22bc9d9a5dadfb495ef23a7
Reviewed-on: https://chromium-review.googlesource.com/388846
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Geoff Lang 2016-09-23 16:51:04 -04:00 коммит произвёл Commit Bot
Родитель e85587ac5a
Коммит 76cdbd5104
25 изменённых файлов: 746 добавлений и 240 удалений

Просмотреть файл

@ -5,9 +5,12 @@
//
#include "libANGLE/Caps.h"
#include "common/debug.h"
#include "common/angleutils.h"
#include "libANGLE/formatutils.h"
#include "angle_gl.h"
#include <algorithm>
@ -56,6 +59,22 @@ GLuint TextureCaps::getNearestSamples(GLuint requestedSamples) const
return 0;
}
TextureCaps GenerateMinimumTextureCaps(GLenum internalFormat,
const Version &clientVersion,
const Extensions &extensions)
{
TextureCaps caps;
const InternalFormat &internalFormatInfo = GetInternalFormatInfo(internalFormat);
caps.texturable = internalFormatInfo.textureSupport(clientVersion, extensions);
caps.renderable = internalFormatInfo.renderSupport(clientVersion, extensions);
caps.filterable = internalFormatInfo.filterSupport(clientVersion, extensions);
caps.sampleCounts.insert(0);
return caps;
}
void TextureCapsMap::insert(GLenum internalFormat, const TextureCaps &caps)
{
mCapsMap[internalFormat] = caps;
@ -97,6 +116,20 @@ size_t TextureCapsMap::size() const
return mCapsMap.size();
}
TextureCapsMap GenerateMinimumTextureCapsMap(const Version &clientVersion,
const Extensions &extensions)
{
TextureCapsMap capsMap;
for (GLenum internalFormat : GetAllSizedInternalFormats())
{
capsMap.insert(internalFormat,
GenerateMinimumTextureCaps(internalFormat, clientVersion, extensions));
}
return capsMap;
}
Extensions::Extensions()
: elementIndexUint(false),
packedDepthStencil(false),
@ -602,38 +635,37 @@ const ExtensionInfoMap &GetExtensionInfoMap()
return extensionInfo;
}
TypePrecision::TypePrecision()
TypePrecision::TypePrecision() : range({{0, 0}}), precision(0)
{
range[0] = 0;
range[1] = 0;
precision = 0;
}
void TypePrecision::setIEEEFloat()
{
range[0] = 127;
range[1] = 127;
range = {{127, 127}};
precision = 23;
}
void TypePrecision::setTwosComplementInt(unsigned int bits)
{
range[0] = GLint(bits) - 1;
range[1] = GLint(bits) - 2;
range = {{static_cast<GLint>(bits) - 1, static_cast<GLint>(bits) - 2}};
precision = 0;
}
void TypePrecision::setSimulatedFloat(unsigned int r, unsigned int p)
{
range = {{static_cast<GLint>(r), static_cast<GLint>(r)}};
precision = static_cast<GLint>(p);
}
void TypePrecision::setSimulatedInt(unsigned int r)
{
range[0] = GLint(r);
range[1] = GLint(r);
range = {{static_cast<GLint>(r), static_cast<GLint>(r)}};
precision = 0;
}
void TypePrecision::get(GLint *returnRange, GLint *returnPrecision) const
{
returnRange[0] = range[0];
returnRange[1] = range[1];
std::copy(range.begin(), range.end(), returnRange);
*returnPrecision = precision;
}
@ -751,6 +783,193 @@ Caps::Caps()
}
}
Caps GenerateMinimumCaps(const Version &clientVersion)
{
Caps caps;
if (clientVersion >= Version(2, 0))
{
// Table 6.18
caps.max2DTextureSize = 64;
caps.maxCubeMapTextureSize = 16;
caps.maxViewportWidth = caps.max2DTextureSize;
caps.maxViewportHeight = caps.max2DTextureSize;
caps.minAliasedPointSize = 1;
caps.maxAliasedPointSize = 1;
// Table 6.19
caps.vertexHighpFloat.setSimulatedFloat(62, 16);
caps.vertexMediumpFloat.setSimulatedFloat(14, 10);
caps.vertexLowpFloat.setSimulatedFloat(1, 8);
caps.vertexHighpInt.setSimulatedInt(16);
caps.vertexMediumpInt.setSimulatedInt(10);
caps.vertexLowpInt.setSimulatedInt(8);
caps.fragmentHighpFloat.setSimulatedFloat(62, 16);
caps.fragmentMediumpFloat.setSimulatedFloat(14, 10);
caps.fragmentLowpFloat.setSimulatedFloat(1, 8);
caps.fragmentHighpInt.setSimulatedInt(16);
caps.fragmentMediumpInt.setSimulatedInt(10);
caps.fragmentLowpInt.setSimulatedInt(8);
// Table 6.20
caps.maxVertexAttributes = 8;
caps.maxVertexUniformVectors = 128;
caps.maxVaryingVectors = 8;
caps.maxCombinedTextureImageUnits = 8;
caps.maxTextureImageUnits = 8;
caps.maxFragmentUniformVectors = 16;
caps.maxRenderbufferSize = 1;
}
if (clientVersion >= Version(3, 0))
{
// Table 6.28
caps.maxElementIndex = (1 << 24) - 1;
caps.max3DTextureSize = 256;
caps.max2DTextureSize = 2048;
caps.maxArrayTextureLayers = 256;
caps.maxLODBias = 2.0f;
caps.maxCubeMapTextureSize = 2048;
caps.maxRenderbufferSize = 2048;
caps.maxDrawBuffers = 4;
caps.maxColorAttachments = 4;
caps.maxViewportWidth = caps.max2DTextureSize;
caps.maxViewportHeight = caps.max2DTextureSize;
// Table 6.29
caps.compressedTextureFormats.push_back(GL_COMPRESSED_R11_EAC);
caps.compressedTextureFormats.push_back(GL_COMPRESSED_SIGNED_R11_EAC);
caps.compressedTextureFormats.push_back(GL_COMPRESSED_RG11_EAC);
caps.compressedTextureFormats.push_back(GL_COMPRESSED_SIGNED_RG11_EAC);
caps.compressedTextureFormats.push_back(GL_COMPRESSED_RGB8_ETC2);
caps.compressedTextureFormats.push_back(GL_COMPRESSED_SRGB8_ETC2);
caps.compressedTextureFormats.push_back(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2);
caps.compressedTextureFormats.push_back(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2);
caps.compressedTextureFormats.push_back(GL_COMPRESSED_RGBA8_ETC2_EAC);
caps.compressedTextureFormats.push_back(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC);
caps.vertexHighpFloat.setIEEEFloat();
caps.vertexHighpInt.setTwosComplementInt(32);
caps.vertexMediumpInt.setTwosComplementInt(16);
caps.vertexLowpInt.setTwosComplementInt(8);
caps.fragmentHighpFloat.setIEEEFloat();
caps.fragmentHighpInt.setSimulatedInt(32);
caps.fragmentMediumpInt.setTwosComplementInt(16);
caps.fragmentLowpInt.setTwosComplementInt(8);
caps.maxServerWaitTimeout = 0;
// Table 6.31
caps.maxVertexAttributes = 16;
caps.maxVertexUniformComponents = 1024;
caps.maxVertexUniformVectors = 256;
caps.maxVertexUniformBlocks = 12;
caps.maxVertexOutputComponents = 64;
caps.maxVertexTextureImageUnits = 16;
// Table 6.32
caps.maxFragmentUniformComponents = 896;
caps.maxFragmentUniformVectors = 224;
caps.maxFragmentUniformBlocks = 12;
caps.maxFragmentInputComponents = 60;
caps.maxTextureImageUnits = 16;
caps.minProgramTexelOffset = -8;
caps.maxProgramTexelOffset = 7;
// Table 6.33
caps.maxUniformBufferBindings = 24;
caps.maxUniformBlockSize = 16384;
caps.uniformBufferOffsetAlignment = 256;
caps.maxCombinedUniformBlocks = 24;
caps.maxCombinedVertexUniformComponents =
caps.maxVertexUniformBlocks * (caps.maxUniformBlockSize / 4) +
caps.maxVertexUniformComponents;
caps.maxCombinedFragmentUniformComponents =
caps.maxFragmentUniformBlocks * (caps.maxUniformBlockSize / 4) +
caps.maxFragmentUniformComponents;
caps.maxVaryingComponents = 60;
caps.maxVaryingVectors = 15;
caps.maxCombinedTextureImageUnits = 32;
// Table 6.34
caps.maxTransformFeedbackInterleavedComponents = 64;
caps.maxTransformFeedbackSeparateAttributes = 4;
caps.maxTransformFeedbackSeparateComponents = 4;
// Table 3.35
caps.maxSamples = 4;
}
if (clientVersion >= Version(3, 1))
{
// Table 20.40
caps.maxFramebufferWidth = 2048;
caps.maxFramebufferHeight = 2048;
caps.maxFramebufferSamples = 4;
caps.maxSampleMaskWords = 1;
caps.maxColorTextureSamples = 1;
caps.maxDepthTextureSamples = 1;
caps.maxIntegerSamples = 1;
// Table 20.41
caps.maxVertexAttribRelativeOffset = 2047;
caps.maxVertexAttribBindings = 16;
caps.maxVertexAttribStride = 2048;
// Table 20.43
caps.maxVertexAtomicCounterBuffers = 0;
caps.maxVertexAtomicCounters = 0;
caps.maxVertexImageUniforms = 0;
caps.maxVertexShaderStorageBlocks = 0;
// Table 20.44
caps.maxFragmentUniformComponents = 1024;
caps.maxFragmentUniformVectors = 256;
caps.maxFragmentAtomicCounterBuffers = 0;
caps.maxFragmentAtomicCounters = 0;
caps.maxFragmentImageUniforms = 0;
caps.maxFragmentShaderStorageBlocks = 0;
caps.minProgramTextureGatherOffset = 0;
caps.maxProgramTextureGatherOffset = 0;
// Table 20.45
caps.maxComputeWorkGroupCount = {{65535, 65535, 65535}};
caps.maxComputeWorkGroupSize = {{128, 128, 64}};
caps.maxComputeWorkGroupInvocations = 12;
caps.maxComputeUniformBlocks = 12;
caps.maxComputeTextureImageUnits = 16;
caps.maxComputeSharedMemorySize = 16384;
caps.maxComputeUniformComponents = 1024;
caps.maxComputeAtomicCounterBuffers = 1;
caps.maxComputeAtomicCounters = 8;
caps.maxComputeImageUniforms = 4;
caps.maxCombinedComputeUniformComponents =
caps.maxComputeUniformBlocks * static_cast<GLuint>(caps.maxUniformBlockSize / 4) +
caps.maxComputeUniformComponents;
caps.maxComputeShaderStorageBlocks = 4;
// Table 20.46
caps.maxUniformBufferBindings = 36;
caps.maxCombinedFragmentUniformComponents =
caps.maxFragmentUniformBlocks * (caps.maxUniformBlockSize / 4) +
caps.maxFragmentUniformComponents;
caps.maxCombinedTextureImageUnits = 48;
caps.maxCombinedShaderOutputResources = 4;
// Table 20.47
caps.maxUniformLocations = 1024;
caps.maxAtomicCounterBufferBindings = 1;
caps.maxAtomicCounterBufferSize = 32;
caps.maxCombinedAtomicCounterBuffers = 1;
caps.maxCombinedAtomicCounters = 8;
caps.maxImageUnits = 4;
caps.maxCombinedImageUniforms = 4;
caps.maxShaderStorageBufferBindings = 4;
caps.maxShaderStorageBlockSize = 1 << 27;
caps.maxCombinedShaderStorageBlocks = 4;
caps.shaderStorageBufferOffsetAlignment = 256;
}
return caps;
}
}
namespace egl

Просмотреть файл

@ -9,6 +9,7 @@
#include "angle_gl.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/Version.h"
#include <map>
#include <set>
@ -19,6 +20,8 @@
namespace gl
{
struct Extensions;
typedef std::set<GLuint> SupportedSampleSet;
struct TextureCaps
@ -45,6 +48,10 @@ struct TextureCaps
GLuint getNearestSamples(GLuint requestedSamples) const;
};
TextureCaps GenerateMinimumTextureCaps(GLenum internalFormat,
const Version &clientVersion,
const Extensions &extensions);
class TextureCapsMap
{
public:
@ -66,6 +73,9 @@ class TextureCapsMap
InternalFormatToCapsMap mCapsMap;
};
TextureCapsMap GenerateMinimumTextureCapsMap(const Version &clientVersion,
const Extensions &extensions);
struct Extensions
{
Extensions();
@ -374,11 +384,12 @@ struct TypePrecision
void setIEEEFloat();
void setTwosComplementInt(unsigned int bits);
void setSimulatedFloat(unsigned int range, unsigned int precision);
void setSimulatedInt(unsigned int range);
void get(GLint *returnRange, GLint *returnPrecision) const;
GLint range[2];
std::array<GLint, 2> range;
GLint precision;
};
@ -510,6 +521,7 @@ struct Caps
GLuint maxSamples;
};
Caps GenerateMinimumCaps(const Version &clientVersion);
}
namespace egl

Просмотреть файл

@ -110,6 +110,11 @@ class Error final
mutable std::unique_ptr<std::string> mMessage;
};
inline Error NoError()
{
return Error(EGL_SUCCESS);
}
} // namespace egl
#define ANGLE_CONCAT1(x, y) x##y

Просмотреть файл

@ -162,7 +162,8 @@ static GLfloat QueryGLFloatRange(const FunctionsGL *functions, GLenum name, size
static gl::TypePrecision QueryTypePrecision(const FunctionsGL *functions, GLenum shaderType, GLenum precisionType)
{
gl::TypePrecision precision;
functions->getShaderPrecisionFormat(shaderType, precisionType, precision.range, &precision.precision);
functions->getShaderPrecisionFormat(shaderType, precisionType, precision.range.data(),
&precision.precision);
return precision;
}

Просмотреть файл

@ -10,6 +10,8 @@
#include "libANGLE/renderer/null/BufferNULL.h"
#include "common/debug.h"
#include "common/utilities.h"
#include "libANGLE/angletypes.h"
namespace rx
{
@ -24,14 +26,21 @@ BufferNULL::~BufferNULL()
gl::Error BufferNULL::setData(GLenum target, const void *data, size_t size, GLenum usage)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
mData.resize(size, 0);
if (size > 0 && data != nullptr)
{
memcpy(mData.data(), data, size);
}
return gl::NoError();
}
gl::Error BufferNULL::setSubData(GLenum target, const void *data, size_t size, size_t offset)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
if (size > 0)
{
memcpy(mData.data() + offset, data, size);
}
return gl::NoError();
}
gl::Error BufferNULL::copySubData(BufferImpl *source,
@ -39,26 +48,30 @@ gl::Error BufferNULL::copySubData(BufferImpl *source,
GLintptr destOffset,
GLsizeiptr size)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
BufferNULL *sourceNULL = GetAs<BufferNULL>(source);
if (size > 0)
{
memcpy(mData.data() + destOffset, sourceNULL->mData.data() + sourceOffset, size);
}
return gl::NoError();
}
gl::Error BufferNULL::map(GLenum access, GLvoid **mapPtr)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
*mapPtr = mData.data();
return gl::NoError();
}
gl::Error BufferNULL::mapRange(size_t offset, size_t length, GLbitfield access, GLvoid **mapPtr)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
*mapPtr = mData.data() + offset;
return gl::NoError();
}
gl::Error BufferNULL::unmap(GLboolean *result)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
*result = GL_TRUE;
return gl::NoError();
}
gl::Error BufferNULL::getIndexRange(GLenum type,
@ -67,8 +80,8 @@ gl::Error BufferNULL::getIndexRange(GLenum type,
bool primitiveRestartEnabled,
gl::IndexRange *outRange)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
*outRange = gl::ComputeIndexRange(type, mData.data() + offset, count, primitiveRestartEnabled);
return gl::NoError();
}
} // namespace rx

Просмотреть файл

@ -36,6 +36,9 @@ class BufferNULL : public BufferImpl
size_t count,
bool primitiveRestartEnabled,
gl::IndexRange *outRange) override;
private:
std::vector<uint8_t> mData;
};
} // namespace rx

Просмотреть файл

@ -24,14 +24,12 @@ CompilerNULL::~CompilerNULL()
gl::Error CompilerNULL::release()
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
ShShaderOutput CompilerNULL::getTranslatorOutputType() const
{
UNIMPLEMENTED();
return ShShaderOutput();
return SH_ESSL_OUTPUT;
}
} // namespace rx

Просмотреть файл

@ -11,11 +11,32 @@
#include "common/debug.h"
#include "libANGLE/renderer/null/BufferNULL.h"
#include "libANGLE/renderer/null/CompilerNULL.h"
#include "libANGLE/renderer/null/DisplayNULL.h"
#include "libANGLE/renderer/null/FenceNVNULL.h"
#include "libANGLE/renderer/null/FenceSyncNULL.h"
#include "libANGLE/renderer/null/FramebufferNULL.h"
#include "libANGLE/renderer/null/ImageNULL.h"
#include "libANGLE/renderer/null/PathNULL.h"
#include "libANGLE/renderer/null/ProgramNULL.h"
#include "libANGLE/renderer/null/QueryNULL.h"
#include "libANGLE/renderer/null/RenderbufferNULL.h"
#include "libANGLE/renderer/null/SamplerNULL.h"
#include "libANGLE/renderer/null/ShaderNULL.h"
#include "libANGLE/renderer/null/TextureNULL.h"
#include "libANGLE/renderer/null/TransformFeedbackNULL.h"
#include "libANGLE/renderer/null/VertexArrayNULL.h"
namespace rx
{
ContextNULL::ContextNULL(const gl::ContextState &state) : ContextImpl(state)
{
const gl::Version maxClientVersion(3, 1);
mCaps = GenerateMinimumCaps(maxClientVersion);
mExtensions = gl::Extensions();
mTextureCaps = GenerateMinimumTextureCapsMap(maxClientVersion, mExtensions);
}
ContextNULL::~ContextNULL()
@ -24,26 +45,22 @@ ContextNULL::~ContextNULL()
gl::Error ContextNULL::initialize()
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error ContextNULL::flush()
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error ContextNULL::finish()
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error ContextNULL::drawArrays(GLenum mode, GLint first, GLsizei count)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error ContextNULL::drawArraysInstanced(GLenum mode,
@ -51,8 +68,7 @@ gl::Error ContextNULL::drawArraysInstanced(GLenum mode,
GLsizei count,
GLsizei instanceCount)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error ContextNULL::drawElements(GLenum mode,
@ -61,8 +77,7 @@ gl::Error ContextNULL::drawElements(GLenum mode,
const GLvoid *indices,
const gl::IndexRange &indexRange)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error ContextNULL::drawElementsInstanced(GLenum mode,
@ -72,8 +87,7 @@ gl::Error ContextNULL::drawElementsInstanced(GLenum mode,
GLsizei instances,
const gl::IndexRange &indexRange)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error ContextNULL::drawRangeElements(GLenum mode,
@ -84,92 +98,225 @@ gl::Error ContextNULL::drawRangeElements(GLenum mode,
const GLvoid *indices,
const gl::IndexRange &indexRange)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
void ContextNULL::stencilFillPath(const gl::Path *path, GLenum fillMode, GLuint mask)
{
}
void ContextNULL::stencilStrokePath(const gl::Path *path, GLint reference, GLuint mask)
{
}
void ContextNULL::coverFillPath(const gl::Path *path, GLenum coverMode)
{
}
void ContextNULL::coverStrokePath(const gl::Path *path, GLenum coverMode)
{
}
void ContextNULL::stencilThenCoverFillPath(const gl::Path *path,
GLenum fillMode,
GLuint mask,
GLenum coverMode)
{
}
void ContextNULL::stencilThenCoverStrokePath(const gl::Path *path,
GLint reference,
GLuint mask,
GLenum coverMode)
{
}
void ContextNULL::coverFillPathInstanced(const std::vector<gl::Path *> &paths,
GLenum coverMode,
GLenum transformType,
const GLfloat *transformValues)
{
}
void ContextNULL::coverStrokePathInstanced(const std::vector<gl::Path *> &paths,
GLenum coverMode,
GLenum transformType,
const GLfloat *transformValues)
{
}
void ContextNULL::stencilFillPathInstanced(const std::vector<gl::Path *> &paths,
GLenum fillMode,
GLuint mask,
GLenum transformType,
const GLfloat *transformValues)
{
}
void ContextNULL::stencilStrokePathInstanced(const std::vector<gl::Path *> &paths,
GLint reference,
GLuint mask,
GLenum transformType,
const GLfloat *transformValues)
{
}
void ContextNULL::stencilThenCoverFillPathInstanced(const std::vector<gl::Path *> &paths,
GLenum coverMode,
GLenum fillMode,
GLuint mask,
GLenum transformType,
const GLfloat *transformValues)
{
}
void ContextNULL::stencilThenCoverStrokePathInstanced(const std::vector<gl::Path *> &paths,
GLenum coverMode,
GLint reference,
GLuint mask,
GLenum transformType,
const GLfloat *transformValues)
{
}
GLenum ContextNULL::getResetStatus()
{
return GL_NO_ERROR;
}
std::string ContextNULL::getVendorString() const
{
return "NULL";
}
std::string ContextNULL::getRendererDescription() const
{
return "NULL";
}
void ContextNULL::insertEventMarker(GLsizei length, const char *marker)
{
}
void ContextNULL::pushGroupMarker(GLsizei length, const char *marker)
{
}
void ContextNULL::popGroupMarker()
{
}
void ContextNULL::syncState(const gl::State &state, const gl::State::DirtyBits &dirtyBits)
{
}
GLint ContextNULL::getGPUDisjoint()
{
return 0;
}
GLint64 ContextNULL::getTimestamp()
{
return 0;
}
void ContextNULL::onMakeCurrent(const gl::ContextState &data)
{
}
const gl::Caps &ContextNULL::getNativeCaps() const
{
return mCaps;
}
const gl::TextureCapsMap &ContextNULL::getNativeTextureCaps() const
{
return mTextureCaps;
}
const gl::Extensions &ContextNULL::getNativeExtensions() const
{
return mExtensions;
}
const gl::Limitations &ContextNULL::getNativeLimitations() const
{
return mLimitations;
}
CompilerImpl *ContextNULL::createCompiler()
{
UNIMPLEMENTED();
return static_cast<CompilerImpl *>(0);
return new CompilerNULL();
}
ShaderImpl *ContextNULL::createShader(const gl::ShaderState &data)
{
UNIMPLEMENTED();
return static_cast<ShaderImpl *>(0);
return new ShaderNULL(data);
}
ProgramImpl *ContextNULL::createProgram(const gl::ProgramState &data)
{
UNIMPLEMENTED();
return static_cast<ProgramImpl *>(0);
return new ProgramNULL(data);
}
FramebufferImpl *ContextNULL::createFramebuffer(const gl::FramebufferState &data)
{
UNIMPLEMENTED();
return static_cast<FramebufferImpl *>(0);
return new FramebufferNULL(data);
}
TextureImpl *ContextNULL::createTexture(const gl::TextureState &state)
{
UNIMPLEMENTED();
return static_cast<TextureImpl *>(0);
return new TextureNULL(state);
}
RenderbufferImpl *ContextNULL::createRenderbuffer()
{
UNIMPLEMENTED();
return static_cast<RenderbufferImpl *>(0);
return new RenderbufferNULL();
}
BufferImpl *ContextNULL::createBuffer(const gl::BufferState &state)
{
UNIMPLEMENTED();
return static_cast<BufferImpl *>(0);
return new BufferNULL(state);
}
VertexArrayImpl *ContextNULL::createVertexArray(const gl::VertexArrayState &data)
{
UNIMPLEMENTED();
return static_cast<VertexArrayImpl *>(0);
return new VertexArrayNULL(data);
}
QueryImpl *ContextNULL::createQuery(GLenum type)
{
UNIMPLEMENTED();
return static_cast<QueryImpl *>(0);
return new QueryNULL(type);
}
FenceNVImpl *ContextNULL::createFenceNV()
{
UNIMPLEMENTED();
return static_cast<FenceNVImpl *>(0);
return new FenceNVNULL();
}
FenceSyncImpl *ContextNULL::createFenceSync()
{
UNIMPLEMENTED();
return static_cast<FenceSyncImpl *>(0);
return new FenceSyncNULL();
}
TransformFeedbackImpl *ContextNULL::createTransformFeedback(const gl::TransformFeedbackState &state)
{
UNIMPLEMENTED();
return static_cast<TransformFeedbackImpl *>(0);
return new TransformFeedbackNULL(state);
}
SamplerImpl *ContextNULL::createSampler()
{
UNIMPLEMENTED();
return static_cast<SamplerImpl *>(0);
return new SamplerNULL();
}
std::vector<PathImpl *> ContextNULL::createPaths(GLsizei range)
{
UNIMPLEMENTED();
return std::vector<PathImpl *>();
std::vector<PathImpl *> result(range);
for (GLsizei idx = 0; idx < range; idx++)
{
result[idx] = new PathNULL();
}
return result;
}
} // namespace rx

Просмотреть файл

@ -54,6 +54,78 @@ class ContextNULL : public ContextImpl
const gl::IndexRange &indexRange) override;
// CHROMIUM_path_rendering path drawing methods.
void stencilFillPath(const gl::Path *path, GLenum fillMode, GLuint mask) override;
void stencilStrokePath(const gl::Path *path, GLint reference, GLuint mask) override;
void coverFillPath(const gl::Path *path, GLenum coverMode) override;
void coverStrokePath(const gl::Path *path, GLenum coverMode) override;
void stencilThenCoverFillPath(const gl::Path *path,
GLenum fillMode,
GLuint mask,
GLenum coverMode) override;
void stencilThenCoverStrokePath(const gl::Path *path,
GLint reference,
GLuint mask,
GLenum coverMode) override;
void coverFillPathInstanced(const std::vector<gl::Path *> &paths,
GLenum coverMode,
GLenum transformType,
const GLfloat *transformValues) override;
void coverStrokePathInstanced(const std::vector<gl::Path *> &paths,
GLenum coverMode,
GLenum transformType,
const GLfloat *transformValues) override;
void stencilFillPathInstanced(const std::vector<gl::Path *> &paths,
GLenum fillMode,
GLuint mask,
GLenum transformType,
const GLfloat *transformValues) override;
void stencilStrokePathInstanced(const std::vector<gl::Path *> &paths,
GLint reference,
GLuint mask,
GLenum transformType,
const GLfloat *transformValues) override;
void stencilThenCoverFillPathInstanced(const std::vector<gl::Path *> &paths,
GLenum coverMode,
GLenum fillMode,
GLuint mask,
GLenum transformType,
const GLfloat *transformValues) override;
void stencilThenCoverStrokePathInstanced(const std::vector<gl::Path *> &paths,
GLenum coverMode,
GLint reference,
GLuint mask,
GLenum transformType,
const GLfloat *transformValues) override;
// Device loss
GLenum getResetStatus() override;
// Vendor and description strings.
std::string getVendorString() const override;
std::string getRendererDescription() const override;
// Debug markers.
void insertEventMarker(GLsizei length, const char *marker) override;
void pushGroupMarker(GLsizei length, const char *marker) override;
void popGroupMarker() override;
// State sync with dirty bits.
void syncState(const gl::State &state, const gl::State::DirtyBits &dirtyBits) override;
// Disjoint timer queries
GLint getGPUDisjoint() override;
GLint64 getTimestamp() override;
// Context switching
void onMakeCurrent(const gl::ContextState &data) override;
// Native capabilities, unmodified by gl::Context.
const gl::Caps &getNativeCaps() const override;
const gl::TextureCapsMap &getNativeTextureCaps() const override;
const gl::Extensions &getNativeExtensions() const override;
const gl::Limitations &getNativeLimitations() const override;
// Shader creation
CompilerImpl *createCompiler() override;
@ -88,6 +160,12 @@ class ContextNULL : public ContextImpl
SamplerImpl *createSampler() override;
std::vector<PathImpl *> createPaths(GLsizei range) override;
private:
gl::Caps mCaps;
gl::TextureCapsMap mTextureCaps;
gl::Extensions mExtensions;
gl::Limitations mLimitations;
};
} // namespace rx

Просмотреть файл

@ -30,19 +30,16 @@ egl::Error DeviceNULL::getDevice(void **outValue)
EGLint DeviceNULL::getType()
{
UNIMPLEMENTED();
return EGLint();
return 0;
}
void DeviceNULL::generateExtensions(egl::DeviceExtensions *outExtensions) const
{
UNIMPLEMENTED();
}
bool DeviceNULL::deviceExternallySourced()
{
UNIMPLEMENTED();
return bool();
return false;
}
} // namespace rx

Просмотреть файл

@ -11,10 +11,15 @@
#include "common/debug.h"
#include "libANGLE/renderer/null/ContextNULL.h"
#include "libANGLE/renderer/null/DeviceNULL.h"
#include "libANGLE/renderer/null/ImageNULL.h"
#include "libANGLE/renderer/null/SurfaceNULL.h"
namespace rx
{
DisplayNULL::DisplayNULL() : DisplayImpl()
DisplayNULL::DisplayNULL() : DisplayImpl(), mDevice(nullptr)
{
}
@ -24,77 +29,106 @@ DisplayNULL::~DisplayNULL()
egl::Error DisplayNULL::initialize(egl::Display *display)
{
UNIMPLEMENTED();
return egl::Error(EGL_BAD_ACCESS);
mDevice = new DeviceNULL();
return egl::NoError();
}
void DisplayNULL::terminate()
{
UNIMPLEMENTED();
SafeDelete(mDevice);
}
egl::Error DisplayNULL::makeCurrent(egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context)
{
UNIMPLEMENTED();
return egl::Error(EGL_BAD_ACCESS);
return egl::NoError();
}
egl::ConfigSet DisplayNULL::generateConfigs()
{
UNIMPLEMENTED();
return egl::ConfigSet();
egl::Config config;
config.renderTargetFormat = GL_RGBA8;
config.depthStencilFormat = GL_DEPTH24_STENCIL8;
config.bufferSize = 32;
config.redSize = 8;
config.greenSize = 8;
config.blueSize = 8;
config.alphaSize = 8;
config.alphaMaskSize = 0;
config.bindToTextureRGB = EGL_TRUE;
config.bindToTextureRGBA = EGL_TRUE;
config.colorBufferType = EGL_RGB_BUFFER;
config.configCaveat = EGL_NONE;
config.conformant = EGL_OPENGL_ES2_BIT | EGL_OPENGL_ES3_BIT;
config.depthSize = 24;
config.level = 0;
config.matchNativePixmap = EGL_NONE;
config.maxPBufferWidth = 0;
config.maxPBufferHeight = 0;
config.maxPBufferPixels = 0;
config.maxSwapInterval = 1;
config.minSwapInterval = 1;
config.nativeRenderable = EGL_TRUE;
config.nativeVisualID = 0;
config.nativeVisualType = EGL_NONE;
config.renderableType = EGL_OPENGL_ES2_BIT | EGL_OPENGL_ES3_BIT;
config.sampleBuffers = 0;
config.samples = 0;
config.stencilSize = 8;
config.surfaceType = EGL_WINDOW_BIT | EGL_PBUFFER_BIT;
config.optimalOrientation = 0;
config.transparentType = EGL_NONE;
config.transparentRedValue = 0;
config.transparentGreenValue = 0;
config.transparentBlueValue = 0;
egl::ConfigSet configSet;
configSet.add(config);
return configSet;
}
bool DisplayNULL::testDeviceLost()
{
UNIMPLEMENTED();
return bool();
return false;
}
egl::Error DisplayNULL::restoreLostDevice()
{
UNIMPLEMENTED();
return egl::Error(EGL_BAD_ACCESS);
return egl::NoError();
}
bool DisplayNULL::isValidNativeWindow(EGLNativeWindowType window) const
{
UNIMPLEMENTED();
return bool();
return true;
}
std::string DisplayNULL::getVendorString() const
{
UNIMPLEMENTED();
return std::string();
return "NULL";
}
egl::Error DisplayNULL::getDevice(DeviceImpl **device)
{
UNIMPLEMENTED();
return egl::Error(EGL_BAD_ACCESS);
*device = mDevice;
return egl::NoError();
}
egl::Error DisplayNULL::waitClient() const
{
UNIMPLEMENTED();
return egl::Error(EGL_BAD_ACCESS);
return egl::NoError();
}
egl::Error DisplayNULL::waitNative(EGLint engine,
egl::Surface *drawSurface,
egl::Surface *readSurface) const
{
UNIMPLEMENTED();
return egl::Error(EGL_BAD_ACCESS);
return egl::NoError();
}
gl::Version DisplayNULL::getMaxSupportedESVersion() const
{
UNIMPLEMENTED();
return gl::Version();
return gl::Version(3, 2);
}
SurfaceImpl *DisplayNULL::createWindowSurface(const egl::SurfaceState &state,
@ -102,16 +136,14 @@ SurfaceImpl *DisplayNULL::createWindowSurface(const egl::SurfaceState &state,
EGLNativeWindowType window,
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return static_cast<SurfaceImpl *>(0);
return new SurfaceNULL(state);
}
SurfaceImpl *DisplayNULL::createPbufferSurface(const egl::SurfaceState &state,
const egl::Config *configuration,
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return static_cast<SurfaceImpl *>(0);
return new SurfaceNULL(state);
}
SurfaceImpl *DisplayNULL::createPbufferFromClientBuffer(const egl::SurfaceState &state,
@ -120,8 +152,7 @@ SurfaceImpl *DisplayNULL::createPbufferFromClientBuffer(const egl::SurfaceState
EGLClientBuffer buffer,
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return static_cast<SurfaceImpl *>(0);
return new SurfaceNULL(state);
}
SurfaceImpl *DisplayNULL::createPixmapSurface(const egl::SurfaceState &state,
@ -129,22 +160,19 @@ SurfaceImpl *DisplayNULL::createPixmapSurface(const egl::SurfaceState &state,
NativePixmapType nativePixmap,
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return static_cast<SurfaceImpl *>(0);
return new SurfaceNULL(state);
}
ImageImpl *DisplayNULL::createImage(EGLenum target,
egl::ImageSibling *buffer,
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return static_cast<ImageImpl *>(0);
return new ImageNULL();
}
ContextImpl *DisplayNULL::createContext(const gl::ContextState &state)
{
UNIMPLEMENTED();
return static_cast<ContextImpl *>(0);
return new ContextNULL(state);
}
StreamProducerImpl *DisplayNULL::createStreamProducerD3DTextureNV12(
@ -152,17 +180,33 @@ StreamProducerImpl *DisplayNULL::createStreamProducerD3DTextureNV12(
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return static_cast<StreamProducerImpl *>(0);
return nullptr;
}
void DisplayNULL::generateExtensions(egl::DisplayExtensions *outExtensions) const
{
UNIMPLEMENTED();
outExtensions->createContextRobustness = true;
outExtensions->postSubBuffer = true;
outExtensions->createContext = true;
outExtensions->deviceQuery = true;
outExtensions->image = true;
outExtensions->imageBase = true;
outExtensions->glTexture2DImage = true;
outExtensions->glTextureCubemapImage = true;
outExtensions->glTexture3DImage = true;
outExtensions->glRenderbufferImage = true;
outExtensions->getAllProcAddresses = true;
outExtensions->flexibleSurfaceCompatibility = true;
outExtensions->directComposition = true;
outExtensions->createContextNoError = true;
outExtensions->createContextWebGLCompatibility = true;
outExtensions->createContextBindGeneratesResource = true;
outExtensions->swapBuffersWithDamage = true;
}
void DisplayNULL::generateCaps(egl::Caps *outCaps) const
{
UNIMPLEMENTED();
outCaps->textureNPOT = true;
}
} // namespace rx

Просмотреть файл

@ -75,6 +75,8 @@ class DisplayNULL : public DisplayImpl
private:
void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
void generateCaps(egl::Caps *outCaps) const override;
DeviceImpl *mDevice;
};
} // namespace rx

Просмотреть файл

@ -26,28 +26,24 @@ FramebufferNULL::~FramebufferNULL()
gl::Error FramebufferNULL::discard(size_t count, const GLenum *attachments)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error FramebufferNULL::invalidate(size_t count, const GLenum *attachments)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error FramebufferNULL::invalidateSub(size_t count,
const GLenum *attachments,
const gl::Rectangle &area)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error FramebufferNULL::clear(ContextImpl *context, GLbitfield mask)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error FramebufferNULL::clearBufferfv(ContextImpl *context,
@ -55,8 +51,7 @@ gl::Error FramebufferNULL::clearBufferfv(ContextImpl *context,
GLint drawbuffer,
const GLfloat *values)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error FramebufferNULL::clearBufferuiv(ContextImpl *context,
@ -64,8 +59,7 @@ gl::Error FramebufferNULL::clearBufferuiv(ContextImpl *context,
GLint drawbuffer,
const GLuint *values)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error FramebufferNULL::clearBufferiv(ContextImpl *context,
@ -73,8 +67,7 @@ gl::Error FramebufferNULL::clearBufferiv(ContextImpl *context,
GLint drawbuffer,
const GLint *values)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error FramebufferNULL::clearBufferfi(ContextImpl *context,
@ -83,8 +76,7 @@ gl::Error FramebufferNULL::clearBufferfi(ContextImpl *context,
GLfloat depth,
GLint stencil)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
GLenum FramebufferNULL::getImplementationColorReadFormat() const
@ -119,8 +111,7 @@ gl::Error FramebufferNULL::readPixels(ContextImpl *context,
GLenum type,
GLvoid *pixels) const
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error FramebufferNULL::blit(ContextImpl *context,
@ -129,19 +120,16 @@ gl::Error FramebufferNULL::blit(ContextImpl *context,
GLbitfield mask,
GLenum filter)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
bool FramebufferNULL::checkStatus() const
{
UNIMPLEMENTED();
return bool();
return true;
}
void FramebufferNULL::syncState(const gl::Framebuffer::DirtyBits &dirtyBits)
{
UNIMPLEMENTED();
}
} // namespace rx

Просмотреть файл

@ -24,91 +24,74 @@ ProgramNULL::~ProgramNULL()
LinkResult ProgramNULL::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return true;
}
gl::Error ProgramNULL::save(gl::BinaryOutputStream *stream)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
void ProgramNULL::setBinaryRetrievableHint(bool retrievable)
{
UNIMPLEMENTED();
}
LinkResult ProgramNULL::link(const gl::ContextState &data, gl::InfoLog &infoLog)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return true;
}
GLboolean ProgramNULL::validate(const gl::Caps &caps, gl::InfoLog *infoLog)
{
UNIMPLEMENTED();
return GLboolean();
return GL_TRUE;
}
void ProgramNULL::setUniform1fv(GLint location, GLsizei count, const GLfloat *v)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniform1iv(GLint location, GLsizei count, const GLint *v)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniform2iv(GLint location, GLsizei count, const GLint *v)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniform3iv(GLint location, GLsizei count, const GLint *v)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniform4iv(GLint location, GLsizei count, const GLint *v)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniform1uiv(GLint location, GLsizei count, const GLuint *v)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniform2uiv(GLint location, GLsizei count, const GLuint *v)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniform3uiv(GLint location, GLsizei count, const GLuint *v)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniform4uiv(GLint location, GLsizei count, const GLuint *v)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniformMatrix2fv(GLint location,
@ -116,7 +99,6 @@ void ProgramNULL::setUniformMatrix2fv(GLint location,
GLboolean transpose,
const GLfloat *value)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniformMatrix3fv(GLint location,
@ -124,7 +106,6 @@ void ProgramNULL::setUniformMatrix3fv(GLint location,
GLboolean transpose,
const GLfloat *value)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniformMatrix4fv(GLint location,
@ -132,7 +113,6 @@ void ProgramNULL::setUniformMatrix4fv(GLint location,
GLboolean transpose,
const GLfloat *value)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniformMatrix2x3fv(GLint location,
@ -140,7 +120,6 @@ void ProgramNULL::setUniformMatrix2x3fv(GLint location,
GLboolean transpose,
const GLfloat *value)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniformMatrix3x2fv(GLint location,
@ -148,7 +127,6 @@ void ProgramNULL::setUniformMatrix3x2fv(GLint location,
GLboolean transpose,
const GLfloat *value)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniformMatrix2x4fv(GLint location,
@ -156,7 +134,6 @@ void ProgramNULL::setUniformMatrix2x4fv(GLint location,
GLboolean transpose,
const GLfloat *value)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniformMatrix4x2fv(GLint location,
@ -164,7 +141,6 @@ void ProgramNULL::setUniformMatrix4x2fv(GLint location,
GLboolean transpose,
const GLfloat *value)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniformMatrix3x4fv(GLint location,
@ -172,7 +148,6 @@ void ProgramNULL::setUniformMatrix3x4fv(GLint location,
GLboolean transpose,
const GLfloat *value)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniformMatrix4x3fv(GLint location,
@ -180,12 +155,10 @@ void ProgramNULL::setUniformMatrix4x3fv(GLint location,
GLboolean transpose,
const GLfloat *value)
{
UNIMPLEMENTED();
}
void ProgramNULL::setUniformBlockBinding(GLuint uniformBlockIndex, GLuint uniformBlockBinding)
{
UNIMPLEMENTED();
}
bool ProgramNULL::getUniformBlockSize(const std::string &blockName, size_t *sizeOut) const
@ -206,7 +179,6 @@ void ProgramNULL::setPathFragmentInputGen(const std::string &inputName,
GLint components,
const GLfloat *coeffs)
{
UNIMPLEMENTED();
}
} // namespace rx

Просмотреть файл

@ -25,20 +25,18 @@ ShaderNULL::~ShaderNULL()
ShCompileOptions ShaderNULL::prepareSourceAndReturnOptions(std::stringstream *sourceStream,
std::string *sourcePath)
{
UNIMPLEMENTED();
return ShCompileOptions();
*sourceStream << mData.getSource();
return 0;
}
bool ShaderNULL::postTranslateCompile(gl::Compiler *compiler, std::string *infoLog)
{
UNIMPLEMENTED();
return bool();
return true;
}
std::string ShaderNULL::getDebugInfo() const
{
UNIMPLEMENTED();
return std::string();
return "";
}
} // namespace rx

Просмотреть файл

@ -11,6 +11,8 @@
#include "common/debug.h"
#include "libANGLE/renderer/null/FramebufferNULL.h"
namespace rx
{
@ -24,80 +26,64 @@ SurfaceNULL::~SurfaceNULL()
egl::Error SurfaceNULL::initialize()
{
UNIMPLEMENTED();
return egl::Error(EGL_BAD_ACCESS);
return egl::NoError();
}
FramebufferImpl *SurfaceNULL::createDefaultFramebuffer(const gl::FramebufferState &state)
{
UNIMPLEMENTED();
return static_cast<FramebufferImpl *>(0);
return new FramebufferNULL(state);
}
egl::Error SurfaceNULL::swap()
{
UNIMPLEMENTED();
return egl::Error(EGL_BAD_ACCESS);
return egl::NoError();
}
egl::Error SurfaceNULL::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height)
{
UNIMPLEMENTED();
return egl::Error(EGL_BAD_ACCESS);
return egl::NoError();
}
egl::Error SurfaceNULL::querySurfacePointerANGLE(EGLint attribute, void **value)
{
UNIMPLEMENTED();
return egl::Error(EGL_BAD_ACCESS);
UNREACHABLE();
return egl::NoError();
}
egl::Error SurfaceNULL::bindTexImage(gl::Texture *texture, EGLint buffer)
{
UNIMPLEMENTED();
return egl::Error(EGL_BAD_ACCESS);
return egl::NoError();
}
egl::Error SurfaceNULL::releaseTexImage(EGLint buffer)
{
UNIMPLEMENTED();
return egl::Error(EGL_BAD_ACCESS);
return egl::NoError();
}
void SurfaceNULL::setSwapInterval(EGLint interval)
{
UNIMPLEMENTED();
}
EGLint SurfaceNULL::getWidth() const
{
UNIMPLEMENTED();
return EGLint();
// TODO(geofflang): Read from an actual window?
return 100;
}
EGLint SurfaceNULL::getHeight() const
{
UNIMPLEMENTED();
return EGLint();
// TODO(geofflang): Read from an actual window?
return 100;
}
EGLint SurfaceNULL::isPostSubBufferSupported() const
{
UNIMPLEMENTED();
return EGLint();
return EGL_TRUE;
}
EGLint SurfaceNULL::getSwapBehavior() const
{
UNIMPLEMENTED();
return EGLint();
}
gl::Error SurfaceNULL::getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target,
FramebufferAttachmentRenderTarget **rtOut)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return EGL_BUFFER_PRESERVED;
}
} // namespace rx

Просмотреть файл

@ -36,9 +36,6 @@ class SurfaceNULL : public SurfaceImpl
EGLint isPostSubBufferSupported() const override;
EGLint getSwapBehavior() const override;
gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target,
FramebufferAttachmentRenderTarget **rtOut) override;
};
} // namespace rx

Просмотреть файл

@ -31,8 +31,9 @@ gl::Error TextureNULL::setImage(GLenum target,
const gl::PixelUnpackState &unpack,
const uint8_t *pixels)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
// TODO(geofflang): Read all incoming pixel data (maybe hash it?) to make sure we don't read out
// of bounds due to validation bugs.
return gl::NoError();
}
gl::Error TextureNULL::setSubImage(GLenum target,
@ -43,8 +44,7 @@ gl::Error TextureNULL::setSubImage(GLenum target,
const gl::PixelUnpackState &unpack,
const uint8_t *pixels)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error TextureNULL::setCompressedImage(GLenum target,
@ -55,8 +55,7 @@ gl::Error TextureNULL::setCompressedImage(GLenum target,
size_t imageSize,
const uint8_t *pixels)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error TextureNULL::setCompressedSubImage(GLenum target,
@ -67,8 +66,7 @@ gl::Error TextureNULL::setCompressedSubImage(GLenum target,
size_t imageSize,
const uint8_t *pixels)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error TextureNULL::copyImage(GLenum target,
@ -77,8 +75,7 @@ gl::Error TextureNULL::copyImage(GLenum target,
GLenum internalFormat,
const gl::Framebuffer *source)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error TextureNULL::copySubImage(GLenum target,
@ -87,8 +84,7 @@ gl::Error TextureNULL::copySubImage(GLenum target,
const gl::Rectangle &sourceArea,
const gl::Framebuffer *source)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error TextureNULL::setStorage(GLenum target,
@ -96,48 +92,40 @@ gl::Error TextureNULL::setStorage(GLenum target,
GLenum internalFormat,
const gl::Extents &size)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error TextureNULL::setEGLImageTarget(GLenum target, egl::Image *image)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error TextureNULL::setImageExternal(GLenum target,
egl::Stream *stream,
const egl::Stream::GLTextureDescription &desc)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
gl::Error TextureNULL::generateMipmap()
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
return gl::NoError();
}
void TextureNULL::setBaseLevel(GLuint baseLevel)
{
UNIMPLEMENTED();
}
void TextureNULL::bindTexImage(egl::Surface *surface)
{
UNIMPLEMENTED();
}
void TextureNULL::releaseTexImage()
{
UNIMPLEMENTED();
}
void TextureNULL::syncState(const gl::Texture::DirtyBits &dirtyBits)
{
UNIMPLEMENTED();
}
} // namespace rx

Просмотреть файл

@ -805,6 +805,13 @@
'ANGLE_ENABLE_VULKAN',
],
}],
['angle_enable_null==1',
{
'defines':
[
'ANGLE_ENABLE_NULL',
],
}],
],
},
'conditions':

Просмотреть файл

@ -101,6 +101,11 @@ TEST_P(RendererTest, RequestedRendererCreated)
ASSERT_TRUE(found);
}
if (platform.renderer == EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE)
{
ASSERT_TRUE(IsNULL());
}
EGLint glesMajorVersion = GetParam().majorVersion;
// Ensure that the renderer string contains GL ES 3.0, if we requested a GL ES 3.0
@ -119,6 +124,12 @@ TEST_P(RendererTest, RequestedRendererCreated)
// Perform a simple operation (clear and read pixels) to verify the device is working
TEST_P(RendererTest, SimpleOperation)
{
if (IsNULL())
{
std::cout << "ANGLE NULL backend clears are not functional" << std::endl;
return;
}
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
EXPECT_PIXEL_EQ(0, 0, 0, 255, 0, 255);
@ -206,5 +217,10 @@ ANGLE_INSTANTIATE_TEST(RendererTest,
ES3_OPENGLES(),
ES3_OPENGLES(3, 0),
ES3_OPENGLES(3, 1),
ES3_OPENGLES(3, 2));
ES3_OPENGLES(3, 2),
// All ES version on top of the NULL backend
ES2_NULL(),
ES3_NULL(),
ES31_NULL());
}

Просмотреть файл

@ -758,6 +758,12 @@ bool IsOpenGL()
return (rendererString.find("OpenGL") != std::string::npos);
}
bool IsNULL()
{
std::string rendererString(reinterpret_cast<const char *>(glGetString(GL_RENDERER)));
return (rendererString.find("NULL") != std::string::npos);
}
bool IsAndroid()
{
#if defined(ANGLE_PLATFORM_ANDROID)

Просмотреть файл

@ -246,6 +246,7 @@ bool IsD3DSM3();
bool IsDesktopOpenGL();
bool IsOpenGLES();
bool IsOpenGL();
bool IsNULL();
// Operating systems
bool IsAndroid();

Просмотреть файл

@ -70,7 +70,10 @@ std::ostream &operator<<(std::ostream& stream, const PlatformParameters &pp)
break;
case EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE:
stream << "OPENGLES";
break;
break;
case EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE:
stream << "NULL";
break;
case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE:
stream << "DEFAULT";
break;
@ -595,4 +598,19 @@ PlatformParameters ES31_OPENGL(EGLint major, EGLint minor)
return PlatformParameters(3, 1, egl_platform::OPENGL(major, minor));
}
PlatformParameters ES2_NULL()
{
return PlatformParameters(2, 0, EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE));
}
PlatformParameters ES3_NULL()
{
return PlatformParameters(3, 0, EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE));
}
PlatformParameters ES31_NULL()
{
return PlatformParameters(3, 1, EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE));
}
} // namespace angle

Просмотреть файл

@ -139,6 +139,10 @@ PlatformParameters ES3_OPENGLES(EGLint major, EGLint minor);
PlatformParameters ES31_OPENGLES();
PlatformParameters ES31_OPENGLES(EGLint major, EGLint minor);
PlatformParameters ES2_NULL();
PlatformParameters ES3_NULL();
PlatformParameters ES31_NULL();
} // namespace angle
#endif // ANGLE_TEST_CONFIGS_H_

Просмотреть файл

@ -45,6 +45,12 @@ bool IsPlatformAvailable(const PlatformParameters &param)
#endif
break;
case EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE:
#ifndef ANGLE_ENABLE_NULL
return false;
#endif
break;
default:
UNREACHABLE();
break;