I disagree. First of all, core OpenGL has been behind for a number of years now, and yet it's still relatively easy to use due to the extensions interface. And with OpenGL 2.0, GL is taking a huge step in the right direction for graphics hardware: hardware-specific compilation of a HLSL. This alone takes it a quantum leap beyond DirectX.MfA said:I was being sarcastic, I think there is no such thing as a futureproof API at the moment ... for the moment a new API for each new generation of hardware plain makes sense IMO.
OpenGL worked a lot better when hardware was chasing it, now OpenGL is chasing the hardware.
It'd call it an ideal way to approach HLSL. Obviously it's not complete. And I don't think adding surface subdivision would be a significant change to the HLSL, particularly if the hardware is unified.MfA said:It might be a standard HLSL, but it isnt exactly what I would call ideal.
Chalnoth said:A DX9 driver does have to compile shaders, yes.
How easily a DX9 driver can optimize shaders as it compiles them depends on two main factors:
1. How well-optimized the assembly already is.
2. How well the assembly language maps to the internal hardware.
A GLSlang compiler doesn't have these limitations, since there is no intermediate assembly, and has the further bonus of having developer code remain at a higher level, which gives more information to the compiler, which in turn makes optimization easier.
Basically, I'd say that writing a basic DX9 shader compiler is easier than writing a basic GLSlang compiler.
But optimizing a GLSlang compiler should be easier than optimizing a DX9 shader compiler.
Additionally, since there are bound to be example implementations of GLSlang, the challenge in getting that basic GLSlang compiler out is greatly reduced.
Could you elaborate?MfA said:In some ways Java bytecode is low level too, but in other ways it is no more low level than Java code itself ...
JohnH said:Why is the OGL2.0 approach to HLSL parsing not correct at this time ?
1) IHV's can individually introduce there own unique bugs
2) IHV's can individually tweak the syntax ("illegally") for there own devious reasons
3) For the above reasons, any shader thats successfully compiled on your own favorate dev systems is not gaurenteed to compile on all HW in the field.
4) Parsing of the HLSL will add time to runtime compilation
A seperate question, is there any concept of a profile that allows you to compile for a known target? As far as I know its up to the app to queuery capabilities. This is important given that no target HW currently support much of that required for true OGL2.0 support.
Why is M$'s approach of compiling to an intermediate format better?
1) Parser is owned by one "person", bugs and work arounds are common to all HW/Drivers
2) Syntax is fixed and unchangeable by IHV's
3) Shaders are compiled to defined targets, there is a high likelyhood that they will run on all HW in the field (not sure that WHQL has managed to achieve this ideal yet!)
4) The minimum amount of work is done at runtime (outside of offline HW targets).
Whats wrong with the M$ approach at the moment?
1) Target level mean that "optimisations" may be applied that are only there to get around restrictions in the target (e.g. texdr can be re-ordered to workaround sequence limit imposed by model).
2) There's some issues currently with unnecessary expansion of macros
All the discussion about intermediat formats removing optimisation opportunities are invalidated if the correct intermediat representation is used. This generally means that, as long as basic resoureces assumed by the model exceed or are nuetral to the target system and that the intermediate representation accuratley reflects what was originally supplied, you can always produce an optimal result at the backend.
This means things like preserving conditional statements in their full form, not reordering based on assumed latencies, not using temp registers instead use named and annotated variables/arrays etc etc.
Dx9 doesn't yet do all this, however there are no targets available that can truely support, say, arbitrary temp counts. If you look at the 3.0 asm format you'll notice that is does a bit more of the above, while retaining the defined target approach to life.
Basically, I think the ARB got this aspect of the OGL2.0 design wrong, other that its fine (ish).
JohnH said:Why is the OGL2.0 approach to HLSL parsing not correct at this time ?
1) IHV's can individually introduce there own unique bugs
2) IHV's can individually tweak the syntax ("illegally") for there own devious reasons
3) For the above reasons, any shader thats successfully compiled on your own favorate dev systems is not gaurenteed to compile on all HW in the field.
4) Parsing of the HLSL will add time to runtime compilation
JohnH said:Why is M$'s approach of compiling to an intermediate format better?
1) Parser is owned by one "person", bugs and work arounds are common to all HW/Drivers
2) Syntax is fixed and unchangeable by IHV's
3) Shaders are compiled to defined targets, there is a high likelyhood that they will run on all HW in the field (not sure that WHQL has managed to achieve this ideal yet!)
4) The minimum amount of work is done at runtime (outside of offline HW targets).
JohnH said:Whats wrong with the M$ approach at the moment?
1) Target level mean that "optimisations" may be applied that are only there to get around restrictions in the target (e.g. texdr can be re-ordered to workaround sequence limit imposed by model).
2) There's some issues currently with unnecessary expansion of macros
All the discussion about intermediat formats removing optimisation opportunities are invalidated if the correct intermediat representation is used. This generally means that, as long as basic resoureces assumed by the model exceed or are nuetral to the target system and that the intermediate representation accuratley reflects what was originally supplied, you can always produce an optimal result at the backend.
This means things like preserving conditional statements in their full form, not reordering based on assumed latencies, not using temp registers instead use named and annotated variables/arrays etc etc.
Dx9 doesn't yet do all this, however there are no targets available that can truely support, say, arbitrary temp counts. If you look at the 3.0 asm format you'll notice that is does a bit more of the above, while retaining the defined target approach to life.
Basically, I think the ARB got this aspect of the OGL2.0 design wrong, other that its fine (ish).
Rambling mode off.
John
(phew, think thats the longest post I've ever made!)
Xmas said:Could you elaborate?MfA said:In some ways Java bytecode is low level too, but in other ways it is no more low level than Java code itself ...
JohnH said:1) IHV's can individually introduce there own unique bugs
2) IHV's can individually tweak the syntax ("illegally") for there own devious reasons
3) For the above reasons, any shader thats successfully compiled on your own favorate dev systems is not gaurenteed to compile on all HW in the field.
4) Parsing of the HLSL will add time to runtime compilation
Why is M$'s approach of compiling to an intermediate format better?
1) Parser is owned by one "person", bugs and work arounds are common to all HW/Drivers
2) Syntax is fixed and unchangeable by IHV's
3) Shaders are compiled to defined targets, there is a high likelyhood that they will run on all HW in the field (not sure that WHQL has managed to achieve this ideal yet!)
4) The minimum amount of work is done at runtime (outside of offline HW targets).
Whats wrong with the M$ approach at the moment?
1) Target level mean that "optimisations" may be applied that are only there to get around restrictions in the target (e.g. texdr can be re-ordered to workaround sequence limit imposed by model).
2) There's some issues currently with unnecessary expansion of macros
All the discussion about intermediat formats removing optimisation opportunities are invalidated if the correct intermediat representation is used.
Not wrt to the HLSL parser, or the intermediate format, as the former is supplied by MS not the IHV, and the later is validated by MS so can't be changed.DiGuru said:Sorry if the following seems a bit negative, that is not the intention.
JohnH said:Why is the OGL2.0 approach to HLSL parsing not correct at this time ?
1) IHV's can individually introduce there own unique bugs
As with a DX9 implementation, this depends as much on the compiler as on the hardware. For example, a shader that uses multiple render targets will break on NVx hardware.
IHV's _Cannot_ tweak the syntax of the HLSL as they do not have acces to it. They Also can't tweak the intermediate format as it won't get past validation.2) IHV's can individually tweak the syntax ("illegally") for there own devious reasons
You mean, like they do right now with DX9?
Thats a seperate capabilities issue due to the "externalisation" of a capability that effects how you write your shader code. My personal view is that MRT's should have been roled into to 2.0 profile as well.3) For the above reasons, any shader thats successfully compiled on your own favorate dev systems is not gaurenteed to compile on all HW in the field.
Like, when your shader that uses multiple render targets works just fine on your R3x0?
I have no idea what you mean here. Parsing to the intermediate format can be offline so has no need to impact on runtime.4) Parsing of the HLSL will add time to runtime compilation
Isn't that why all DX9 shaders have to be initialized before execution, so they can be compiled by the driver up front?
When compiling in Dx9 you specify a target profile that if supported by the card it should run, its kind of a heavy caps check without the effort.A seperate question, is there any concept of a profile that allows you to compile for a known target? As far as I know its up to the app to queuery capabilities. This is important given that no target HW currently support much of that required for true OGL2.0 support.
Again, what is different with DX9?
There are no extension in Dx9.Why is M$'s approach of compiling to an intermediate format better?
1) Parser is owned by one "person", bugs and work arounds are common to all HW/Drivers
... depending on the extensions you use and the hardware you use to run it.
Again, there are no extension in Dx9.2) Syntax is fixed and unchangeable by IHV's
You mean, Microsoft has to make the extension, instead of the IHV? (And they do so anyway, so what's the point? It being endorsed by M$?
The profiles are supposed prevent that from happening. The only thing missing in Dx9 is that things like MRT's aren't wrapped up in the 2.0 profile, which by the way they are for 3.0.3) Shaders are compiled to defined targets, there is a high likelyhood that they will run on all HW in the field (not sure that WHQL has managed to achieve this ideal yet!)
... as long as you don't use any function that is not supported by all IHV's in the exact same way.
JIT yes, both, but OGL 2.0 is also JIP (just in time parsing), there is a considerable difference.4) The minimum amount of work is done at runtime (outside of offline HW targets).
JIT compilers? Yes, both.
Sorry for the criticism, it's not personal, your post was just a good way to give some feedback .
;-)
Let me get this straight, JohnH.JohnH said:IHV's _Cannot_ tweak the syntax of the HLSL as they do not have acces to it. They Also can't tweak the intermediate format as it won't get past validation.
Where did he write that?Chalnoth said:Let me get this straight, JohnH.JohnH said:IHV's _Cannot_ tweak the syntax of the HLSL as they do not have acces to it. They Also can't tweak the intermediate format as it won't get past validation.
You like DX9 HLSL because IHV's can't cheat on it, because IHV's have in the past "modified" DX9 shaders?
JohnH said:IHV's _Cannot_ tweak the syntax of the HLSL as they do not have acces to it. They Also can't tweak the intermediate format as it won't get past validation.