Horde3D

Next-Generation Graphics Engine
It is currently 29.03.2024, 08:15

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 04.10.2008, 18:44 
Offline

Joined: 15.06.2008, 11:21
Posts: 166
Location: Germany
With my work on Shadow Mapping for point lights, I just saw that it might be good to be able to write more than just one shader for a material, with one shader being a fallback for every hardware, and others being chosen based on the available extensions. I atm didn't see any si9mple way to do this in Horde3D, if there is one, correct me.
(When thinking about this, I though about the depth cubemaps provided with EXT_gpu_shader4, though they are no good example for this as they also depend on changes on the C++ side of the things, when used, they might make things quite a bit easier though)

I thought about a setup like this in the shader file:
Code:
[...]
<Context id="OVERLAY">
<Variant priority = "0">
<VertexShader>
[...]
</VertexShader>
<FragmentShader>
[...]
</FragmentShader>
</Variant>
<Variant priority = "1" extension="EXT_gpu_shader4">
[...]
</Variant>
</Context>
[...]

This would just execute the variant of the shader with the highest priority which is available with the given extensions.

If this is a bad idea, just say so, but I though this might be handy.


Top
 Profile  
Reply with quote  
PostPosted: 04.10.2008, 21:26 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
The current solution for slightly different hardware caps is using #ifdefs in the shader (ubershader approach). There is an API function setShaderPreambles with which you can define a common header for all shaders. You can put #defines there depending on the hardware configuration. Is that sufficient for your needs?


Top
 Profile  
Reply with quote  
PostPosted: 04.10.2008, 21:27 
Offline

Joined: 15.06.2008, 11:21
Posts: 166
Location: Germany
Yeah, probably it is :)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 51 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group