mirror of
https://github.com/ModOrganizer2/modorganizer-preview_dds.git
synced 2026-07-27 14:06:05 -07:00
Avoid using the to-BGRA converter for luminance textures
When inspecting bitmasks for old-style DDS headers, we were labelling luminance as `l`, then later using that to attempt to look up a GL enum by name. The luminance enums actually call it `LUMINANCE` instead of `L`, despite using single letters for single-colour channels, so the lookup was failing, and we were falling back to conversion instead of uploading the data directly.
This commit is contained in:
@@ -463,10 +463,10 @@ def buildConverter(byteCount, usedBitCounts = {8}, bitmasks = None, intmasks = N
|
||||
bIntMask = unpackCombiner(*struct.unpack("<" + unpackFormat, bitmasks["b"][:byteCount]))
|
||||
if "a" in bitmasks:
|
||||
aIntMask = unpackCombiner(*struct.unpack("<" + unpackFormat, bitmasks["a"][:byteCount]))
|
||||
if "l" in bitmasks:
|
||||
rIntMask = unpackCombiner(*struct.unpack("<" + unpackFormat, bitmasks["l"][:byteCount]))
|
||||
gIntMask = unpackCombiner(*struct.unpack("<" + unpackFormat, bitmasks["l"][:byteCount]))
|
||||
bIntMask = unpackCombiner(*struct.unpack("<" + unpackFormat, bitmasks["l"][:byteCount]))
|
||||
if "luminance" in bitmasks:
|
||||
rIntMask = unpackCombiner(*struct.unpack("<" + unpackFormat, bitmasks["luminance"][:byteCount]))
|
||||
gIntMask = unpackCombiner(*struct.unpack("<" + unpackFormat, bitmasks["luminance"][:byteCount]))
|
||||
bIntMask = unpackCombiner(*struct.unpack("<" + unpackFormat, bitmasks["luminance"][:byteCount]))
|
||||
|
||||
rDivisor = 2 ** bin(rIntMask).count("1") - 1
|
||||
gDivisor = 2 ** bin(gIntMask).count("1") - 1
|
||||
@@ -573,9 +573,9 @@ def getGLFormat(pixelFormat, dxt10Header = None):
|
||||
starts["a"] = firstBit(aBitmask)
|
||||
namedBitmasks["a"] = aBitmask
|
||||
if lumBitmask:
|
||||
bitCounts["l"] = bitCount(lumBitmask)
|
||||
starts["l"] = firstBit(lumBitmask)
|
||||
namedBitmasks["l"] = lumBitmask
|
||||
bitCounts["luminance"] = bitCount(lumBitmask)
|
||||
starts["luminancel"] = firstBit(lumBitmask)
|
||||
namedBitmasks["luminance"] = lumBitmask
|
||||
|
||||
toSort = []
|
||||
for key in starts:
|
||||
@@ -676,4 +676,4 @@ def sizeFromFormat(dxgiFormat, width, height):
|
||||
currentNum = ""
|
||||
pixelSize = (count + 7) // 8
|
||||
return width * height * pixelSize
|
||||
pass
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user