mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 10:35:43 -05:00
Cleanup.
This commit is contained in:
parent
28ae783664
commit
39409696e6
4 changed files with 34 additions and 7 deletions
|
@ -4894,6 +4894,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||||
: 0
|
: 0
|
||||||
;
|
;
|
||||||
|
|
||||||
|
bool depth = isDepth(TextureFormat::Enum(src.m_textureFormat) );
|
||||||
deviceCtx->CopySubresourceRegion(dst.m_ptr
|
deviceCtx->CopySubresourceRegion(dst.m_ptr
|
||||||
, dstZ*dst.m_numMips+blit.m_dstMip
|
, dstZ*dst.m_numMips+blit.m_dstMip
|
||||||
, blit.m_dstX
|
, blit.m_dstX
|
||||||
|
@ -4901,7 +4902,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||||
, 0
|
, 0
|
||||||
, src.m_ptr
|
, src.m_ptr
|
||||||
, srcZ*src.m_numMips+blit.m_srcMip
|
, srcZ*src.m_numMips+blit.m_srcMip
|
||||||
, isDepth((TextureFormat::Enum)src.m_textureFormat) ? NULL : &box
|
, depth ? NULL : &box
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4614,12 +4614,13 @@ data.NumQualityLevels = 0;
|
||||||
|
|
||||||
D3D12_TEXTURE_COPY_LOCATION dstLocation = { dst.m_ptr, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, { dstZ*dst.m_numMips+blit.m_dstMip } };
|
D3D12_TEXTURE_COPY_LOCATION dstLocation = { dst.m_ptr, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, { dstZ*dst.m_numMips+blit.m_dstMip } };
|
||||||
D3D12_TEXTURE_COPY_LOCATION srcLocation = { src.m_ptr, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, { srcZ*src.m_numMips+blit.m_srcMip } };
|
D3D12_TEXTURE_COPY_LOCATION srcLocation = { src.m_ptr, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, { srcZ*src.m_numMips+blit.m_srcMip } };
|
||||||
|
bool depth = isDepth(TextureFormat::Enum(src.m_textureFormat) );
|
||||||
m_commandList->CopyTextureRegion(&dstLocation
|
m_commandList->CopyTextureRegion(&dstLocation
|
||||||
, blit.m_dstX
|
, blit.m_dstX
|
||||||
, blit.m_dstY
|
, blit.m_dstY
|
||||||
, 0
|
, 0
|
||||||
, &srcLocation
|
, &srcLocation
|
||||||
, &box
|
, depth ? NULL : &box
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3648,10 +3648,11 @@ namespace bgfx { namespace d3d9
|
||||||
//
|
//
|
||||||
// GetRenderTargetData (dst must be SYSTEMMEM)
|
// GetRenderTargetData (dst must be SYSTEMMEM)
|
||||||
|
|
||||||
|
bool depth = isDepth(TextureFormat::Enum(src.m_textureFormat) );
|
||||||
HRESULT hr = m_device->StretchRect(srcSurface
|
HRESULT hr = m_device->StretchRect(srcSurface
|
||||||
, isDepth((TextureFormat::Enum)src.m_textureFormat) ? NULL : &srcRect
|
, depth ? NULL : &srcRect
|
||||||
, dstSurface
|
, dstSurface
|
||||||
, isDepth((TextureFormat::Enum)src.m_textureFormat) ? NULL : &dstRect
|
, depth ? NULL : &dstRect
|
||||||
, D3DTEXF_NONE
|
, D3DTEXF_NONE
|
||||||
);
|
);
|
||||||
if (FAILED(hr) )
|
if (FAILED(hr) )
|
||||||
|
|
|
@ -18,6 +18,7 @@ using namespace bgfx;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
#include <bx/bx.h>
|
#include <bx/bx.h>
|
||||||
|
#include <bx/allocator.h>
|
||||||
#include <bx/commandline.h>
|
#include <bx/commandline.h>
|
||||||
#include <bx/uint32_t.h>
|
#include <bx/uint32_t.h>
|
||||||
|
|
||||||
|
@ -70,6 +71,13 @@ int main(int _argc, const char* _argv[])
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* outputFileName = cmdLine.findOption('o');
|
||||||
|
if (NULL == outputFileName)
|
||||||
|
{
|
||||||
|
help("Output file must be specified.");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
bx::CrtFileReader reader;
|
bx::CrtFileReader reader;
|
||||||
if (0 != bx::open(&reader, inputFileName) )
|
if (0 != bx::open(&reader, inputFileName) )
|
||||||
{
|
{
|
||||||
|
@ -84,6 +92,21 @@ int main(int _argc, const char* _argv[])
|
||||||
|
|
||||||
ImageContainer imageContainer;
|
ImageContainer imageContainer;
|
||||||
|
|
||||||
|
if (imageParse(imageContainer, mem->data, mem->size) )
|
||||||
|
{
|
||||||
|
bx::CrtFileWriter writer;
|
||||||
|
if (0 == bx::open(&writer, outputFileName) )
|
||||||
|
{
|
||||||
|
if (NULL != bx::stristr(outputFileName, ".ktx") )
|
||||||
|
{
|
||||||
|
imageWriteKtx(&writer, imageContainer, mem->data, mem->size);
|
||||||
|
}
|
||||||
|
|
||||||
|
bx::close(&writer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (imageParse(imageContainer, mem->data, mem->size) )
|
if (imageParse(imageContainer, mem->data, mem->size) )
|
||||||
{
|
{
|
||||||
bool decompress = cmdLine.hasArg('d');
|
bool decompress = cmdLine.hasArg('d');
|
||||||
|
@ -93,12 +116,12 @@ int main(int _argc, const char* _argv[])
|
||||||
{
|
{
|
||||||
for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
|
for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
|
||||||
{
|
{
|
||||||
uint32_t width = imageContainer.m_width;
|
uint32_t width = imageContainer.m_width;
|
||||||
uint32_t height = imageContainer.m_height;
|
uint32_t height = imageContainer.m_height;
|
||||||
|
|
||||||
for (uint32_t lod = 0, num = imageContainer.m_numMips; lod < num; ++lod)
|
for (uint32_t lod = 0, num = imageContainer.m_numMips; lod < num; ++lod)
|
||||||
{
|
{
|
||||||
width = bx::uint32_max(1, width);
|
width = bx::uint32_max(1, width);
|
||||||
height = bx::uint32_max(1, height);
|
height = bx::uint32_max(1, height);
|
||||||
|
|
||||||
ImageMip mip;
|
ImageMip mip;
|
||||||
|
@ -107,7 +130,7 @@ int main(int _argc, const char* _argv[])
|
||||||
uint32_t dstpitch = width*4;
|
uint32_t dstpitch = width*4;
|
||||||
uint8_t* bits = (uint8_t*)malloc(dstpitch*height);
|
uint8_t* bits = (uint8_t*)malloc(dstpitch*height);
|
||||||
|
|
||||||
if (width != mip.m_width
|
if (width != mip.m_width
|
||||||
|| height != mip.m_height)
|
|| height != mip.m_height)
|
||||||
{
|
{
|
||||||
uint8_t* temp = (uint8_t*)realloc(NULL, mip.m_width*mip.m_height*4);
|
uint8_t* temp = (uint8_t*)realloc(NULL, mip.m_width*mip.m_height*4);
|
||||||
|
@ -195,6 +218,7 @@ int main(int _argc, const char* _argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // 0
|
||||||
|
|
||||||
release(mem);
|
release(mem);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue