This commit is contained in:
Chuck Walbourn 2016-07-02 18:37:15 -07:00
Родитель 21cd91c4a9
Коммит 2d2659eb66
9 изменённых файлов: 112 добавлений и 100 удалений

Просмотреть файл

@ -47,10 +47,10 @@ namespace DirectX
HRESULT __cdecl LoadDDSTextureFromMemory(
_In_ ID3D12Device* d3dDevice,
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
_In_ size_t ddsDataSize,
size_t ddsDataSize,
_Outptr_ ID3D12Resource** texture,
_Inout_ std::vector<D3D12_SUBRESOURCE_DATA>& subresources,
_In_ size_t maxsize = 0,
size_t maxsize = 0,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr,
_Out_opt_ bool* isCubeMap = nullptr);
@ -60,28 +60,28 @@ namespace DirectX
_Outptr_ ID3D12Resource** texture,
_Inout_ std::unique_ptr<uint8_t[]>& ddsData,
_Inout_ std::vector<D3D12_SUBRESOURCE_DATA>& subresources,
_In_ size_t maxsize = 0,
size_t maxsize = 0,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr,
_Out_opt_ bool* isCubeMap = nullptr);
HRESULT __cdecl CreateDDSTextureFromMemory(
_In_ ID3D12Device* device,
_In_ ResourceUploadBatch& resourceUpload,
ResourceUploadBatch& resourceUpload,
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
_In_ size_t ddsDataSize,
size_t ddsDataSize,
_Outptr_ ID3D12Resource** texture,
_In_ bool generateMipsIfMissing = false,
_In_ size_t maxsize = 0,
bool generateMipsIfMissing = false,
size_t maxsize = 0,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr,
_Out_opt_ bool* isCubeMap = nullptr);
HRESULT __cdecl CreateDDSTextureFromFile(
_In_ ID3D12Device* device,
_In_ ResourceUploadBatch& resourceUpload,
ResourceUploadBatch& resourceUpload,
_In_z_ const wchar_t* szFileName,
_Outptr_ ID3D12Resource** texture,
_In_ bool generateMipsIfMissing = false,
_In_ size_t maxsize = 0,
bool generateMipsIfMissing = false,
size_t maxsize = 0,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr,
_Out_opt_ bool* isCubeMap = nullptr);
@ -89,50 +89,50 @@ namespace DirectX
HRESULT __cdecl LoadDDSTextureFromMemoryEx(
_In_ ID3D12Device* d3dDevice,
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
_In_ size_t ddsDataSize,
_In_ size_t maxsize,
_In_ D3D12_RESOURCE_FLAGS flags,
_In_ bool forceSRGB,
_In_ bool reserveFullMipChain,
size_t ddsDataSize,
size_t maxsize,
D3D12_RESOURCE_FLAGS flags,
bool forceSRGB,
bool reserveFullMipChain,
_Outptr_ ID3D12Resource** texture,
_Inout_ std::vector<D3D12_SUBRESOURCE_DATA>& subresources,
std::vector<D3D12_SUBRESOURCE_DATA>& subresources,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr,
_Out_opt_ bool* isCubeMap = nullptr);
HRESULT __cdecl LoadDDSTextureFromFileEx(
_In_ ID3D12Device* d3dDevice,
_In_z_ const wchar_t* szFileName,
_In_ size_t maxsize,
_In_ D3D12_RESOURCE_FLAGS flags,
_In_ bool forceSRGB,
_In_ bool reserveFullMipChain,
size_t maxsize,
D3D12_RESOURCE_FLAGS flags,
bool forceSRGB,
bool reserveFullMipChain,
_Outptr_ ID3D12Resource** texture,
_Inout_ std::unique_ptr<uint8_t[]>& ddsData,
_Inout_ std::vector<D3D12_SUBRESOURCE_DATA>& subresources,
std::unique_ptr<uint8_t[]>& ddsData,
std::vector<D3D12_SUBRESOURCE_DATA>& subresources,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr,
_Out_opt_ bool* isCubeMap = nullptr);
HRESULT __cdecl CreateDDSTextureFromMemoryEx(
_In_ ID3D12Device* device,
_In_ ResourceUploadBatch& resourceUpload,
ResourceUploadBatch& resourceUpload,
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
_In_ size_t ddsDataSize,
_In_ size_t maxsize,
_In_ D3D12_RESOURCE_FLAGS flags,
_In_ bool forceSRGB,
_In_ bool generateMipsIfMissing,
size_t ddsDataSize,
size_t maxsize,
D3D12_RESOURCE_FLAGS flags,
bool forceSRGB,
bool generateMipsIfMissing,
_Outptr_ ID3D12Resource** texture,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr,
_Out_opt_ bool* isCubeMap = nullptr);
HRESULT __cdecl CreateDDSTextureFromFileEx(
_In_ ID3D12Device* device,
_In_ ResourceUploadBatch& resourceUpload,
ResourceUploadBatch& resourceUpload,
_In_z_ const wchar_t* szFileName,
_In_ size_t maxsize,
_In_ D3D12_RESOURCE_FLAGS flags,
_In_ bool forceSRGB,
_In_ bool generateMipsIfMissing,
size_t maxsize,
D3D12_RESOURCE_FLAGS flags,
bool forceSRGB,
bool generateMipsIfMissing,
_Outptr_ ID3D12Resource** texture,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr,
_Out_opt_ bool* isCubeMap = nullptr);

Просмотреть файл

@ -324,10 +324,10 @@ namespace DirectX
void XM_CALLCONV SetFogColor(FXMVECTOR value) override;
// Texture setting.
void __cdecl SetTexture(_In_opt_ D3D12_GPU_DESCRIPTOR_HANDLE value);
void __cdecl SetTexture(D3D12_GPU_DESCRIPTOR_HANDLE value);
// Environment map settings.
void __cdecl SetEnvironmentMap(_In_opt_ D3D12_GPU_DESCRIPTOR_HANDLE value);
void __cdecl SetEnvironmentMap(D3D12_GPU_DESCRIPTOR_HANDLE value);
void __cdecl SetEnvironmentMapAmount(float value);
void XM_CALLCONV SetEnvironmentMapSpecular(FXMVECTOR value);
void __cdecl SetFresnelFactor(float value);

Просмотреть файл

@ -94,7 +94,7 @@ namespace DirectX
class SpriteBatch
{
public:
SpriteBatch(_In_ ID3D12Device* device, _In_ ResourceUploadBatch& upload, _In_ const SpriteBatchPipelineStateDescription* psoDesc, _In_opt_ const D3D12_VIEWPORT* viewport = nullptr);
SpriteBatch(_In_ ID3D12Device* device, ResourceUploadBatch& upload, _In_ const SpriteBatchPipelineStateDescription* psoDesc, _In_opt_ const D3D12_VIEWPORT* viewport = nullptr);
SpriteBatch(SpriteBatch&& moveFrom);
SpriteBatch& operator= (SpriteBatch&& moveFrom);
@ -106,23 +106,23 @@ namespace DirectX
// Begin/End a batch of sprite drawing operations.
void XM_CALLCONV Begin(
_In_ ID3D12GraphicsCommandList* commandList,
_In_opt_ SpriteSortMode sortMode = SpriteSortMode_Deferred,
_In_opt_ FXMMATRIX transformMatrix = MatrixIdentity);
SpriteSortMode sortMode = SpriteSortMode_Deferred,
FXMMATRIX transformMatrix = MatrixIdentity);
void __cdecl End();
// Draw overloads specifying position, origin and scale as XMFLOAT2.
void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, _In_ XMUINT2 textureSize, XMFLOAT2 const& position, FXMVECTOR color = Colors::White);
void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, _In_ XMUINT2 textureSize, XMFLOAT2 const& position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, _In_ XMUINT2 textureSize, XMFLOAT2 const& position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color, float rotation, XMFLOAT2 const& origin, XMFLOAT2 const& scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
void XM_CALLCONV Draw(D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, XMUINT2 textureSize, XMFLOAT2 const& position, FXMVECTOR color = Colors::White);
void XM_CALLCONV Draw(D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, XMUINT2 textureSize, XMFLOAT2 const& position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
void XM_CALLCONV Draw(D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, XMUINT2 textureSize, XMFLOAT2 const& position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color, float rotation, XMFLOAT2 const& origin, XMFLOAT2 const& scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
// Draw overloads specifying position, origin and scale via the first two components of an XMVECTOR.
void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, _In_ XMUINT2 textureSize, FXMVECTOR position, FXMVECTOR color = Colors::White);
void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, _In_ XMUINT2 textureSize, FXMVECTOR position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color = Colors::White, float rotation = 0, FXMVECTOR origin = g_XMZero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, _In_ XMUINT2 textureSize, FXMVECTOR position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color, float rotation, FXMVECTOR origin, GXMVECTOR scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
void XM_CALLCONV Draw(D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, XMUINT2 textureSize, FXMVECTOR position, FXMVECTOR color = Colors::White);
void XM_CALLCONV Draw(D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, XMUINT2 textureSize, FXMVECTOR position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color = Colors::White, float rotation = 0, FXMVECTOR origin = g_XMZero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
void XM_CALLCONV Draw(D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, XMUINT2 textureSize, FXMVECTOR position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color, float rotation, FXMVECTOR origin, GXMVECTOR scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
// Draw overloads specifying position as a RECT.
void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, _In_ XMUINT2 textureSize, RECT const& destinationRectangle, FXMVECTOR color = Colors::White);
void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, _In_ XMUINT2 textureSize, RECT const& destinationRectangle, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
void XM_CALLCONV Draw(D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, XMUINT2 textureSize, RECT const& destinationRectangle, FXMVECTOR color = Colors::White);
void XM_CALLCONV Draw(D3D12_GPU_DESCRIPTOR_HANDLE textureSRV, XMUINT2 textureSize, RECT const& destinationRectangle, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
// Rotation mode to be applied to the sprite transformation
void __cdecl SetRotation( DXGI_MODE_ROTATION mode );

Просмотреть файл

@ -23,9 +23,9 @@ namespace DirectX
public:
struct Glyph;
SpriteFont(_In_ ID3D12Device* device, _In_ ResourceUploadBatch& upload, _In_z_ wchar_t const* fileName, _In_ D3D12_CPU_DESCRIPTOR_HANDLE cpuDescriptorDest, _In_ D3D12_GPU_DESCRIPTOR_HANDLE gpuDescriptor);
SpriteFont(_In_ ID3D12Device* device, _In_ ResourceUploadBatch& upload, _In_reads_bytes_(dataSize) uint8_t const* dataBlob, _In_ size_t dataSize, _In_ D3D12_CPU_DESCRIPTOR_HANDLE cpuDescriptorDest, _In_ D3D12_GPU_DESCRIPTOR_HANDLE gpuDescriptor);
SpriteFont(_In_ D3D12_GPU_DESCRIPTOR_HANDLE texture, _In_ XMUINT2 textureSize, _In_reads_(glyphCount) Glyph const* glyphs, _In_ size_t glyphCount, _In_ float lineSpacing);
SpriteFont(ID3D12Device* device, ResourceUploadBatch& upload, _In_z_ wchar_t const* fileName, D3D12_CPU_DESCRIPTOR_HANDLE cpuDescriptorDest, D3D12_GPU_DESCRIPTOR_HANDLE gpuDescriptor);
SpriteFont(ID3D12Device* device, ResourceUploadBatch& upload, _In_reads_bytes_(dataSize) uint8_t const* dataBlob, size_t dataSize, D3D12_CPU_DESCRIPTOR_HANDLE cpuDescriptorDest, D3D12_GPU_DESCRIPTOR_HANDLE gpuDescriptor);
SpriteFont(D3D12_GPU_DESCRIPTOR_HANDLE texture, XMUINT2 textureSize, _In_reads_(glyphCount) Glyph const* glyphs, size_t glyphCount, float lineSpacing);
SpriteFont(SpriteFont&& moveFrom);
SpriteFont& operator= (SpriteFont&& moveFrom);

Просмотреть файл

@ -39,40 +39,40 @@ namespace DirectX
// Standard version
HRESULT __cdecl CreateWICTextureFromMemory(
_In_ ID3D12Device* d3dDevice,
_In_ ResourceUploadBatch& resourceUpload,
ResourceUploadBatch& resourceUpload,
_In_reads_bytes_(wicDataSize) const uint8_t* wicData,
_In_ size_t wicDataSize,
size_t wicDataSize,
_Outptr_ ID3D12Resource** texture,
_In_ bool generateMips = true,
_In_ size_t maxsize = 0);
bool generateMips = true,
size_t maxsize = 0);
HRESULT __cdecl CreateWICTextureFromFile(
_In_ ID3D12Device* d3dDevice,
_In_ ResourceUploadBatch& resourceUpload,
ResourceUploadBatch& resourceUpload,
_In_z_ const wchar_t* szFileName,
_Outptr_ ID3D12Resource** texture,
_In_ bool generateMips = true,
_In_ size_t maxsize = 0);
bool generateMips = true,
size_t maxsize = 0);
// Extended version
HRESULT __cdecl CreateWICTextureFromMemoryEx(
_In_ ID3D12Device* d3dDevice,
_In_ ResourceUploadBatch& resourceUpload,
ResourceUploadBatch& resourceUpload,
_In_reads_bytes_(wicDataSize) const uint8_t* wicData,
_In_ size_t wicDataSize,
_In_ size_t maxsize,
_In_ D3D12_RESOURCE_FLAGS flags,
_In_ bool forceSRGB,
_In_ bool generateMips,
size_t wicDataSize,
size_t maxsize,
D3D12_RESOURCE_FLAGS flags,
bool forceSRGB,
bool generateMips,
_Outptr_ ID3D12Resource** texture);
HRESULT __cdecl CreateWICTextureFromFileEx(
_In_ ID3D12Device* d3dDevice,
_In_ ResourceUploadBatch& resourceUpload,
ResourceUploadBatch& resourceUpload,
_In_z_ const wchar_t* szFileName,
_In_ size_t maxsize,
_In_ D3D12_RESOURCE_FLAGS flags,
_In_ bool forceSRGB,
_In_ bool generateMips,
size_t maxsize,
D3D12_RESOURCE_FLAGS flags,
bool forceSRGB,
bool generateMips,
_Outptr_ ID3D12Resource** texture);
}

Просмотреть файл

@ -462,13 +462,13 @@ void XM_CALLCONV EnvironmentMapEffect::SetFogColor(FXMVECTOR value)
}
void EnvironmentMapEffect::SetTexture(_In_opt_ D3D12_GPU_DESCRIPTOR_HANDLE value)
void EnvironmentMapEffect::SetTexture(D3D12_GPU_DESCRIPTOR_HANDLE value)
{
pImpl->texture = value;
}
void EnvironmentMapEffect::SetEnvironmentMap(_In_opt_ D3D12_GPU_DESCRIPTOR_HANDLE value)
void EnvironmentMapEffect::SetEnvironmentMap(D3D12_GPU_DESCRIPTOR_HANDLE value)
{
pImpl->environmentMap = value;
}

Просмотреть файл

@ -68,18 +68,19 @@ __declspec(align(16)) class SpriteBatch::Impl : public AlignedNew<SpriteBatch::I
{
public:
Impl(_In_ ID3D12Device* device,
_In_ ResourceUploadBatch& upload,
ResourceUploadBatch& upload,
_In_ const SpriteBatchPipelineStateDescription* psoDesc,
_In_opt_ const D3D12_VIEWPORT* viewport);
const D3D12_VIEWPORT* viewport);
void XM_CALLCONV Begin(
_In_ ID3D12GraphicsCommandList* commandList,
_In_opt_ SpriteSortMode sortMode = SpriteSortMode_Deferred,
_In_opt_ FXMMATRIX transformMatrix = MatrixIdentity);
SpriteSortMode sortMode = SpriteSortMode_Deferred,
FXMMATRIX transformMatrix = MatrixIdentity);
void End();
void XM_CALLCONV Draw(_In_ D3D12_GPU_DESCRIPTOR_HANDLE texture,
_In_ XMUINT2 textureSize,
void XM_CALLCONV Draw(
D3D12_GPU_DESCRIPTOR_HANDLE texture,
XMUINT2 textureSize,
FXMVECTOR destination,
_In_opt_ RECT const* sourceRectangle,
FXMVECTOR color,
@ -189,14 +190,14 @@ private:
// Only one of these helpers is allocated per D3D device, even if there are multiple SpriteBatch instances.
struct DeviceResources
{
DeviceResources(_In_ ID3D12Device* device, _In_ ResourceUploadBatch& upload);
DeviceResources(_In_ ID3D12Device* device, ResourceUploadBatch& upload);
ComPtr<ID3D12Resource> indexBuffer;
D3D12_INDEX_BUFFER_VIEW indexBufferView;
ComPtr<ID3D12RootSignature> rootSignature;
private:
void CreateIndexBuffer(_In_ ID3D12Device* device, _In_ ResourceUploadBatch& upload);
void CreateIndexBuffer(_In_ ID3D12Device* device, ResourceUploadBatch& upload);
void CreateRootSignature(_In_ ID3D12Device* device);
static std::vector<short> CreateIndexValues();
@ -224,14 +225,14 @@ const D3D12_RASTERIZER_DESC SpriteBatch::Impl::s_DefaultRasterizerDesc = {D3D12_
const D3D12_DEPTH_STENCIL_DESC SpriteBatch::Impl::s_DefaultDepthStencilDesc = {FALSE, D3D12_DEPTH_WRITE_MASK_ALL, D3D12_COMPARISON_FUNC_ALWAYS, FALSE, 0, 0};
// Per-device constructor.
SpriteBatch::Impl::DeviceResources::DeviceResources(_In_ ID3D12Device* device, _In_ ResourceUploadBatch& upload)
SpriteBatch::Impl::DeviceResources::DeviceResources(_In_ ID3D12Device* device, ResourceUploadBatch& upload)
{
CreateIndexBuffer(device, upload);
CreateRootSignature(device);
}
// Creates the SpriteBatch index buffer.
void SpriteBatch::Impl::DeviceResources::CreateIndexBuffer(_In_ ID3D12Device* device, _In_ ResourceUploadBatch& upload)
void SpriteBatch::Impl::DeviceResources::CreateIndexBuffer(_In_ ID3D12Device* device, ResourceUploadBatch& upload)
{
static_assert((MaxBatchSize * VerticesPerSprite) < USHRT_MAX, "MaxBatchSize too large for 16-bit indices");
@ -923,7 +924,6 @@ void SpriteBatch::End()
}
_Use_decl_annotations_
void XM_CALLCONV SpriteBatch::Draw(D3D12_GPU_DESCRIPTOR_HANDLE texture,
XMUINT2 textureSize,
XMFLOAT2 const& position,
@ -975,7 +975,6 @@ void XM_CALLCONV SpriteBatch::Draw(D3D12_GPU_DESCRIPTOR_HANDLE texture,
}
_Use_decl_annotations_
void XM_CALLCONV SpriteBatch::Draw(D3D12_GPU_DESCRIPTOR_HANDLE texture, XMUINT2 textureSize, FXMVECTOR position, FXMVECTOR color)
{
XMVECTOR destination = XMVectorPermute<0, 1, 4, 5>(position, g_XMOne); // x, y, 1, 1
@ -1028,7 +1027,6 @@ void XM_CALLCONV SpriteBatch::Draw(D3D12_GPU_DESCRIPTOR_HANDLE texture,
}
_Use_decl_annotations_
void XM_CALLCONV SpriteBatch::Draw(D3D12_GPU_DESCRIPTOR_HANDLE texture,
XMUINT2 textureSize,
RECT const& destinationRectangle,

Просмотреть файл

@ -31,15 +31,15 @@ class SpriteFont::Impl
{
public:
Impl(_In_ ID3D12Device* device,
_In_ ResourceUploadBatch& upload,
ResourceUploadBatch& upload,
_In_ BinaryReader* reader,
_In_ D3D12_CPU_DESCRIPTOR_HANDLE cpuDesc,
_In_ D3D12_GPU_DESCRIPTOR_HANDLE gpuDesc);
Impl(_In_ D3D12_GPU_DESCRIPTOR_HANDLE texture,
_In_ XMUINT2 textureSize,
D3D12_CPU_DESCRIPTOR_HANDLE cpuDesc,
D3D12_GPU_DESCRIPTOR_HANDLE gpuDesc);
Impl(D3D12_GPU_DESCRIPTOR_HANDLE texture,
XMUINT2 textureSize,
_In_reads_(glyphCount) Glyph const* glyphs,
_In_ size_t glyphCount,
_In_ float lineSpacing);
size_t glyphCount,
float lineSpacing);
Glyph const* FindGlyph(wchar_t character) const;
@ -49,10 +49,10 @@ public:
void ForEachGlyph(_In_z_ wchar_t const* text, TAction action) const;
void CreateTextureResource(_In_ ID3D12Device* device,
_In_ ResourceUploadBatch& upload,
_In_ uint32_t width, _In_ uint32_t height,
_In_ DXGI_FORMAT format,
_In_ uint32_t stride, _In_ uint32_t rows,
ResourceUploadBatch& upload,
uint32_t width, uint32_t height,
DXGI_FORMAT format,
uint32_t stride, uint32_t rows,
_In_reads_(stride * rows) const uint8_t* data);
// Fields.
@ -315,7 +315,8 @@ SpriteFont::SpriteFont(ID3D12Device* device, ResourceUploadBatch& upload, uint8_
// Construct from arbitrary user specified glyph data (for those not using the MakeSpriteFont utility).
SpriteFont::SpriteFont(_In_ D3D12_GPU_DESCRIPTOR_HANDLE texture, _In_ XMUINT2 textureSize, _In_reads_(glyphCount) Glyph const* glyphs, _In_ size_t glyphCount, _In_ float lineSpacing)
_Use_decl_annotations_
SpriteFont::SpriteFont(D3D12_GPU_DESCRIPTOR_HANDLE texture, XMUINT2 textureSize, Glyph const* glyphs, size_t glyphCount, float lineSpacing)
: pImpl(new Impl(texture, textureSize, glyphs, glyphCount, lineSpacing))
{
}

Просмотреть файл

@ -224,12 +224,12 @@ namespace
//---------------------------------------------------------------------------------
HRESULT CreateTextureFromWIC(_In_ ID3D12Device* d3dDevice,
_In_ ResourceUploadBatch& resourceUpload,
ResourceUploadBatch& resourceUpload,
_In_ IWICBitmapFrameDecode *frame,
_In_ size_t maxsize,
_In_ D3D12_RESOURCE_FLAGS flags,
_In_ bool forceSRGB,
_In_ bool generateMips,
size_t maxsize,
D3D12_RESOURCE_FLAGS flags,
bool forceSRGB,
bool generateMips,
_Outptr_ ID3D12Resource** texture)
{
UINT width, height;
@ -363,6 +363,19 @@ namespace
}
}
// Verify our target format is supported by the current device
// (handles WDDM 1.0 or WDDM 1.1 device driver cases as well as DirectX 11.0 Runtime without 16bpp format support)
D3D12_FEATURE_DATA_FORMAT_SUPPORT support = {};
support.Format = format;
hr = d3dDevice->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, &support, sizeof(support));
if (FAILED(hr) || !(support.Support1 & D3D12_FORMAT_SUPPORT1_TEXTURE2D))
{
// Fallback to RGBA 32-bit format which is supported by all devices
memcpy(&convertGUID, &GUID_WICPixelFormat32bppRGBA, sizeof(WICPixelFormatGUID));
format = DXGI_FORMAT_R8G8B8A8_UNORM;
bpp = 32;
}
// Allocate temporary memory for image
size_t rowPitch = (twidth * bpp + 7) / 8;
size_t imageSize = rowPitch * theight;