Commit 18bd4100 by Brandon Jones

Removed the last references to Renderer from ProgramBinary.

BUG=angle:731 Change-Id: I8829a434e59279b1b9c37e9a1922ae05d467b376 Reviewed-on: https://chromium-review.googlesource.com/219421Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarBrandon Jones <bajones@chromium.org>
parent 10ac4043
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "libGLESv2/BinaryStream.h" #include "libGLESv2/BinaryStream.h"
#include "libGLESv2/Constants.h" #include "libGLESv2/Constants.h"
#include "libGLESv2/ProgramBinary.h" #include "libGLESv2/ProgramBinary.h"
#include "libGLESv2/renderer/Renderer.h"
namespace rx namespace rx
{ {
...@@ -24,8 +25,6 @@ class ProgramImpl ...@@ -24,8 +25,6 @@ class ProgramImpl
public: public:
virtual ~ProgramImpl() { } virtual ~ProgramImpl() { }
// TODO: Temporary interfaces to ease migration. Remove soon!
virtual Renderer *getRenderer() = 0;
virtual const std::vector<rx::PixelShaderOutputVariable> &getPixelShaderKey() = 0; virtual const std::vector<rx::PixelShaderOutputVariable> &getPixelShaderKey() = 0;
virtual bool usesPointSize() const = 0; virtual bool usesPointSize() const = 0;
...@@ -47,6 +46,9 @@ public: ...@@ -47,6 +46,9 @@ public:
virtual rx::ShaderExecutable *getGeometryExecutable(gl::InfoLog &infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader, virtual rx::ShaderExecutable *getGeometryExecutable(gl::InfoLog &infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader,
const std::vector<gl::LinkedVarying> &transformFeedbackLinkedVaryings, const std::vector<gl::LinkedVarying> &transformFeedbackLinkedVaryings,
bool separatedOutputBuffers, int registers) = 0; bool separatedOutputBuffers, int registers) = 0;
virtual rx::ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type,
const std::vector<gl::LinkedVarying> &transformFeedbackLinkedVaryings,
bool separatedOutputBuffers) = 0;
virtual bool link(gl::InfoLog &infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader, virtual bool link(gl::InfoLog &infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader,
const std::vector<std::string> &transformFeedbackVaryings, int *registers, const std::vector<std::string> &transformFeedbackVaryings, int *registers,
...@@ -57,6 +59,13 @@ public: ...@@ -57,6 +59,13 @@ public:
virtual void initializeUniformStorage(const std::vector<gl::LinkedUniform*> &uniforms) = 0; virtual void initializeUniformStorage(const std::vector<gl::LinkedUniform*> &uniforms) = 0;
virtual gl::Error applyUniforms(const std::vector<gl::LinkedUniform*> &uniforms) = 0;
virtual gl::Error applyUniformBuffers(const std::vector<gl::UniformBlock*> uniformBlocks, const std::vector<gl::Buffer*> boundBuffers,
const gl::Caps &caps) = 0;
virtual bool assignUniformBlockRegister(gl::InfoLog &infoLog, gl::UniformBlock *uniformBlock, GLenum shader,
unsigned int registerIndex, const gl::Caps &caps) = 0;
virtual unsigned int getReservedUniformVectors(GLenum shader) = 0;
virtual void reset() = 0; virtual void reset() = 0;
}; };
......
...@@ -128,7 +128,7 @@ class Renderer ...@@ -128,7 +128,7 @@ class Renderer
virtual gl::Error applyRenderTarget(gl::Framebuffer *frameBuffer) = 0; virtual gl::Error applyRenderTarget(gl::Framebuffer *frameBuffer) = 0;
virtual gl::Error applyShaders(gl::ProgramBinary *programBinary, const gl::VertexFormat inputLayout[], const gl::Framebuffer *framebuffer, virtual gl::Error applyShaders(gl::ProgramBinary *programBinary, const gl::VertexFormat inputLayout[], const gl::Framebuffer *framebuffer,
bool rasterizerDiscard, bool transformFeedbackActive) = 0; bool rasterizerDiscard, bool transformFeedbackActive) = 0;
virtual gl::Error applyUniforms(const gl::ProgramBinary &programBinary) = 0; virtual gl::Error applyUniforms(const ProgramImpl &program, const std::vector<gl::LinkedUniform*> &uniformArray) = 0;
virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount) = 0; virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount) = 0;
virtual gl::Error applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], const gl::VertexAttribCurrentValueData currentValues[], virtual gl::Error applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], const gl::VertexAttribCurrentValueData currentValues[],
GLint first, GLsizei count, GLsizei instances) = 0; GLint first, GLsizei count, GLsizei instances) = 0;
......
...@@ -35,7 +35,6 @@ class ProgramD3D : public ProgramImpl ...@@ -35,7 +35,6 @@ class ProgramD3D : public ProgramImpl
static ProgramD3D *makeProgramD3D(ProgramImpl *impl); static ProgramD3D *makeProgramD3D(ProgramImpl *impl);
static const ProgramD3D *makeProgramD3D(const ProgramImpl *impl); static const ProgramD3D *makeProgramD3D(const ProgramImpl *impl);
Renderer *getRenderer() { return mRenderer; }
const std::vector<rx::PixelShaderOutputVariable> &getPixelShaderKey() { return mPixelShaderKey; } const std::vector<rx::PixelShaderOutputVariable> &getPixelShaderKey() { return mPixelShaderKey; }
int getShaderVersion() const { return mShaderVersion; } int getShaderVersion() const { return mShaderVersion; }
...@@ -58,6 +57,9 @@ class ProgramD3D : public ProgramImpl ...@@ -58,6 +57,9 @@ class ProgramD3D : public ProgramImpl
ShaderExecutable *getGeometryExecutable(gl::InfoLog &infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader, ShaderExecutable *getGeometryExecutable(gl::InfoLog &infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader,
const std::vector<gl::LinkedVarying> &transformFeedbackLinkedVaryings, const std::vector<gl::LinkedVarying> &transformFeedbackLinkedVaryings,
bool separatedOutputBuffers, int registers); bool separatedOutputBuffers, int registers);
ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type,
const std::vector<gl::LinkedVarying> &transformFeedbackLinkedVaryings,
bool separatedOutputBuffers);
bool link(gl::InfoLog &infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader, bool link(gl::InfoLog &infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader,
const std::vector<std::string> &transformFeedbackVaryings, int *registers, const std::vector<std::string> &transformFeedbackVaryings, int *registers,
...@@ -65,8 +67,13 @@ class ProgramD3D : public ProgramImpl ...@@ -65,8 +67,13 @@ class ProgramD3D : public ProgramImpl
void getInputLayoutSignature(const gl::VertexFormat inputLayout[], GLenum signature[]) const; void getInputLayoutSignature(const gl::VertexFormat inputLayout[], GLenum signature[]) const;
// D3D only
void initializeUniformStorage(const std::vector<gl::LinkedUniform*> &uniforms); void initializeUniformStorage(const std::vector<gl::LinkedUniform*> &uniforms);
gl::Error applyUniforms(const std::vector<gl::LinkedUniform*> &uniforms);
gl::Error applyUniformBuffers(const std::vector<gl::UniformBlock*> uniformBlocks, const std::vector<gl::Buffer*> boundBuffers,
const gl::Caps &caps);
bool assignUniformBlockRegister(gl::InfoLog &infoLog, gl::UniformBlock *uniformBlock, GLenum shader,
unsigned int registerIndex, const gl::Caps &caps);
unsigned int getReservedUniformVectors(GLenum shader);
const UniformStorage &getVertexUniformStorage() const { return *mVertexUniformStorage; } const UniformStorage &getVertexUniformStorage() const { return *mVertexUniformStorage; }
const UniformStorage &getFragmentUniformStorage() const { return *mFragmentUniformStorage; } const UniformStorage &getFragmentUniformStorage() const { return *mFragmentUniformStorage; }
......
...@@ -1392,10 +1392,8 @@ gl::Error Renderer11::applyShaders(gl::ProgramBinary *programBinary, const gl::V ...@@ -1392,10 +1392,8 @@ gl::Error Renderer11::applyShaders(gl::ProgramBinary *programBinary, const gl::V
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
} }
gl::Error Renderer11::applyUniforms(const gl::ProgramBinary &programBinary) gl::Error Renderer11::applyUniforms(const ProgramImpl &program, const std::vector<gl::LinkedUniform*> &uniformArray)
{ {
const std::vector<gl::LinkedUniform*> &uniformArray = programBinary.getUniforms();
unsigned int totalRegisterCountVS = 0; unsigned int totalRegisterCountVS = 0;
unsigned int totalRegisterCountPS = 0; unsigned int totalRegisterCountPS = 0;
...@@ -1419,7 +1417,7 @@ gl::Error Renderer11::applyUniforms(const gl::ProgramBinary &programBinary) ...@@ -1419,7 +1417,7 @@ gl::Error Renderer11::applyUniforms(const gl::ProgramBinary &programBinary)
} }
} }
const ProgramD3D *programD3D = ProgramD3D::makeProgramD3D(programBinary.getImplementation()); const ProgramD3D *programD3D = ProgramD3D::makeProgramD3D(&program);
const UniformStorage11 *vertexUniformStorage = UniformStorage11::makeUniformStorage11(&programD3D->getVertexUniformStorage()); const UniformStorage11 *vertexUniformStorage = UniformStorage11::makeUniformStorage11(&programD3D->getVertexUniformStorage());
const UniformStorage11 *fragmentUniformStorage = UniformStorage11::makeUniformStorage11(&programD3D->getFragmentUniformStorage()); const UniformStorage11 *fragmentUniformStorage = UniformStorage11::makeUniformStorage11(&programD3D->getFragmentUniformStorage());
ASSERT(vertexUniformStorage); ASSERT(vertexUniformStorage);
......
...@@ -79,7 +79,7 @@ class Renderer11 : public Renderer ...@@ -79,7 +79,7 @@ class Renderer11 : public Renderer
virtual gl::Error applyRenderTarget(gl::Framebuffer *frameBuffer); virtual gl::Error applyRenderTarget(gl::Framebuffer *frameBuffer);
virtual gl::Error applyShaders(gl::ProgramBinary *programBinary, const gl::VertexFormat inputLayout[], const gl::Framebuffer *framebuffer, virtual gl::Error applyShaders(gl::ProgramBinary *programBinary, const gl::VertexFormat inputLayout[], const gl::Framebuffer *framebuffer,
bool rasterizerDiscard, bool transformFeedbackActive); bool rasterizerDiscard, bool transformFeedbackActive);
virtual gl::Error applyUniforms(const gl::ProgramBinary &programBinary); virtual gl::Error applyUniforms(const ProgramImpl &program, const std::vector<gl::LinkedUniform*> &uniformArray);
virtual gl::Error applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], const gl::VertexAttribCurrentValueData currentValues[], virtual gl::Error applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], const gl::VertexAttribCurrentValueData currentValues[],
GLint first, GLsizei count, GLsizei instances); GLint first, GLsizei count, GLsizei instances);
virtual gl::Error applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo); virtual gl::Error applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
......
...@@ -1704,10 +1704,8 @@ gl::Error Renderer9::applyShaders(gl::ProgramBinary *programBinary, const gl::Ve ...@@ -1704,10 +1704,8 @@ gl::Error Renderer9::applyShaders(gl::ProgramBinary *programBinary, const gl::Ve
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
} }
gl::Error Renderer9::applyUniforms(const gl::ProgramBinary &programBinary) gl::Error Renderer9::applyUniforms(const ProgramImpl &program, const std::vector<gl::LinkedUniform*> &uniformArray)
{ {
const std::vector<gl::LinkedUniform*> &uniformArray = programBinary.getUniforms();
for (size_t uniformIndex = 0; uniformIndex < uniformArray.size(); uniformIndex++) for (size_t uniformIndex = 0; uniformIndex < uniformArray.size(); uniformIndex++)
{ {
gl::LinkedUniform *targetUniform = uniformArray[uniformIndex]; gl::LinkedUniform *targetUniform = uniformArray[uniformIndex];
......
...@@ -79,7 +79,7 @@ class Renderer9 : public Renderer ...@@ -79,7 +79,7 @@ class Renderer9 : public Renderer
virtual gl::Error applyRenderTarget(gl::Framebuffer *frameBuffer); virtual gl::Error applyRenderTarget(gl::Framebuffer *frameBuffer);
virtual gl::Error applyShaders(gl::ProgramBinary *programBinary, const gl::VertexFormat inputLayout[], const gl::Framebuffer *framebuffer, virtual gl::Error applyShaders(gl::ProgramBinary *programBinary, const gl::VertexFormat inputLayout[], const gl::Framebuffer *framebuffer,
bool rasterizerDiscard, bool transformFeedbackActive); bool rasterizerDiscard, bool transformFeedbackActive);
virtual gl::Error applyUniforms(const gl::ProgramBinary &programBinary); virtual gl::Error applyUniforms(const ProgramImpl &program, const std::vector<gl::LinkedUniform*> &uniformArray);
virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount); virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount);
virtual gl::Error applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], const gl::VertexAttribCurrentValueData currentValues[], virtual gl::Error applyVertexBuffer(gl::ProgramBinary *programBinary, const gl::VertexAttribute vertexAttributes[], const gl::VertexAttribCurrentValueData currentValues[],
GLint first, GLsizei count, GLsizei instances); GLint first, GLsizei count, GLsizei instances);
......
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