Code review feedback

This commit is contained in:
walbourn_cp
2013-03-28 00:14:06 -07:00
parent 9c9364490c
commit 991b325f10
8 changed files with 35 additions and 25 deletions

View File

@@ -50,7 +50,7 @@ const uint16_t F16S_MASK = 0x8000; // f16 sign mask
const uint16_t F16EM_MASK = 0x7fff; // f16 exp & mantissa mask
const uint16_t F16MAX = 0x7bff; // MAXFLT bit pattern for XMHALF
#define SIGN_EXTEND(x,nb) ((((x)&(1<<((nb)-1)))?((~0)<<(nb)):0)|(x))
#define SIGN_EXTEND(x,nb) ((((x)&(1<<((nb)-1)))?((~0)<<(nb)):0)|(x))
// Because these are used in SAL annotations, they need to remain macros rather than const values
#define NUM_PIXELS_PER_BLOCK 16

View File

@@ -481,7 +481,7 @@ bool _IsAlphaAllOpaqueBC( _In_ const Image& cImage )
XMVECTOR temp[16];
const uint8_t *pPixels = cImage.pixels;
for( size_t h=0; h < cImage.height; h += 4 )
for( size_t h = 0; h < cImage.height; h += 4 )
{
const uint8_t *ptr = pPixels;
for( size_t count = 0; count < cImage.rowPitch; count += sbpp )

View File

@@ -746,7 +746,6 @@ HRESULT CaptureTexture( ID3D11Device* pDevice, ID3D11DeviceContext* pContext, ID
for( UINT level = 0; level < desc.MipLevels; ++level )
{
UINT index = D3D11CalcSubresource( level, item, desc.MipLevels );
pContext->ResolveSubresource( pTemp.Get(), index, pSource, index, fmt );
}
}

View File

@@ -258,7 +258,7 @@ static HRESULT _DecodeDDSHeader( _In_reads_bytes_(size) LPCVOID pSource, size_t
metadata.format = d3d10ext->dxgiFormat;
if ( !IsValid( metadata.format ) )
{
HRESULT_FROM_WIN32( ERROR_INVALID_DATA );
return HRESULT_FROM_WIN32( ERROR_INVALID_DATA );
}
static_assert( TEX_MISC_TEXTURECUBE == DDS_RESOURCE_MISC_TEXTURECUBE, "DDS header mismatch");
@@ -467,7 +467,6 @@ HRESULT _EncodeDDSHeader( const TexMetadata& metadata, DWORD flags,
case DXGI_FORMAT_B5G5R5A1_UNORM: memcpy_s( &ddpf, sizeof(ddpf), &DDSPF_A1R5G5B5, sizeof(DDS_PIXELFORMAT) ); break;
case DXGI_FORMAT_B8G8R8A8_UNORM: memcpy_s( &ddpf, sizeof(ddpf), &DDSPF_A8R8G8B8, sizeof(DDS_PIXELFORMAT) ); break; // DXGI 1.1
case DXGI_FORMAT_B8G8R8X8_UNORM: memcpy_s( &ddpf, sizeof(ddpf), &DDSPF_X8R8G8B8, sizeof(DDS_PIXELFORMAT) ); break; // DXGI 1.1
#ifdef DXGI_1_2_FORMATS
case DXGI_FORMAT_B4G4R4A4_UNORM: memcpy_s( &ddpf, sizeof(ddpf), &DDSPF_A4R4G4B4, sizeof(DDS_PIXELFORMAT) ); break;
#endif
@@ -941,6 +940,11 @@ static HRESULT _CopyImage( _In_reads_bytes_(size) const void* pPixels, _In_ size
assert( pixelSize <= size );
std::unique_ptr<Image[]> timages( new (std::nothrow) Image[nimages] );
if ( !timages )
{
return E_OUTOFMEMORY;
}
if ( !_SetupImageArray( (uint8_t*)pPixels, size, metadata, cpFlags, timages.get(), nimages ) )
{
return E_FAIL;

View File

@@ -1109,7 +1109,6 @@ HRESULT LoadFromTGAFile( LPCWSTR szFile, TexMetadata* metadata, ScratchImage& im
for( size_t h = 0; h < img->height; ++h )
{
_SwizzleScanline( pPixels, rowPitch, pPixels, rowPitch, mdata.format, tflags );
pPixels += rowPitch;
}
}