Commit Graph
64 Commits
Author SHA1 Message Date
baldurk 9f4f0e6aa1 Update copyright years to 2024 2024-02-12 11:04:52 +00:00
Jake Turner 977adf5001 Opening DDS file better estimate size of mip-tail closes #3179
If a mip-tail exists estimate that it will be the same size as mip 0
2023-12-20 10:00:56 +00:00
baldurk 9d39b8e1a8 Reformat code for clang-format 15 2023-09-05 11:02:08 +01:00
Jake Turner df1a7cec50 Use max of mips and slices to test for invalid dimensions
The assert was incorrectly triggering on a texture with depth of 128 and mipcount of 6
2023-09-01 20:02:06 +01:00
baldurk 00dcec8a25 Catch and try to more gracefully handle invalid DDS files 2023-06-05 16:21:19 +01:00
baldurk a0863b2aed Check for DDS files having legacy header but no bitmask 2023-03-29 10:29:37 +01:00
baldurk d47e79ae07 Update copyright years to 2023 2023-02-01 12:23:32 +00:00
baldurk e33f1c1329 Add D32 conversion properly for DDS files 2022-12-15 15:17:15 +00:00
baldurk 013527b59c Some legay DDS formats should only be used for non-SRGB data 2022-12-15 15:17:05 +00:00
baldurk 8aa0390948 Add string messages to returned result codes to display to user
* Most of the main entry points that can fail with relevant reasons now has a
  way of specifying a message to return with it. This message can be displayed
  to the user to give more information or context about an error.
2022-04-26 16:21:54 +01:00
baldurk fcdea67879 Update copyright years to 2022 2022-02-17 17:38:32 +00:00
baldurk 0ba16d187a Handle B8G8R8A8_UNORM case in DDS load 2021-11-19 11:18:51 +00:00
Theodore CipicchioandBaldur Karlsson 1e3fc0e320 Fix row count calculation when writing block-compressed DDS data
Block-compressed textures with dimensions that are not evenly divisible
by the block size are typically padded internally to align with the
block size. load_dds_from_file() was previously corrected to account for
this alignment when calculating the number of rows of blocks to read
from a DDS file, but the fix was not applied to write_dds_to_file(),
resulting in missing rows of texels or loading failures when attempting
to open a DDS file generated by RenderDoc from a texture whose
dimensions are not a multiple of four.
2021-04-26 12:18:15 +01:00
baldurk 4de38aef1e Fix issue with DDS writing reading from wrong subresource index for data 2021-02-24 13:52:07 +00:00
baldurk 04e533742f Adjust pitch calculation in saved DDS files to match spec. Closes #2189
* The spec is not particularly clear but this matches the DirectXTex behaviour
  which is as close to 'official' as we'll get most likely.
2021-02-22 17:03:12 +00:00
baldurk 11268b358a Remap block-compressed 3D textures to 2D arrays on GL. Closes #2186 2021-02-22 12:38:43 +00:00
baldurk 026da176bb Update copyright years to 2021 2021-01-13 13:56:10 +00:00
baldurk fa24dc8872 Silence some PVS warnings 2020-08-20 16:11:05 +01:00
baldurk 27db02b7e2 Handle legacy DDS headers for more than just RGBA8. Closes #1888
* DirectXTex seems to emit legacy DDS headers for any UNORM format less than
  32-bit per pixel, so we do the same.
2020-05-18 15:20:58 +01:00
baldurk d0bd2e8da2 Fix calculation of number of rows in block DDS formats. Closes #1870
* The number of rows should be the ceiling of the 4-row number, since any
  overlap becomes a whole extra row of blocks.
2020-05-07 12:37:06 +01:00
baldurk 6f2dfc1a2b Add support for non-compressed formats in DDS shell preview 2020-04-01 16:55:58 +01:00
ArvastraandBaldur Karlsson d7af989746 Tidying up. 2020-03-19 17:16:01 +00:00
ArvastraandBaldur Karlsson 482114f6f4 Display Thumbnails for dds files. 2020-03-19 17:16:01 +00:00
baldurk 310011999f Add bounds checking for DDS header values 2020-03-12 11:07:58 +00:00
baldurk ec5e63a53f Ensure component count is set correctly for special formats. Refs #1688 2020-01-17 19:53:38 +00:00
baldurk 2916c0f9f7 Update copyright years to 2020 2020-01-06 16:20:45 +00:00
baldurk f68645bddc Reduce dependencies pulled in by common.h 2019-12-16 17:06:16 +00:00
baldurk 222816c537 Fix check for DDS flags not to be equality 2019-12-13 12:27:40 +00:00
baldurk 6d1d302491 Fix a number of warnings identified by higher clang warning levels
* We enable a couple of high signal-to-noise warnings in all clang builds
2019-12-02 20:41:28 +00:00
baldurk 03d064beb0 Tighten up handling of unsupported DXGI formats in DDS read/write 2019-11-25 23:36:45 +00:00
baldurk 07dc55c39d Handle depth formats better in DDS loading 2019-11-20 18:37:43 +00:00
baldurk 111ca43800 Fix handling of sub-8bit packed formats in DDS 2019-11-20 18:37:43 +00:00
baldurk d955c5b00c Change defaults when saving DDS to favour unorm variants 2019-11-13 10:11:39 +00:00
baldurk a8baf4fa49 Fix compile error 2019-10-28 19:25:02 +00:00
baldurk b9fbdc0ff0 Add explicit error for legacy CxV8U8 texture format 2019-10-28 12:04:05 +00:00
baldurk 0fe6be3ac6 Support YUY2/UYVY formats in DDS files
* These can only be supported if the proxy texture can be created
2019-10-28 12:03:50 +00:00
baldurk ec29e92abf Add support for old D32F_LOCKABLE format 2019-10-28 11:27:55 +00:00
baldurk 15c0244fd4 Add support for DXT2 / DXT4 aliases of DXT3 (BC2) and DXT5 (BC3)
* The only difference in these is whether or not pre-multiplied alpha is assumed
  to be used, and that doesn't change the actual data - only the interpretation.
2019-10-28 11:23:37 +00:00
baldurk e525630a17 Add special resource type for A8_UNORM. Closes #1426
* While it's redundant this format is still valid in D3D so needs to be handled
  correctly.
2019-06-25 19:08:07 +01:00
baldurk 8ffe33767c Handle UNormSRGB in some places that were missing handling 2019-04-23 16:31:18 +01:00
baldurk 86ff87863e Update copyright years to 2019 2019-02-01 18:32:13 +00:00
baldurk 44da10be06 Change SRGB to be a component type, not a ResourceFormat flag
* This allows us to have sRGB as a type hint, and better matches API format
  types.
* It's currently impossible and unlikely to ever be the case that srgb is
  applied to anything other than UNorm, so having it be independent from the
  component type was a degree of freedom that was unused.
2019-01-14 13:19:59 +00:00
baldurk 2237c241ff Fix incorrectly named methods in ResourceFormat
* We try to maintain at least an internally consistent naming scheme for the
  python/public interface, even if it doesn't match python naming schemes.
2019-01-03 12:22:29 +00:00
baldurk 68b23c5f62 Add support for YUV resource formats
* We handle 4:4:4, 4:2:2, and 4:2:0, with packed, 2-plane and 3-plane formats,
  for 8, 10, 12, and 16 bit depths.
* This covers most common formats but still leaves a few out - NV11, palettised
  formats, V208/V408 JPG formats.
2018-12-11 19:57:20 +00:00
baldurk 2411ce70ea Add flags to ResourceFormat to replace bgraOrder/srgbCorrected
* Allows for future expansion as well
2018-12-11 19:57:20 +00:00
baldurk e305029ddd Update copyright years to 2018 2018-01-01 17:55:29 +00:00
baldurk 40a0272a3e Remove use of bool32 replay API type&optimise mem layout in some structs 2017-08-24 10:44:45 +01:00
baldurk e85c8d19bf Combine 'special' with 'specialFormat' as single resource format type
* There was no good reason to have a flag indicating if the special
  format was valid or not. Now it's a single enum, with a value
  'Regular' indicating that the compCount/compWidth/compType fully
  describe the format itself.
* This makes code patterns easier as you no longer need to check for
  special then check for specialFormat, you can just test the type
  directly.
2017-08-24 10:37:16 +01:00
baldurk fdf04cae39 Print better error messages for failures to save textures to disk 2017-06-02 17:59:57 +01:00
baldurk d40fc8471d Change API enums to enum class, remove now redundant prefixing
* This gives a little nicer syntax, a bit better type safety, and also
  reflects better for SWIG bindings. Overall it's a minor change but
  better.
* We don't update the C# UI at all, since it's soon to be removed and
  not worth the effort/code churn.
* For now so we're ABI compatible with C#, all enums are uint32_t, but
  that is an obvious optimisation in future to reduce struct packing.
* We avoid 'None' as an enum value, because it's a reserved word in
  python so will cause problems generating bindings.
2017-04-18 14:57:33 +01:00