Skip to content

Commit 0d09911

Browse files
committed
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla
2 parents 76af008 + 38312cf commit 0d09911

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

include/nbl/builtin/hlsl/workgroup/shared_scan.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct reduce
5656
[unroll(1)]
5757
while (lastInvocationInLevel>subgroupMask)
5858
{
59-
scanLoadIndex += lastInvocationInLevel+_static_cast<uint16_t>(1);
59+
scanLoadIndex += lastInvocationInLevel-_static_cast<uint16_t>(1);
6060
// only invocations that have the final value of the subgroupOp (inclusive scan) store their results
6161
if (participate && (SubgroupContiguousIndex()==lastInvocationInLevel || isLastSubgroupInvocation))
6262
scratchAccessor.set(scanLoadIndex-loadStoreIndexDiff,scan); // For subgroupSz = 32, first 512 invocations store index is [0,15], 512-1023 [16,31] etc.
@@ -121,7 +121,7 @@ struct scan// : reduce<BinOp,ItemCount> https://github.com/microsoft/DirectXShad
121121
if (logShift!=initialLogShift) // but the top level doesn't have any level above itself
122122
{
123123
// this is fine if on the way up you also += under `if (participate)`
124-
scanStoreIndex -= __base.lastInvocationInLevel+_static_cast<uint16_t>(1);
124+
scanStoreIndex -= __base.lastInvocationInLevel-_static_cast<uint16_t>(1);
125125
type_t higherLevelEPS;
126126
scratchAccessor.get(scanStoreIndex, higherLevelEPS);
127127
__base.lastLevelScan = binop(__base.lastLevelScan,higherLevelEPS);

src/nbl/asset/interchange/CImageLoaderPNG.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ asset::SAssetBundle CImageLoaderPng::loadAsset(system::IFile* _file, const asset
178178

179179
if (ColorType == PNG_COLOR_TYPE_PALETTE)
180180
png_set_palette_to_rgb(png_ptr);
181+
else if (ColorType == PNG_COLOR_TYPE_GRAY_ALPHA)
182+
png_set_gray_to_rgb(png_ptr);
181183

182184
// Convert low bit colors to 8 bit colors
183185
if (BitDepth < 8)
@@ -238,7 +240,6 @@ asset::SAssetBundle CImageLoaderPng::loadAsset(system::IFile* _file, const asset
238240
imgInfo.flags = static_cast<IImage::E_CREATE_FLAGS>(0u);
239241
core::smart_refctd_ptr<ICPUImage> image = nullptr;
240242

241-
bool lumaAlphaType = false;
242243
switch (ColorType) {
243244
case PNG_COLOR_TYPE_RGB_ALPHA:
244245
imgInfo.format = EF_R8G8B8A8_SRGB;
@@ -251,7 +252,6 @@ asset::SAssetBundle CImageLoaderPng::loadAsset(system::IFile* _file, const asset
251252
break;
252253
case PNG_COLOR_TYPE_GRAY_ALPHA:
253254
imgInfo.format = EF_R8G8B8A8_SRGB;
254-
lumaAlphaType = true;
255255
break;
256256
default:
257257
{
@@ -309,20 +309,6 @@ asset::SAssetBundle CImageLoaderPng::loadAsset(system::IFile* _file, const asset
309309
png_read_image(png_ptr, RowPointers);
310310

311311
png_read_end(png_ptr, nullptr);
312-
if (lumaAlphaType)
313-
{
314-
assert(imgInfo.format==asset::EF_R8G8B8A8_SRGB);
315-
for (uint32_t i=0u; i<Height; ++i)
316-
for (uint32_t j=0u; j<Width;)
317-
{
318-
uint32_t in = reinterpret_cast<uint16_t*>(RowPointers[i])[j];
319-
j++;
320-
auto& out = reinterpret_cast<uint32_t*>(RowPointers[i])[Width-j];
321-
out = in|(in << 16u); // LXLA
322-
out &= 0xffff00ffu;
323-
out |= (in&0xffu) << 8u;
324-
}
325-
}
326312
_NBL_DELETE_ARRAY(RowPointers, Height);
327313
png_destroy_read_struct(&png_ptr,&info_ptr, 0); // Clean up memory
328314
#else

0 commit comments

Comments
 (0)