Skip to content

Commit 1c47191

Browse files
authored
Xbox auxiliary EncodeDDSHeader helper exposed as public function (#497)
1 parent 059ce81 commit 1c47191

10 files changed

+282
-239
lines changed

Auxiliary/DirectXTexEXR.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ HRESULT DirectX::LoadFromEXRFile(const wchar_t* szFile, TexMetadata* metadata, S
410410

411411
hr = image.Initialize2D(DXGI_FORMAT_R16G16B16A16_FLOAT,
412412
static_cast<size_t>(width), static_cast<size_t>(height), arraySize, 1u);
413-
413+
414414
if (FAILED(hr))
415415
return hr;
416416

Auxiliary/DirectXTexXbox.h

+29-23
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ namespace Xbox
6969
XboxImage(const XboxImage&) = delete;
7070
XboxImage& operator=(const XboxImage&) = delete;
7171

72-
HRESULT Initialize(_In_ const XG_TEXTURE1D_DESC& desc, _In_ const XG_RESOURCE_LAYOUT& layout, _In_ uint32_t miscFlags2 = 0);
73-
HRESULT Initialize(_In_ const XG_TEXTURE2D_DESC& desc, _In_ const XG_RESOURCE_LAYOUT& layout, _In_ uint32_t miscFlags2 = 0);
74-
HRESULT Initialize(_In_ const XG_TEXTURE3D_DESC& desc, _In_ const XG_RESOURCE_LAYOUT& layout, _In_ uint32_t miscFlags2 = 0);
75-
HRESULT Initialize(_In_ const DirectX::TexMetadata& mdata, _In_ XboxTileMode tm, _In_ uint32_t size, _In_ uint32_t alignment);
72+
HRESULT __cdecl Initialize(_In_ const XG_TEXTURE1D_DESC& desc, _In_ const XG_RESOURCE_LAYOUT& layout, _In_ uint32_t miscFlags2 = 0);
73+
HRESULT __cdecl Initialize(_In_ const XG_TEXTURE2D_DESC& desc, _In_ const XG_RESOURCE_LAYOUT& layout, _In_ uint32_t miscFlags2 = 0);
74+
HRESULT __cdecl Initialize(_In_ const XG_TEXTURE3D_DESC& desc, _In_ const XG_RESOURCE_LAYOUT& layout, _In_ uint32_t miscFlags2 = 0);
75+
HRESULT __cdecl Initialize(_In_ const DirectX::TexMetadata& mdata, _In_ XboxTileMode tm, _In_ uint32_t size, _In_ uint32_t alignment);
7676

77-
void Release();
77+
void __cdecl Release();
7878

7979
const DirectX::TexMetadata& GetMetadata() const { return metadata; }
8080
XboxTileMode GetTileMode() const { return tilemode; }
@@ -94,65 +94,65 @@ namespace Xbox
9494
//---------------------------------------------------------------------------------
9595
// Image I/O
9696

97-
HRESULT GetMetadataFromDDSMemory(
97+
HRESULT __cdecl GetMetadataFromDDSMemory(
9898
_In_reads_bytes_(size) const void* pSource, _In_ size_t size,
9999
_Out_ DirectX::TexMetadata& metadata, _Out_ bool& isXbox);
100-
HRESULT GetMetadataFromDDSFile(
100+
HRESULT __cdecl GetMetadataFromDDSFile(
101101
_In_z_ const wchar_t* szFile, _Out_ DirectX::TexMetadata& metadata, _Out_ bool& isXbox);
102102

103-
HRESULT GetMetadataFromDDSMemoryEx(
103+
HRESULT __cdecl GetMetadataFromDDSMemoryEx(
104104
_In_reads_bytes_(size) const void* pSource, _In_ size_t size,
105105
_Out_ DirectX::TexMetadata& metadata, _Out_ bool& isXbox,
106106
_Out_opt_ DirectX::DDSMetaData* ddPixelFormat);
107-
HRESULT GetMetadataFromDDSFileEx(
107+
HRESULT __cdecl GetMetadataFromDDSFileEx(
108108
_In_z_ const wchar_t* szFile, _Out_ DirectX::TexMetadata& metadata, _Out_ bool& isXbox,
109109
_Out_opt_ DirectX::DDSMetaData* ddPixelFormat);
110110

111-
HRESULT LoadFromDDSMemory(
111+
HRESULT __cdecl LoadFromDDSMemory(
112112
_In_reads_bytes_(size) const void* pSource, _In_ size_t size,
113113
_Out_opt_ DirectX::TexMetadata* metadata, _Out_ XboxImage& image);
114-
HRESULT LoadFromDDSFile(
114+
HRESULT __cdecl LoadFromDDSFile(
115115
_In_z_ const wchar_t* szFile,
116116
_Out_opt_ DirectX::TexMetadata* metadata, _Out_ XboxImage& image);
117117

118-
HRESULT LoadFromDDSMemoryEx(
118+
HRESULT __cdecl LoadFromDDSMemoryEx(
119119
_In_reads_bytes_(size) const void* pSource, _In_ size_t size,
120120
_Out_opt_ DirectX::TexMetadata* metadata,
121121
_Out_opt_ DirectX::DDSMetaData* ddPixelFormat,
122122
_Out_ XboxImage& image);
123-
HRESULT LoadFromDDSFileEx(
123+
HRESULT __cdecl LoadFromDDSFileEx(
124124
_In_z_ const wchar_t* szFile,
125125
_Out_opt_ DirectX::TexMetadata* metadata,
126126
_Out_opt_ DirectX::DDSMetaData* ddPixelFormat,
127127
_Out_ XboxImage& image);
128128

129-
HRESULT SaveToDDSMemory(_In_ const XboxImage& xbox, _Out_ DirectX::Blob& blob);
130-
HRESULT SaveToDDSFile(_In_ const XboxImage& xbox, _In_z_ const wchar_t* szFile);
129+
HRESULT __cdecl SaveToDDSMemory(_In_ const XboxImage& xbox, _Out_ DirectX::Blob& blob);
130+
HRESULT __cdecl SaveToDDSFile(_In_ const XboxImage& xbox, _In_z_ const wchar_t* szFile);
131131

132132
//---------------------------------------------------------------------------------
133133
// Xbox Texture Tiling / Detiling (requires XG DLL to be present at runtime)
134134

135-
HRESULT Tile(_In_ const DirectX::Image& srcImage, _Out_ XboxImage& xbox, _In_ XboxTileMode mode = c_XboxTileModeInvalid);
136-
HRESULT Tile(
135+
HRESULT __cdecl Tile(_In_ const DirectX::Image& srcImage, _Out_ XboxImage& xbox, _In_ XboxTileMode mode = c_XboxTileModeInvalid);
136+
HRESULT __cdecl Tile(
137137
_In_ const DirectX::Image* srcImages, _In_ size_t nimages, _In_ const DirectX::TexMetadata& metadata,
138138
_Out_ XboxImage& xbox, _In_ XboxTileMode mode = c_XboxTileModeInvalid);
139139

140-
HRESULT Detile(_In_ const XboxImage& xbox, _Out_ DirectX::ScratchImage& image);
140+
HRESULT __cdecl Detile(_In_ const XboxImage& xbox, _Out_ DirectX::ScratchImage& image);
141141

142142
//---------------------------------------------------------------------------------
143143
// Direct3D 11.X functions
144144

145145
#if defined(_XBOX_ONE) && defined(_TITLE) && defined(__d3d11_x_h__)
146146

147-
HRESULT CreateTexture(
147+
HRESULT __cdecl CreateTexture(
148148
_In_ ID3D11DeviceX* d3dDevice,
149149
_In_ const XboxImage& xbox, _Outptr_opt_ ID3D11Resource** ppResource, _Outptr_ void** grfxMemory);
150150

151-
HRESULT CreateShaderResourceView(
151+
HRESULT __cdecl CreateShaderResourceView(
152152
_In_ ID3D11DeviceX* d3dDevice,
153153
_In_ const XboxImage& xbox, _Outptr_opt_ ID3D11ShaderResourceView** ppSRV, _Outptr_ void** grfxMemory);
154154

155-
void FreeTextureMemory(_In_ ID3D11DeviceX* d3dDevice, _In_opt_ void* grfxMemory);
155+
void __cdecl FreeTextureMemory(_In_ ID3D11DeviceX* d3dDevice, _In_opt_ void* grfxMemory);
156156

157157
#endif
158158

@@ -161,12 +161,18 @@ namespace Xbox
161161

162162
#if ((defined(_XBOX_ONE) && defined(_TITLE)) || defined(_GAMING_XBOX)) && (defined(__d3d12_x_h__) || defined(__XBOX_D3D12_X__))
163163

164-
HRESULT CreateTexture(
164+
HRESULT __cdecl CreateTexture(
165165
_In_ ID3D12Device* d3dDevice,
166166
_In_ const XboxImage& xbox, _Outptr_opt_ ID3D12Resource** ppResource, _Outptr_ void** grfxMemory);
167167

168-
void FreeTextureMemory(_In_ ID3D12Device* d3dDevice, _In_opt_ void* grfxMemory);
168+
void __cdecl FreeTextureMemory(_In_ ID3D12Device* d3dDevice, _In_opt_ void* grfxMemory);
169169

170170
#endif
171171

172+
//---------------------------------------------------------------------------------
173+
// DDS helper functions
174+
HRESULT __cdecl EncodeDDSHeader(
175+
const XboxImage& xbox,
176+
_Out_writes_bytes_(maxsize) void* pDestination, _In_ size_t maxsize) noexcept;
177+
172178
} // namespace

Auxiliary/DirectXTexXboxD3D11X.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//-------------------------------------------------------------------------------------
22
// DirectXTexD3D11X.cpp
3-
//
3+
//
44
// DirectXTex Auxilary functions for creating resouces from XboxImage containers
55
// via the CreatePlacement APIs
66
//

Auxiliary/DirectXTexXboxD3D12X.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//-------------------------------------------------------------------------------------
22
// DirectXTexD3D12X.cpp
3-
//
3+
//
44
// DirectXTex Auxilary functions for creating resouces from XboxImage containers
55
// via the CreatePlacedResourceX API
66
//

0 commit comments

Comments
 (0)