Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2082483002: Support line-continuation character in WebGL 2.0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 441
442 case InPreprocessorDirective: 442 case InPreprocessorDirective:
443 // No matter what the character is, just pass it 443 // No matter what the character is, just pass it
444 // through. Do not parse comments in this state. This 444 // through. Do not parse comments in this state. This
445 // might not be the right thing to do long term, but it 445 // might not be the right thing to do long term, but it
446 // should handle the #error preprocessor directive. 446 // should handle the #error preprocessor directive.
447 emit(c); 447 emit(c);
448 break; 448 break;
449 449
450 case InSingleLineComment: 450 case InSingleLineComment:
451 // Handle line-continuation character in single line comment.
452 // Advance string to next nonspace character and eat it.
Zhenyao Mo 2016/06/29 18:16:07 Can you also add a comment, saying that line-conti
Ken Russell (switch to Gerrit) 2016/06/30 00:04:31 This change doesn't seem to implement the behavior
qiankun 2016/06/30 15:12:47 Done.
453 if (c == '\\') {
454 while (peek(temp) && WTF::isASCIISpace(temp))
455 advance();
456 advance();
457 }
458
451 // The newline code at the top of this function takes care 459 // The newline code at the top of this function takes care
452 // of resetting our state when we get out of the 460 // of resetting our state when we get out of the
453 // single-line comment. Swallow all other characters. 461 // single-line comment. Swallow all other characters.
454 break; 462 break;
455 463
456 case InMultiLineComment: 464 case InMultiLineComment:
457 if (c == '*' && peek(temp) && temp == '/') { 465 if (c == '*' && peek(temp) && temp == '/') {
458 emit('*'); 466 emit('*');
459 emit('/'); 467 emit('/');
460 m_parseState = MiddleOfLine; 468 m_parseState = MiddleOfLine;
(...skipping 4993 matching lines...) Expand 10 before | Expand all | Expand 10 after
5454 if (x < 0 || y < 0 || z < 0) { 5462 if (x < 0 || y < 0 || z < 0) {
5455 synthesizeGLError(GL_INVALID_VALUE, functionName, "size < 0"); 5463 synthesizeGLError(GL_INVALID_VALUE, functionName, "size < 0");
5456 return false; 5464 return false;
5457 } 5465 }
5458 return true; 5466 return true;
5459 } 5467 }
5460 5468
5461 bool WebGLRenderingContextBase::validateString(const char* functionName, const S tring& string) 5469 bool WebGLRenderingContextBase::validateString(const char* functionName, const S tring& string)
5462 { 5470 {
5463 for (size_t i = 0; i < string.length(); ++i) { 5471 for (size_t i = 0; i < string.length(); ++i) {
5472 // line-continuation character \ is supported in WebGL 2.0.
5473 if (isWebGL2OrHigher() && string[i] == '\\')
qiankun 2016/06/29 05:31:21 This isn't very accurate to say WebGL 2.0 here. We
Zhenyao Mo 2016/06/29 18:16:07 This is not true. See GLSL ES Spec 3.00.4 page 6,
Ken Russell (switch to Gerrit) 2016/06/30 00:04:31 This particular change (to validateString) seems w
5474 continue;
5464 if (!validateCharacter(string[i])) { 5475 if (!validateCharacter(string[i])) {
5465 synthesizeGLError(GL_INVALID_VALUE, functionName, "string not ASCII" ); 5476 synthesizeGLError(GL_INVALID_VALUE, functionName, "string not ASCII" );
5466 return false; 5477 return false;
5467 } 5478 }
5468 } 5479 }
5469 return true; 5480 return true;
5470 } 5481 }
5471 5482
5472 bool WebGLRenderingContextBase::validateTexFuncFormatAndType(const char* functio nName, TexImageFunctionType functionType, GLenum internalformat, GLenum format, GLenum type, GLint level) 5483 bool WebGLRenderingContextBase::validateTexFuncFormatAndType(const char* functio nName, TexImageFunctionType functionType, GLenum internalformat, GLenum format, GLenum type, GLint level)
5473 { 5484 {
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
6444 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); 6455 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
6445 } 6456 }
6446 6457
6447 void WebGLRenderingContextBase::restoreUnpackParameters() 6458 void WebGLRenderingContextBase::restoreUnpackParameters()
6448 { 6459 {
6449 if (m_unpackAlignment != 1) 6460 if (m_unpackAlignment != 1)
6450 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); 6461 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
6451 } 6462 }
6452 6463
6453 } // namespace blink 6464 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698