Commit 5c6b7bfe by Jamie Madill

Add a Program::Data shared state structure.

Similar to the Framebuffer and other classes, this gives the Impl class a read-only view of the object's state. BUG=angleproject:1123 Change-Id: I580eaebe2de236adf8131d6e3f54633cecce8c25 Reviewed-on: https://chromium-review.googlesource.com/293760Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 3b040eb8
...@@ -27,10 +27,9 @@ ...@@ -27,10 +27,9 @@
namespace rx namespace rx
{ {
class Renderer; class ImplFactory;
class Renderer;
struct TranslatedAttribute;
class ProgramImpl; class ProgramImpl;
struct TranslatedAttribute;
} }
namespace gl namespace gl
...@@ -163,7 +162,28 @@ struct LinkedVarying ...@@ -163,7 +162,28 @@ struct LinkedVarying
class Program : angle::NonCopyable class Program : angle::NonCopyable
{ {
public: public:
Program(rx::ProgramImpl *impl, ResourceManager *manager, GLuint handle); class Data final : angle::NonCopyable
{
public:
Data();
~Data();
const Shader *getAttachedVertexShader() const { return mAttachedVertexShader; }
const Shader *getAttachedFragmentShader() const { return mAttachedFragmentShader; }
private:
friend class Program;
Shader *mAttachedFragmentShader;
Shader *mAttachedVertexShader;
std::vector<std::string> mTransformFeedbackVaryings;
GLenum mTransformFeedbackBufferMode;
// TODO(jmadill): move more state into Data.
};
Program(rx::ImplFactory *factory, ResourceManager *manager, GLuint handle);
~Program(); ~Program();
GLuint id() const { return mHandle; } GLuint id() const { return mHandle; }
...@@ -177,7 +197,7 @@ class Program : angle::NonCopyable ...@@ -177,7 +197,7 @@ class Program : angle::NonCopyable
void bindAttributeLocation(GLuint index, const char *name); void bindAttributeLocation(GLuint index, const char *name);
Error link(const Data &data); Error link(const gl::Data &data);
bool isLinked(); bool isLinked();
Error loadBinary(GLenum binaryFormat, const void *binary, GLsizei length); Error loadBinary(GLenum binaryFormat, const void *binary, GLsizei length);
...@@ -195,7 +215,7 @@ class Program : angle::NonCopyable ...@@ -195,7 +215,7 @@ class Program : angle::NonCopyable
void getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); void getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
GLint getActiveAttributeCount(); GLint getActiveAttributeCount();
GLint getActiveAttributeMaxLength(); GLint getActiveAttributeMaxLength();
const sh::Attribute *getLinkedAttributes() const { return mLinkedAttribute; } const std::vector<sh::Attribute> &getLinkedAttributes() const { return mLinkedAttributes; }
GLint getSamplerMapping(SamplerType type, unsigned int samplerIndex, const Caps &caps); GLint getSamplerMapping(SamplerType type, unsigned int samplerIndex, const Caps &caps);
GLenum getSamplerTextureType(SamplerType type, unsigned int samplerIndex); GLenum getSamplerTextureType(SamplerType type, unsigned int samplerIndex);
...@@ -280,7 +300,7 @@ class Program : angle::NonCopyable ...@@ -280,7 +300,7 @@ class Program : angle::NonCopyable
void unlink(bool destroy = false); void unlink(bool destroy = false);
void resetUniformBlockBindings(); void resetUniformBlockBindings();
bool linkAttributes(const Data &data, bool linkAttributes(const gl::Data &data,
InfoLog &infoLog, InfoLog &infoLog,
const AttributeBindings &attributeBindings, const AttributeBindings &attributeBindings,
const Shader *vertexShader); const Shader *vertexShader);
...@@ -303,24 +323,19 @@ class Program : angle::NonCopyable ...@@ -303,24 +323,19 @@ class Program : angle::NonCopyable
bool assignUniformBlockRegister(InfoLog &infoLog, UniformBlock *uniformBlock, GLenum shader, unsigned int registerIndex, const Caps &caps); bool assignUniformBlockRegister(InfoLog &infoLog, UniformBlock *uniformBlock, GLenum shader, unsigned int registerIndex, const Caps &caps);
void defineOutputVariables(Shader *fragmentShader); void defineOutputVariables(Shader *fragmentShader);
Data mData;
rx::ProgramImpl *mProgram; rx::ProgramImpl *mProgram;
sh::Attribute mLinkedAttribute[MAX_VERTEX_ATTRIBS]; std::vector<sh::Attribute> mLinkedAttributes;
std::map<int, VariableLocation> mOutputVariables; std::map<int, VariableLocation> mOutputVariables;
bool mValidated; bool mValidated;
Shader *mFragmentShader;
Shader *mVertexShader;
AttributeBindings mAttributeBindings; AttributeBindings mAttributeBindings;
GLuint mUniformBlockBindings[IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS]; GLuint mUniformBlockBindings[IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS];
std::vector<std::string> mTransformFeedbackVaryings;
GLenum mTransformFeedbackBufferMode;
bool mLinked; bool mLinked;
bool mDeleteStatus; // Flag to indicate that the program can be deleted when no longer in use bool mDeleteStatus; // Flag to indicate that the program can be deleted when no longer in use
......
...@@ -106,7 +106,7 @@ GLuint ResourceManager::createProgram() ...@@ -106,7 +106,7 @@ GLuint ResourceManager::createProgram()
{ {
GLuint handle = mProgramShaderHandleAllocator.allocate(); GLuint handle = mProgramShaderHandleAllocator.allocate();
mProgramMap[handle] = new Program(mFactory->createProgram(), this, handle); mProgramMap[handle] = new Program(mFactory, this, handle);
return handle; return handle;
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#define LIBANGLE_RENDERER_IMPLFACTORY_H_ #define LIBANGLE_RENDERER_IMPLFACTORY_H_
#include "libANGLE/Framebuffer.h" #include "libANGLE/Framebuffer.h"
#include "libANGLE/Program.h"
#include "libANGLE/VertexArray.h" #include "libANGLE/VertexArray.h"
namespace rx namespace rx
...@@ -37,7 +38,7 @@ class ImplFactory : angle::NonCopyable ...@@ -37,7 +38,7 @@ class ImplFactory : angle::NonCopyable
// Shader creation // Shader creation
virtual CompilerImpl *createCompiler(const gl::Data &data) = 0; virtual CompilerImpl *createCompiler(const gl::Data &data) = 0;
virtual ShaderImpl *createShader(GLenum type) = 0; virtual ShaderImpl *createShader(GLenum type) = 0;
virtual ProgramImpl *createProgram() = 0; virtual ProgramImpl *createProgram(const gl::Program::Data &data) = 0;
// Framebuffer creation // Framebuffer creation
virtual FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) = 0; virtual FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) = 0;
......
...@@ -19,6 +19,10 @@ LinkResult::LinkResult(bool linkSuccess, const gl::Error &error) ...@@ -19,6 +19,10 @@ LinkResult::LinkResult(bool linkSuccess, const gl::Error &error)
{ {
} }
ProgramImpl::ProgramImpl(const gl::Program::Data &data) : mData(data)
{
}
ProgramImpl::~ProgramImpl() ProgramImpl::~ProgramImpl()
{ {
// Ensure that reset was called by the inherited class during destruction // Ensure that reset was called by the inherited class during destruction
......
...@@ -33,7 +33,7 @@ class ProgramImpl : angle::NonCopyable ...@@ -33,7 +33,7 @@ class ProgramImpl : angle::NonCopyable
public: public:
typedef int SemanticIndexArray[gl::MAX_VERTEX_ATTRIBS]; typedef int SemanticIndexArray[gl::MAX_VERTEX_ATTRIBS];
ProgramImpl() { } ProgramImpl(const gl::Program::Data &data);
virtual ~ProgramImpl(); virtual ~ProgramImpl();
virtual bool usesPointSize() const = 0; virtual bool usesPointSize() const = 0;
...@@ -87,8 +87,7 @@ class ProgramImpl : angle::NonCopyable ...@@ -87,8 +87,7 @@ class ProgramImpl : angle::NonCopyable
virtual void updateSamplerMapping() = 0; virtual void updateSamplerMapping() = 0;
virtual bool validateSamplers(gl::InfoLog *infoLog, const gl::Caps &caps) = 0; virtual bool validateSamplers(gl::InfoLog *infoLog, const gl::Caps &caps) = 0;
virtual LinkResult compileProgramExecutables(gl::InfoLog &infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader, virtual LinkResult compileProgramExecutables(gl::InfoLog &infoLog, int registers) = 0;
int registers) = 0;
virtual bool linkUniforms(gl::InfoLog &infoLog, const gl::Shader &vertexShader, const gl::Shader &fragmentShader, virtual bool linkUniforms(gl::InfoLog &infoLog, const gl::Shader &vertexShader, const gl::Shader &fragmentShader,
const gl::Caps &caps) = 0; const gl::Caps &caps) = 0;
...@@ -127,6 +126,8 @@ class ProgramImpl : angle::NonCopyable ...@@ -127,6 +126,8 @@ class ProgramImpl : angle::NonCopyable
virtual void reset(); virtual void reset();
protected: protected:
const gl::Program::Data &mData;
std::vector<gl::LinkedUniform*> mUniforms; std::vector<gl::LinkedUniform*> mUniforms;
// TODO: use a hash map // TODO: use a hash map
......
...@@ -1114,14 +1114,18 @@ void DynamicHLSL::defineOutputVariables(ShaderD3D *fragmentShader, std::map<int, ...@@ -1114,14 +1114,18 @@ void DynamicHLSL::defineOutputVariables(ShaderD3D *fragmentShader, std::map<int,
} }
} }
std::string DynamicHLSL::generateGeometryShaderHLSL(int registers, ShaderD3D *fragmentShader, ShaderD3D *vertexShader) const std::string DynamicHLSL::generateGeometryShaderHLSL(int registers,
const ShaderD3D *fragmentShader,
const ShaderD3D *vertexShader) const
{ {
// for now we only handle point sprite emulation // for now we only handle point sprite emulation
ASSERT(vertexShader->mUsesPointSize && mRenderer->getMajorShaderModel() >= 4); ASSERT(vertexShader->mUsesPointSize && mRenderer->getMajorShaderModel() >= 4);
return generatePointSpriteHLSL(registers, fragmentShader, vertexShader); return generatePointSpriteHLSL(registers, fragmentShader, vertexShader);
} }
std::string DynamicHLSL::generatePointSpriteHLSL(int registers, ShaderD3D *fragmentShader, ShaderD3D *vertexShader) const std::string DynamicHLSL::generatePointSpriteHLSL(int registers,
const ShaderD3D *fragmentShader,
const ShaderD3D *vertexShader) const
{ {
ASSERT(registers >= 0); ASSERT(registers >= 0);
ASSERT(vertexShader->mUsesPointSize); ASSERT(vertexShader->mUsesPointSize);
......
...@@ -70,7 +70,9 @@ class DynamicHLSL : angle::NonCopyable ...@@ -70,7 +70,9 @@ class DynamicHLSL : angle::NonCopyable
std::vector<PixelShaderOutputVariable> *outPixelShaderKey, std::vector<PixelShaderOutputVariable> *outPixelShaderKey,
bool *outUsesFragDepth) const; bool *outUsesFragDepth) const;
std::string generateGeometryShaderHLSL(int registers, ShaderD3D *fragmentShader, ShaderD3D *vertexShader) const; std::string generateGeometryShaderHLSL(int registers,
const ShaderD3D *fragmentShader,
const ShaderD3D *vertexShader) const;
private: private:
RendererD3D *const mRenderer; RendererD3D *const mRenderer;
...@@ -85,7 +87,9 @@ class DynamicHLSL : angle::NonCopyable ...@@ -85,7 +87,9 @@ class DynamicHLSL : angle::NonCopyable
void storeUserLinkedVaryings(const ShaderD3D *vertexShader, std::vector<gl::LinkedVarying> *linkedVaryings) const; void storeUserLinkedVaryings(const ShaderD3D *vertexShader, std::vector<gl::LinkedVarying> *linkedVaryings) const;
void storeBuiltinLinkedVaryings(const SemanticInfo &info, std::vector<gl::LinkedVarying> *linkedVaryings) const; void storeBuiltinLinkedVaryings(const SemanticInfo &info, std::vector<gl::LinkedVarying> *linkedVaryings) const;
void defineOutputVariables(ShaderD3D *fragmentShader, std::map<int, gl::VariableLocation> *programOutputVars) const; void defineOutputVariables(ShaderD3D *fragmentShader, std::map<int, gl::VariableLocation> *programOutputVars) const;
std::string generatePointSpriteHLSL(int registers, ShaderD3D *fragmentShader, ShaderD3D *vertexShader) const; std::string generatePointSpriteHLSL(int registers,
const ShaderD3D *fragmentShader,
const ShaderD3D *vertexShader) const;
// Prepend an underscore // Prepend an underscore
static std::string decorateVariable(const std::string &name); static std::string decorateVariable(const std::string &name);
......
...@@ -198,8 +198,8 @@ ProgramD3D::Sampler::Sampler() : active(false), logicalTextureUnit(0), textureTy ...@@ -198,8 +198,8 @@ ProgramD3D::Sampler::Sampler() : active(false), logicalTextureUnit(0), textureTy
unsigned int ProgramD3D::mCurrentSerial = 1; unsigned int ProgramD3D::mCurrentSerial = 1;
ProgramD3D::ProgramD3D(RendererD3D *renderer) ProgramD3D::ProgramD3D(const gl::Program::Data &data, RendererD3D *renderer)
: ProgramImpl(), : ProgramImpl(data),
mRenderer(renderer), mRenderer(renderer),
mDynamicHLSL(NULL), mDynamicHLSL(NULL),
mGeometryExecutable(NULL), mGeometryExecutable(NULL),
...@@ -1005,13 +1005,13 @@ gl::Error ProgramD3D::getVertexExecutableForInputLayout(const gl::InputLayout &i ...@@ -1005,13 +1005,13 @@ gl::Error ProgramD3D::getVertexExecutableForInputLayout(const gl::InputLayout &i
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
} }
LinkResult ProgramD3D::compileProgramExecutables(gl::InfoLog &infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader, LinkResult ProgramD3D::compileProgramExecutables(gl::InfoLog &infoLog, int registers)
int registers)
{ {
ShaderD3D *vertexShaderD3D = GetImplAs<ShaderD3D>(vertexShader); const ShaderD3D *vertexShaderD3D = GetImplAs<ShaderD3D>(mData.getAttachedVertexShader());
ShaderD3D *fragmentShaderD3D = GetImplAs<ShaderD3D>(fragmentShader); const ShaderD3D *fragmentShaderD3D = GetImplAs<ShaderD3D>(mData.getAttachedFragmentShader());
const gl::InputLayout &defaultInputLayout = GetDefaultInputLayoutFromShader(vertexShader); const gl::InputLayout &defaultInputLayout =
GetDefaultInputLayoutFromShader(mData.getAttachedVertexShader());
ShaderExecutableD3D *defaultVertexExecutable = NULL; ShaderExecutableD3D *defaultVertexExecutable = NULL;
gl::Error error = getVertexExecutableForInputLayout(defaultInputLayout, &defaultVertexExecutable, &infoLog); gl::Error error = getVertexExecutableForInputLayout(defaultInputLayout, &defaultVertexExecutable, &infoLog);
if (error.isError()) if (error.isError())
......
...@@ -42,7 +42,7 @@ class ShaderExecutableD3D; ...@@ -42,7 +42,7 @@ class ShaderExecutableD3D;
class ProgramD3D : public ProgramImpl class ProgramD3D : public ProgramImpl
{ {
public: public:
ProgramD3D(RendererD3D *renderer); ProgramD3D(const gl::Program::Data &data, RendererD3D *renderer);
virtual ~ProgramD3D(); virtual ~ProgramD3D();
const std::vector<PixelShaderOutputVariable> &getPixelShaderKey() { return mPixelShaderKey; } const std::vector<PixelShaderOutputVariable> &getPixelShaderKey() { return mPixelShaderKey; }
...@@ -69,8 +69,7 @@ class ProgramD3D : public ProgramImpl ...@@ -69,8 +69,7 @@ class ProgramD3D : public ProgramImpl
gl::Error getVertexExecutableForInputLayout(const gl::InputLayout &inputLayout, ShaderExecutableD3D **outExectuable, gl::InfoLog *infoLog); gl::Error getVertexExecutableForInputLayout(const gl::InputLayout &inputLayout, ShaderExecutableD3D **outExectuable, gl::InfoLog *infoLog);
ShaderExecutableD3D *getGeometryExecutable() const { return mGeometryExecutable; } ShaderExecutableD3D *getGeometryExecutable() const { return mGeometryExecutable; }
LinkResult compileProgramExecutables(gl::InfoLog &infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader, LinkResult compileProgramExecutables(gl::InfoLog &infoLog, int registers);
int registers);
LinkResult link(const gl::Data &data, gl::InfoLog &infoLog, LinkResult link(const gl::Data &data, gl::InfoLog &infoLog,
gl::Shader *fragmentShader, gl::Shader *vertexShader, gl::Shader *fragmentShader, gl::Shader *vertexShader,
......
...@@ -46,21 +46,19 @@ gl::InputLayout GetInputLayout( ...@@ -46,21 +46,19 @@ gl::InputLayout GetInputLayout(
return inputLayout; return inputLayout;
} }
GLenum GetNextGLSLAttributeType(const sh::Attribute *linkedAttributes, int index) GLenum GetNextGLSLAttributeType(const std::vector<sh::Attribute> &linkedAttributes, int index)
{ {
// Count matrices differently // Count matrices differently
int subIndex = 0; int subIndex = 0;
for (int attribIndex = 0; attribIndex < gl::MAX_VERTEX_ATTRIBS; ++attribIndex) for (const sh::Attribute &attrib : linkedAttributes)
{ {
GLenum attribType = linkedAttributes[attribIndex].type; if (attrib.type == GL_NONE)
if (attribType == GL_NONE)
{ {
continue; continue;
} }
GLenum transposedType = gl::TransposeMatrixType(attribType); GLenum transposedType = gl::TransposeMatrixType(attrib.type);
subIndex += gl::VariableRowCount(transposedType); subIndex += gl::VariableRowCount(attrib.type);
if (subIndex > index) if (subIndex > index)
{ {
return transposedType; return transposedType;
...@@ -202,7 +200,7 @@ gl::Error InputLayoutCache::applyVertexBuffers(const std::vector<TranslatedAttri ...@@ -202,7 +200,7 @@ gl::Error InputLayoutCache::applyVertexBuffers(const std::vector<TranslatedAttri
unsigned int firstInstancedElement = gl::MAX_VERTEX_ATTRIBS; unsigned int firstInstancedElement = gl::MAX_VERTEX_ATTRIBS;
unsigned int nextAvailableInputSlot = 0; unsigned int nextAvailableInputSlot = 0;
const sh::Attribute *linkedAttributes = program->getLinkedAttributes(); const std::vector<sh::Attribute> &linkedAttributes = program->getLinkedAttributes();
for (unsigned int i = 0; i < unsortedAttributes.size(); i++) for (unsigned int i = 0; i < unsortedAttributes.size(); i++)
{ {
......
...@@ -2982,9 +2982,9 @@ ShaderImpl *Renderer11::createShader(GLenum type) ...@@ -2982,9 +2982,9 @@ ShaderImpl *Renderer11::createShader(GLenum type)
return new ShaderD3D(type); return new ShaderD3D(type);
} }
ProgramImpl *Renderer11::createProgram() ProgramImpl *Renderer11::createProgram(const gl::Program::Data &data)
{ {
return new ProgramD3D(this); return new ProgramD3D(data, this);
} }
gl::Error Renderer11::loadExecutable(const void *function, size_t length, ShaderType type, gl::Error Renderer11::loadExecutable(const void *function, size_t length, ShaderType type,
......
...@@ -188,7 +188,7 @@ class Renderer11 : public RendererD3D ...@@ -188,7 +188,7 @@ class Renderer11 : public RendererD3D
// Shader creation // Shader creation
virtual CompilerImpl *createCompiler(const gl::Data &data); virtual CompilerImpl *createCompiler(const gl::Data &data);
virtual ShaderImpl *createShader(GLenum type); virtual ShaderImpl *createShader(GLenum type);
virtual ProgramImpl *createProgram(); virtual ProgramImpl *createProgram(const gl::Program::Data &data);
// Shader operations // Shader operations
virtual gl::Error loadExecutable(const void *function, size_t length, ShaderType type, virtual gl::Error loadExecutable(const void *function, size_t length, ShaderType type,
......
...@@ -2672,9 +2672,9 @@ ShaderImpl *Renderer9::createShader(GLenum type) ...@@ -2672,9 +2672,9 @@ ShaderImpl *Renderer9::createShader(GLenum type)
return new ShaderD3D(type); return new ShaderD3D(type);
} }
ProgramImpl *Renderer9::createProgram() ProgramImpl *Renderer9::createProgram(const gl::Program::Data &data)
{ {
return new ProgramD3D(this); return new ProgramD3D(data, this);
} }
gl::Error Renderer9::loadExecutable(const void *function, size_t length, ShaderType type, gl::Error Renderer9::loadExecutable(const void *function, size_t length, ShaderType type,
......
...@@ -173,7 +173,7 @@ class Renderer9 : public RendererD3D ...@@ -173,7 +173,7 @@ class Renderer9 : public RendererD3D
// Shader creation // Shader creation
virtual CompilerImpl *createCompiler(const gl::Data &data); virtual CompilerImpl *createCompiler(const gl::Data &data);
virtual ShaderImpl *createShader(GLenum type); virtual ShaderImpl *createShader(GLenum type);
virtual ProgramImpl *createProgram(); virtual ProgramImpl *createProgram(const gl::Program::Data &data);
// Shader operations // Shader operations
virtual gl::Error loadExecutable(const void *function, size_t length, ShaderType type, virtual gl::Error loadExecutable(const void *function, size_t length, ShaderType type,
......
...@@ -17,11 +17,10 @@ ...@@ -17,11 +17,10 @@
namespace rx namespace rx
{ {
ProgramGL::ProgramGL(const FunctionsGL *functions, StateManagerGL *stateManager) ProgramGL::ProgramGL(const gl::Program::Data &data,
: ProgramImpl(), const FunctionsGL *functions,
mFunctions(functions), StateManagerGL *stateManager)
mStateManager(stateManager), : ProgramImpl(data), mFunctions(functions), mStateManager(stateManager), mProgramID(0)
mProgramID(0)
{ {
ASSERT(mFunctions); ASSERT(mFunctions);
ASSERT(mStateManager); ASSERT(mStateManager);
...@@ -398,8 +397,7 @@ bool ProgramGL::validateSamplers(gl::InfoLog *infoLog, const gl::Caps &caps) ...@@ -398,8 +397,7 @@ bool ProgramGL::validateSamplers(gl::InfoLog *infoLog, const gl::Caps &caps)
return true; return true;
} }
LinkResult ProgramGL::compileProgramExecutables(gl::InfoLog &infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader, LinkResult ProgramGL::compileProgramExecutables(gl::InfoLog &infoLog, int registers)
int registers)
{ {
//UNIMPLEMENTED(); //UNIMPLEMENTED();
return LinkResult(true, gl::Error(GL_NO_ERROR)); return LinkResult(true, gl::Error(GL_NO_ERROR));
......
...@@ -26,7 +26,9 @@ struct SamplerBindingGL ...@@ -26,7 +26,9 @@ struct SamplerBindingGL
class ProgramGL : public ProgramImpl class ProgramGL : public ProgramImpl
{ {
public: public:
ProgramGL(const FunctionsGL *functions, StateManagerGL *stateManager); ProgramGL(const gl::Program::Data &data,
const FunctionsGL *functions,
StateManagerGL *stateManager);
~ProgramGL() override; ~ProgramGL() override;
bool usesPointSize() const override; bool usesPointSize() const override;
...@@ -78,8 +80,7 @@ class ProgramGL : public ProgramImpl ...@@ -78,8 +80,7 @@ class ProgramGL : public ProgramImpl
void updateSamplerMapping() override; void updateSamplerMapping() override;
bool validateSamplers(gl::InfoLog *infoLog, const gl::Caps &caps) override; bool validateSamplers(gl::InfoLog *infoLog, const gl::Caps &caps) override;
LinkResult compileProgramExecutables(gl::InfoLog &infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader, LinkResult compileProgramExecutables(gl::InfoLog &infoLog, int registers) override;
int registers) override;
bool linkUniforms(gl::InfoLog &infoLog, const gl::Shader &vertexShader, const gl::Shader &fragmentShader, bool linkUniforms(gl::InfoLog &infoLog, const gl::Shader &vertexShader, const gl::Shader &fragmentShader,
const gl::Caps &caps) override; const gl::Caps &caps) override;
......
...@@ -176,9 +176,9 @@ ShaderImpl *RendererGL::createShader(GLenum type) ...@@ -176,9 +176,9 @@ ShaderImpl *RendererGL::createShader(GLenum type)
return new ShaderGL(type, mFunctions); return new ShaderGL(type, mFunctions);
} }
ProgramImpl *RendererGL::createProgram() ProgramImpl *RendererGL::createProgram(const gl::Program::Data &data)
{ {
return new ProgramGL(mFunctions, mStateManager); return new ProgramGL(data, mFunctions, mStateManager);
} }
FramebufferImpl *RendererGL::createDefaultFramebuffer(const gl::Framebuffer::Data &data) FramebufferImpl *RendererGL::createDefaultFramebuffer(const gl::Framebuffer::Data &data)
......
...@@ -36,7 +36,7 @@ class RendererGL : public Renderer ...@@ -36,7 +36,7 @@ class RendererGL : public Renderer
// Shader creation // Shader creation
CompilerImpl *createCompiler(const gl::Data &data) override; CompilerImpl *createCompiler(const gl::Data &data) override;
ShaderImpl *createShader(GLenum type) override; ShaderImpl *createShader(GLenum type) override;
ProgramImpl *createProgram() override; ProgramImpl *createProgram(const gl::Program::Data &data) override;
// Framebuffer creation // Framebuffer creation
FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) override; FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) override;
......
...@@ -23,7 +23,7 @@ class NullFactory : public ImplFactory ...@@ -23,7 +23,7 @@ class NullFactory : public ImplFactory
// Shader creation // Shader creation
CompilerImpl *createCompiler(const gl::Data &data) override { return nullptr; } CompilerImpl *createCompiler(const gl::Data &data) override { return nullptr; }
ShaderImpl *createShader(GLenum type) override { return nullptr; } ShaderImpl *createShader(GLenum type) override { return nullptr; }
ProgramImpl *createProgram() override { return nullptr; } ProgramImpl *createProgram(const gl::Program::Data &data) override { return nullptr; }
// Framebuffer creation // Framebuffer creation
FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) override { return nullptr; } FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) override { return nullptr; }
......
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