GL: Added support for texture array.

This commit is contained in:
Branimir Karadžić
2016-08-21 14:03:16 -07:00
parent 9527c756da
commit 7537b705e5
17 changed files with 636 additions and 348 deletions

View File

@@ -139,7 +139,7 @@ struct BgfxCallback : public bgfx::CallbackI
virtual void traceVargs(const char* _filePath, uint16_t _line, const char* _format, va_list _argList) BX_OVERRIDE
{
dbgPrintf("%s (%d): ", _filePath, _line);
dbgPrintfVargs(_format, _argList);
dbgPrintf(_format, _argList);
}
virtual uint32_t cacheReadSize(uint64_t _id) BX_OVERRIDE

View File

@@ -109,7 +109,7 @@ static void updateTextureCubeRectBgra8(bgfx::TextureHandle _handle, uint8_t _sid
data += 4;
}
bgfx::updateTextureCube(_handle, _side, 0, _x, _y, _width, _height, mem);
bgfx::updateTextureCube(_handle, 0, _side, 0, _x, _y, _width, _height, mem);
}
static const uint32_t m_textureside = 512;
@@ -409,7 +409,7 @@ public:
// Pitch here makes possible to pass data from source to destination
// without need for m_textures and allocated memory to be the same size.
bgfx::updateTexture2D(m_texture2d, 0, tx, ty, tw, th, mem, pitch);
bgfx::updateTexture2D(m_texture2d, 0, 0, tx, ty, tw, th, mem, pitch);
}
}

View File

@@ -278,7 +278,7 @@ class ExampleTerrain : public entry::AppI
}
mem = bgfx::makeRef(&m_terrain.m_heightMap[0], sizeof(uint8_t) * s_terrainSize * s_terrainSize);
bgfx::updateTexture2D(m_heightTexture, 0, 0, 0, s_terrainSize, s_terrainSize, mem);
bgfx::updateTexture2D(m_heightTexture, 0, 0, 0, 0, s_terrainSize, s_terrainSize, mem);
break;
}
}

View File

@@ -443,7 +443,7 @@ void Atlas::updateRegion(const AtlasRegion& _region, const uint8_t* _bitmapBuffe
}
}
bgfx::updateTextureCube(m_textureHandle, (uint8_t)_region.getFaceIndex(), 0, _region.x, _region.y, _region.width, _region.height, mem);
bgfx::updateTextureCube(m_textureHandle, 0, (uint8_t)_region.getFaceIndex(), 0, _region.x, _region.y, _region.width, _region.height, mem);
}
}

View File

@@ -337,14 +337,16 @@ namespace
if (NULL != mem)
{
bgfx::updateTexture2D(tex->id
, 0
, 0
, 0
, tex->width
, tex->height
, mem
);
bgfx::updateTexture2D(
tex->id
, 0
, 0
, 0
, 0
, tex->width
, tex->height
, mem
);
}
return bgfx::isValid(tex->id) ? tex->id.idx : 0;
@@ -368,15 +370,17 @@ namespace
uint32_t bytesPerPixel = NVG_TEXTURE_RGBA == tex->type ? 4 : 1;
uint32_t pitch = tex->width * bytesPerPixel;
bgfx::updateTexture2D(tex->id
, 0
, x
, y
, w
, h
, bgfx::copy(data + y*pitch + x*bytesPerPixel, h*pitch)
, pitch
);
bgfx::updateTexture2D(
tex->id
, 0
, 0
, x
, y
, w
, h
, bgfx::copy(data + y*pitch + x*bytesPerPixel, h*pitch)
, pitch
);
return 1;
}