This commit is contained in:
Reece Wilson 2020-09-12 01:43:03 +01:00
parent a77543886f
commit 88c8e81528
6 changed files with 76 additions and 225 deletions

View File

@ -67,16 +67,17 @@ if (WIN32)
set(LIBRARY_SOURCES ${LIBRARY_SOURCES} DirectXTex/DirectXTexCompressGPU.cpp) set(LIBRARY_SOURCES ${LIBRARY_SOURCES} DirectXTex/DirectXTexCompressGPU.cpp)
set(LIBRARY_SOURCES ${LIBRARY_SOURCES} DirectXTex/BCDirectCompute.cpp) set(LIBRARY_SOURCES ${LIBRARY_SOURCES} DirectXTex/BCDirectCompute.cpp)
set(LIBRARY_SOURCES ${LIBRARY_SOURCES} DirectXTex/DirectXTexWIC.cpp) set(LIBRARY_SOURCES ${LIBRARY_SOURCES} DirectXTex/DirectXTexWIC.cpp)
endif()
if(BUILD_DX11) if(BUILD_DX11)
set(LIBRARY_SOURCES ${LIBRARY_SOURCES} DirectXTex/DirectXTexD3D11.cpp) set(LIBRARY_SOURCES ${LIBRARY_SOURCES} DirectXTex/DirectXTexD3D11.cpp)
endif() endif()
if(BUILD_DX12) if(BUILD_DX12)
set(LIBRARY_SOURCES ${LIBRARY_SOURCES} DirectXTex/DirectXTexD3D12.cpp) set(LIBRARY_SOURCES ${LIBRARY_SOURCES} DirectXTex/DirectXTexD3D12.cpp)
endif()
endif() endif()
set(SHADER_SOURCES set(SHADER_SOURCES
DirectXTex/Shaders/BC6HEncode.hlsl DirectXTex/Shaders/BC6HEncode.hlsl
DirectXTex/Shaders/BC7Encode.hlsl) DirectXTex/Shaders/BC7Encode.hlsl)

View File

@ -939,15 +939,14 @@ namespace
time(&now); time(&now);
tm info; tm info;
if (!gmtime_s(&info, &now)) info = *gmtime(&now);
{
ext->wStampMonth = static_cast<uint16_t>(info.tm_mon + 1); ext->wStampMonth = static_cast<uint16_t>(info.tm_mon + 1);
ext->wStampDay = static_cast<uint16_t>(info.tm_mday); ext->wStampDay = static_cast<uint16_t>(info.tm_mday);
ext->wStampYear = static_cast<uint16_t>(info.tm_year + 1900); ext->wStampYear = static_cast<uint16_t>(info.tm_year + 1900);
ext->wStampHour = static_cast<uint16_t>(info.tm_hour); ext->wStampHour = static_cast<uint16_t>(info.tm_hour);
ext->wStampMinute = static_cast<uint16_t>(info.tm_min); ext->wStampMinute = static_cast<uint16_t>(info.tm_min);
ext->wStampSecond = static_cast<uint16_t>(info.tm_sec); ext->wStampSecond = static_cast<uint16_t>(info.tm_sec);
}
} }
} }
@ -995,32 +994,10 @@ HRESULT DirectX::GetMetadataFromTGAFile(const wchar_t* szFile, TexMetadata& meta
if (!szFile) if (!szFile)
return E_INVALIDARG; return E_INVALIDARG;
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) ScopedReadFile hFile(szFile);
ScopedHandle hFile(safe_handle(CreateFile2(szFile, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr)));
#else
ScopedHandle hFile(safe_handle(CreateFileW(szFile, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING,
FILE_FLAG_SEQUENTIAL_SCAN, nullptr)));
#endif
if (!hFile)
{
return HRESULT_FROM_WIN32(GetLastError());
}
// Get the file size
FILE_STANDARD_INFO fileInfo;
if (!GetFileInformationByHandleEx(hFile.get(), FileStandardInfo, &fileInfo, sizeof(fileInfo)))
{
return HRESULT_FROM_WIN32(GetLastError());
}
// File is too big for 32-bit allocation, so reject read (4 GB should be plenty large enough for a valid TGA file)
if (fileInfo.EndOfFile.HighPart > 0)
{
return HRESULT_FROM_WIN32(ERROR_FILE_TOO_LARGE);
}
// Need at least enough data to fill the standard header to be a valid TGA // Need at least enough data to fill the standard header to be a valid TGA
if (fileInfo.EndOfFile.LowPart < (sizeof(TGA_HEADER))) if (hFile.GetLength() < (sizeof(TGA_HEADER)))
{ {
return E_FAIL; return E_FAIL;
} }
@ -1028,9 +1005,9 @@ HRESULT DirectX::GetMetadataFromTGAFile(const wchar_t* szFile, TexMetadata& meta
// Read the standard header (we don't need the file footer to parse the file) // Read the standard header (we don't need the file footer to parse the file)
uint8_t header[sizeof(TGA_HEADER)] = {}; uint8_t header[sizeof(TGA_HEADER)] = {};
DWORD bytesRead = 0; DWORD bytesRead = 0;
if (!ReadFile(hFile.get(), header, sizeof(TGA_HEADER), &bytesRead, nullptr)) if (!(bytesRead = hFile.Read(header, sizeof(TGA_HEADER))))
{ {
return HRESULT_FROM_WIN32(GetLastError()); return E_FAIL;
} }
size_t offset; size_t offset;
@ -1130,32 +1107,12 @@ HRESULT DirectX::LoadFromTGAFile(
image.Release(); image.Release();
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) ScopedReadFile hFile(szFile);
ScopedHandle hFile(safe_handle(CreateFile2(szFile, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr)));
#else
ScopedHandle hFile(safe_handle(CreateFileW(szFile, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING,
FILE_FLAG_SEQUENTIAL_SCAN, nullptr)));
#endif
if (!hFile)
{
return HRESULT_FROM_WIN32(GetLastError());
}
// Get the file size auto length = hFile.GetLength();
FILE_STANDARD_INFO fileInfo;
if (!GetFileInformationByHandleEx(hFile.get(), FileStandardInfo, &fileInfo, sizeof(fileInfo)))
{
return HRESULT_FROM_WIN32(GetLastError());
}
// File is too big for 32-bit allocation, so reject read (4 GB should be plenty large enough for a valid TGA file) // Need at least enough data to fill the standard header to be a valid TGA
if (fileInfo.EndOfFile.HighPart > 0) if (length < (sizeof(TGA_HEADER)))
{
return HRESULT_FROM_WIN32(ERROR_FILE_TOO_LARGE);
}
// Need at least enough data to fill the header to be a valid TGA
if (fileInfo.EndOfFile.LowPart < sizeof(TGA_HEADER))
{ {
return E_FAIL; return E_FAIL;
} }
@ -1163,9 +1120,9 @@ HRESULT DirectX::LoadFromTGAFile(
// Read the header // Read the header
uint8_t header[sizeof(TGA_HEADER)] = {}; uint8_t header[sizeof(TGA_HEADER)] = {};
DWORD bytesRead = 0; DWORD bytesRead = 0;
if (!ReadFile(hFile.get(), header, sizeof(TGA_HEADER), &bytesRead, nullptr)) if (!(bytesRead = hFile.Read(header, sizeof(TGA_HEADER))))
{ {
return HRESULT_FROM_WIN32(GetLastError()); return E_FAIL;
} }
size_t offset; size_t offset;
@ -1175,19 +1132,15 @@ HRESULT DirectX::LoadFromTGAFile(
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
// Read the pixels // Read the pixels
auto remaining = static_cast<DWORD>(fileInfo.EndOfFile.LowPart - offset); auto remaining = static_cast<DWORD>(length - offset);
if (remaining == 0) if (remaining == 0)
return E_FAIL; return E_FAIL;
if (offset > sizeof(TGA_HEADER)) if (offset > sizeof(TGA_HEADER))
{ {
// Skip past the id string hFile.SeekBegin(offset);
LARGE_INTEGER filePos = { { static_cast<DWORD>(offset), 0 } };
if (!SetFilePointerEx(hFile.get(), filePos, nullptr, FILE_BEGIN))
{
return HRESULT_FROM_WIN32(GetLastError());
}
} }
hr = image.Initialize2D(mdata.format, mdata.width, mdata.height, 1, 1); hr = image.Initialize2D(mdata.format, mdata.width, mdata.height, 1, 1);
@ -1213,13 +1166,7 @@ HRESULT DirectX::LoadFromTGAFile(
return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW); return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW);
} }
if (!ReadFile(hFile.get(), image.GetPixels(), static_cast<DWORD>(image.GetPixelsSize()), &bytesRead, nullptr)) if (image.GetPixelsSize() != hFile.Read(image.GetPixels(), static_cast<DWORD>(image.GetPixelsSize())))
{
image.Release();
return HRESULT_FROM_WIN32(GetLastError());
}
if (bytesRead != image.GetPixelsSize())
{ {
image.Release(); image.Release();
return E_FAIL; return E_FAIL;
@ -1363,10 +1310,10 @@ HRESULT DirectX::LoadFromTGAFile(
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
if (!ReadFile(hFile.get(), temp.get(), remaining, &bytesRead, nullptr)) if (!(bytesRead = hFile.Read(temp.get(), remaining)))
{ {
image.Release(); image.Release();
return HRESULT_FROM_WIN32(GetLastError()); return E_FAIL;
} }
if (bytesRead != remaining) if (bytesRead != remaining)
@ -1406,37 +1353,26 @@ HRESULT DirectX::LoadFromTGAFile(
// Handle optional TGA 2.0 footer // Handle optional TGA 2.0 footer
TGA_FOOTER footer = {}; TGA_FOOTER footer = {};
if (SetFilePointer(hFile.get(), -static_cast<int>(sizeof(TGA_FOOTER)), nullptr, FILE_END) == INVALID_SET_FILE_POINTER) hFile.SeekEnd(-static_cast<int>(sizeof(TGA_FOOTER)));
{
return HRESULT_FROM_WIN32(GetLastError());
}
if (!ReadFile(hFile.get(), &footer, sizeof(TGA_FOOTER), &bytesRead, nullptr)) if (sizeof(TGA_FOOTER) != hFile.Read(&footer, sizeof(TGA_FOOTER)))
{
image.Release();
return HRESULT_FROM_WIN32(GetLastError());
}
if (bytesRead != sizeof(TGA_FOOTER))
{ {
image.Release(); image.Release();
return E_FAIL; return E_FAIL;
} }
if (memcmp(footer.Signature, g_Signature, sizeof(g_Signature)) == 0) if (memcmp(footer.Signature, g_Signature, sizeof(g_Signature)) == 0)
{ {
if (footer.dwExtensionOffset != 0 if (footer.dwExtensionOffset != 0
&& ((footer.dwExtensionOffset + sizeof(TGA_EXTENSION)) <= fileInfo.EndOfFile.LowPart)) && ((footer.dwExtensionOffset + sizeof(TGA_EXTENSION)) <= length))
{ {
LARGE_INTEGER filePos = { { static_cast<DWORD>(footer.dwExtensionOffset), 0 } }; hFile.SeekBegin(footer.dwExtensionOffset);
if (SetFilePointerEx(hFile.get(), filePos, nullptr, FILE_BEGIN)) TGA_EXTENSION ext = {};
if ((sizeof(TGA_EXTENSION) == hFile.Read(&ext, sizeof(TGA_EXTENSION))))
{ {
TGA_EXTENSION ext = {};
if (ReadFile(hFile.get(), &ext, sizeof(TGA_EXTENSION), &bytesRead, nullptr)
&& bytesRead == sizeof(TGA_EXTENSION))
{
metadata->SetAlphaMode(GetAlphaModeFromExtension(&ext)); metadata->SetAlphaMode(GetAlphaModeFromExtension(&ext));
}
} }
} }
} }
@ -1549,18 +1485,7 @@ HRESULT DirectX::SaveToTGAFile(const Image& image, const wchar_t* szFile, const
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
// Create file and write header ScopedWriteFile hFile(szFile);
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
ScopedHandle hFile(safe_handle(CreateFile2(szFile, GENERIC_WRITE, 0, CREATE_ALWAYS, nullptr)));
#else
ScopedHandle hFile(safe_handle(CreateFileW(szFile, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, 0, nullptr)));
#endif
if (!hFile)
{
return HRESULT_FROM_WIN32(GetLastError());
}
auto_delete_file delonfail(hFile.get());
// Determine size for TGA pixel data // Determine size for TGA pixel data
size_t rowPitch, slicePitch; size_t rowPitch, slicePitch;
@ -1580,13 +1505,7 @@ HRESULT DirectX::SaveToTGAFile(const Image& image, const wchar_t* szFile, const
// Write blob // Write blob
const DWORD bytesToWrite = static_cast<DWORD>(blob.GetBufferSize()); const DWORD bytesToWrite = static_cast<DWORD>(blob.GetBufferSize());
DWORD bytesWritten; if (! hFile.Write(blob.GetBufferPointer(), bytesToWrite))
if (!WriteFile(hFile.get(), blob.GetBufferPointer(), bytesToWrite, &bytesWritten, nullptr))
{
return HRESULT_FROM_WIN32(GetLastError());
}
if (bytesWritten != bytesToWrite)
{ {
return E_FAIL; return E_FAIL;
} }
@ -1599,15 +1518,11 @@ HRESULT DirectX::SaveToTGAFile(const Image& image, const wchar_t* szFile, const
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
// Write header // Write header
DWORD bytesWritten; if (!hFile.Write(&tga_header, sizeof(TGA_HEADER)))
if (!WriteFile(hFile.get(), &tga_header, sizeof(TGA_HEADER), &bytesWritten, nullptr))
{ {
return HRESULT_FROM_WIN32(GetLastError());
}
if (bytesWritten != sizeof(TGA_HEADER))
return E_FAIL; return E_FAIL;
}
if (rowPitch > UINT32_MAX) if (rowPitch > UINT32_MAX)
return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW); return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW);
@ -1632,13 +1547,10 @@ HRESULT DirectX::SaveToTGAFile(const Image& image, const wchar_t* szFile, const
pPixels += image.rowPitch; pPixels += image.rowPitch;
if (!WriteFile(hFile.get(), temp.get(), static_cast<DWORD>(rowPitch), &bytesWritten, nullptr)) if (!hFile.Write(temp.get(), rowPitch))
{ {
return HRESULT_FROM_WIN32(GetLastError());
}
if (bytesWritten != rowPitch)
return E_FAIL; return E_FAIL;
}
} }
uint32_t extOffset = 0; uint32_t extOffset = 0;
@ -1648,19 +1560,12 @@ HRESULT DirectX::SaveToTGAFile(const Image& image, const wchar_t* szFile, const
TGA_EXTENSION ext = {}; TGA_EXTENSION ext = {};
SetExtension(&ext, *metadata); SetExtension(&ext, *metadata);
extOffset = SetFilePointer(hFile.get(), 0, nullptr, FILE_CURRENT); extOffset = hFile.GetOffset();
if (extOffset == INVALID_SET_FILE_POINTER)
{
return HRESULT_FROM_WIN32(GetLastError());
}
if (!WriteFile(hFile.get(), &ext, sizeof(TGA_EXTENSION), &bytesWritten, nullptr)) if (!hFile.Write(&ext, sizeof(TGA_EXTENSION)))
{ {
return HRESULT_FROM_WIN32(GetLastError());
}
if (bytesWritten != sizeof(TGA_EXTENSION))
return E_FAIL; return E_FAIL;
}
} }
// Write TGA 2.0 footer // Write TGA 2.0 footer
@ -1668,16 +1573,12 @@ HRESULT DirectX::SaveToTGAFile(const Image& image, const wchar_t* szFile, const
footer.dwExtensionOffset = extOffset; footer.dwExtensionOffset = extOffset;
memcpy(footer.Signature, g_Signature, sizeof(g_Signature)); memcpy(footer.Signature, g_Signature, sizeof(g_Signature));
if (!WriteFile(hFile.get(), &footer, sizeof(footer), &bytesWritten, nullptr))
if (!hFile.Write(&footer, sizeof(footer)))
{ {
return HRESULT_FROM_WIN32(GetLastError()); return E_FAIL;
} }
if (bytesWritten != sizeof(footer))
return E_FAIL;
} }
delonfail.clear();
return S_OK; return S_OK;
} }

View File

@ -11,6 +11,10 @@
#include "DirectXTexP.h" #include "DirectXTexP.h"
using Blob = DirectX::Blob;
#if !defined(_DXTX_NOWIN)
#if (defined(_XBOX_ONE) && defined(_TITLE)) || defined(_GAMING_XBOX) #if (defined(_XBOX_ONE) && defined(_TITLE)) || defined(_GAMING_XBOX)
static_assert(XBOX_DXGI_FORMAT_R10G10B10_7E3_A2_FLOAT == DXGI_FORMAT_R10G10B10_7E3_A2_FLOAT, "Xbox mismatch detected"); static_assert(XBOX_DXGI_FORMAT_R10G10B10_7E3_A2_FLOAT == DXGI_FORMAT_R10G10B10_7E3_A2_FLOAT, "Xbox mismatch detected");
static_assert(XBOX_DXGI_FORMAT_R10G10B10_6E4_A2_FLOAT == DXGI_FORMAT_R10G10B10_6E4_A2_FLOAT, "Xbox mismatch detected"); static_assert(XBOX_DXGI_FORMAT_R10G10B10_6E4_A2_FLOAT == DXGI_FORMAT_R10G10B10_6E4_A2_FLOAT, "Xbox mismatch detected");
@ -32,6 +36,7 @@ using Microsoft::WRL::ComPtr;
namespace namespace
{ {
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// WIC Pixel Format Translation Data // WIC Pixel Format Translation Data
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
@ -145,16 +150,8 @@ bool DirectX::_DXGIToWIC(DXGI_FORMAT format, GUID& guid, bool ignoreRGBvsBGR) no
{ {
switch (format) switch (format)
{ {
case DXGI_FORMAT_R8G8B8A8_UNORM: case DXGI_FORMA#endif
case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
if (ignoreRGBvsBGR)
{
// If we are not doing conversion so don't really care about BGR vs RGB color-order,
// we can use the canonical WIC 32bppBGRA format which avoids an extra format conversion when using the WIC scaler
memcpy(&guid, &GUID_WICPixelFormat32bppBGRA, sizeof(GUID));
}
else
{
memcpy(&guid, &GUID_WICPixelFormat32bppRGBA, sizeof(GUID)); memcpy(&guid, &GUID_WICPixelFormat32bppRGBA, sizeof(GUID));
} }
return true; return true;
@ -318,6 +315,7 @@ void DirectX::SetWICFactory(_In_opt_ IWICImagingFactory* pWIC) noexcept
pWIC->Release(); pWIC->Release();
} }
#endif
//===================================================================================== //=====================================================================================
@ -1384,7 +1382,7 @@ DXGI_FORMAT DirectX::MakeTypelessFLOAT(DXGI_FORMAT fmt) noexcept
//===================================================================================== //=====================================================================================
_Use_decl_annotations_ _Use_decl_annotations_
size_t TexMetadata::ComputeIndex(size_t mip, size_t item, size_t slice) const noexcept size_t DirectX::TexMetadata::ComputeIndex(size_t mip, size_t item, size_t slice) const noexcept
{ {
if (mip >= mipLevels) if (mip >= mipLevels)
return size_t(-1); return size_t(-1);
@ -1456,7 +1454,7 @@ void Blob::Release() noexcept
{ {
if (m_buffer) if (m_buffer)
{ {
_aligned_free(m_buffer); std::free(m_buffer);
m_buffer = nullptr; m_buffer = nullptr;
} }
@ -1471,7 +1469,7 @@ HRESULT Blob::Initialize(size_t size) noexcept
Release(); Release();
m_buffer = _aligned_malloc(size, 16); m_buffer = std::aligned_alloc(size, 16);
if (!m_buffer) if (!m_buffer)
{ {
Release(); Release();

View File

@ -289,60 +289,6 @@ DirectXTex/DirectXTexConvert.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/DirectXTex.dir/build.make CMakeFiles/DirectXTex.dir/DirectXTex/DirectXTexConvert.cpp.s $(MAKE) $(MAKESILENT) -f CMakeFiles/DirectXTex.dir/build.make CMakeFiles/DirectXTex.dir/DirectXTex/DirectXTexConvert.cpp.s
.PHONY : DirectXTex/DirectXTexConvert.cpp.s .PHONY : DirectXTex/DirectXTexConvert.cpp.s
DirectXTex/DirectXTexD3D11.o: DirectXTex/DirectXTexD3D11.cpp.o
.PHONY : DirectXTex/DirectXTexD3D11.o
# target to build an object file
DirectXTex/DirectXTexD3D11.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/DirectXTex.dir/build.make CMakeFiles/DirectXTex.dir/DirectXTex/DirectXTexD3D11.cpp.o
.PHONY : DirectXTex/DirectXTexD3D11.cpp.o
DirectXTex/DirectXTexD3D11.i: DirectXTex/DirectXTexD3D11.cpp.i
.PHONY : DirectXTex/DirectXTexD3D11.i
# target to preprocess a source file
DirectXTex/DirectXTexD3D11.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/DirectXTex.dir/build.make CMakeFiles/DirectXTex.dir/DirectXTex/DirectXTexD3D11.cpp.i
.PHONY : DirectXTex/DirectXTexD3D11.cpp.i
DirectXTex/DirectXTexD3D11.s: DirectXTex/DirectXTexD3D11.cpp.s
.PHONY : DirectXTex/DirectXTexD3D11.s
# target to generate assembly for a file
DirectXTex/DirectXTexD3D11.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/DirectXTex.dir/build.make CMakeFiles/DirectXTex.dir/DirectXTex/DirectXTexD3D11.cpp.s
.PHONY : DirectXTex/DirectXTexD3D11.cpp.s
DirectXTex/DirectXTexD3D12.o: DirectXTex/DirectXTexD3D12.cpp.o
.PHONY : DirectXTex/DirectXTexD3D12.o
# target to build an object file
DirectXTex/DirectXTexD3D12.cpp.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/DirectXTex.dir/build.make CMakeFiles/DirectXTex.dir/DirectXTex/DirectXTexD3D12.cpp.o
.PHONY : DirectXTex/DirectXTexD3D12.cpp.o
DirectXTex/DirectXTexD3D12.i: DirectXTex/DirectXTexD3D12.cpp.i
.PHONY : DirectXTex/DirectXTexD3D12.i
# target to preprocess a source file
DirectXTex/DirectXTexD3D12.cpp.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/DirectXTex.dir/build.make CMakeFiles/DirectXTex.dir/DirectXTex/DirectXTexD3D12.cpp.i
.PHONY : DirectXTex/DirectXTexD3D12.cpp.i
DirectXTex/DirectXTexD3D12.s: DirectXTex/DirectXTexD3D12.cpp.s
.PHONY : DirectXTex/DirectXTexD3D12.s
# target to generate assembly for a file
DirectXTex/DirectXTexD3D12.cpp.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/DirectXTex.dir/build.make CMakeFiles/DirectXTex.dir/DirectXTex/DirectXTexD3D12.cpp.s
.PHONY : DirectXTex/DirectXTexD3D12.cpp.s
DirectXTex/DirectXTexDDS.o: DirectXTex/DirectXTexDDS.cpp.o DirectXTex/DirectXTexDDS.o: DirectXTex/DirectXTexDDS.cpp.o
.PHONY : DirectXTex/DirectXTexDDS.o .PHONY : DirectXTex/DirectXTexDDS.o
@ -841,12 +787,6 @@ help:
@echo "... DirectXTex/DirectXTexConvert.o" @echo "... DirectXTex/DirectXTexConvert.o"
@echo "... DirectXTex/DirectXTexConvert.i" @echo "... DirectXTex/DirectXTexConvert.i"
@echo "... DirectXTex/DirectXTexConvert.s" @echo "... DirectXTex/DirectXTexConvert.s"
@echo "... DirectXTex/DirectXTexD3D11.o"
@echo "... DirectXTex/DirectXTexD3D11.i"
@echo "... DirectXTex/DirectXTexD3D11.s"
@echo "... DirectXTex/DirectXTexD3D12.o"
@echo "... DirectXTex/DirectXTexD3D12.i"
@echo "... DirectXTex/DirectXTexD3D12.s"
@echo "... DirectXTex/DirectXTexDDS.o" @echo "... DirectXTex/DirectXTexDDS.o"
@echo "... DirectXTex/DirectXTexDDS.i" @echo "... DirectXTex/DirectXTexDDS.i"
@echo "... DirectXTex/DirectXTexDDS.s" @echo "... DirectXTex/DirectXTexDDS.s"

View File

@ -80,6 +80,11 @@ public:
_stream.seekp(offset, std::ios_base::beg); _stream.seekp(offset, std::ios_base::beg);
} }
size_t GetOffset()
{
return static_cast<size_t>(_stream.tellp());;
}
size_t GetLength() size_t GetLength()
{ {
if (!_stream.is_open()) if (!_stream.is_open())
@ -88,7 +93,7 @@ public:
} }
auto old = _stream.tellp(); auto old = _stream.tellp();
_stream.seekp(0, std::ios_base::end); _stream.seekp(0, std::ios_base::end);
auto ret = static_cast<size_t>(_stream.tellp()); auto ret = GetOffset();
_stream.seekp(old, std::ios_base::beg); _stream.seekp(old, std::ios_base::beg);
return ret; return ret;
} }
@ -137,6 +142,12 @@ public:
_stream.seekg(offset, std::ios_base::end); _stream.seekg(offset, std::ios_base::end);
} }
size_t GetOffset()
{
return static_cast<size_t>(_stream.tellg());;
}
size_t GetLength() size_t GetLength()
{ {
if (!_stream.is_open()) if (!_stream.is_open())
@ -145,7 +156,7 @@ public:
} }
auto old = _stream.tellg(); auto old = _stream.tellg();
_stream.seekg(0, std::ios_base::end); _stream.seekg(0, std::ios_base::end);
auto ret = static_cast<size_t>(_stream.tellg()); auto ret = GetOffset();
_stream.seekg(old, std::ios_base::beg); _stream.seekg(old, std::ios_base::beg);
return ret; return ret;
} }

BIN
bin/CMake/libDirectXTex.a Normal file

Binary file not shown.