Sunday, January 6, 2019

File transfer speed comparison: USB3.1 Gen2 Type-C and USB3.1 Gen2 Type-A

I've got USB3.1 Gen2 Type-C to Type-A adapter Sanwa supply AD-USB29CFA (Fig.1).











Fig.1: AD-USB29CFA.

Attach it to USB 3.1 Gen2 Type-C storage device and tested CrystalDiskMark.

Computer:
AMD Threadripper 2990WX
Asus Zenith Extreme, Firmware 1601

USB Mass Storage Device:
ENCU3NV-JO1 M.2 to USB3.1 Gen2 Type-C converter.
Samsung 970 Pro 512GB M.2 NVMe SSD inside.


NTFS formatted, NTFS Allocation unit size=64KB.














Fig.2:  ENCU3NV-JO1 M.2 to USB3.1 Gen2 Type-C converter.

Motherboard backpanel USB3.1Gen2 ports are used to connect USB mass storage device (Fig.3).

















Fig.3:  USB ports used. SS10 marked, magenta colored. Upper port is Type-A and lower port is Type-C. Both USB 3.1 Gen2 (SuperSpeed+ 10Gbps) ports.













Fig.4: WWShowUsbDeviceTree shows USB storage connected to Type-C port as "TypeC". magenta line means this device is linked at SuperSpeed+.














Fig.5: WWShowUsbDeviceTree shows "TypeA" on USB storage connected to Type-A port using AD-USB29CFA. magenta line means this device is linked at SuperSpeed+.

CrystalDiskMark Results


















Fig.6: CrystalDiskMark result of Type-C port.



















Fig.7: CrystalDiskMark result of Type-A port.

















Fig.8: Comparison graph.

 

Conclusion


There is no significant speed difference between Type-C USB3.1Gen2 port and Type-A USB3.1Gen2 port. Both works at SuperSpeed+ speed.

It is confirmed that AD-USB29CFA is USB3.1Gen2 SuperSpeed+ capable adapter. It is Recommended.






















Tuesday, January 1, 2019

Modifying D3D12HelloFrameBuffering desktop to support fullscreen

DirectX-Graphics-Samples-master\Samples\Desktop\D3D12HelloWorld\src\HelloFrameBuffers

There is D3D12Fullscreen desktop project but it is little bit complicated so I modified D3D12FrameBuffering desktop project to enable Fullscreen capability.

D3D12FrameBuffering Project setting

Right click D3D12FrameBuffering Project top open D3D12HelloFrameBuffering property pages.
Select configuration to "All configurations"
On Configuration Options > Manifest Tool > All options, set DPI Awareness to Per Monitor High DPI Aware.

Win32Application class


Copy  WM_SIZE handler from D3D12Fullscreen Win32Application to WindowProc()

DXSample class


Add OnSizeChanged() pure virtual function declaration to DXSample class
 virtual void OnSizeChanged(UINT width, UINT height, bool minimized) = 0;

Copy SetWindowBounds() from D3D12Fullscreen DXSample.
Add     RECT m_windowBounds; member.


D3D12HelloFrameBuffering class


Comment out following line to enable ALT+Enter

factory->MakeWindowAssociation(Win32Application::GetHwnd(), DXGI_MWA_NO_ALT_ENTER)


Add bool m_windowedMode variable to D3D12HelloFrameBuffering class.


Copy those functions from D3D12Fullscreen to D3D12HelloFrameBuffer
 void LoadSizeDependentResources();
 void UpdatePostViewAndScissor();
 void LoadSceneResolutionDependentResources();

 virtual void OnSizeChanged(UINT width, UINT height, bool minimized);


 PopulateCommandList() is unchanged.

This is my UpdatePostViewAndScissor() implementation:

void D3D12HelloFrameBuffering::UpdatePostViewAndScissor()
{
    float x = 1.0f;
    float y = 1.0f;

    m_viewport.TopLeftX = m_width * (1.0f - x) / 2.0f;
    m_viewport.TopLeftY = m_height * (1.0f - y) / 2.0f;
    m_viewport.Width = x * m_width;
    m_viewport.Height = y * m_height;

    m_scissorRect.left = static_cast<LONG>(m_viewport.TopLeftX);
    m_scissorRect.right = static_cast<LONG>(m_viewport.TopLeftX + m_viewport.Width);
    m_scissorRect.top = static_cast<LONG>(m_viewport.TopLeftY);
    m_scissorRect.bottom = static_cast<LONG>(m_viewport.TopLeftY + m_viewport.Height);
}


m_resolutionOptions[], m_postViewport, m_postScissorRect, m_postCommandList and LoadSceneResolutionDependentResources() is not absolute necessary

 Call LoadSizeDependentResources() on the last portion of LoadAssets()

Run and press ALT+Enter to switch fullscreen

Screen shot of D3D12HelloFrameBuffering, 3840x2160 fullscreen mode


Studying D3D12HelloConstBuffers desktop sample


DirectX-Graphics-Samples-master\Samples\Desktop\D3D12HelloWorld\src\HelloConstBuffers

•Describe how to pass constant buffer to shaders.

Diff from D3DXHelloTriangle.h


struct SceneConstantBuffer
    {
        XMFLOAT4 offset;
    };
SceneConstantBuffer m_constantBufferData;
// constant buffer view (CBV) descriptor heap.
ComPtr<ID3D12DescriptorHeap> m_cbvHeap;
ComPtr<ID3D12Resource> m_constantBuffer;
UINT8* m_pCbvDataBegin;

D3D12HelloConstBuffers objects and their relations






























m_constantBuffer->Map() is called to get mapped pointer m_cbvDataBegin on OnInit() and m_constantBuffer is never Unmap() ed. Keep constant buffer mapped is OK

OnUpdate(), constant buffer data is updated and memcpy() ed to m_cbvDataBegin.

m_commandList->SetDescriptorHeaps() and m_commandList->SetGraphicsRootDesrptorTable() to set m_cbvHeap.

on Shaders.hlsl, constant buffer is exposed at register(b0):

cbuffer SceneConstantBuffer : register(b0)

{

    float4 offset;

};