Horde3D

Next-Generation Graphics Engine
It is currently 26.11.2024, 04:54

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: 13.09.2008, 04:46 
Offline

Joined: 19.11.2007, 19:35
Posts: 218
Here's a patch.
Attachment:
File comment: Zipped .diff patch
ContextsAndTests.zip [2.21 KiB]
Downloaded 804 times

Shared contexts Explanation:

As I posted in the thread pertaining to these directly, the following is the XML usage. It has no problems with linking to a link that links to a link, but it can't handle loops at the moment (you really shouldn't be doing something that silly, but I'll add the safeguards).
Code:
<Context id="LIGHTING" link="shared.shader.xml" />


The alpha and depth testing and such is very different.
Code:
<RenderConfig ...valid render config contents />
<TestConfig alphaTest="true" alphaMode="greater" alphaValue="0.5" />


The <TestConfig /> tag is optional, and will default to DepthTest = true, DepthMode = GL_LEQUAL, AlphaTest = false, and AlphaToCoverage = false.

Available attributes:

depthTest="bool", turns depth test on or off
depthMode="greater" or "less" decides whether to use GL_GEQUAL or GL_LEQUAL testing mode
alphaTest="bool", turns alpha test on or off
alphaMode="greater" or "less" decides whether to use GL_GREATER or GL_LESS testing mode
alphaValue="float" the standard of measure that the test is compared against.
alphaToCoverage="bool" enables alpha to coverage

NOTE on alphaToCoverage: You must use Horde3D::setOption( EngineOptions::SampleCount, # ) to something greater than 0 for it to actually be used. Setting it to true won't do anything if alphaTest is enabled, the two aren't compatible.

Everything has been tested fairly thoroughly with different combinations of settings, but not thoroughly enough in practice. The To-Do list includes exact specification of test modes, using "gequal" "equal" "lequal" "greater" "less"

Open for review and discussion on both implementation and XML usage.


Top
 Profile  
Reply with quote  
PostPosted: 14.09.2008, 02:57 
Offline

Joined: 19.11.2007, 19:35
Posts: 218
Here's an updated and improved version, with significant changes.

Attachment:
ContextsAndTestsV2.zip [2.54 KiB]
Downloaded 820 times


<TestConfig /> does not exist anymore.
It's been replaced with

<AlphaTest enabled="bool" mode="modeCode" value="float" />
<DepthTest enabled="bool" mode="modeCode" />
<AlphaToCoverage enabled="bool />

The default results are identical. I think this is probably more intuitive than <TestConfig /> which honestly made no sense for Alpha To Coverage, because it isn't a test. It also makes the shader's test setup instantly comprehensible instead of being long winded in the event of combined alpha and depth testing.

Valid test modes have been expanded to include "gequal" "lequal" and "equal" in addition to "less" and "greater"

Context linking will now choke and return 0x0 if it loops. PLEASE suggest a different solution if one pops into your mind than what I implemented, an alteration to findContext(string, **string safety = ""**)


Top
 Profile  
Reply with quote  
PostPosted: 14.09.2008, 23:03 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Looks good at first sight....I will have a closer look when I have a bit more time...


Top
 Profile  
Reply with quote  
PostPosted: 18.09.2008, 21:36 
Offline

Joined: 19.11.2007, 19:35
Posts: 218
Update to Context linking:

No longer calls getLink if there are no links present in the shader.
Recursive check for looping reference optimized to use a vector<pair<string,string>*> *safety that is reserved for 3 (seemed like a realistic likely depth in complicated circumstances).
Pointer == Pointer is alot faster than string.find(string).

findContext(const string &name, vector<pair<string,string>*> *safety = 0x0)

Hasn't been tested yet in cases where there's material data and expected shader data absences.
Attachment:
File comment: Zipped Patch File
ContextsAndTestsv3.zip [2.64 KiB]
Downloaded 839 times


Top
 Profile  
Reply with quote  
PostPosted: 05.10.2008, 16:33 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
I had a closer look at your code. The extended rendering state configuration is very good. The context linking will be really practical, although the "safety" part does not look so clean but I didn't have the time to think about a nicer solution. Good work, if you are happy with it yourself I think it can go to the community branch.


Top
 Profile  
Reply with quote  
PostPosted: 07.10.2008, 18:41 
Offline

Joined: 19.11.2007, 19:35
Posts: 218
Yeah, the safety is the part I don't like. I'm going to dig through some books for a few days before pushing it to see if I can find something else that will do the trick and make more sense.


Top
 Profile  
Reply with quote  
PostPosted: 18.11.2008, 21:46 
Offline

Joined: 19.11.2007, 19:35
Posts: 218
I've committed the rendering state related code to the community SVN, and updated the relevant documentation.

I'll post a recent patch for context linking, but I don't think it should go into the SVN stock.


Top
 Profile  
Reply with quote  
PostPosted: 28.01.2009, 23:51 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
AcidFaucet, thanks again for your patch!

We have finally taken over your first suggestion in some modified form (e.g. depthTest is not necessary since you can set depthMode to ALWAYS which is the same as disabling depth test). Since that way the number of properties is quite small, we though it would be nicer to have them in a single xml node (btw, d3d also just has a single renderstate enum for these states).


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 9 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:  
Powered by phpBB® Forum Software © phpBB Group