blob: 4d765d645b9d4c80be4645a9872a9a1a81b8edaf [file] [log] [blame]
Brandon Jonesc9610c52014-08-25 17:02:59 -07001//
2// Copyright 2014 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7// ProgramImpl.h: Defines the abstract rx::ProgramImpl class.
8
9#ifndef LIBGLESV2_RENDERER_PROGRAMIMPL_H_
10#define LIBGLESV2_RENDERER_PROGRAMIMPL_H_
11
12#include "common/angleutils.h"
Brandon Jones22502d52014-08-29 16:58:36 -070013#include "libGLESv2/BinaryStream.h"
Brandon Jonesc9610c52014-08-25 17:02:59 -070014#include "libGLESv2/Constants.h"
15#include "libGLESv2/ProgramBinary.h"
Brandon Jones18bd4102014-09-22 14:21:44 -070016#include "libGLESv2/renderer/Renderer.h"
Brandon Jonesc9610c52014-08-25 17:02:59 -070017
18namespace rx
19{
20
Brandon Jonesc9610c52014-08-25 17:02:59 -070021class Renderer;
22
23class ProgramImpl
24{
25public:
26 virtual ~ProgramImpl() { }
27
Brandon Jones22502d52014-08-29 16:58:36 -070028 virtual const std::vector<rx::PixelShaderOutputVariable> &getPixelShaderKey() = 0;
29
Brandon Jones44151a92014-09-10 11:32:25 -070030 virtual bool usesPointSize() const = 0;
31 virtual bool usesGeometryShader() const = 0;
32 virtual int getShaderVersion() const = 0;
33
Brandon Jones22502d52014-08-29 16:58:36 -070034 virtual GLenum getBinaryFormat() = 0;
35 virtual bool load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream) = 0;
36 virtual bool save(gl::BinaryOutputStream *stream) = 0;
37
38 virtual rx::ShaderExecutable *getPixelExecutableForOutputLayout(gl::InfoLog &infoLog, const std::vector<GLenum> &outputSignature,
39 const std::vector<gl::LinkedVarying> &transformFeedbackLinkedVaryings,
40 bool separatedOutputBuffers) = 0;
41 virtual rx::ShaderExecutable *getVertexExecutableForInputLayout(gl::InfoLog &infoLog,
42 const gl::VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS],
43 const sh::Attribute shaderAttributes[],
44 const std::vector<gl::LinkedVarying> &transformFeedbackLinkedVaryings,
45 bool separatedOutputBuffers) = 0;
Brandon Jones44151a92014-09-10 11:32:25 -070046 virtual rx::ShaderExecutable *getGeometryExecutable(gl::InfoLog &infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader,
47 const std::vector<gl::LinkedVarying> &transformFeedbackLinkedVaryings,
48 bool separatedOutputBuffers, int registers) = 0;
Brandon Jones18bd4102014-09-22 14:21:44 -070049 virtual rx::ShaderExecutable *loadExecutable(const void *function, size_t length, rx::ShaderType type,
50 const std::vector<gl::LinkedVarying> &transformFeedbackLinkedVaryings,
51 bool separatedOutputBuffers) = 0;
Brandon Jones22502d52014-08-29 16:58:36 -070052
53 virtual bool link(gl::InfoLog &infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader,
54 const std::vector<std::string> &transformFeedbackVaryings, int *registers,
55 std::vector<gl::LinkedVarying> *linkedVaryings, std::map<int,
56 gl::VariableLocation> *outputVariables) = 0;
57
Brandon Jones44151a92014-09-10 11:32:25 -070058 virtual void getInputLayoutSignature(const gl::VertexFormat inputLayout[], GLenum signature[]) const = 0;
59
Brandon Jonesc9610c52014-08-25 17:02:59 -070060 virtual void initializeUniformStorage(const std::vector<gl::LinkedUniform*> &uniforms) = 0;
61
Brandon Jones18bd4102014-09-22 14:21:44 -070062 virtual gl::Error applyUniforms(const std::vector<gl::LinkedUniform*> &uniforms) = 0;
63 virtual gl::Error applyUniformBuffers(const std::vector<gl::UniformBlock*> uniformBlocks, const std::vector<gl::Buffer*> boundBuffers,
64 const gl::Caps &caps) = 0;
65 virtual bool assignUniformBlockRegister(gl::InfoLog &infoLog, gl::UniformBlock *uniformBlock, GLenum shader,
66 unsigned int registerIndex, const gl::Caps &caps) = 0;
67 virtual unsigned int getReservedUniformVectors(GLenum shader) = 0;
68
Brandon Jonesc9610c52014-08-25 17:02:59 -070069 virtual void reset() = 0;
70};
71
72}
73
74#endif // LIBGLESV2_RENDERER_PROGRAMIMPL_H_