Commit 9a30b095 by apatrick@chromium.org

Program::link() and callees do not access mPixelHLSL, mVertexHLSL,…

Program::link() and callees do not access mPixelHLSL, mVertexHLSL, mFragmentShader, mVertexShader, mAttributeBinding. mPixelHLSL and mVertexHLSL are deleted because they are only used during linking. Review URL: https://codereview.appspot.com/6306047 git-svn-id: https://angleproject.googlecode.com/svn/trunk@1141 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 4cfe7b7f
#define MAJOR_VERSION 1 #define MAJOR_VERSION 1
#define MINOR_VERSION 0 #define MINOR_VERSION 0
#define BUILD_VERSION 0 #define BUILD_VERSION 0
#define BUILD_REVISION 1139 #define BUILD_REVISION 1141
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
...@@ -25,6 +25,19 @@ class ResourceManager; ...@@ -25,6 +25,19 @@ class ResourceManager;
class FragmentShader; class FragmentShader;
class VertexShader; class VertexShader;
class AttributeBindings
{
public:
AttributeBindings();
~AttributeBindings();
void bindAttributeLocation(GLuint index, const char *name);
int getAttributeBinding(const std::string &name) const;
private:
std::set<std::string> mAttributeBinding[MAX_VERTEX_ATTRIBS];
};
// Helper struct representing a single shader uniform // Helper struct representing a single shader uniform
struct Uniform struct Uniform
{ {
...@@ -136,6 +149,7 @@ class Program ...@@ -136,6 +149,7 @@ class Program
void applyUniforms(); void applyUniforms();
void link(); void link();
void link(const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader);
bool isLinked(); bool isLinked();
int getInfoLogLength() const; int getInfoLogLength() const;
void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog); void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
...@@ -170,11 +184,10 @@ class Program ...@@ -170,11 +184,10 @@ class Program
ID3D10Blob *compileToBinary(const char *hlsl, const char *profile, ID3DXConstantTable **constantTable); ID3D10Blob *compileToBinary(const char *hlsl, const char *profile, ID3DXConstantTable **constantTable);
void unlink(bool destroy = false); void unlink(bool destroy = false);
int packVaryings(const Varying *packing[][4]); int packVaryings(const Varying *packing[][4], FragmentShader *fragmentShader);
bool linkVaryings(); bool linkVaryings(std::string& pixelHLSL, std::string& vertexHLSL, FragmentShader *fragmentShader, VertexShader *vertexShader);
bool linkAttributes(); bool linkAttributes(const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader);
int getAttributeBinding(const std::string &name);
bool linkUniforms(GLenum shader, ID3DXConstantTable *constantTable); bool linkUniforms(GLenum shader, ID3DXConstantTable *constantTable);
bool defineUniform(GLenum shader, const D3DXHANDLE &constantHandle, const D3DXCONSTANT_DESC &constantDescription, std::string name = ""); bool defineUniform(GLenum shader, const D3DXHANDLE &constantHandle, const D3DXCONSTANT_DESC &constantDescription, std::string name = "");
...@@ -198,15 +211,12 @@ class Program ...@@ -198,15 +211,12 @@ class Program
FragmentShader *mFragmentShader; FragmentShader *mFragmentShader;
VertexShader *mVertexShader; VertexShader *mVertexShader;
std::string mPixelHLSL;
std::string mVertexHLSL;
IDirect3DPixelShader9 *mPixelExecutable; IDirect3DPixelShader9 *mPixelExecutable;
IDirect3DVertexShader9 *mVertexExecutable; IDirect3DVertexShader9 *mVertexExecutable;
ID3DXConstantTable *mConstantTablePS; ID3DXConstantTable *mConstantTablePS;
ID3DXConstantTable *mConstantTableVS; ID3DXConstantTable *mConstantTableVS;
std::set<std::string> mAttributeBinding[MAX_VERTEX_ATTRIBS]; AttributeBindings mAttributeBindings;
Attribute mLinkedAttribute[MAX_VERTEX_ATTRIBS]; Attribute mLinkedAttribute[MAX_VERTEX_ATTRIBS];
int mSemanticIndex[MAX_VERTEX_ATTRIBS]; int mSemanticIndex[MAX_VERTEX_ATTRIBS];
......
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