DiligentGraphics / DiligentCore

A modern cross-platform low-level graphics API
http://diligentgraphics.com/diligent-engine/
Apache License 2.0
615 stars 133 forks source link

Enable Delphi bindings & Windows COM compatibility #83

Closed DiligentGraphics closed 4 years ago

neslib commented 5 years ago

Continuing #55:

refactored overloaded IShaderResourceBinding::GetVariable and IPipelineState::GetStaticShaderVariable methods.

Thanks! This fixes the issue with the wrong vtable order with VC++.

Also added API info query: dd56cf8. The info is queried via engine factory

Thanks for doing this so quickly. Works like a charm...

DiligentGraphics commented 5 years ago

@neslib I also reworked IShaderSourceInputStreamFactory (https://github.com/DiligentGraphics/DiligentCore/commit/696a3cbb5a5f30d2f5000c0db90125d614ea09ca; main repo: https://github.com/DiligentGraphics/DiligentEngine/commit/ea0c5eacdd91a1c17502eb2ba36093ac054572ce): the interface is now derived from IObject. Default shader source stream factory can be created by the engine factory. Engine factory can be queried from the device, or you can keep pointer to original factory. I guess this should fix most of your issues.

Speaking about IDataBlob and DataBlobImpl, I am not really sure where you would really need these. If you want to implement Diligent interfaces, you can simply return null from GetReferenceCounters method. The method is only used when creating weak references and there are only few places in the engine where they are used.

DiligentGraphics commented 5 years ago

BTW, speaking about functions returning interfaces, I guess what is likely happening is Delphi thinks that AddRef was called and calls Release. However by convention Diligent only increments reference counter when interface is returned as out parameter of a function. This would explain why it works when you cast return value to raw pointer.

TheMostDiligent commented 4 years ago

Closing the issue for now. @neslib feel free to reopen/create a new one if there is still interest.