Rev. 1.01
23
10 AMD Code Sample for DirectX®
// Create module handle.
HMODULE hDxxDll = GetModuleHandle(DXX_DLL_NAME);
if (hDxxExt == NULL) {
s
td::cout
<<
"Error: Unable to load DX library."
<< std::endl;
return
;
}
// Initial function pointer from module.
PFNAmdDxExtCreate11 pAmdDxExtCreate =
reinterpret_cast<PFNAmdDxExtCreate11>(GetProcAddress(hDxxDll, "AmdDxExtCreate11"));
if (pAmdDxExtCreate == nullptr) {
s
td::cout
<<
"Error: Unable to get DX information."
<< std::endl;
return
;
}
// Create general extension object.
IAmdDxExt* dxExt = nullptr;
pAmdDxExtCreate(D3D11DEVICE, &dxExt);
if (dxExt == nullptr) {
s
td::cout
<<
"Error: Unable to get DX extension."
<< std::endl;
return
;
}
// Get SSG extension interface.
IAmdDxExtSsg* dxSsgExt = static_cast<IAmdDxExtSsg*>
(dxExt->GetExtInterface(AmdDxExtSsgID));
if (dxSsgExt == nullptr) {
s
td::cout
<<
"Error: Unable to get DX SSG extension."
<< std::endl;
return
;
}
// Create SSG file handle.
AmdDxSsgFileHandle hSsgFile;
HRESULT hr = dxSsgExt->CreateFile(
FILE_NAME, AmdDxSsgFile_Read,
&hSsgFile);
If (FAILED(hr)) {
s
td::cout
<<
"Error: Unable to create liquid flash file handle."
<< std::endl;
return
;
}
// Get the file information: file size and block size.
AmdDxSsgFileInfo dxSsgFileInfo;
hr = dxSsgExt->GetFileInfo(hSsgFile, &dxSsgFileInfo);
if (FAILED(hr)) {
s
td::cout
<<
"Error: Unable to retrieve file/block size."
<< std::endl;
return
;
}
// Create buffer: SIZE_TO_READ.
CComPtr<ID3D11Buffer> pDxBuffer;
D3D11_BUFFER_DESC bufferDesc;
ZeroMemory(&bufferDesc, sizeof(bufferDesc));
bufferDesc.ByteWidth =
SIZE_TO_READ
;
bufferDesc.Usage = D3D11_USAGE_DEFAULT;
bufferDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
bufferDesc.MiscFlags = 0;
bufferDesc.StructureByteStride = 0;
bufferDesc.CPUAccessFlags = 0;
hr = D3D11DEVICE->CreateBuffer(&bufferDesc, NULL, &pDxBuffer);
if (FAILED(hr)) {
s
td::cout
<<
"Error: Unable to create dx buffer."
<< std::endl;
return
;
}
Содержание Pro Solid State Graphics
Страница 1: ...Solid State Graphics SSG API User Manual ...