Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2775)

Issue 698041: Added GLSL backend for ESSL translator. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 2 months ago by Alok Priyadarshi
Modified:
14 years, 1 month ago
Reviewers:
vangelis, kbr1, dgkoch, kbr
CC:
angleproject-review_googlegroups.com
Base URL:
http://angleproject.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Added GLSL backend for ESSL translator.

Patch Set 1 #

Total comments: 27

Patch Set 2 : '' #

Total comments: 6

Patch Set 3 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1962 lines, -865 lines) Patch
M samples/samples.sln View 1 2 2 chunks +37 lines, -1 line 0 comments Download
A samples/translator/essl_to_glsl.vcproj View 1 chunk +193 lines, -0 lines 0 comments Download
A samples/translator/essl_to_hlsl.vcproj View 1 chunk +193 lines, -0 lines 0 comments Download
A samples/translator/translator.cpp View 1 2 1 chunk +243 lines, -0 lines 0 comments Download
M src/ANGLE.sln View 1 2 3 chunks +20 lines, -2 lines 0 comments Download
D src/compiler/CodeGen.cpp View 1 2 1 chunk +0 lines, -47 lines 0 comments Download
A src/compiler/CodeGenGLSL.cpp View 1 chunk +25 lines, -0 lines 0 comments Download
A + src/compiler/CodeGenHLSL.cpp View 2 chunks +2 lines, -24 lines 0 comments Download
M src/compiler/ConstantUnion.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
M src/compiler/Link.cpp View 1 2 1 chunk +2 lines, -3 lines 0 comments Download
A src/compiler/OutputGLSL.h View 1 chunk +38 lines, -0 lines 0 comments Download
A src/compiler/OutputGLSL.cpp View 1 chunk +469 lines, -0 lines 0 comments Download
M src/compiler/ShHandle.h View 1 2 5 chunks +12 lines, -13 lines 0 comments Download
M src/compiler/ShaderLang.cpp View 1 2 3 chunks +8 lines, -16 lines 0 comments Download
A src/compiler/TranslatorGLSL.h View 1 chunk +19 lines, -0 lines 0 comments Download
A src/compiler/TranslatorGLSL.cpp View 1 chunk +22 lines, -0 lines 0 comments Download
A src/compiler/TranslatorHLSL.h View 1 chunk +19 lines, -0 lines 0 comments Download
A src/compiler/TranslatorHLSL.cpp View 1 chunk +22 lines, -0 lines 0 comments Download
D src/compiler/compiler.vcproj View 1 2 1 chunk +0 lines, -468 lines 0 comments Download
M src/compiler/intermOut.cpp View 1 2 4 chunks +270 lines, -277 lines 0 comments Download
A + src/compiler/translator_common.vcproj View 4 chunks +1 line, -13 lines 0 comments Download
A src/compiler/translator_glsl.vcproj View 1 chunk +183 lines, -0 lines 0 comments Download
A src/compiler/translator_hlsl.vcproj View 1 chunk +183 lines, -0 lines 0 comments Download

Messages

Total messages: 18
Alok Priyadarshi
14 years, 2 months ago (2010-03-23 19:47:34 UTC) #1
vangelis
Mostly comments about style issues. http://codereview.appspot.com/698041/diff/1/2 File samples/samples.sln (right): http://codereview.appspot.com/698041/diff/1/2#newcode72 samples/samples.sln:72: ProjectSection(ProjectDependencies) = postProject Was ...
14 years, 2 months ago (2010-03-23 22:34:28 UTC) #2
Alok Priyadarshi
what do you guys think about using translator in project names? will it be confusing ...
14 years, 2 months ago (2010-03-23 23:24:51 UTC) #3
Alok Priyadarshi
+kbr
14 years, 2 months ago (2010-03-23 23:25:24 UTC) #4
vangelis
I think "translator" is a good name for what we're trying to do. http://codereview.appspot.com/698041/diff/1/2 File ...
14 years, 2 months ago (2010-03-23 23:45:11 UTC) #5
kbr1
LGTM. Couple of high-level comments. 1) What is the plan when we are running on ...
14 years, 2 months ago (2010-03-24 01:25:20 UTC) #6
kbr1
(Resending just to get archived in angleproject-review) On 2010/03/24 01:25:20, kbr1 wrote: > LGTM. Couple ...
14 years, 2 months ago (2010-03-24 01:33:26 UTC) #7
nicolas
Hi Vangelis, Regarding sticking the * with the type or variable name: If I may ...
14 years, 2 months ago (2010-03-24 02:50:19 UTC) #8
Alok Priyadarshi
http://codereview.appspot.com/698041/diff/9001/10002 File samples/translator/translator.cpp (right): http://codereview.appspot.com/698041/diff/9001/10002#newcode2 samples/translator/translator.cpp:2: // Copyright (c) 2002-2010 The GATE Project Authors. All ...
14 years, 2 months ago (2010-03-24 16:46:49 UTC) #9
Alok Priyadarshi
On Tue, Mar 23, 2010 at 7:25 PM, <kbr@chromium.org> wrote: > LGTM. Couple of high-level ...
14 years, 2 months ago (2010-03-24 16:52:46 UTC) #10
vangelis
Hi Nicholas, You're bringing up some good examples where * makes more sense when it ...
14 years, 2 months ago (2010-03-24 16:53:29 UTC) #11
Alok Priyadarshi
Daniel? Any objections before I check it in?
14 years, 2 months ago (2010-03-24 16:55:29 UTC) #12
dgkoch
Hi Vangelis, As Nicolas pointed out, we've been using the * aligned with the variable ...
14 years, 2 months ago (2010-03-24 17:31:01 UTC) #13
kbr1
On 2010/03/24 16:52:46, alokp wrote: > I did not find any tabs in this CL. ...
14 years, 2 months ago (2010-03-24 17:40:30 UTC) #14
vangelis
On Wed, Mar 24, 2010 at 10:30 AM, Daniel Koch <daniel@transgaming.com>wrote: > Hi Vangelis, > ...
14 years, 2 months ago (2010-03-24 17:45:20 UTC) #15
dgkoch
Looks good. Daniel
14 years, 2 months ago (2010-03-24 17:55:27 UTC) #16
nicolas
Hi Vangelis, Again this is just my two cents, but I believe comparing it directly ...
14 years, 1 month ago (2010-03-25 11:54:47 UTC) #17
vangelis
14 years, 1 month ago (2010-03-25 16:17:15 UTC) #18
On Thu, Mar 25, 2010 at 4:54 AM, Nicolas Capens <nicolas@transgaming.com>wrote:

>  Hi Vangelis,
>
>
>
> Again this is just my two cents, but I believe comparing it directly to
> casting is incorrect.
>
>
>
> For example to cast something to a pointer to an array of integers you
> could write "static_cast<int(*)[]>(p)". Yet something like "int(*)[] p;" is
> not a valid declaration. You have to write "int (*p)[];" instead. So writing
> "int* p;" because "static_cast<int*>(p)" happens to be valid is not a good
> argument in my humble opinion.
>
>
>
> Actually the full declaration syntax would be "int (*p);" and the cast is
> "static_cast<int (*)>(p)". Reading the type from the innermost parenthesis
> outward (first to the right then to the left) always leads to the correct
> interpretation. But (thankfully) C allows to drop superfluous parenthesis
> and spaces so you can safely write "static_cast<int*>(p)", without risk of
> misinterpretation. For declarations though sticking the asterisk to the
> variable name is the most consistent notation,  that also aids
> interpretation. Just think of "int (*p)[];" and then removing the array so
> you end up with "int *p;".
>
>
>
> I fully understand that "int *p;" looks a bit alien at first but clearly
> because of the above (and the five arguments I gave previously) C/C++ wants
> us to write declarations this way. The reasons behind its 'inside-out' type
> declaration are historical [1]. We can't change the language, so we might as
> well make sure it is used as intended by its design to avoid any further
> confusion.
>
>
>
> I have to add that after adopting this notation my understanding of pointer
> syntax and semantic, probably the most complex concept in C, improved
> dramatically. This is just a personal experience and opinion, but I hope
> I've given enough technical arguments to clarify why this could be
> significant.
>
>
>
> Anyway, since other Google project already adopted the other notation I can
> see why you would want to adopt that as well for consistency reasons. I hope
> it's not out of place though to warn that several decades later a lot of
> Microsoft code is still using (Systems) Hungarian notation even though all
> their naming conventions now explicitly advise against it [2]...
>

:) The internal google styleguide also forces an 80 char limit on lines so
it's not exactly the bible of modern programming!  Feel free to use whatever
style feels good to your team.

Vangelis




>
>
> Kind regards,
>
>
>
> Nicolas
>
>
>
> [1] http://www.peoi.org/Courses/Coursesen/cprog/fram1.html
>
> [2] http://www.joelonsoftware.com/articles/Wrong.html
>
>
>
>
>
> *From:* angleproject-review@googlegroups.com [mailto:
> angleproject-review@googlegroups.com] *On Behalf Of *Vangelis Kokkevis
> *Sent:* Wednesday, March 24, 2010 17:53
> *To:* angleproject-review@googlegroups.com
> *Cc:* alokp@chromium.org; daniel@transgaming.com;
> reply@codereview.appspotmail.com
>
> *Subject:* Re: Added GLSL backend for ESSL translator. (issue698041)
>
>
>
> Hi Nicholas,
>
>    You're bringing up some good examples where * makes more sense when it
> stays with the variable name.  In my mind the biggest reason for keeping the
> * with the type is that it is actually integral to the type definition.  For
> example, a pointer to an int is int*.  If you were to cast something to a
> new type you would use static_cast<int*>(foo) .  I do realize though that
> there's valid arguments on both sides. A quick survey of our style guides
> reveal:
>
>
>
> - WebKit : T* var
>
> - Chromium: T* var
>
> - Internal Google style guide:  either T* var or T *var but not T * var  .
>  Stay consistent within the file.
>
>
>
> Ideally we should stay consistent throughout the project but given that
> there's already a lot of code there, unless anyone objects, I'd like to
> follow the internal google guideline and stay consistent within the file.
>
>
>
> Vangelis
>
>
>
>
>
> On Tue, Mar 23, 2010 at 7:50 PM, Nicolas Capens <nicolas@transgaming.com>
> wrote:
>
> Hi Vangelis,
>
> Regarding sticking the * with the type or variable name: If I may put my
> two
> cents in, I believe there are strong technical reasons to stick it to the
> variable name. Here are five real-world situations where this becomes more
> than a style decision:
>
> 1) A declaration like "int* p, q;" does not declare two pointers, it
> declares a pointer and an integer. And it gets really awkward to have to
> write "int* p, *q;" when you do want two pointers. By writing "int *p, q;"
> and "int *p, *q;" both cases are easy to interpret correctly and
> consistent.
>
> 2) Writing "(int*) p;" results in a compilation error. You would think that
> if "int*" represented a valid type in a declaration you could enclose it
> with parenthesis. On the other hand "int (*p);" does compile correctly.
>
> 3) The asterisk can be regarded as a decoration of the name, and without
> the
> decoration you get the pointer. So when writing something like "const int
> **p;", "**p" is the full name of a constant integer, and indeed it can be
> used as one. "*p" is the name of a pointer to a constant integer, and "p"
> is
> the name of a pointer to a pointer to a constant integer. If instead one
> would write "const int** p;", something like "*p" has little connection to
> the declaration (it's hard to tell whether the address is constant or
> whether the integer is constant).
>
> 4) In C/C++ types are always read from the variable name outward. A
> declaration like "int *const &r;" is a reference to a constant pointer to
> an
> integer. Reading it left-to-right instead and trying to interpret it
> correctly is quite hard if not impossible but you'd be encouraged to do
> that
> if it was written as "int* const& r;". And things can get much, much more
> complicated than this.
>
> 5) Something like "int (*p)[2];" declares a pointer to an array of
> integers,
> while "int* p[2];" declares an array of pointers. That's something entirely
> different. Of course you could write "int(* p)[2];" but that quickly
> becomes
> nonsensical ascii soup. Likewise the notation for function pointers and
> even
> more so method pointers demand placing the asterisk next to the variable
> name if you want to avoid spaces in the weirdest places.
>
> Kind regards,
>
> Nicolas
>
>
>
> -----Original Message-----
> From: angleproject-review@googlegroups.com
> [mailto:angleproject-review@googlegroups.com] On Behalf Of
> vangelis@google.com
> Sent: Tuesday, March 23, 2010 23:34
> To: alokp@chromium.org; daniel@transgaming.com
> Cc: angleproject-review@googlegroups.com; reply@codereview.appspotmail.com
> Subject: Re: Added GLSL backend for ESSL translator. (issue698041)
>
> Mostly comments about style issues.
>
>
> http://codereview.appspot.com/698041/diff/1/2
> File samples/samples.sln (right):
>
> http://codereview.appspot.com/698041/diff/1/2#newcode72
>
samples/samples.sln:72<http://codereview.appspot.com/698041/diff/1/2#newcode72%0Dsamples/samples.sln:72>:
> ProjectSection(ProjectDependencies) =
> postProject
> Was this section hand-edited?  I wouldn't expect to see tabs here.
>
> http://codereview.appspot.com/698041/diff/1/3
> File samples/translator/translator.cpp (right):
>
> http://codereview.appspot.com/698041/diff/1/3#newcode82
>
samples/translator/translator.cpp:82<http://codereview.appspot.com/698041/diff/1/3#newcode82%0Dsamples/translator/translator.cpp:82>:
> case 'i': debugOptions |=
> EDebugOpIntermediate; break;
> there seem to be some issues with the alignment of the case statements
> here.
>
> http://codereview.appspot.com/698041/diff/1/3#newcode101
>
samples/translator/translator.cpp:101<http://codereview.appspot.com/698041/diff/1/3#newcode101%0Dsamples/translator/translator.cpp:101>:
> if (! CompileFile(argv[0],
> compilers[numCompilers-1], debugOptions, &resources))
> remove space after !
>
> http://codereview.appspot.com/698041/diff/1/3#newcode180
>
samples/translator/translator.cpp:180<http://codereview.appspot.com/698041/diff/1/3#newcode180%0Dsamples/translator/translator.cpp:180>:
> printf("Usage: standalone [-i -a
> -c -o -m] file1 file2 ...\n"
> document the flags here?
>
> http://codereview.appspot.com/698041/diff/1/3#newcode190
>
samples/translator/translator.cpp:190<http://codereview.appspot.com/698041/diff/1/3#newcode190%0Dsamples/translator/translator.cpp:190>:
> FILE *in    = fopen(fileName,
> "r");
> remove extra spaces before =
>
> http://codereview.appspot.com/698041/diff/1/3#newcode193
>
samples/translator/translator.cpp:193<http://codereview.appspot.com/698041/diff/1/3#newcode193%0Dsamples/translator/translator.cpp:193>
> :
> char**return_data=(char**)malloc(MAX_SOURCE_STRINGS+1);
> add space after **
>
> http://codereview.appspot.com/698041/diff/1/3#newcode206
>
samples/translator/translator.cpp:206<http://codereview.appspot.com/698041/diff/1/3#newcode206%0Dsamples/translator/translator.cpp:206>:
> if (!(fdata = (char
> *)malloc(count+2))) {
> remove space between char and *
>
> http://codereview.appspot.com/698041/diff/1/3#newcode216
>
samples/translator/translator.cpp:216<http://codereview.appspot.com/698041/diff/1/3#newcode216%0Dsamples/translator/translator.cpp:216>:
> if(count==0){
> I notice in general that the spacing you use in expressions is a bit
> inconsistent.  Sometimes you use spaces around = sometimes not, etc.
> Ideally you should stick with one style.
>
> http://codereview.appspot.com/698041/diff/1/3#newcode243
>
samples/translator/translator.cpp:243<http://codereview.appspot.com/698041/diff/1/3#newcode243%0Dsamples/translator/translator.cpp:243>:
> void FreeFileData(char **data)
> char** data
>
> http://codereview.appspot.com/698041/diff/1/3#newcode255
>
samples/translator/translator.cpp:255<http://codereview.appspot.com/698041/diff/1/3#newcode255%0Dsamples/translator/translator.cpp:255>:
> int ShOutputMultipleStrings(char
> **argv)
> char** argv
>
> It's a style issue but it seems that most guides say the * sticks with
> the type.
>
> http://codereview.appspot.com/698041/diff/1/6
> File src/ANGLE.sln (right):
>
> http://codereview.appspot.com/698041/diff/1/6#newcode22
>
src/ANGLE.sln:22<http://codereview.appspot.com/698041/diff/1/6#newcode22%0Dsrc/ANGLE.sln:22>:
> ProjectSection(ProjectDependencies) = postProject
> tabs, again.
>
> http://codereview.appspot.com/698041/diff/1/10
> File src/compiler/intermOut.cpp (right):
>
> http://codereview.appspot.com/698041/diff/1/10#newcode100
>
src/compiler/intermOut.cpp:100<http://codereview.appspot.com/698041/diff/1/10#newcode100%0Dsrc/compiler/intermOut.cpp:100>:
> case EOpInitialize:
> out.debug << "initialize first child with second child";   break;
> watch indentation
>
> http://codereview.appspot.com/698041/diff/1/18
> File src/compiler/translator_frontend.vcproj (right):
>
> http://codereview.appspot.com/698041/diff/1/18#newcode5
>
src/compiler/translator_frontend.vcproj:5<http://codereview.appspot.com/698041/diff/1/18#newcode5%0Dsrc/compiler/translator_frontend.vcproj:5>:
> Name="translator_frontend"
> tab
>
> http://codereview.appspot.com/698041/show
>
> To unsubscribe from this group, send email to
> angleproject-review+unsubscribegooglegroups.com or reply to this email
> with
> the words "REMOVE ME" as the subject.
>
> To unsubscribe from this group, send email to angleproject-review+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>
>
>
> To unsubscribe from this group, send email to angleproject-review+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>
> To unsubscribe from this group, send email to angleproject-review+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b