Commit 2539fffa by Dmitry Skiba Committed by Jamie Madill

Add ShClearResults() for clearing last compilation results.

This helps reclaiming memory used by the results when we don't need them anymore. BUG=492725 Change-Id: I4bc11be27b23589548120f0dc43e9979bf894089 Reviewed-on: https://chromium-review.googlesource.com/277808Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Dmitry Skiba <dskiba@google.com> Tested-by: 's avatarDmitry Skiba <dskiba@google.com> Reviewed-by: 's avatarDmitry Skiba <dskiba@google.com>
parent e9e4c7f7
......@@ -48,7 +48,7 @@ typedef unsigned int GLenum;
// Version number for shader translation API.
// It is incremented every time the API changes.
#define ANGLE_SH_VERSION 137
#define ANGLE_SH_VERSION 138
typedef enum {
SH_GLES2_SPEC = 0x8B40,
......@@ -354,6 +354,9 @@ COMPILER_EXPORT bool ShCompile(
size_t numStrings,
int compileOptions);
// Clears the results from the previous compilation.
COMPILER_EXPORT void ShClearResults(const ShHandle handle);
// Return the version of the shader language.
COMPILER_EXPORT int ShGetShaderVersion(const ShHandle handle);
......
......@@ -85,6 +85,9 @@ class TCompiler : public TShHandleBase
int getShaderVersion() const { return shaderVersion; }
TInfoSink& getInfoSink() { return infoSink; }
// Clears the results from the previous compilation.
void clearResults();
const std::vector<sh::Attribute> &getAttributes() const { return attributes; }
const std::vector<sh::Attribute> &getOutputVariables() const { return outputVariables; }
const std::vector<sh::Uniform> &getUniforms() const { return uniforms; }
......@@ -107,8 +110,6 @@ class TCompiler : public TShHandleBase
bool InitBuiltInSymbolTable(const ShBuiltInResources& resources);
// Compute the string representation of the built-in resources
void setResourceString();
// Clears the results from the previous compilation.
void clearResults();
// Return false if the call depth is exceeded.
bool checkCallDepth();
// Returns true if a program has no conflicting or missing fragment outputs
......
......@@ -240,6 +240,13 @@ bool ShCompile(
return compiler->compile(shaderStrings, numStrings, compileOptions);
}
void ShClearResults(const ShHandle handle)
{
TCompiler *compiler = GetCompilerFromHandle(handle);
ASSERT(compiler);
compiler->clearResults();
}
int ShGetShaderVersion(const ShHandle handle)
{
TCompiler* compiler = GetCompilerFromHandle(handle);
......
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