1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-21 12:00:06 +00:00

.edtiorconfig driven reformat of source (#271)

This commit is contained in:
Chuck Walbourn 2022-04-04 15:03:02 -07:00 committed by GitHub
parent 091835fa86
commit b1001d15b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 5645 additions and 5531 deletions

View File

@ -1,9 +1,74 @@
root = true
[*.{cpp,h,inl,fx,hlsl}]
[*.{fx,fxh,hlsl,hlsli}]
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = crlf
charset = latin1
cpp_space_before_function_open_parenthesis = remove
cpp_space_around_binary_operator = ignore
cpp_space_pointer_reference_alignment = ignore
[*.{cpp,h,hpp,inl}]
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = crlf
charset = latin1
cpp_indent_braces = false
cpp_indent_multi_line_relative_to = innermost_parenthesis
cpp_indent_within_parentheses = indent
cpp_indent_preserve_within_parentheses = false
cpp_indent_case_contents = true
cpp_indent_case_labels = false
cpp_indent_case_contents_when_block = true
cpp_indent_lambda_braces_when_parameter = true
cpp_indent_preprocessor = one_left
cpp_indent_access_specifiers = false
cpp_indent_namespace_contents = true
cpp_indent_preserve_comments = true
cpp_new_line_before_open_brace_namespace = new_line
cpp_new_line_before_open_brace_type = new_line
cpp_new_line_before_open_brace_function = new_line
cpp_new_line_before_open_brace_block = new_line
cpp_new_line_before_open_brace_lambda = new_line
cpp_new_line_scope_braces_on_separate_lines = true
cpp_new_line_close_brace_same_line_empty_type = true
cpp_new_line_close_brace_same_line_empty_function = true
cpp_new_line_before_catch = true
cpp_new_line_before_else = true
cpp_new_line_before_while_in_do_while = true
cpp_space_before_function_open_parenthesis = remove
cpp_space_within_parameter_list_parentheses = false
cpp_space_between_empty_parameter_list_parentheses = false
cpp_space_after_keywords_in_control_flow_statements = true
cpp_space_within_control_flow_statement_parentheses = false
cpp_space_before_lambda_open_parenthesis = false
cpp_space_within_cast_parentheses = false
cpp_space_after_cast_close_parenthesis = false
cpp_space_within_expression_parentheses = false
cpp_space_before_initializer_list_open_brace = false
cpp_space_within_initializer_list_braces = true
cpp_space_before_open_square_bracket = false
cpp_space_within_square_brackets = false
cpp_space_before_empty_square_brackets = false
cpp_space_between_empty_square_brackets = false
cpp_space_group_square_brackets = true
cpp_space_within_lambda_brackets = false
cpp_space_between_empty_lambda_brackets = false
cpp_space_before_comma = false
cpp_space_after_comma = true
cpp_space_remove_around_member_operators = true
cpp_space_before_inheritance_colon = true
cpp_space_before_constructor_colon = true
cpp_space_remove_before_semicolon = true
cpp_space_after_semicolon = false
cpp_space_remove_around_unary_operator = false
cpp_space_around_binary_operator = ignore
cpp_space_around_assignment_operator = insert
cpp_space_pointer_reference_alignment = ignore
cpp_space_around_ternary_operator = insert
cpp_wrap_preserve_blocks = one_liners

View File

@ -30,11 +30,21 @@ namespace DirectX
enum BC_FLAGS : uint32_t
{
BC_FLAGS_NONE = 0x0,
BC_FLAGS_DITHER_RGB = 0x10000, // Enables dithering for RGB colors for BC1-3
BC_FLAGS_DITHER_A = 0x20000, // Enables dithering for Alpha channel for BC1-3
BC_FLAGS_UNIFORM = 0x40000, // By default, uses perceptual weighting for BC1-3; this flag makes it a uniform weighting
BC_FLAGS_USE_3SUBSETS = 0x80000, // By default, BC7 skips mode 0 & 2; this flag adds those modes back
BC_FLAGS_FORCE_BC7_MODE6 = 0x100000, // BC7 should only use mode 6; skip other modes
BC_FLAGS_DITHER_RGB = 0x10000,
// Enables dithering for RGB colors for BC1-3
BC_FLAGS_DITHER_A = 0x20000,
// Enables dithering for Alpha channel for BC1-3
BC_FLAGS_UNIFORM = 0x40000,
// By default, uses perceptual weighting for BC1-3; this flag makes it a uniform weighting
BC_FLAGS_USE_3SUBSETS = 0x80000,
// By default, BC7 skips mode 0 & 2; this flag adds those modes back
BC_FLAGS_FORCE_BC7_MODE6 = 0x100000,
// BC7 should only use mode 6; skip other modes
};
//-------------------------------------------------------------------------------------

View File

@ -3201,7 +3201,7 @@ void D3DX_BC7::EmitBlock(const EncodeParams* pEP, size_t uShape, size_t uRotatio
for (i = 0; i < uPBits; i++)
{
SetBits(uStartBit, 1, aPVote[i] > (aCount[i] >> 1) ? 1u : 0u);
SetBits(uStartBit, 1, (aPVote[i] >(aCount[i] >> 1)) ? 1u : 0u);
}
}
else

View File

@ -85,16 +85,35 @@ namespace DirectX
enum CP_FLAGS : unsigned long
{
CP_FLAGS_NONE = 0x0, // Normal operation
CP_FLAGS_LEGACY_DWORD = 0x1, // Assume pitch is DWORD aligned instead of BYTE aligned
CP_FLAGS_PARAGRAPH = 0x2, // Assume pitch is 16-byte aligned instead of BYTE aligned
CP_FLAGS_YMM = 0x4, // Assume pitch is 32-byte aligned instead of BYTE aligned
CP_FLAGS_ZMM = 0x8, // Assume pitch is 64-byte aligned instead of BYTE aligned
CP_FLAGS_PAGE4K = 0x200, // Assume pitch is 4096-byte aligned instead of BYTE aligned
CP_FLAGS_BAD_DXTN_TAILS = 0x1000, // BC formats with malformed mipchain blocks smaller than 4x4
CP_FLAGS_24BPP = 0x10000, // Override with a legacy 24 bits-per-pixel format size
CP_FLAGS_16BPP = 0x20000, // Override with a legacy 16 bits-per-pixel format size
CP_FLAGS_8BPP = 0x40000, // Override with a legacy 8 bits-per-pixel format size
CP_FLAGS_NONE = 0x0,
// Normal operation
CP_FLAGS_LEGACY_DWORD = 0x1,
// Assume pitch is DWORD aligned instead of BYTE aligned
CP_FLAGS_PARAGRAPH = 0x2,
// Assume pitch is 16-byte aligned instead of BYTE aligned
CP_FLAGS_YMM = 0x4,
// Assume pitch is 32-byte aligned instead of BYTE aligned
CP_FLAGS_ZMM = 0x8,
// Assume pitch is 64-byte aligned instead of BYTE aligned
CP_FLAGS_PAGE4K = 0x200,
// Assume pitch is 4096-byte aligned instead of BYTE aligned
CP_FLAGS_BAD_DXTN_TAILS = 0x1000,
// BC formats with malformed mipchain blocks smaller than 4x4
CP_FLAGS_24BPP = 0x10000,
// Override with a legacy 24 bits-per-pixel format size
CP_FLAGS_16BPP = 0x20000,
// Override with a legacy 16 bits-per-pixel format size
CP_FLAGS_8BPP = 0x40000,
// Override with a legacy 8 bits-per-pixel format size
};
HRESULT __cdecl ComputePitch(

View File

@ -69,7 +69,8 @@ namespace
{
Exponent--;
Mantissa <<= 1;
} while ((Mantissa & 0x80) == 0);
}
while ((Mantissa & 0x80) == 0);
Mantissa &= 0x7F;
}
@ -135,7 +136,8 @@ namespace
{
Exponent--;
Mantissa <<= 1;
} while ((Mantissa & 0x40) == 0);
}
while ((Mantissa & 0x40) == 0);
Mantissa &= 0x3F;
}
@ -3670,7 +3672,7 @@ void DirectX::Internal::ConvertScanline(
// RGB format -> RG format
switch (static_cast<int>(flags & (TEX_FILTER_RGB_COPY_RED | TEX_FILTER_RGB_COPY_GREEN | TEX_FILTER_RGB_COPY_BLUE)))
{
case static_cast<int>(TEX_FILTER_RGB_COPY_RED) | static_cast<int>(TEX_FILTER_RGB_COPY_BLUE):
case (static_cast<int>(TEX_FILTER_RGB_COPY_RED) | static_cast<int>(TEX_FILTER_RGB_COPY_BLUE)):
{
XMVECTOR* ptr = pBuffer;
for (size_t i = 0; i < count; ++i)
@ -3682,7 +3684,7 @@ void DirectX::Internal::ConvertScanline(
}
break;
case static_cast<int>(TEX_FILTER_RGB_COPY_GREEN) | static_cast<int>(TEX_FILTER_RGB_COPY_BLUE):
case (static_cast<int>(TEX_FILTER_RGB_COPY_GREEN) | static_cast<int>(TEX_FILTER_RGB_COPY_BLUE)):
{
XMVECTOR* ptr = pBuffer;
for (size_t i = 0; i < count; ++i)
@ -3694,7 +3696,7 @@ void DirectX::Internal::ConvertScanline(
}
break;
case static_cast<int>(TEX_FILTER_RGB_COPY_RED) | static_cast<int>(TEX_FILTER_RGB_COPY_GREEN):
case (static_cast<int>(TEX_FILTER_RGB_COPY_RED) | static_cast<int>(TEX_FILTER_RGB_COPY_GREEN)):
default:
// Leave data unchanged and the store will handle this...
break;
@ -4773,6 +4775,10 @@ namespace
}\
}
#ifdef __clang__
#pragma clang diagnostic ignored "-Wextra-semi-stmt"
#endif
HRESULT ConvertToSinglePlane_(_In_ const Image& srcImage, _In_ const Image& destImage) noexcept
{
assert(srcImage.width == destImage.width);
@ -4787,17 +4793,17 @@ namespace
{
case DXGI_FORMAT_NV12:
assert(destImage.format == DXGI_FORMAT_YUY2);
CONVERT_420_TO_422(uint8_t, XMUBYTEN4)
CONVERT_420_TO_422(uint8_t, XMUBYTEN4);
return S_OK;
case DXGI_FORMAT_P010:
assert(destImage.format == DXGI_FORMAT_Y210);
CONVERT_420_TO_422(uint16_t, XMUSHORTN4)
CONVERT_420_TO_422(uint16_t, XMUSHORTN4);
return S_OK;
case DXGI_FORMAT_P016:
assert(destImage.format == DXGI_FORMAT_Y216);
CONVERT_420_TO_422(uint16_t, XMUSHORTN4)
CONVERT_420_TO_422(uint16_t, XMUSHORTN4);
return S_OK;
case DXGI_FORMAT_NV11:

View File

@ -1190,6 +1190,10 @@ namespace
}
//--- 2D Cubic Filter ---
#ifdef __clang__
#pragma clang diagnostic ignored "-Wextra-semi-stmt"
#endif
HRESULT Generate2DMipsCubicFilter(size_t levels, TEX_FILTER_FLAGS filter, const ScratchImage& mipChain, size_t item) noexcept
{
using namespace DirectX::Filters;
@ -1353,12 +1357,12 @@ namespace
XMVECTOR C0, C1, C2, C3;
CUBIC_INTERPOLATE(C0, toX.x, row0[toX.u0], row0[toX.u1], row0[toX.u2], row0[toX.u3])
CUBIC_INTERPOLATE(C1, toX.x, row1[toX.u0], row1[toX.u1], row1[toX.u2], row1[toX.u3])
CUBIC_INTERPOLATE(C2, toX.x, row2[toX.u0], row2[toX.u1], row2[toX.u2], row2[toX.u3])
CUBIC_INTERPOLATE(C3, toX.x, row3[toX.u0], row3[toX.u1], row3[toX.u2], row3[toX.u3])
CUBIC_INTERPOLATE(C0, toX.x, row0[toX.u0], row0[toX.u1], row0[toX.u2], row0[toX.u3]);
CUBIC_INTERPOLATE(C1, toX.x, row1[toX.u0], row1[toX.u1], row1[toX.u2], row1[toX.u3]);
CUBIC_INTERPOLATE(C2, toX.x, row2[toX.u0], row2[toX.u1], row2[toX.u2], row2[toX.u3]);
CUBIC_INTERPOLATE(C3, toX.x, row3[toX.u0], row3[toX.u1], row3[toX.u2], row3[toX.u3]);
CUBIC_INTERPOLATE(target[x], toY.x, C0, C1, C2, C3)
CUBIC_INTERPOLATE(target[x], toY.x, C0, C1, C2, C3);
}
if (!StoreScanlineLinear(pDest, dest->rowPitch, dest->format, target, nwidth, filter))
@ -2384,15 +2388,15 @@ namespace
for (size_t j = 0; j < 4; ++j)
{
XMVECTOR C0, C1, C2, C3;
CUBIC_INTERPOLATE(C0, toX.x, urow[j][toX.u0], urow[j][toX.u1], urow[j][toX.u2], urow[j][toX.u3])
CUBIC_INTERPOLATE(C1, toX.x, vrow[j][toX.u0], vrow[j][toX.u1], vrow[j][toX.u2], vrow[j][toX.u3])
CUBIC_INTERPOLATE(C2, toX.x, srow[j][toX.u0], srow[j][toX.u1], srow[j][toX.u2], srow[j][toX.u3])
CUBIC_INTERPOLATE(C3, toX.x, trow[j][toX.u0], trow[j][toX.u1], trow[j][toX.u2], trow[j][toX.u3])
CUBIC_INTERPOLATE(C0, toX.x, urow[j][toX.u0], urow[j][toX.u1], urow[j][toX.u2], urow[j][toX.u3]);
CUBIC_INTERPOLATE(C1, toX.x, vrow[j][toX.u0], vrow[j][toX.u1], vrow[j][toX.u2], vrow[j][toX.u3]);
CUBIC_INTERPOLATE(C2, toX.x, srow[j][toX.u0], srow[j][toX.u1], srow[j][toX.u2], srow[j][toX.u3]);
CUBIC_INTERPOLATE(C3, toX.x, trow[j][toX.u0], trow[j][toX.u1], trow[j][toX.u2], trow[j][toX.u3]);
CUBIC_INTERPOLATE(D[j], toY.x, C0, C1, C2, C3)
CUBIC_INTERPOLATE(D[j], toY.x, C0, C1, C2, C3);
}
CUBIC_INTERPOLATE(target[x], toZ.x, D[0], D[1], D[2], D[3])
CUBIC_INTERPOLATE(target[x], toZ.x, D[0], D[1], D[2], D[3]);
}
if (!StoreScanlineLinear(pDest, dest->rowPitch, dest->format, target, nwidth, filter))
@ -2516,12 +2520,12 @@ namespace
auto const& toX = cfX[x];
XMVECTOR C0, C1, C2, C3;
CUBIC_INTERPOLATE(C0, toX.x, urow[0][toX.u0], urow[0][toX.u1], urow[0][toX.u2], urow[0][toX.u3])
CUBIC_INTERPOLATE(C1, toX.x, vrow[0][toX.u0], vrow[0][toX.u1], vrow[0][toX.u2], vrow[0][toX.u3])
CUBIC_INTERPOLATE(C2, toX.x, srow[0][toX.u0], srow[0][toX.u1], srow[0][toX.u2], srow[0][toX.u3])
CUBIC_INTERPOLATE(C3, toX.x, trow[0][toX.u0], trow[0][toX.u1], trow[0][toX.u2], trow[0][toX.u3])
CUBIC_INTERPOLATE(C0, toX.x, urow[0][toX.u0], urow[0][toX.u1], urow[0][toX.u2], urow[0][toX.u3]);
CUBIC_INTERPOLATE(C1, toX.x, vrow[0][toX.u0], vrow[0][toX.u1], vrow[0][toX.u2], vrow[0][toX.u3]);
CUBIC_INTERPOLATE(C2, toX.x, srow[0][toX.u0], srow[0][toX.u1], srow[0][toX.u2], srow[0][toX.u3]);
CUBIC_INTERPOLATE(C3, toX.x, trow[0][toX.u0], trow[0][toX.u1], trow[0][toX.u2], trow[0][toX.u3]);
CUBIC_INTERPOLATE(target[x], toY.x, C0, C1, C2, C3)
CUBIC_INTERPOLATE(target[x], toY.x, C0, C1, C2, C3);
}
if (!StoreScanlineLinear(pDest, dest->rowPitch, dest->format, target, nwidth, filter))

View File

@ -314,8 +314,12 @@ namespace DirectX
enum TEXP_SCANLINE_FLAGS : uint32_t
{
TEXP_SCANLINE_NONE = 0,
TEXP_SCANLINE_SETALPHA = 0x1, // Set alpha channel to known opaque value
TEXP_SCANLINE_LEGACY = 0x2, // Enables specific legacy format conversion cases
TEXP_SCANLINE_SETALPHA = 0x1,
// Set alpha channel to known opaque value
TEXP_SCANLINE_LEGACY = 0x2,
// Enables specific legacy format conversion cases
};
enum CONVERT_FLAGS : uint32_t

View File

@ -451,6 +451,10 @@ namespace
//--- Cubic Filter ---
#ifdef __clang__
#pragma clang diagnostic ignored "-Wextra-semi-stmt"
#endif
HRESULT ResizeCubicFilter(const Image& srcImage, TEX_FILTER_FLAGS filter, const Image& destImage) noexcept
{
using namespace DirectX::Filters;
@ -594,12 +598,12 @@ namespace
XMVECTOR C0, C1, C2, C3;
CUBIC_INTERPOLATE(C0, toX.x, row0[toX.u0], row0[toX.u1], row0[toX.u2], row0[toX.u3])
CUBIC_INTERPOLATE(C1, toX.x, row1[toX.u0], row1[toX.u1], row1[toX.u2], row1[toX.u3])
CUBIC_INTERPOLATE(C2, toX.x, row2[toX.u0], row2[toX.u1], row2[toX.u2], row2[toX.u3])
CUBIC_INTERPOLATE(C3, toX.x, row3[toX.u0], row3[toX.u1], row3[toX.u2], row3[toX.u3])
CUBIC_INTERPOLATE(C0, toX.x, row0[toX.u0], row0[toX.u1], row0[toX.u2], row0[toX.u3]);
CUBIC_INTERPOLATE(C1, toX.x, row1[toX.u0], row1[toX.u1], row1[toX.u2], row1[toX.u3]);
CUBIC_INTERPOLATE(C2, toX.x, row2[toX.u0], row2[toX.u1], row2[toX.u2], row2[toX.u3]);
CUBIC_INTERPOLATE(C3, toX.x, row3[toX.u0], row3[toX.u1], row3[toX.u2], row3[toX.u3]);
CUBIC_INTERPOLATE(target[x], toY.x, C0, C1, C2, C3)
CUBIC_INTERPOLATE(target[x], toY.x, C0, C1, C2, C3);
}
if (!StoreScanlineLinear(pDest, destImage.rowPitch, destImage.format, target, destImage.width, filter))

View File

@ -1492,6 +1492,7 @@ namespace
return Convert(diffImage.GetImages(), diffImage.GetImageCount(), diffImage.GetMetadata(), format, dwFilter, TEX_THRESHOLD_DEFAULT, result);
}
#pragma region DumpBC
//--------------------------------------------------------------------------------------
// Partition, Shape, Fixup
const uint8_t g_aFixUp[3][64][3] =
@ -3209,6 +3210,7 @@ namespace
return S_OK;
}
#pragma endregion
}