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.
[...]
| 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?
-- Gaby
-------------------------------------------------------
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