Skip to content

Commit

Permalink
v1.140:
Browse files Browse the repository at this point in the history
HIGHLIGHTS:
- NRI: exposed optional memory priority
- NRI: exposed "HIGH_PRIORITY_COPY" queue
- VK: doesn't use potentially slow "VK_SHARING_MODE_CONCURRENT" unless COMPUTE or COPY queue is requested
- NVAPI with MIT license!

BREAKING CHANGES:
- "Vulkan" => "VK" or "vk" to avoid divergence
- "isVulkan12" => "minorVersion" for future needs
- "familyIndex" => "queueFamilyIndex" to avoid divergence

DETAILS:
- NRI: "AllocateMemory" args wrapped into "AllocateMemoryDesc" struct with optional priority
- VK: improved queue related code
- VK: hooked up "VK_EXT_memory_priority"
- Wrapper: fixed not updated queue family indices participating into multi-queue activities
- reduced code entropy
- updated NVAPI
- improved comments
  • Loading branch information
dzhdanNV committed Aug 7, 2024
1 parent 8336b96 commit 97eb304
Show file tree
Hide file tree
Showing 45 changed files with 536 additions and 400 deletions.
2 changes: 1 addition & 1 deletion External/nvapi
Submodule nvapi updated 37 files
+19 −64 License.txt
+26 −38 NvApiDriverSettings.c
+25 −38 NvApiDriverSettings.h
+26 −33 Sample_Code/CustomTiming/CustomTiming.cpp
+27 −33 Sample_Code/DisplayColorControl/DisplayColorControl.cpp
+27 −33 Sample_Code/DisplayColorControl/NVHelper.cpp
+27 −33 Sample_Code/DisplayColorControl/NVHelper.h
+27 −33 Sample_Code/DisplayConfiguration/DisplayConfiguration.cpp
+27 −33 Sample_Code/DisplayConfiguration/targetver.h
+26 −12 Sample_Code/GPUHandleEnumeration/gpuHandleEnumeration.c
+27 −33 Sample_Code/QSYNC_Event_Registration/QSYNC_Event_Registration.cpp
+26 −33 Sample_Code/Sync_Configuration/Sync_Configuration.cpp
+26 −33 Sample_Code/Sync_Configuration/targetver.h
+27 −33 Sample_Code/i2c/i2c.cpp
+27 −33 Sample_Code/i2c/targetver.h
+ amd64/nvapi64.lib
+ docs/NVAPI Public SDK for Driver Release 550.pdf
+ docs/NVAPI Public SDK for Driver Release 555.pdf
+ docs/NVAPI_Reference_Developer.chm
+ docs/NVAPI_Reference_Developer_HTML.zip
+ docs/NVAPI_SDKs_Samples_and_Tools_License_Agreement(Public).pdf
+ docs/R555_NVAPI_Reference_Developer_HTML.zip
+ docs/R560-OpenSource.docx
+ docs/R560_NVAPI_OpenSource_Release_Notes.pdf
+25 −33 nvHLSLExtns.h
+25 −34 nvHLSLExtnsInternal.h
+25 −33 nvShaderExtnEnums.h
+121 −59 nvapi.h
+520 −0 nvapi_interface.h
+33 −33 nvapi_lite_common.h
+26 −33 nvapi_lite_d3dext.h
+26 −33 nvapi_lite_salend.h
+25 −33 nvapi_lite_salstart.h
+25 −33 nvapi_lite_sli.h
+25 −33 nvapi_lite_stereo.h
+26 −34 nvapi_lite_surround.h
+ x86/nvapi.lib
18 changes: 11 additions & 7 deletions Include/Extensions/NRIDeviceCreation.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ NRI_STRUCT(CallbackInterface)
void* userArg;
};

// Use largest offset for the resource type planned to be used as unbounded array
// Use largest offset for the resource type planned to be used as an unbounded array
NRI_STRUCT(SPIRVBindingOffsets)
{
uint32_t samplerOffset;
Expand All @@ -39,7 +39,7 @@ NRI_STRUCT(SPIRVBindingOffsets)
uint32_t storageTextureAndBufferOffset;
};

NRI_STRUCT(VulkanExtensions)
NRI_STRUCT(VKExtensions)
{
const char* const* instanceExtensions;
uint32_t instanceExtensionNum;
Expand All @@ -49,19 +49,23 @@ NRI_STRUCT(VulkanExtensions)

NRI_STRUCT(DeviceCreationDesc)
{
const NRI_NAME(AdapterDesc)* adapterDesc;
const NRI_NAME(AdapterDesc)* adapterDesc; // optional
NRI_NAME(CallbackInterface) callbackInterface;
NRI_NAME(MemoryAllocatorInterface) memoryAllocatorInterface;
NRI_NAME(SPIRVBindingOffsets) spirvBindingOffsets;
NRI_NAME(VulkanExtensions) vulkanExtensions;
NRI_NAME(VKExtensions) vkExtensions;
NRI_NAME(GraphicsAPI) graphicsAPI;
uint32_t shaderExtRegister; // D3D12/D3D11 only
uint32_t shaderExtSpace; // D3D12 only

// Switches (disabled by default)
bool enableNRIValidation;
bool enableAPIValidation;
bool enableGraphicsAPIValidation;
bool enableD3D12DrawParametersEmulation; // not needed for VK, unsupported by D3D11
bool enableD3D11CommandBufferEmulation; // force enable, but why?
bool disableVulkanRayTracing; // to save some CPU memory
bool enableD3D11CommandBufferEmulation; // enable? but why? (auto-enabled if deferred contexts are not supported)

// Switches (enabled by default)
bool disableVKRayTracing; // to save CPU memory in some implementations
};

NRI_API NRI_NAME(Result) NRI_CALL nriEnumerateAdapters(NRI_NAME(AdapterDesc)* adapterDescs, uint32_t NRI_REF adapterDescNum);
Expand Down
6 changes: 3 additions & 3 deletions Include/Extensions/NRIWrapperVK.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ NRI_STRUCT(DeviceCreationVKDesc)
NRI_NAME(CallbackInterface) callbackInterface;
NRI_NAME(MemoryAllocatorInterface) memoryAllocatorInterface;
NRI_NAME(SPIRVBindingOffsets) spirvBindingOffsets;
NRI_NAME(VulkanExtensions) enabledExtensions;
NRI_NAME(VKExtensions) enabledExtensions;
NRIVkInstance vkInstance;
NRIVkDevice vkDevice;
NRIVkPhysicalDevice vkPhysicalDevice;
const uint32_t* queueFamilyIndices;
uint32_t queueFamilyIndexNum;
const char* vulkanLoaderPath;
bool isVulkan12;
uint8_t minorVersion; // >= 2
};

NRI_STRUCT(CommandQueueVKDesc)
{
NRIVkQueue vkQueue;
uint32_t familyIndex;
uint32_t queueFamilyIndex;
NRI_NAME(CommandQueueType) commandQueueType;
};

Expand Down
31 changes: 16 additions & 15 deletions Include/NRI.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// © 2021 NVIDIA Corporation

/*
NRI: generalized common denominator for D3D11, D3D12 and Vulkan GAPIs
NRI: generalized common denominator for D3D11, D3D12 and VK GAPIs
D3D11 spec: https://microsoft.github.io/DirectX-Specs/d3d/archive/D3D11_3_FunctionalSpec.htm
D3D12 spec: https://microsoft.github.io/DirectX-Specs/
VK spec: https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html
Expand All @@ -25,8 +25,8 @@ Non-goals:
#include <stddef.h>

#define NRI_VERSION_MAJOR 1
#define NRI_VERSION_MINOR 139
#define NRI_VERSION_DATE "31 July 2024"
#define NRI_VERSION_MINOR 140
#define NRI_VERSION_DATE "6 August 2024"

#ifdef _WIN32
#define NRI_CALL __fastcall
Expand Down Expand Up @@ -58,6 +58,9 @@ NRI_STRUCT(CoreInterface)
uint32_t (NRI_CALL *GetQuerySize)(const NRI_NAME_REF(QueryPool) queryPool);
void (NRI_CALL *GetBufferMemoryDesc)(const NRI_NAME_REF(Device) device, const NRI_NAME_REF(BufferDesc) bufferDesc, NRI_NAME(MemoryLocation) memoryLocation, NRI_NAME_REF(MemoryDesc) memoryDesc);
void (NRI_CALL *GetTextureMemoryDesc)(const NRI_NAME_REF(Device) device, const NRI_NAME_REF(TextureDesc) textureDesc, NRI_NAME(MemoryLocation) memoryLocation, NRI_NAME_REF(MemoryDesc) memoryDesc);

// Getting COMPUTE and/or COPY queues switches VK "sharing mode" to "VK_SHARING_MODE_CONCURRENT", which can be slower on some HW. This approach is used to avoid
// dealing with "queue ownership transitions", but also adds a requirement to "get" all async queues before resources creation participating into multi-queue activity
NRI_NAME(Result) (NRI_CALL *GetCommandQueue)(NRI_NAME_REF(Device) device, NRI_NAME(CommandQueueType) commandQueueType, NRI_NAME_REF(CommandQueue*) commandQueue);

// Create
Expand Down Expand Up @@ -94,7 +97,7 @@ NRI_STRUCT(CoreInterface)
// - (optional) group returned "MemoryDesc"s by "MemoryType", but do not group if "mustBeDedicated = true"
// - call "BindBufferMemory" (or "BindTextureMemory") to bind resources to "Memory" objects
// => "CalculateAllocationNumber" and "AllocateAndBindMemory" simplify this process for static allocations
NRI_NAME(Result) (NRI_CALL *AllocateMemory)(NRI_NAME_REF(Device) device, NRI_NAME(MemoryType) memoryType, uint64_t size, NRI_NAME_REF(Memory*) memory);
NRI_NAME(Result) (NRI_CALL *AllocateMemory)(NRI_NAME_REF(Device) device, const NRI_NAME_REF(AllocateMemoryDesc) allocateMemoryDesc, NRI_NAME_REF(Memory*) memory);
NRI_NAME(Result) (NRI_CALL *BindBufferMemory)(NRI_NAME_REF(Device) device, const NRI_NAME(BufferMemoryBindingDesc)* memoryBindingDescs, uint32_t memoryBindingDescNum);
NRI_NAME(Result) (NRI_CALL *BindTextureMemory)(NRI_NAME_REF(Device) device, const NRI_NAME(TextureMemoryBindingDesc)* memoryBindingDescs, uint32_t memoryBindingDescNum);
void (NRI_CALL *FreeMemory)(NRI_NAME_REF(Memory) memory);
Expand Down Expand Up @@ -175,12 +178,10 @@ NRI_STRUCT(CoreInterface)
// }
NRI_NAME(Result) (NRI_CALL *EndCommandBuffer)(NRI_NAME_REF(CommandBuffer) commandBuffer);

// Synchronization
// Work submission and synchronization
void (NRI_CALL *QueueSubmit)(NRI_NAME_REF(CommandQueue) commandQueue, const NRI_NAME_REF(QueueSubmitDesc) queueSubmitDesc); // on device
void (NRI_CALL *Wait)(NRI_NAME_REF(Fence) fence, uint64_t value); // on host
uint64_t (NRI_CALL *GetFenceValue)(NRI_NAME_REF(Fence) fence);
void (NRI_CALL *Wait)(NRI_NAME_REF(Fence) fence, uint64_t value);

// Work submission (with queue synchronization)
void (NRI_CALL *QueueSubmit)(NRI_NAME_REF(CommandQueue) commandQueue, const NRI_NAME_REF(QueueSubmitDesc) queueSubmitDesc);

// Descriptor set
void (NRI_CALL *UpdateDescriptorRanges)(NRI_NAME_REF(DescriptorSet) descriptorSet, uint32_t baseRange, uint32_t rangeNum, const NRI_NAME(DescriptorRangeUpdateDesc)* rangeUpdateDescs);
Expand Down Expand Up @@ -218,12 +219,12 @@ NRI_STRUCT(CoreInterface)
void (NRI_CALL *SetDescriptorSetDebugName)(NRI_NAME_REF(DescriptorSet) descriptorSet, const char* name);
void (NRI_CALL *SetMemoryDebugName)(NRI_NAME_REF(Memory) memory, const char* name);

// Native objects D3D11 D3D12 VK
void* (NRI_CALL *GetDeviceNativeObject)(const NRI_NAME_REF(Device) device); // ID3D11Device* ID3D12Device* VkDevice
void* (NRI_CALL *GetCommandBufferNativeObject)(const NRI_NAME_REF(CommandBuffer) commandBuffer); // ID3D11DeviceContext* ID3D12GraphicsCommandList* VkCommandBuffer
uint64_t (NRI_CALL *GetBufferNativeObject)(const NRI_NAME_REF(Buffer) buffer); // ID3D11Buffer* ID3D12Resource* VkBuffer
uint64_t (NRI_CALL *GetTextureNativeObject)(const NRI_NAME_REF(Texture) texture); // ID3D11Resource* ID3D12Resource* VkImage
uint64_t (NRI_CALL *GetDescriptorNativeObject)(const NRI_NAME_REF(Descriptor) descriptor); // ID3D11View* D3D12_CPU_DESCRIPTOR_HANDLE VkImageView/VkBufferView
// Native objects ___D3D11________________|_D3D12_______________________|_VK______________________
void* (NRI_CALL *GetDeviceNativeObject)(const NRI_NAME_REF(Device) device); // ID3D11Device* | ID3D12Device* | VkDevice
void* (NRI_CALL *GetCommandBufferNativeObject)(const NRI_NAME_REF(CommandBuffer) commandBuffer); // ID3D11DeviceContext* | ID3D12GraphicsCommandList* | VkCommandBuffer
uint64_t (NRI_CALL *GetBufferNativeObject)(const NRI_NAME_REF(Buffer) buffer); // ID3D11Buffer* | ID3D12Resource* | VkBuffer
uint64_t (NRI_CALL *GetTextureNativeObject)(const NRI_NAME_REF(Texture) texture); // ID3D11Resource* | ID3D12Resource* | VkImage
uint64_t (NRI_CALL *GetDescriptorNativeObject)(const NRI_NAME_REF(Descriptor) descriptor); // ID3D11View* | D3D12_CPU_DESCRIPTOR_HANDLE | VkImageView/VkBufferView
};

NRI_API NRI_NAME(Result) NRI_CALL nriGetInterface(const NRI_NAME_REF(Device) device, const char* interfaceName, size_t interfaceSize, void* interfacePtr);
Expand Down
14 changes: 11 additions & 3 deletions Include/NRIDescs.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ NRI_ENUM
GRAPHICS,
COMPUTE,
COPY,
HIGH_PRIORITY_COPY,

MAX_NUM
);
Expand Down Expand Up @@ -1220,6 +1221,13 @@ NRI_STRUCT(MemoryDesc)
bool mustBeDedicated;
};

NRI_STRUCT(AllocateMemoryDesc)
{
uint64_t size;
NRI_NAME(MemoryType) type;
float priority; // [-1; 1]: low < 0, normal = 0, high > 0
};

NRI_STRUCT(BufferMemoryBindingDesc)
{
NRI_NAME(Memory)* memory;
Expand Down Expand Up @@ -1387,7 +1395,7 @@ NRI_ENUM

D3D11,
D3D12,
VULKAN,
VK,

MAX_NUM
);
Expand All @@ -1408,8 +1416,8 @@ NRI_ENUM
NRI_ENUM
(
MemoryTier, uint8_t,
ONE, // A memory can only support resources from a single resource category (buffers, color and depth-stencil attachments, all other textures)

ONE, // A memory can only support resources from a single resource category (buffers, color and depth-stencil attachments, all other textures)
TWO, // A memory can support resources from all 3 categories

MAX_NUM
Expand Down
2 changes: 1 addition & 1 deletion Resources/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define STR(x) STR_HELPER(x)

#define VERSION_MAJOR 1
#define VERSION_MINOR 139
#define VERSION_MINOR 140
#define VERSION_BUILD 0
#define VERSION_REVISION 0

Expand Down
6 changes: 3 additions & 3 deletions Source/Creation/Creation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ NRI_API Result NRI_CALL nriCreateDevice(const DeviceCreationDesc& deviceCreation
#endif

#if NRI_USE_VULKAN
if (modifiedDeviceCreationDesc.graphicsAPI == GraphicsAPI::VULKAN)
if (modifiedDeviceCreationDesc.graphicsAPI == GraphicsAPI::VK)
result = CreateDeviceVK(modifiedDeviceCreationDesc, deviceImpl);
#endif

Expand Down Expand Up @@ -190,7 +190,7 @@ NRI_API Result NRI_CALL nriCreateDeviceFromVkDevice(const DeviceCreationVKDesc&
deviceCreationDesc.callbackInterface = deviceCreationVKDesc.callbackInterface;
deviceCreationDesc.memoryAllocatorInterface = deviceCreationVKDesc.memoryAllocatorInterface;
deviceCreationDesc.spirvBindingOffsets = deviceCreationVKDesc.spirvBindingOffsets;
deviceCreationDesc.graphicsAPI = GraphicsAPI::VULKAN;
deviceCreationDesc.graphicsAPI = GraphicsAPI::VK;
deviceCreationDesc.enableNRIValidation = false;

CheckAndSetDefaultCallbacks(deviceCreationDesc.callbackInterface);
Expand Down Expand Up @@ -256,7 +256,7 @@ NRI_API const char* NRI_CALL nriGetGraphicsAPIString(GraphicsAPI graphicsAPI) {
return "D3D11";
case GraphicsAPI::D3D12:
return "D3D12";
case GraphicsAPI::VULKAN:
case GraphicsAPI::VK:
return "VK";
default:
return "UNKNOWN";
Expand Down
5 changes: 2 additions & 3 deletions Source/D3D11/BufferD3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ Result BufferD3D11::Create(const MemoryD3D11& memory) {
if (m_Buffer)
return Result::SUCCESS;

MemoryLocation memoryLocation = memory.GetType();

D3D11_BUFFER_DESC desc = {};
desc.ByteWidth = (uint32_t)m_Desc.size;
desc.StructureByteStride = m_Desc.structureStride;
Expand All @@ -36,6 +34,7 @@ Result BufferD3D11::Create(const MemoryD3D11& memory) {
if (m_Desc.usageMask & BufferUsageBits::ARGUMENT_BUFFER)
desc.MiscFlags |= D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS;

MemoryLocation memoryLocation = memory.GetLocation();
if (memoryLocation == MemoryLocation::HOST_UPLOAD || memoryLocation == MemoryLocation::DEVICE_UPLOAD) {
if (m_Desc.usageMask == BufferUsageBits::NONE) {
m_Type = BufferType::UPLOAD;
Expand Down Expand Up @@ -74,7 +73,7 @@ Result BufferD3D11::Create(const MemoryD3D11& memory) {
HRESULT hr = m_Device->CreateBuffer(&desc, nullptr, &m_Buffer);
RETURN_ON_BAD_HRESULT(&m_Device, hr, "ID3D11Device::CreateBuffer()");

uint32_t priority = memory.GetResidencyPriority(m_Desc.size);
uint32_t priority = memory.GetPriority();
if (priority != 0)
m_Buffer->SetEvictionPriority(priority);

Expand Down
54 changes: 23 additions & 31 deletions Source/D3D11/DeviceD3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Result CreateDeviceD3D11(const DeviceCreationD3D11Desc& deviceCreationD3D11Desc,
return result;
}

DeviceD3D11::DeviceD3D11(const CallbackInterface& callbacks, StdAllocator<uint8_t>& stdAllocator) : DeviceBase(callbacks, stdAllocator), m_CommandQueues(GetStdAllocator()) {
DeviceD3D11::DeviceD3D11(const CallbackInterface& callbacks, StdAllocator<uint8_t>& stdAllocator) : DeviceBase(callbacks, stdAllocator) {
m_Desc.graphicsAPI = GraphicsAPI::D3D11;
m_Desc.nriVersionMajor = NRI_VERSION_MAJOR;
m_Desc.nriVersionMinor = NRI_VERSION_MINOR;
Expand All @@ -98,13 +98,18 @@ DeviceD3D11::~DeviceD3D11() {
if (m_Ext.HasAGS() && !m_IsWrapped)
m_Ext.m_AGS.DestroyDeviceD3D11(m_Ext.m_AGSContext, m_Device, nullptr, m_ImmediateContext, nullptr);
#endif

for (CommandQueueD3D11* commandQueue: m_CommandQueues) {
if (commandQueue)
Deallocate(GetStdAllocator(), commandQueue);
}
}

Result DeviceD3D11::Create(const DeviceCreationDesc& deviceCreationDesc, ID3D11Device* device, AGSContext* agsContext, bool isNVAPILoadedInApp) {
// Get adapter
if (!device) {
ComPtr<IDXGIFactory4> dxgiFactory;
HRESULT hr = CreateDXGIFactory2(deviceCreationDesc.enableAPIValidation ? DXGI_CREATE_FACTORY_DEBUG : 0, IID_PPV_ARGS(&dxgiFactory));
HRESULT hr = CreateDXGIFactory2(deviceCreationDesc.enableGraphicsAPIValidation ? DXGI_CREATE_FACTORY_DEBUG : 0, IID_PPV_ARGS(&dxgiFactory));
RETURN_ON_BAD_HRESULT(this, hr, "CreateDXGIFactory2()");

if (deviceCreationDesc.adapterDesc) {
Expand Down Expand Up @@ -145,7 +150,7 @@ Result DeviceD3D11::Create(const DeviceCreationDesc& deviceCreationDesc, ID3D11D
// Device
ComPtr<ID3D11DeviceBest> deviceTemp = (ID3D11DeviceBest*)device;
if (!deviceTemp) {
const UINT flags = deviceCreationDesc.enableAPIValidation ? D3D11_CREATE_DEVICE_DEBUG : 0;
const UINT flags = deviceCreationDesc.enableGraphicsAPIValidation ? D3D11_CREATE_DEVICE_DEBUG : 0;
D3D_FEATURE_LEVEL levels[2] = {D3D_FEATURE_LEVEL_11_1, D3D_FEATURE_LEVEL_11_0};
const uint32_t levelNum = GetCountOf(levels);
bool isDepthBoundsTestSupported = false;
Expand Down Expand Up @@ -239,11 +244,12 @@ Result DeviceD3D11::Create(const DeviceCreationDesc& deviceCreationDesc, ID3D11D
} else
m_Multithread->SetMultithreadProtected(true);

// Other
FillDesc();
// Create command queues (ignoring support, since there is no real support in any case)
for (CommandQueueD3D11*& commandQueue : m_CommandQueues)
commandQueue = Allocate<CommandQueueD3D11>(GetStdAllocator(), *this);

for (uint32_t i = 0; i < (uint32_t)CommandQueueType::MAX_NUM; i++)
m_CommandQueues.emplace_back(*this);
// Fill desc
FillDesc();

return FillFunctionTable(m_CoreInterface);
}
Expand Down Expand Up @@ -416,6 +422,10 @@ void DeviceD3D11::FillDesc() {
m_Desc.programmableSampleLocationsTier = rasterizerFeatures.ProgrammableSamplePositions ? 2 : 0;
#endif

// TODO: report fake COMPUTE and COPY queues support since multi-queue supporting code is NOP. Can it hurt?
m_Desc.isComputeQueueSupported = true;
m_Desc.isCopyQueueSupported = true;

m_Desc.isTextureFilterMinMaxSupported = options1.MinMaxFiltering != 0;
m_Desc.isLogicOpSupported = options.OutputMergerLogicOp != 0;
m_Desc.isLineSmoothingSupported = true;
Expand Down Expand Up @@ -443,6 +453,7 @@ Result DeviceD3D11::CreateImplementation(Interface*& entity, const Args&... args
}

Deallocate(GetStdAllocator(), implementation);
entity = nullptr;

return result;
}
Expand All @@ -462,7 +473,7 @@ void DeviceD3D11::GetMemoryDesc(const BufferDesc& bufferDesc, MemoryLocation mem
memoryDesc.mustBeDedicated = false;
}

void DeviceD3D11::GetMemoryDesc(const TextureDesc& textureDesc,MemoryLocation memoryLocation, MemoryDesc& memoryDesc) const {
void DeviceD3D11::GetMemoryDesc(const TextureDesc& textureDesc, MemoryLocation memoryLocation, MemoryDesc& memoryDesc) const {
bool isMultisampled = textureDesc.sampleNum > 1;
uint32_t size = TextureD3D11::GetMipmappedSize(textureDesc);

Expand Down Expand Up @@ -501,14 +512,9 @@ inline void DeviceD3D11::DestroySwapChain(SwapChain& swapChain) {
}

inline Result DeviceD3D11::GetCommandQueue(CommandQueueType commandQueueType, CommandQueue*& commandQueue) {
commandQueue = (CommandQueue*)&m_CommandQueues[(uint32_t)commandQueueType];

if (commandQueueType != CommandQueueType::GRAPHICS) {
REPORT_WARNING(this, "%s command queue is not supported by the device!", commandQueueType == CommandQueueType::COMPUTE ? "COMPUTE" : "COPY");
return Result::UNSUPPORTED;
}
commandQueue = (CommandQueue*)m_CommandQueues[(uint32_t)commandQueueType];

return Result::SUCCESS;
return commandQueue ? Result::SUCCESS : Result::UNSUPPORTED;
}

inline Result DeviceD3D11::CreateCommandAllocator(const CommandQueue& commandQueue, CommandAllocator*& commandAllocator) {
Expand Down Expand Up @@ -651,10 +657,8 @@ inline void DeviceD3D11::DestroyFence(Fence& fence) {
Deallocate(GetStdAllocator(), (FenceD3D11*)&fence);
}

inline Result DeviceD3D11::AllocateMemory(MemoryType memoryType, uint64_t size, Memory*& memory) {
MaybeUnused(size);

memory = (Memory*)Allocate<MemoryD3D11>(GetStdAllocator(), *this, memoryType);
inline Result DeviceD3D11::AllocateMemory(const AllocateMemoryDesc& allocateMemoryDesc, Memory*& memory) {
memory = (Memory*)Allocate<MemoryD3D11>(GetStdAllocator(), *this, allocateMemoryDesc);

return Result::SUCCESS;
}
Expand Down Expand Up @@ -733,18 +737,6 @@ inline FormatSupportBits DeviceD3D11::GetFormatSupport(Format format) const {
return mask;
}

inline uint32_t DeviceD3D11::CalculateAllocationNumber(const ResourceGroupDesc& resourceGroupDesc) const {
HelperDeviceMemoryAllocator allocator(m_CoreInterface, (Device&)*this);

return allocator.CalculateAllocationNumber(resourceGroupDesc);
}

inline Result DeviceD3D11::AllocateAndBindMemory(const ResourceGroupDesc& resourceGroupDesc, Memory** allocations) {
HelperDeviceMemoryAllocator allocator(m_CoreInterface, (Device&)*this);

return allocator.AllocateAndBindMemory(resourceGroupDesc, allocations);
}

namespace d3d11 {
#include "D3DExt.hpp"
}
Expand Down
Loading

0 comments on commit 97eb304

Please sign in to comment.