Commit a336b90f by Yunchao He Committed by Commit Bot

ES31: Impl program pipeline object management entries for GL backend.

The program pipeline object management entries are: GenProgramPipelines DeleteProgramPipelines BindProgramPipeline IsProgramPipeline BUG:angleproject:2123 Change-Id: I114d054b90caf2ee3f9befef7439552a1c309bc4 Reviewed-on: https://chromium-review.googlesource.com/629978 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 5307e15d
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "libANGLE/FramebufferAttachment.h" #include "libANGLE/FramebufferAttachment.h"
#include "libANGLE/Path.h" #include "libANGLE/Path.h"
#include "libANGLE/Program.h" #include "libANGLE/Program.h"
#include "libANGLE/ProgramPipeline.h"
#include "libANGLE/Query.h" #include "libANGLE/Query.h"
#include "libANGLE/Renderbuffer.h" #include "libANGLE/Renderbuffer.h"
#include "libANGLE/ResourceManager.h" #include "libANGLE/ResourceManager.h"
...@@ -473,6 +474,7 @@ egl::Error Context::onDestroy(const egl::Display *display) ...@@ -473,6 +474,7 @@ egl::Error Context::onDestroy(const egl::Display *display)
mState.mSyncs->release(this); mState.mSyncs->release(this);
mState.mPaths->release(this); mState.mPaths->release(this);
mState.mFramebuffers->release(this); mState.mFramebuffers->release(this);
mState.mPipelines->release(this);
return egl::NoError(); return egl::NoError();
} }
...@@ -628,6 +630,11 @@ GLuint Context::createFenceNV() ...@@ -628,6 +630,11 @@ GLuint Context::createFenceNV()
return handle; return handle;
} }
GLuint Context::createProgramPipeline()
{
return mState.mPipelines->createProgramPipeline();
}
void Context::deleteBuffer(GLuint buffer) void Context::deleteBuffer(GLuint buffer)
{ {
if (mState.mBuffers->getBuffer(buffer)) if (mState.mBuffers->getBuffer(buffer))
...@@ -677,6 +684,16 @@ void Context::deleteSync(GLsync sync) ...@@ -677,6 +684,16 @@ void Context::deleteSync(GLsync sync)
mState.mSyncs->deleteObject(this, static_cast<GLuint>(reinterpret_cast<uintptr_t>(sync))); mState.mSyncs->deleteObject(this, static_cast<GLuint>(reinterpret_cast<uintptr_t>(sync)));
} }
void Context::deleteProgramPipeline(GLuint pipeline)
{
if (mState.mPipelines->getProgramPipeline(pipeline))
{
detachProgramPipeline(pipeline);
}
mState.mPipelines->deleteObject(this, pipeline);
}
void Context::deletePaths(GLuint first, GLsizei range) void Context::deletePaths(GLuint first, GLsizei range)
{ {
mState.mPaths->deletePaths(first, range); mState.mPaths->deletePaths(first, range);
...@@ -822,6 +839,11 @@ TransformFeedback *Context::getTransformFeedback(GLuint handle) const ...@@ -822,6 +839,11 @@ TransformFeedback *Context::getTransformFeedback(GLuint handle) const
return mTransformFeedbackMap.query(handle); return mTransformFeedbackMap.query(handle);
} }
ProgramPipeline *Context::getProgramPipeline(GLuint handle) const
{
return mState.mPipelines->getProgramPipeline(handle);
}
LabeledObject *Context::getLabeledObject(GLenum identifier, GLuint name) const LabeledObject *Context::getLabeledObject(GLenum identifier, GLuint name) const
{ {
switch (identifier) switch (identifier)
...@@ -1090,6 +1112,13 @@ void Context::bindTransformFeedback(GLenum target, GLuint transformFeedbackHandl ...@@ -1090,6 +1112,13 @@ void Context::bindTransformFeedback(GLenum target, GLuint transformFeedbackHandl
mGLState.setTransformFeedbackBinding(this, transformFeedback); mGLState.setTransformFeedbackBinding(this, transformFeedback);
} }
void Context::bindProgramPipeline(GLuint pipelineHandle)
{
ProgramPipeline *pipeline =
mState.mPipelines->checkProgramPipelineAllocation(mImplementation.get(), pipelineHandle);
mGLState.setProgramPipelineBinding(this, pipeline);
}
void Context::beginQuery(GLenum target, GLuint query) void Context::beginQuery(GLenum target, GLuint query)
{ {
Query *queryObject = getQuery(query, true, target); Query *queryObject = getQuery(query, true, target);
...@@ -2355,6 +2384,11 @@ void Context::detachSampler(GLuint sampler) ...@@ -2355,6 +2384,11 @@ void Context::detachSampler(GLuint sampler)
mGLState.detachSampler(this, sampler); mGLState.detachSampler(this, sampler);
} }
void Context::detachProgramPipeline(GLuint pipeline)
{
mGLState.detachProgramPipeline(this, pipeline);
}
void Context::vertexAttribDivisor(GLuint index, GLuint divisor) void Context::vertexAttribDivisor(GLuint index, GLuint divisor)
{ {
mGLState.setVertexAttribDivisor(this, index, divisor); mGLState.setVertexAttribDivisor(this, index, divisor);
...@@ -5280,4 +5314,33 @@ void Context::onTextureChange(const Texture *texture) ...@@ -5280,4 +5314,33 @@ void Context::onTextureChange(const Texture *texture)
mGLState.setObjectDirty(GL_TEXTURE); mGLState.setObjectDirty(GL_TEXTURE);
} }
void Context::genProgramPipelines(GLsizei count, GLuint *pipelines)
{
for (int i = 0; i < count; i++)
{
pipelines[i] = createProgramPipeline();
}
}
void Context::deleteProgramPipelines(GLsizei count, const GLuint *pipelines)
{
for (int i = 0; i < count; i++)
{
if (pipelines[i] != 0)
{
deleteProgramPipeline(pipelines[i]);
}
}
}
GLboolean Context::isProgramPipeline(GLuint pipeline)
{
if (pipeline == 0)
{
return GL_FALSE;
}
return (getProgramPipeline(pipeline) ? GL_TRUE : GL_FALSE);
}
} // namespace gl } // namespace gl
...@@ -58,6 +58,7 @@ class Texture; ...@@ -58,6 +58,7 @@ class Texture;
class TransformFeedback; class TransformFeedback;
class VertexArray; class VertexArray;
struct VertexAttribute; struct VertexAttribute;
class ProgramPipeline;
class Context final : public ValidationContext class Context final : public ValidationContext
{ {
...@@ -85,6 +86,7 @@ class Context final : public ValidationContext ...@@ -85,6 +86,7 @@ class Context final : public ValidationContext
GLuint createTexture(); GLuint createTexture();
GLuint createRenderbuffer(); GLuint createRenderbuffer();
GLuint createPaths(GLsizei range); GLuint createPaths(GLsizei range);
GLuint createProgramPipeline();
void deleteBuffer(GLuint buffer); void deleteBuffer(GLuint buffer);
void deleteShader(GLuint shader); void deleteShader(GLuint shader);
...@@ -92,6 +94,7 @@ class Context final : public ValidationContext ...@@ -92,6 +94,7 @@ class Context final : public ValidationContext
void deleteTexture(GLuint texture); void deleteTexture(GLuint texture);
void deleteRenderbuffer(GLuint renderbuffer); void deleteRenderbuffer(GLuint renderbuffer);
void deletePaths(GLuint first, GLsizei range); void deletePaths(GLuint first, GLsizei range);
void deleteProgramPipeline(GLuint pipeline);
// CHROMIUM_path_rendering // CHROMIUM_path_rendering
bool hasPathData(GLuint path) const; bool hasPathData(GLuint path) const;
...@@ -159,6 +162,7 @@ class Context final : public ValidationContext ...@@ -159,6 +162,7 @@ class Context final : public ValidationContext
void useProgram(GLuint program); void useProgram(GLuint program);
void bindTransformFeedback(GLenum target, GLuint transformFeedbackHandle); void bindTransformFeedback(GLenum target, GLuint transformFeedbackHandle);
void bindDrawIndirectBuffer(GLuint bufferHandle); void bindDrawIndirectBuffer(GLuint bufferHandle);
void bindProgramPipeline(GLuint pipelineHandle);
void beginQuery(GLenum target, GLuint query); void beginQuery(GLenum target, GLuint query);
void endQuery(GLenum target); void endQuery(GLenum target);
...@@ -229,6 +233,8 @@ class Context final : public ValidationContext ...@@ -229,6 +233,8 @@ class Context final : public ValidationContext
Query *getQuery(GLuint handle, bool create, GLenum type); Query *getQuery(GLuint handle, bool create, GLenum type);
Query *getQuery(GLuint handle) const; Query *getQuery(GLuint handle) const;
TransformFeedback *getTransformFeedback(GLuint handle) const; TransformFeedback *getTransformFeedback(GLuint handle) const;
ProgramPipeline *getProgramPipeline(GLuint handle) const;
void objectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label); void objectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
void objectPtrLabel(const void *ptr, GLsizei length, const GLchar *label); void objectPtrLabel(const void *ptr, GLsizei length, const GLchar *label);
void getObjectLabel(GLenum identifier, void getObjectLabel(GLenum identifier,
...@@ -880,6 +886,10 @@ class Context final : public ValidationContext ...@@ -880,6 +886,10 @@ class Context final : public ValidationContext
void programUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value); void programUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);
void deleteProgramPipelines(GLsizei n, const GLuint *pipelines);
void genProgramPipelines(GLsizei n, GLuint *pipelines);
GLboolean isProgramPipeline(GLuint pipeline);
// Consumes the error. // Consumes the error.
void handleError(const Error &error) override; void handleError(const Error &error) override;
...@@ -953,6 +963,7 @@ class Context final : public ValidationContext ...@@ -953,6 +963,7 @@ class Context final : public ValidationContext
void detachVertexArray(GLuint vertexArray); void detachVertexArray(GLuint vertexArray);
void detachTransformFeedback(GLuint transformFeedback); void detachTransformFeedback(GLuint transformFeedback);
void detachSampler(GLuint sampler); void detachSampler(GLuint sampler);
void detachProgramPipeline(GLuint pipeline);
void initRendererString(); void initRendererString();
void initVersionStrings(); void initVersionStrings();
......
...@@ -88,7 +88,8 @@ ContextState::ContextState(ContextID contextIn, ...@@ -88,7 +88,8 @@ ContextState::ContextState(ContextID contextIn,
mSamplers(AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mSamplers)), mSamplers(AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mSamplers)),
mSyncs(AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mSyncs)), mSyncs(AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mSyncs)),
mPaths(AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mPaths)), mPaths(AllocateOrGetSharedResourceManager(shareContextState, &ContextState::mPaths)),
mFramebuffers(new FramebufferManager()) mFramebuffers(new FramebufferManager()),
mPipelines(new ProgramPipelineManager())
{ {
} }
...@@ -780,6 +781,11 @@ bool ValidationContext::isFramebufferGenerated(GLuint framebuffer) const ...@@ -780,6 +781,11 @@ bool ValidationContext::isFramebufferGenerated(GLuint framebuffer) const
return mState.mFramebuffers->isHandleGenerated(framebuffer); return mState.mFramebuffers->isHandleGenerated(framebuffer);
} }
bool ValidationContext::isProgramPipelineGenerated(GLuint pipeline) const
{
return mState.mPipelines->isHandleGenerated(pipeline);
}
bool ValidationContext::usingDisplayTextureShareGroup() const bool ValidationContext::usingDisplayTextureShareGroup() const
{ {
return mDisplayTextureShareGroup; return mDisplayTextureShareGroup;
......
...@@ -21,6 +21,7 @@ class BufferManager; ...@@ -21,6 +21,7 @@ class BufferManager;
class ContextState; class ContextState;
class FramebufferManager; class FramebufferManager;
class PathManager; class PathManager;
class ProgramPipelineManager;
class RenderbufferManager; class RenderbufferManager;
class SamplerManager; class SamplerManager;
class ShaderProgramManager; class ShaderProgramManager;
...@@ -85,6 +86,7 @@ class ContextState final : angle::NonCopyable ...@@ -85,6 +86,7 @@ class ContextState final : angle::NonCopyable
SyncManager *mSyncs; SyncManager *mSyncs;
PathManager *mPaths; PathManager *mPaths;
FramebufferManager *mFramebuffers; FramebufferManager *mFramebuffers;
ProgramPipelineManager *mPipelines;
}; };
class ValidationContext : angle::NonCopyable class ValidationContext : angle::NonCopyable
...@@ -125,6 +127,7 @@ class ValidationContext : angle::NonCopyable ...@@ -125,6 +127,7 @@ class ValidationContext : angle::NonCopyable
bool isBufferGenerated(GLuint buffer) const; bool isBufferGenerated(GLuint buffer) const;
bool isRenderbufferGenerated(GLuint renderbuffer) const; bool isRenderbufferGenerated(GLuint renderbuffer) const;
bool isFramebufferGenerated(GLuint framebuffer) const; bool isFramebufferGenerated(GLuint framebuffer) const;
bool isProgramPipelineGenerated(GLuint pipeline) const;
bool usingDisplayTextureShareGroup() const; bool usingDisplayTextureShareGroup() const;
......
//
// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ProgramPipeline.cpp: Implements the gl::ProgramPipeline class.
// Implements GL program pipeline objects and related functionality.
// [OpenGL ES 3.1] section 7.4 page 105.
#include "libANGLE/ProgramPipeline.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/renderer/GLImplFactory.h"
#include "libANGLE/renderer/ProgramPipelineImpl.h"
namespace gl
{
ProgramPipelineState::ProgramPipelineState() : mLabel()
{
}
ProgramPipelineState::~ProgramPipelineState()
{
}
const std::string &ProgramPipelineState::getLabel() const
{
return mLabel;
}
ProgramPipeline::ProgramPipeline(rx::GLImplFactory *factory, GLuint handle)
: RefCountObject(handle),
mProgramPipeline(factory->createProgramPipeline(mState))
{
ASSERT(mProgramPipeline);
}
ProgramPipeline::~ProgramPipeline()
{
mProgramPipeline.release();
}
void ProgramPipeline::setLabel(const std::string &label)
{
mState.mLabel = label;
}
const std::string &ProgramPipeline::getLabel() const
{
return mState.mLabel;
}
rx::ProgramPipelineImpl *ProgramPipeline::getImplementation() const
{
return mProgramPipeline.get();
}
} // namespace gl
//
// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ProgramPipeline.h: Defines the gl::ProgramPipeline class.
// Implements GL program pipeline objects and related functionality.
// [OpenGL ES 3.1] section 7.4 page 105.
#ifndef LIBANGLE_PROGRAMPIPELINE_H_
#define LIBANGLE_PROGRAMPIPELINE_H_
#include <memory>
#include "common/angleutils.h"
#include "libANGLE/Debug.h"
#include "libANGLE/RefCountObject.h"
namespace rx
{
class GLImplFactory;
class ProgramPipelineImpl;
};
namespace gl
{
class Context;
class ProgramPipeline;
class ProgramPipelineState final : angle::NonCopyable
{
public:
ProgramPipelineState();
~ProgramPipelineState();
const std::string &getLabel() const;
private:
friend class ProgramPipeline;
std::string mLabel;
};
class ProgramPipeline final : public RefCountObject, public LabeledObject
{
public:
ProgramPipeline(rx::GLImplFactory *factory, GLuint handle);
~ProgramPipeline() override;
Error onDestroy(const Context *context) override { return NoError(); }
void setLabel(const std::string &label) override;
const std::string &getLabel() const override;
rx::ProgramPipelineImpl *getImplementation() const;
private:
std::unique_ptr<rx::ProgramPipelineImpl> mProgramPipeline;
ProgramPipelineState mState;
};
}
#endif // LIBANGLE_PROGRAMPIPELINE_H_
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "libANGLE/Fence.h" #include "libANGLE/Fence.h"
#include "libANGLE/Path.h" #include "libANGLE/Path.h"
#include "libANGLE/Program.h" #include "libANGLE/Program.h"
#include "libANGLE/ProgramPipeline.h"
#include "libANGLE/Renderbuffer.h" #include "libANGLE/Renderbuffer.h"
#include "libANGLE/Sampler.h" #include "libANGLE/Sampler.h"
#include "libANGLE/Shader.h" #include "libANGLE/Shader.h"
...@@ -104,6 +105,7 @@ template class TypedResourceManager<Renderbuffer, HandleAllocator, RenderbufferM ...@@ -104,6 +105,7 @@ template class TypedResourceManager<Renderbuffer, HandleAllocator, RenderbufferM
template class TypedResourceManager<Sampler, HandleAllocator, SamplerManager>; template class TypedResourceManager<Sampler, HandleAllocator, SamplerManager>;
template class TypedResourceManager<Sync, HandleAllocator, SyncManager>; template class TypedResourceManager<Sync, HandleAllocator, SyncManager>;
template class TypedResourceManager<Framebuffer, HandleAllocator, FramebufferManager>; template class TypedResourceManager<Framebuffer, HandleAllocator, FramebufferManager>;
template class TypedResourceManager<ProgramPipeline, HandleAllocator, ProgramPipelineManager>;
// BufferManager Implementation. // BufferManager Implementation.
...@@ -440,4 +442,31 @@ void FramebufferManager::invalidateFramebufferComplenessCache() const ...@@ -440,4 +442,31 @@ void FramebufferManager::invalidateFramebufferComplenessCache() const
} }
} }
// ProgramPipelineManager Implementation.
// static
ProgramPipeline *ProgramPipelineManager::AllocateNewObject(rx::GLImplFactory *factory,
GLuint handle)
{
ProgramPipeline *pipeline = new ProgramPipeline(factory, handle);
pipeline->addRef();
return pipeline;
}
// static
void ProgramPipelineManager::DeleteObject(const Context *context, ProgramPipeline *pipeline)
{
pipeline->release(context);
}
GLuint ProgramPipelineManager::createProgramPipeline()
{
return AllocateEmptyObject(&mHandleAllocator, &mObjectMap);
}
ProgramPipeline *ProgramPipelineManager::getProgramPipeline(GLuint handle) const
{
return mObjectMap.query(handle);
}
} // namespace gl } // namespace gl
...@@ -32,6 +32,7 @@ class Framebuffer; ...@@ -32,6 +32,7 @@ class Framebuffer;
struct Limitations; struct Limitations;
class Path; class Path;
class Program; class Program;
class ProgramPipeline;
class Renderbuffer; class Renderbuffer;
class Sampler; class Sampler;
class Shader; class Shader;
...@@ -260,6 +261,25 @@ class FramebufferManager ...@@ -260,6 +261,25 @@ class FramebufferManager
~FramebufferManager() override {} ~FramebufferManager() override {}
}; };
class ProgramPipelineManager
: public TypedResourceManager<ProgramPipeline, HandleAllocator, ProgramPipelineManager>
{
public:
GLuint createProgramPipeline();
ProgramPipeline *getProgramPipeline(GLuint handle) const;
ProgramPipeline *checkProgramPipelineAllocation(rx::GLImplFactory *factory, GLuint handle)
{
return checkObjectAllocation(factory, handle);
}
static ProgramPipeline *AllocateNewObject(rx::GLImplFactory *factory, GLuint handle);
static void DeleteObject(const Context *context, ProgramPipeline *pipeline);
protected:
~ProgramPipelineManager() override {}
};
} // namespace gl } // namespace gl
#endif // LIBANGLE_RESOURCEMANAGER_H_ #endif // LIBANGLE_RESOURCEMANAGER_H_
...@@ -237,6 +237,8 @@ void State::reset(const Context *context) ...@@ -237,6 +237,8 @@ void State::reset(const Context *context)
} }
mProgram = nullptr; mProgram = nullptr;
mProgramPipeline.set(context, nullptr);
mTransformFeedback.set(context, nullptr); mTransformFeedback.set(context, nullptr);
for (State::ActiveQueryMap::iterator i = mActiveQueries.begin(); i != mActiveQueries.end(); i++) for (State::ActiveQueryMap::iterator i = mActiveQueries.begin(); i != mActiveQueries.end(); i++)
...@@ -1158,6 +1160,16 @@ bool State::removeTransformFeedbackBinding(const Context *context, GLuint transf ...@@ -1158,6 +1160,16 @@ bool State::removeTransformFeedbackBinding(const Context *context, GLuint transf
return false; return false;
} }
void State::setProgramPipelineBinding(const Context *context, ProgramPipeline *pipeline)
{
mProgramPipeline.set(context, pipeline);
}
void State::detachProgramPipeline(const Context *context, GLuint pipeline)
{
mProgramPipeline.set(context, nullptr);
}
bool State::isQueryActive(const GLenum type) const bool State::isQueryActive(const GLenum type) const
{ {
for (auto &iter : mActiveQueries) for (auto &iter : mActiveQueries)
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "common/bitset_utils.h" #include "common/bitset_utils.h"
#include "libANGLE/Debug.h" #include "libANGLE/Debug.h"
#include "libANGLE/Program.h" #include "libANGLE/Program.h"
#include "libANGLE/ProgramPipeline.h"
#include "libANGLE/RefCountObject.h" #include "libANGLE/RefCountObject.h"
#include "libANGLE/Renderbuffer.h" #include "libANGLE/Renderbuffer.h"
#include "libANGLE/Sampler.h" #include "libANGLE/Sampler.h"
...@@ -219,6 +220,10 @@ class State : public OnAttachmentDirtyReceiver, angle::NonCopyable ...@@ -219,6 +220,10 @@ class State : public OnAttachmentDirtyReceiver, angle::NonCopyable
GLuint getActiveQueryId(GLenum target) const; GLuint getActiveQueryId(GLenum target) const;
Query *getActiveQuery(GLenum target) const; Query *getActiveQuery(GLenum target) const;
// Program Pipeline binding manipulation
void setProgramPipelineBinding(const Context *context, ProgramPipeline *pipeline);
void detachProgramPipeline(const Context *context, GLuint pipeline);
//// Typed buffer binding point manipulation //// //// Typed buffer binding point manipulation ////
// GL_ARRAY_BUFFER // GL_ARRAY_BUFFER
void setArrayBufferBinding(const Context *context, Buffer *buffer); void setArrayBufferBinding(const Context *context, Buffer *buffer);
...@@ -524,6 +529,7 @@ class State : public OnAttachmentDirtyReceiver, angle::NonCopyable ...@@ -524,6 +529,7 @@ class State : public OnAttachmentDirtyReceiver, angle::NonCopyable
Framebuffer *mDrawFramebuffer; Framebuffer *mDrawFramebuffer;
BindingPointer<Renderbuffer> mRenderbuffer; BindingPointer<Renderbuffer> mRenderbuffer;
Program *mProgram; Program *mProgram;
BindingPointer<ProgramPipeline> mProgramPipeline;
typedef std::vector<VertexAttribCurrentValueData> VertexAttribVector; typedef std::vector<VertexAttribCurrentValueData> VertexAttribVector;
VertexAttribVector mVertexAttribCurrentValues; // From glVertexAttrib VertexAttribVector mVertexAttribCurrentValues; // From glVertexAttrib
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "angle_gl.h" #include "angle_gl.h"
#include "libANGLE/Framebuffer.h" #include "libANGLE/Framebuffer.h"
#include "libANGLE/Program.h" #include "libANGLE/Program.h"
#include "libANGLE/ProgramPipeline.h"
#include "libANGLE/Shader.h" #include "libANGLE/Shader.h"
#include "libANGLE/TransformFeedback.h" #include "libANGLE/TransformFeedback.h"
#include "libANGLE/VertexArray.h" #include "libANGLE/VertexArray.h"
...@@ -34,6 +35,7 @@ class SyncImpl; ...@@ -34,6 +35,7 @@ class SyncImpl;
class FramebufferImpl; class FramebufferImpl;
class PathImpl; class PathImpl;
class ProgramImpl; class ProgramImpl;
class ProgramPipelineImpl;
class QueryImpl; class QueryImpl;
class RenderbufferImpl; class RenderbufferImpl;
class SamplerImpl; class SamplerImpl;
...@@ -80,6 +82,9 @@ class GLImplFactory : angle::NonCopyable ...@@ -80,6 +82,9 @@ class GLImplFactory : angle::NonCopyable
// Sampler object creation // Sampler object creation
virtual SamplerImpl *createSampler(const gl::SamplerState &state) = 0; virtual SamplerImpl *createSampler(const gl::SamplerState &state) = 0;
// Program Pipeline object creation
virtual ProgramPipelineImpl *createProgramPipeline(const gl::ProgramPipelineState &data) = 0;
virtual std::vector<PathImpl *> createPaths(GLsizei range) = 0; virtual std::vector<PathImpl *> createPaths(GLsizei range) = 0;
}; };
......
//
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ProgramPipelineImpl.h: Defines the abstract rx::ProgramPipelineImpl class.
#ifndef LIBANGLE_RENDERER_PROGRAMPIPELINEIMPL_H_
#define LIBANGLE_RENDERER_PROGRAMPIPELINEIMPL_H_
#include "common/angleutils.h"
#include "libANGLE/ProgramPipeline.h"
namespace rx
{
class ContextImpl;
class ProgramPipelineImpl : public angle::NonCopyable
{
public:
ProgramPipelineImpl(const gl::ProgramPipelineState &state) : mState(state) {}
virtual ~ProgramPipelineImpl() {}
virtual void destroy(const ContextImpl *contextImpl) {}
protected:
const gl::ProgramPipelineState &mState;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_PROGRAMPIPELINEIMPL_H_
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "libANGLE/renderer/d3d/d3d11/Buffer11.h" #include "libANGLE/renderer/d3d/d3d11/Buffer11.h"
#include "libANGLE/renderer/d3d/d3d11/Fence11.h" #include "libANGLE/renderer/d3d/d3d11/Fence11.h"
#include "libANGLE/renderer/d3d/d3d11/Framebuffer11.h" #include "libANGLE/renderer/d3d/d3d11/Framebuffer11.h"
#include "libANGLE/renderer/d3d/d3d11/ProgramPipeline11.h"
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h" #include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
#include "libANGLE/renderer/d3d/d3d11/StateManager11.h" #include "libANGLE/renderer/d3d/d3d11/StateManager11.h"
#include "libANGLE/renderer/d3d/d3d11/TransformFeedback11.h" #include "libANGLE/renderer/d3d/d3d11/TransformFeedback11.h"
...@@ -136,6 +137,11 @@ SamplerImpl *Context11::createSampler(const gl::SamplerState &state) ...@@ -136,6 +137,11 @@ SamplerImpl *Context11::createSampler(const gl::SamplerState &state)
return new SamplerD3D(state); return new SamplerD3D(state);
} }
ProgramPipelineImpl *Context11::createProgramPipeline(const gl::ProgramPipelineState &data)
{
return new ProgramPipeline11(data);
}
std::vector<PathImpl *> Context11::createPaths(GLsizei) std::vector<PathImpl *> Context11::createPaths(GLsizei)
{ {
return std::vector<PathImpl *>(); return std::vector<PathImpl *>();
......
...@@ -56,6 +56,9 @@ class Context11 : public ContextImpl ...@@ -56,6 +56,9 @@ class Context11 : public ContextImpl
// Sampler object creation // Sampler object creation
SamplerImpl *createSampler(const gl::SamplerState &state) override; SamplerImpl *createSampler(const gl::SamplerState &state) override;
// Program Pipeline object creation
ProgramPipelineImpl *createProgramPipeline(const gl::ProgramPipelineState &data) override;
// Path object creation. // Path object creation.
std::vector<PathImpl *> createPaths(GLsizei) override; std::vector<PathImpl *> createPaths(GLsizei) override;
......
//
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ProgramPipelineNULL.cpp:
// Implements the class methods for ProgramPipeline11.
//
#include "libANGLE/renderer/d3d/d3d11/ProgramPipeline11.h"
namespace rx
{
ProgramPipeline11::ProgramPipeline11(const gl::ProgramPipelineState &state)
: ProgramPipelineImpl(state)
{
}
ProgramPipeline11::~ProgramPipeline11()
{
}
} // namespace rx
//
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ProgramPipeline11.h:
// Defines the class interface for ProgramPipeline11, implementing ProgramPipelineImpl.
//
#ifndef LIBANGLE_RENDERER_D3D_D3D11_PROGRAMPIPELINE11_H_
#define LIBANGLE_RENDERER_D3D_D3D11_PROGRAMPIPELINE11_H_
#include "libANGLE/renderer/ProgramPipelineImpl.h"
namespace rx
{
class ProgramPipeline11 : public ProgramPipelineImpl
{
public:
ProgramPipeline11(const gl::ProgramPipelineState &state);
~ProgramPipeline11() override;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_D3D_D3D11_PROGRAMPIPELINE11_H_
...@@ -120,6 +120,12 @@ SamplerImpl *Context9::createSampler(const gl::SamplerState &state) ...@@ -120,6 +120,12 @@ SamplerImpl *Context9::createSampler(const gl::SamplerState &state)
return new SamplerD3D(state); return new SamplerD3D(state);
} }
ProgramPipelineImpl *Context9::createProgramPipeline(const gl::ProgramPipelineState &data)
{
UNREACHABLE();
return nullptr;
}
std::vector<PathImpl *> Context9::createPaths(GLsizei) std::vector<PathImpl *> Context9::createPaths(GLsizei)
{ {
return std::vector<PathImpl *>(); return std::vector<PathImpl *>();
......
...@@ -56,6 +56,9 @@ class Context9 : public ContextImpl ...@@ -56,6 +56,9 @@ class Context9 : public ContextImpl
// Sampler object creation // Sampler object creation
SamplerImpl *createSampler(const gl::SamplerState &state) override; SamplerImpl *createSampler(const gl::SamplerState &state) override;
// Program Pipeline object creation
ProgramPipelineImpl *createProgramPipeline(const gl::ProgramPipelineState &data) override;
// Path object creation // Path object creation
std::vector<PathImpl *> createPaths(GLsizei) override; std::vector<PathImpl *> createPaths(GLsizei) override;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "libANGLE/renderer/gl/FunctionsGL.h" #include "libANGLE/renderer/gl/FunctionsGL.h"
#include "libANGLE/renderer/gl/PathGL.h" #include "libANGLE/renderer/gl/PathGL.h"
#include "libANGLE/renderer/gl/ProgramGL.h" #include "libANGLE/renderer/gl/ProgramGL.h"
#include "libANGLE/renderer/gl/ProgramPipelineGL.h"
#include "libANGLE/renderer/gl/QueryGL.h" #include "libANGLE/renderer/gl/QueryGL.h"
#include "libANGLE/renderer/gl/RenderbufferGL.h" #include "libANGLE/renderer/gl/RenderbufferGL.h"
#include "libANGLE/renderer/gl/RendererGL.h" #include "libANGLE/renderer/gl/RendererGL.h"
...@@ -122,6 +123,11 @@ SamplerImpl *ContextGL::createSampler(const gl::SamplerState &state) ...@@ -122,6 +123,11 @@ SamplerImpl *ContextGL::createSampler(const gl::SamplerState &state)
return new SamplerGL(state, getFunctions(), getStateManager()); return new SamplerGL(state, getFunctions(), getStateManager());
} }
ProgramPipelineImpl *ContextGL::createProgramPipeline(const gl::ProgramPipelineState &data)
{
return new ProgramPipelineGL(data, getFunctions());
}
std::vector<PathImpl *> ContextGL::createPaths(GLsizei range) std::vector<PathImpl *> ContextGL::createPaths(GLsizei range)
{ {
const FunctionsGL *funcs = getFunctions(); const FunctionsGL *funcs = getFunctions();
......
...@@ -64,6 +64,9 @@ class ContextGL : public ContextImpl ...@@ -64,6 +64,9 @@ class ContextGL : public ContextImpl
// Sampler object creation // Sampler object creation
SamplerImpl *createSampler(const gl::SamplerState &state) override; SamplerImpl *createSampler(const gl::SamplerState &state) override;
// Program Pipeline object creation
ProgramPipelineImpl *createProgramPipeline(const gl::ProgramPipelineState &data) override;
// Path object creation // Path object creation
std::vector<PathImpl *> createPaths(GLsizei range) override; std::vector<PathImpl *> createPaths(GLsizei range) override;
......
//
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ProgramPipelineGL.cpp: Implements the class methods for ProgramPipelineGL.
#include "libANGLE/renderer/gl/ProgramPipelineGL.h"
#include "common/debug.h"
#include "libANGLE/renderer/gl/FunctionsGL.h"
namespace rx
{
ProgramPipelineGL::ProgramPipelineGL(const gl::ProgramPipelineState &data,
const FunctionsGL *functions)
: ProgramPipelineImpl(data), mFunctions(functions), mProgramPipelineID(0)
{
ASSERT(mFunctions);
mFunctions->genProgramPipelines(1, &mProgramPipelineID);
}
ProgramPipelineGL::~ProgramPipelineGL()
{
if (mProgramPipelineID != 0)
{
mFunctions->deleteProgramPipelines(1, &mProgramPipelineID);
mProgramPipelineID = 0;
}
}
} // namespace rx
//
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ProgramPipelineGL.h:
// Defines the class interface for ProgramPipelineGL, implementing ProgramPipelineImpl.
//
#ifndef LIBANGLE_RENDERER_GL_PROGRAMPIPELINEGL_H_
#define LIBANGLE_RENDERER_GL_PROGRAMPIPELINEGL_H_
#include "libANGLE/renderer/ProgramPipelineImpl.h"
namespace rx
{
class FunctionsGL;
class ProgramPipelineGL : public ProgramPipelineImpl
{
public:
ProgramPipelineGL(const gl::ProgramPipelineState &data, const FunctionsGL *functions);
~ProgramPipelineGL() override;
GLuint getID() const { return mProgramPipelineID; }
private:
const FunctionsGL *mFunctions;
GLuint mProgramPipelineID;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_GL_PROGRAMPIPELINEGL_H_
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "libANGLE/renderer/null/ImageNULL.h" #include "libANGLE/renderer/null/ImageNULL.h"
#include "libANGLE/renderer/null/PathNULL.h" #include "libANGLE/renderer/null/PathNULL.h"
#include "libANGLE/renderer/null/ProgramNULL.h" #include "libANGLE/renderer/null/ProgramNULL.h"
#include "libANGLE/renderer/null/ProgramPipelineNULL.h"
#include "libANGLE/renderer/null/QueryNULL.h" #include "libANGLE/renderer/null/QueryNULL.h"
#include "libANGLE/renderer/null/RenderbufferNULL.h" #include "libANGLE/renderer/null/RenderbufferNULL.h"
#include "libANGLE/renderer/null/SamplerNULL.h" #include "libANGLE/renderer/null/SamplerNULL.h"
...@@ -362,6 +363,11 @@ SamplerImpl *ContextNULL::createSampler(const gl::SamplerState &state) ...@@ -362,6 +363,11 @@ SamplerImpl *ContextNULL::createSampler(const gl::SamplerState &state)
return new SamplerNULL(state); return new SamplerNULL(state);
} }
ProgramPipelineImpl *ContextNULL::createProgramPipeline(const gl::ProgramPipelineState &state)
{
return new ProgramPipelineNULL(state);
}
std::vector<PathImpl *> ContextNULL::createPaths(GLsizei range) std::vector<PathImpl *> ContextNULL::createPaths(GLsizei range)
{ {
std::vector<PathImpl *> result(range); std::vector<PathImpl *> result(range);
......
...@@ -185,6 +185,9 @@ class ContextNULL : public ContextImpl ...@@ -185,6 +185,9 @@ class ContextNULL : public ContextImpl
// Sampler object creation // Sampler object creation
SamplerImpl *createSampler(const gl::SamplerState &state) override; SamplerImpl *createSampler(const gl::SamplerState &state) override;
// Program Pipeline object creation
ProgramPipelineImpl *createProgramPipeline(const gl::ProgramPipelineState &data) override;
std::vector<PathImpl *> createPaths(GLsizei range) override; std::vector<PathImpl *> createPaths(GLsizei range) override;
gl::Error dispatchCompute(const gl::Context *context, gl::Error dispatchCompute(const gl::Context *context,
......
//
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ProgramPipelineNULL.cpp:
// Implements the class methods for ProgramPipelineNULL.
//
#include "libANGLE/renderer/null/ProgramPipelineNULL.h"
namespace rx
{
ProgramPipelineNULL::ProgramPipelineNULL(const gl::ProgramPipelineState &state)
: ProgramPipelineImpl(state)
{
}
ProgramPipelineNULL::~ProgramPipelineNULL()
{
}
} // namespace rx
//
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ProgramPipelineNULL.h:
// Defines the class interface for ProgramPipelineNULL, implementing ProgramPipelineImpl.
//
#ifndef LIBANGLE_RENDERER_NULL_PROGRAMPIPELINENULL_H_
#define LIBANGLE_RENDERER_NULL_PROGRAMPIPELINENULL_H_
#include "libANGLE/renderer/ProgramPipelineImpl.h"
namespace rx
{
class ProgramPipelineNULL : public ProgramPipelineImpl
{
public:
ProgramPipelineNULL(const gl::ProgramPipelineState &state);
~ProgramPipelineNULL() override;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_NULL_PROGRAMPIPELINENULL_H_
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "libANGLE/renderer/vulkan/FenceNVVk.h" #include "libANGLE/renderer/vulkan/FenceNVVk.h"
#include "libANGLE/renderer/vulkan/FramebufferVk.h" #include "libANGLE/renderer/vulkan/FramebufferVk.h"
#include "libANGLE/renderer/vulkan/ImageVk.h" #include "libANGLE/renderer/vulkan/ImageVk.h"
#include "libANGLE/renderer/vulkan/ProgramPipelineVk.h"
#include "libANGLE/renderer/vulkan/ProgramVk.h" #include "libANGLE/renderer/vulkan/ProgramVk.h"
#include "libANGLE/renderer/vulkan/QueryVk.h" #include "libANGLE/renderer/vulkan/QueryVk.h"
#include "libANGLE/renderer/vulkan/RenderbufferVk.h" #include "libANGLE/renderer/vulkan/RenderbufferVk.h"
...@@ -545,6 +546,11 @@ SamplerImpl *ContextVk::createSampler(const gl::SamplerState &state) ...@@ -545,6 +546,11 @@ SamplerImpl *ContextVk::createSampler(const gl::SamplerState &state)
return new SamplerVk(state); return new SamplerVk(state);
} }
ProgramPipelineImpl *ContextVk::createProgramPipeline(const gl::ProgramPipelineState &state)
{
return new ProgramPipelineVk(state);
}
std::vector<PathImpl *> ContextVk::createPaths(GLsizei) std::vector<PathImpl *> ContextVk::createPaths(GLsizei)
{ {
return std::vector<PathImpl *>(); return std::vector<PathImpl *>();
......
...@@ -128,6 +128,9 @@ class ContextVk : public ContextImpl, public ResourceVk ...@@ -128,6 +128,9 @@ class ContextVk : public ContextImpl, public ResourceVk
// Sampler object creation // Sampler object creation
SamplerImpl *createSampler(const gl::SamplerState &state) override; SamplerImpl *createSampler(const gl::SamplerState &state) override;
// Program Pipeline object creation
ProgramPipelineImpl *createProgramPipeline(const gl::ProgramPipelineState &data) override;
// Path object creation // Path object creation
std::vector<PathImpl *> createPaths(GLsizei) override; std::vector<PathImpl *> createPaths(GLsizei) override;
......
//
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ProgramPipelineVk.cpp:
// Implements the class methods for ProgramPipelineVk.
//
#include "libANGLE/renderer/vulkan/ProgramPipelineVk.h"
namespace rx
{
ProgramPipelineVk::ProgramPipelineVk(const gl::ProgramPipelineState &state)
: ProgramPipelineImpl(state)
{
}
ProgramPipelineVk::~ProgramPipelineVk()
{
}
} // namespace rx
//
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ProgramPipelineVk.h:
// Defines the class interface for ProgramPipelineVk, implementing ProgramPipelineImpl.
//
#ifndef LIBANGLE_RENDERER_VULKAN_PROGRAMPIPELINEVK_H_
#define LIBANGLE_RENDERER_VULKAN_PROGRAMPIPELINEVK_H_
#include "libANGLE/renderer/ProgramPipelineImpl.h"
namespace rx
{
class ProgramPipelineVk : public ProgramPipelineImpl
{
public:
ProgramPipelineVk(const gl::ProgramPipelineState &state);
~ProgramPipelineVk() override;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_VULKAN_PROGRAMPIPELINEVK_H_
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "libANGLE/Framebuffer.h" #include "libANGLE/Framebuffer.h"
#include "libANGLE/VertexArray.h" #include "libANGLE/VertexArray.h"
#include "libANGLE/validationES.h" #include "libANGLE/validationES.h"
#include "libANGLE/validationES2.h"
#include "libANGLE/validationES3.h" #include "libANGLE/validationES3.h"
#include "common/utilities.h" #include "common/utilities.h"
...@@ -1262,4 +1263,53 @@ bool ValidateGetProgramInterfaceiv(Context *context, ...@@ -1262,4 +1263,53 @@ bool ValidateGetProgramInterfaceiv(Context *context,
return true; return true;
} }
static bool ValidateGenOrDeleteES31(Context *context, GLint n)
{
if (context->getClientVersion() < ES_3_1)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
return ValidateGenOrDelete(context, n);
}
bool ValidateGenProgramPipelines(Context *context, GLint n, GLuint *)
{
return ValidateGenOrDeleteES31(context, n);
}
bool ValidateDeleteProgramPipelines(Context *context, GLint n, const GLuint *)
{
return ValidateGenOrDeleteES31(context, n);
}
bool ValidateBindProgramPipeline(Context *context, GLuint pipeline)
{
if (context->getClientVersion() < ES_3_1)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
if (!context->isProgramPipelineGenerated(pipeline))
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ObjectNotGenerated);
return false;
}
return true;
}
bool ValidateIsProgramPipeline(Context *context, GLuint pipeline)
{
if (context->getClientVersion() < ES_3_1)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
return true;
}
} // namespace gl } // namespace gl
...@@ -116,6 +116,10 @@ bool ValidateBindImageTexture(Context *context, ...@@ -116,6 +116,10 @@ bool ValidateBindImageTexture(Context *context,
GLenum access, GLenum access,
GLenum format); GLenum format);
bool ValidateGenProgramPipelines(Context *context, GLint n, GLuint *pipelines);
bool ValidateDeleteProgramPipelines(Context *context, GLint n, const GLuint *pipelines);
bool ValidateBindProgramPipeline(Context *context, GLuint pipeline);
bool ValidateIsProgramPipeline(Context *context, GLuint pipeline);
} // namespace gl } // namespace gl
#endif // LIBANGLE_VALIDATION_ES31_H_ #endif // LIBANGLE_VALIDATION_ES31_H_
...@@ -174,6 +174,8 @@ ...@@ -174,6 +174,8 @@
'libANGLE/Platform.cpp', 'libANGLE/Platform.cpp',
'libANGLE/Program.cpp', 'libANGLE/Program.cpp',
'libANGLE/Program.h', 'libANGLE/Program.h',
'libANGLE/ProgramPipeline.cpp',
'libANGLE/ProgramPipeline.h',
'libANGLE/Query.cpp', 'libANGLE/Query.cpp',
'libANGLE/Query.h', 'libANGLE/Query.h',
'libANGLE/RefCountObject.h', 'libANGLE/RefCountObject.h',
...@@ -250,6 +252,7 @@ ...@@ -250,6 +252,7 @@
'libANGLE/renderer/GLImplFactory.h', 'libANGLE/renderer/GLImplFactory.h',
'libANGLE/renderer/ImageImpl.h', 'libANGLE/renderer/ImageImpl.h',
'libANGLE/renderer/ProgramImpl.h', 'libANGLE/renderer/ProgramImpl.h',
'libANGLE/renderer/ProgramPipelineImpl.h',
'libANGLE/renderer/QueryImpl.h', 'libANGLE/renderer/QueryImpl.h',
'libANGLE/renderer/RenderbufferImpl.h', 'libANGLE/renderer/RenderbufferImpl.h',
'libANGLE/renderer/SamplerImpl.h', 'libANGLE/renderer/SamplerImpl.h',
...@@ -417,6 +420,8 @@ ...@@ -417,6 +420,8 @@
'libANGLE/renderer/d3d/d3d11/NativeWindow11.h', 'libANGLE/renderer/d3d/d3d11/NativeWindow11.h',
'libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp', 'libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp',
'libANGLE/renderer/d3d/d3d11/PixelTransfer11.h', 'libANGLE/renderer/d3d/d3d11/PixelTransfer11.h',
'libANGLE/renderer/d3d/d3d11/ProgramPipeline11.cpp',
'libANGLE/renderer/d3d/d3d11/ProgramPipeline11.h',
'libANGLE/renderer/d3d/d3d11/Query11.cpp', 'libANGLE/renderer/d3d/d3d11/Query11.cpp',
'libANGLE/renderer/d3d/d3d11/Query11.h', 'libANGLE/renderer/d3d/d3d11/Query11.h',
'libANGLE/renderer/d3d/d3d11/Renderer11.cpp', 'libANGLE/renderer/d3d/d3d11/Renderer11.cpp',
...@@ -578,6 +583,8 @@ ...@@ -578,6 +583,8 @@
'libANGLE/renderer/gl/PathGL.cpp', 'libANGLE/renderer/gl/PathGL.cpp',
'libANGLE/renderer/gl/ProgramGL.cpp', 'libANGLE/renderer/gl/ProgramGL.cpp',
'libANGLE/renderer/gl/ProgramGL.h', 'libANGLE/renderer/gl/ProgramGL.h',
'libANGLE/renderer/gl/ProgramPipelineGL.cpp',
'libANGLE/renderer/gl/ProgramPipelineGL.h',
'libANGLE/renderer/gl/QueryGL.cpp', 'libANGLE/renderer/gl/QueryGL.cpp',
'libANGLE/renderer/gl/QueryGL.h', 'libANGLE/renderer/gl/QueryGL.h',
'libANGLE/renderer/gl/RenderbufferGL.cpp', 'libANGLE/renderer/gl/RenderbufferGL.cpp',
...@@ -704,6 +711,8 @@ ...@@ -704,6 +711,8 @@
'libANGLE/renderer/vulkan/ImageVk.h', 'libANGLE/renderer/vulkan/ImageVk.h',
'libANGLE/renderer/vulkan/ProgramVk.cpp', 'libANGLE/renderer/vulkan/ProgramVk.cpp',
'libANGLE/renderer/vulkan/ProgramVk.h', 'libANGLE/renderer/vulkan/ProgramVk.h',
'libANGLE/renderer/vulkan/ProgramPipelineVk.cpp',
'libANGLE/renderer/vulkan/ProgramPipelineVk.h',
'libANGLE/renderer/vulkan/QueryVk.cpp', 'libANGLE/renderer/vulkan/QueryVk.cpp',
'libANGLE/renderer/vulkan/QueryVk.h', 'libANGLE/renderer/vulkan/QueryVk.h',
'libANGLE/renderer/vulkan/RenderbufferVk.cpp', 'libANGLE/renderer/vulkan/RenderbufferVk.cpp',
...@@ -768,6 +777,8 @@ ...@@ -768,6 +777,8 @@
'libANGLE/renderer/null/PathNULL.h', 'libANGLE/renderer/null/PathNULL.h',
'libANGLE/renderer/null/ProgramNULL.cpp', 'libANGLE/renderer/null/ProgramNULL.cpp',
'libANGLE/renderer/null/ProgramNULL.h', 'libANGLE/renderer/null/ProgramNULL.h',
'libANGLE/renderer/null/ProgramPipelineNULL.cpp',
'libANGLE/renderer/null/ProgramPipelineNULL.h',
'libANGLE/renderer/null/QueryNULL.cpp', 'libANGLE/renderer/null/QueryNULL.cpp',
'libANGLE/renderer/null/QueryNULL.h', 'libANGLE/renderer/null/QueryNULL.h',
'libANGLE/renderer/null/RenderbufferNULL.cpp', 'libANGLE/renderer/null/RenderbufferNULL.cpp',
......
...@@ -280,11 +280,12 @@ void GL_APIENTRY BindProgramPipeline(GLuint pipeline) ...@@ -280,11 +280,12 @@ void GL_APIENTRY BindProgramPipeline(GLuint pipeline)
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (pipeline != 0) if (!context->skipValidation() && !ValidateBindProgramPipeline(context, pipeline))
{ {
// Binding non-zero pipelines is not implemented yet. return;
UNIMPLEMENTED();
} }
context->bindProgramPipeline(pipeline);
} }
} }
...@@ -294,11 +295,12 @@ void GL_APIENTRY DeleteProgramPipelines(GLsizei n, const GLuint *pipelines) ...@@ -294,11 +295,12 @@ void GL_APIENTRY DeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (!context->skipValidation()) if (!context->skipValidation() && !ValidateDeleteProgramPipelines(context, n, pipelines))
{ {
context->handleError(InvalidOperation() << "Entry point not implemented"); return;
} }
UNIMPLEMENTED();
context->deleteProgramPipelines(n, pipelines);
} }
} }
...@@ -308,11 +310,12 @@ void GL_APIENTRY GenProgramPipelines(GLsizei n, GLuint *pipelines) ...@@ -308,11 +310,12 @@ void GL_APIENTRY GenProgramPipelines(GLsizei n, GLuint *pipelines)
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (!context->skipValidation()) if (!context->skipValidation() && !ValidateGenProgramPipelines(context, n, pipelines))
{ {
context->handleError(InvalidOperation() << "Entry point not implemented"); return;
} }
UNIMPLEMENTED();
context->genProgramPipelines(n, pipelines);
} }
} }
...@@ -322,13 +325,15 @@ GLboolean GL_APIENTRY IsProgramPipeline(GLuint pipeline) ...@@ -322,13 +325,15 @@ GLboolean GL_APIENTRY IsProgramPipeline(GLuint pipeline)
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (!context->skipValidation()) if (!context->skipValidation() && !ValidateIsProgramPipeline(context, pipeline))
{ {
context->handleError(InvalidOperation() << "Entry point not implemented"); return GL_FALSE;
} }
UNIMPLEMENTED();
return context->isProgramPipeline(pipeline);
} }
return false;
return GL_FALSE;
} }
void GL_APIENTRY GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params) void GL_APIENTRY GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
......
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
'<(angle_path)/src/tests/gl_tests/ProgramBinaryTest.cpp', '<(angle_path)/src/tests/gl_tests/ProgramBinaryTest.cpp',
'<(angle_path)/src/tests/gl_tests/ProgramInterfaceTest.cpp', '<(angle_path)/src/tests/gl_tests/ProgramInterfaceTest.cpp',
'<(angle_path)/src/tests/gl_tests/ProgramParameterTest.cpp', '<(angle_path)/src/tests/gl_tests/ProgramParameterTest.cpp',
'<(angle_path)/src/tests/gl_tests/ProgramPipelineTest.cpp',
'<(angle_path)/src/tests/gl_tests/ReadPixelsTest.cpp', '<(angle_path)/src/tests/gl_tests/ReadPixelsTest.cpp',
'<(angle_path)/src/tests/gl_tests/RendererTest.cpp', '<(angle_path)/src/tests/gl_tests/RendererTest.cpp',
'<(angle_path)/src/tests/gl_tests/RobustClientMemoryTest.cpp', '<(angle_path)/src/tests/gl_tests/RobustClientMemoryTest.cpp',
......
...@@ -63,6 +63,12 @@ class NullFactory : public GLImplFactory ...@@ -63,6 +63,12 @@ class NullFactory : public GLImplFactory
// Sampler object creation // Sampler object creation
SamplerImpl *createSampler(const gl::SamplerState &state) override { return nullptr; } SamplerImpl *createSampler(const gl::SamplerState &state) override { return nullptr; }
// Program Pipeline creation
ProgramPipelineImpl *createProgramPipeline(const gl::ProgramPipelineState &data) override
{
return nullptr;
}
std::vector<PathImpl *> createPaths(GLsizei range) override std::vector<PathImpl *> createPaths(GLsizei range) override
{ {
return std::vector<PathImpl *>(); return std::vector<PathImpl *>();
...@@ -77,6 +83,7 @@ class MockGLFactory : public GLImplFactory ...@@ -77,6 +83,7 @@ class MockGLFactory : public GLImplFactory
MOCK_METHOD0(createCompiler, CompilerImpl *()); MOCK_METHOD0(createCompiler, CompilerImpl *());
MOCK_METHOD1(createShader, ShaderImpl *(const gl::ShaderState &)); MOCK_METHOD1(createShader, ShaderImpl *(const gl::ShaderState &));
MOCK_METHOD1(createProgram, ProgramImpl *(const gl::ProgramState &)); MOCK_METHOD1(createProgram, ProgramImpl *(const gl::ProgramState &));
MOCK_METHOD1(createProgramPipeline, ProgramPipelineImpl *(const gl::ProgramPipelineState &));
MOCK_METHOD1(createFramebuffer, FramebufferImpl *(const gl::FramebufferState &)); MOCK_METHOD1(createFramebuffer, FramebufferImpl *(const gl::FramebufferState &));
MOCK_METHOD1(createTexture, TextureImpl *(const gl::TextureState &)); MOCK_METHOD1(createTexture, TextureImpl *(const gl::TextureState &));
MOCK_METHOD0(createRenderbuffer, RenderbufferImpl *()); MOCK_METHOD0(createRenderbuffer, RenderbufferImpl *());
......
//
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ProgramPipelineTest:
// Various tests related to Program Pipeline.
//
#include "test_utils/ANGLETest.h"
#include "test_utils/gl_raii.h"
using namespace angle;
namespace
{
class ProgramPipelineTest : public ANGLETest
{
protected:
ProgramPipelineTest()
{
setWindowWidth(64);
setWindowHeight(64);
setConfigRedBits(8);
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
}
};
// Verify that program pipeline is not supported in version lower than ES31.
TEST_P(ProgramPipelineTest, GenerateProgramPipelineObject)
{
GLuint pipeline;
glGenProgramPipelines(1, &pipeline);
if (getClientMajorVersion() < 3 || getClientMinorVersion() < 1)
{
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
}
else
{
EXPECT_GL_NO_ERROR();
glDeleteProgramPipelines(1, &pipeline);
EXPECT_GL_NO_ERROR();
}
}
class ProgramPipelineTest31 : public ProgramPipelineTest
{
};
// Test generate or delete program pipeline.
TEST_P(ProgramPipelineTest31, GenOrDeleteProgramPipelineTest)
{
GLuint pipeline;
glGenProgramPipelines(-1, &pipeline);
EXPECT_GL_ERROR(GL_INVALID_VALUE);
glGenProgramPipelines(0, &pipeline);
EXPECT_GL_NO_ERROR();
glDeleteProgramPipelines(-1, &pipeline);
EXPECT_GL_ERROR(GL_INVALID_VALUE);
glDeleteProgramPipelines(0, &pipeline);
EXPECT_GL_NO_ERROR();
}
// Test BindProgramPipeline.
TEST_P(ProgramPipelineTest31, BindProgramPipelineTest)
{
glBindProgramPipeline(0);
EXPECT_GL_NO_ERROR();
glBindProgramPipeline(2);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
GLuint pipeline;
glGenProgramPipelines(1, &pipeline);
glBindProgramPipeline(pipeline);
EXPECT_GL_NO_ERROR();
glDeleteProgramPipelines(1, &pipeline);
glBindProgramPipeline(pipeline);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
}
// Test IsProgramPipeline
TEST_P(ProgramPipelineTest31, IsProgramPipelineTest)
{
EXPECT_EQ(GL_FALSE, glIsProgramPipeline(0));
EXPECT_GL_NO_ERROR();
EXPECT_EQ(GL_FALSE, glIsProgramPipeline(2));
EXPECT_GL_NO_ERROR();
GLuint pipeline;
glGenProgramPipelines(1, &pipeline);
glBindProgramPipeline(pipeline);
EXPECT_EQ(GL_TRUE, glIsProgramPipeline(pipeline));
EXPECT_GL_NO_ERROR();
glBindProgramPipeline(0);
glDeleteProgramPipelines(1, &pipeline);
EXPECT_EQ(GL_FALSE, glIsProgramPipeline(pipeline));
EXPECT_GL_NO_ERROR();
}
ANGLE_INSTANTIATE_TEST(ProgramPipelineTest,
ES3_OPENGL(),
ES3_OPENGLES(),
ES31_OPENGL(),
ES31_OPENGLES());
ANGLE_INSTANTIATE_TEST(ProgramPipelineTest31, ES31_OPENGL(), ES31_OPENGLES());
} // namespace
...@@ -72,6 +72,7 @@ using GLFramebuffer = GLWrapper<glGenFramebuffers, glDeleteFramebuffers>; ...@@ -72,6 +72,7 @@ using GLFramebuffer = GLWrapper<glGenFramebuffers, glDeleteFramebuffers>;
using GLRenderbuffer = GLWrapper<glGenRenderbuffers, glDeleteRenderbuffers>; using GLRenderbuffer = GLWrapper<glGenRenderbuffers, glDeleteRenderbuffers>;
using GLSampler = GLWrapper<glGenSamplers, glDeleteSamplers>; using GLSampler = GLWrapper<glGenSamplers, glDeleteSamplers>;
using GLTransformFeedback = GLWrapper<glGenTransformFeedbacks, glDeleteTransformFeedbacks>; using GLTransformFeedback = GLWrapper<glGenTransformFeedbacks, glDeleteTransformFeedbacks>;
using GLProgramPipeline = GLWrapper<glGenProgramPipelines, glDeleteProgramPipelines>;
// Don't use GLProgram directly, use ANGLE_GL_PROGRAM. // Don't use GLProgram directly, use ANGLE_GL_PROGRAM.
namespace priv namespace priv
......
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