diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-24 19:32:50 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-24 19:32:50 +0000 |
commit | abd3ee31ea51b47264986e4f5a3109582fbef97d (patch) | |
tree | 6780c5aad3a11d7e4472dba9373c7d40d756f075 /gpu/command_buffer/build_gles2_cmd_buffer.py | |
parent | 826fa729e3763314e75a8391af8b7ca50f3aa573 (diff) | |
download | chromium_src-abd3ee31ea51b47264986e4f5a3109582fbef97d.zip chromium_src-abd3ee31ea51b47264986e4f5a3109582fbef97d.tar.gz chromium_src-abd3ee31ea51b47264986e4f5a3109582fbef97d.tar.bz2 |
Initialize destinations variables before calling GL functions
because if the context is lost those variables will
be uninitialized.
TEST=ran chrome, conformance tests, unit tests and hand edited gles2_demo to test
BUG=none
Review URL: http://codereview.chromium.org/5305005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67293 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/build_gles2_cmd_buffer.py')
-rwxr-xr-x | gpu/command_buffer/build_gles2_cmd_buffer.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index 331159c..d610e5b 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -2125,6 +2125,11 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { else: self.WriteGLES2ImplementationDeclaration(func, file) + def WriteDestinationInitalizationValidation(self, func, file): + """Writes the client side destintion initialization validation.""" + for arg in func.GetOriginalArgs(): + arg.WriteDestinationInitalizationValidation(file, func) + def WriteImmediateCmdComputeSize(self, func, file): """Writes the size computation code for the immediate version of a cmd.""" file.Write(" static uint32 ComputeSize(uint32 size_in_bytes) {\n") @@ -3980,6 +3985,7 @@ class Argument(object): 'GLfloat': 'float', 'GLclampf': 'float', } + need_validation_ = ['GLsizei*', 'GLboolean*', 'GLenum*', 'GLint*'] def __init__(self, name, type): self.name = name @@ -4029,6 +4035,20 @@ class Argument(object): """Writes the validation code for an argument.""" pass + def WriteDestinationInitalizationValidation(self, file, func): + """Writes the client side destintion initialization validation.""" + pass + + def WriteDestinationInitalizationValidatationIfNeeded(self, file, func): + """Writes the client side destintion initialization validation if needed.""" + parts = self.type.split(" ") + if len(parts) > 1: + return + if parts[0] in self.need_validation_: + file.Write(" GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(%s, %s);\n" % + (self.type[:-1], self.name)) + + def WriteGetAddress(self, file): """Writes the code to get the address this argument refers to.""" pass @@ -4213,6 +4233,10 @@ class ImmediatePointerArgument(Argument): """Overridden from Argument.""" return None + def WriteDestinationInitalizationValidation(self, file, func): + """Overridden from Argument.""" + self.WriteDestinationInitalizationValidatationIfNeeded(file, func) + class BucketPointerArgument(Argument): """A class that represents an bucket argument to a function.""" @@ -4238,6 +4262,10 @@ class BucketPointerArgument(Argument): """Overridden from Argument.""" return None + def WriteDestinationInitalizationValidation(self, file, func): + """Overridden from Argument.""" + self.WriteDestinationInitalizationValidatationIfNeeded(file, func) + class PointerArgument(Argument): """A class that represents a pointer argument to a function.""" @@ -4308,6 +4336,10 @@ class PointerArgument(Argument): return InputStringBucketArgument(self.name, self.type) return BucketPointerArgument(self.name, self.type) + def WriteDestinationInitalizationValidation(self, file, func): + """Overridden from Argument.""" + self.WriteDestinationInitalizationValidatationIfNeeded(file, func) + class InputStringBucketArgument(Argument): """An string input argument where the string is passed in a bucket.""" @@ -4629,6 +4661,10 @@ class Function(object): """Writes the GLES2 Implemention declaration.""" self.type_handler.WriteGLES2ImplementationHeader(self, file) + def WriteDestinationInitalizationValidation(self, file): + """Writes the client side destintion initialization validation.""" + self.type_handler.WriteDestinationInitalizationValidation(self, file) + def WriteFormatTest(self, file): """Writes the cmd's format test.""" self.type_handler.WriteFormatTest(self, file) @@ -5113,6 +5149,7 @@ class GLGenerator(object): file.Write("%s GLES2%s(%s) {\n" % (func.return_type, func.name, func.MakeTypedOriginalArgString(""))) + func.WriteDestinationInitalizationValidation(file) comma = "" if len(func.GetOriginalArgs()): comma = " << " |