Keith Whitwell <[EMAIL PROTECTED]> writes:
[...]
| > struct function_table {
| > ...
| > void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor);
| > ...
| > } driver;
| > and
| > class Context {
| > ...
| > void BlendFunc(GLenum sfactor, GLenum dfactor);
| > ...
| > } ;
| > You can't simply do
| > driver.BlendFunc = Context::BlendFunc;
| > or can you?
| | No, because one of the things C++ does is pass around an extra parameter -- | namely the 'self' pointer. The 'real' prototype looks something like:
| | void Context::BlendFunc( Context *self, GLenum sfactor, GLenum dfactor )
| | -- but there's no guarentee that this is actually what is happening,
| or that it won't change.
All that is right.
| Yes, I know there is an ABI now -- but I've
| no idea what it actually specifies.
And it helps to remember that that cross-vendor ABI is not supported by Microsoft and not every vendor supports it currently. At any rate, I would suggest against mocking around the ABI.
| Does it allow the compiler to try | & figure out if self is needed? If BlendFunc doesn't reference it, | does it go away, or is it always passed even if its not needed?
If self is not used, then I think the compiler makes it go away.
But if it's a virtual function, it can't because it might be needed in some other implementation...
As I once mentioned, it can be difficult to guess whats going on at a low level by looking at C++ code. That's fine for 95% of the driver, but not so good for the remaining 5% -- and it's really that 5% that interests me most. Coincidentally, the example that started this discussion was set in that 5%.
All in all I'm broadly in favour of a C++ framework where it can enhance sharing between the drivers and doesn't further obscure the functioning of the code.
[...]
| This is something that C++ does internally, but for GL driver | development you are probably better off doing it explicitly, as you | have to at the libGL.so layer anyway.
I didn't understand why that needs to be done explicitly. Plesse, could you elaborate?
I was talking about the dispatch layer that already exists inside libGL.so, I think... I talked about this with Marcello in other posts.
Keith
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Dri-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dri-devel