Add GetNativePtr to GPUAdapter

This commit is contained in:
Wojciech Figat
2022-12-14 16:16:25 +01:00
parent 713aa3e0f9
commit 79f4dfcaab
4 changed files with 17 additions and 5 deletions

View File

@@ -41,6 +41,11 @@ public:
/// <returns>True if valid, otherwise false.</returns> /// <returns>True if valid, otherwise false.</returns>
virtual bool IsValid() const = 0; virtual bool IsValid() const = 0;
/// <summary>
/// Gets the native pointer to the underlying graphics device adapter. It's a low-level platform-specific handle.
/// </summary>
API_PROPERTY() virtual void* GetNativePtr() const = 0;
/// <summary> /// <summary>
/// Gets the GPU vendor identifier. /// Gets the GPU vendor identifier.
/// </summary> /// </summary>

View File

@@ -38,12 +38,14 @@ public:
{ {
return Index != INVALID_INDEX && MaxFeatureLevel != static_cast<D3D_FEATURE_LEVEL>(0); return Index != INVALID_INDEX && MaxFeatureLevel != static_cast<D3D_FEATURE_LEVEL>(0);
} }
void* GetNativePtr() const override
{
return (void*)(intptr)Index;
}
uint32 GetVendorId() const override uint32 GetVendorId() const override
{ {
return (uint32)Description.VendorId; return (uint32)Description.VendorId;
} }
String GetDescription() const override String GetDescription() const override
{ {
return Description.Description; return Description.Description;

View File

@@ -12,18 +12,19 @@
class GPUAdapterNull : public GPUAdapter class GPUAdapterNull : public GPUAdapter
{ {
public: public:
// [GPUAdapter] // [GPUAdapter]
bool IsValid() const override bool IsValid() const override
{ {
return true; return true;
} }
void* GetNativePtr() const override
{
return nullptr;
}
uint32 GetVendorId() const override uint32 GetVendorId() const override
{ {
return 0; return 0;
} }
String GetDescription() const override String GetDescription() const override
{ {
return TEXT("Null"); return TEXT("Null");

View File

@@ -61,6 +61,10 @@ public:
{ {
return Gpu != VK_NULL_HANDLE; return Gpu != VK_NULL_HANDLE;
} }
void* GetNativePtr() const override
{
return (void*)Gpu;
}
uint32 GetVendorId() const override uint32 GetVendorId() const override
{ {
return GpuProps.vendorID; return GpuProps.vendorID;