mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-22 02:00:11 +00:00
srb2::hwr2::PaletteManager: disable lighttables upload
- This code uploads encoremap to the GPU as a texture. - It assumes encoremap is 256 * 32 bytes, but in reality encoremap is only 256 bytes. - The textures go completely unused, so I simply commented out the code altogether.
This commit is contained in:
parent
f9b66ad969
commit
4a7d2504b0
2 changed files with 10 additions and 0 deletions
|
|
@ -32,6 +32,7 @@ void PaletteManager::update(Rhi& rhi, Handle<GraphicsContext> ctx)
|
|||
palette_ = rhi.create_texture({TextureFormat::kRGBA, kPaletteSize, 1, TextureWrapMode::kClamp, TextureWrapMode::kClamp});
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (!lighttable_)
|
||||
{
|
||||
lighttable_ = rhi.create_texture({TextureFormat::kLuminance, kPaletteSize, kLighttableRows, TextureWrapMode::kClamp, TextureWrapMode::kClamp});
|
||||
|
|
@ -41,6 +42,7 @@ void PaletteManager::update(Rhi& rhi, Handle<GraphicsContext> ctx)
|
|||
{
|
||||
encore_lighttable_ = rhi.create_texture({TextureFormat::kLuminance, kPaletteSize, kLighttableRows, TextureWrapMode::kClamp, TextureWrapMode::kClamp});
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!default_colormap_)
|
||||
{
|
||||
|
|
@ -57,6 +59,7 @@ void PaletteManager::update(Rhi& rhi, Handle<GraphicsContext> ctx)
|
|||
rhi.update_texture(ctx, palette_, {0, 0, kPaletteSize, 1}, PixelFormat::kRGBA8, tcb::as_bytes(tcb::span(palette_32)));
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Lighttables
|
||||
{
|
||||
if (colormaps != nullptr)
|
||||
|
|
@ -65,12 +68,15 @@ void PaletteManager::update(Rhi& rhi, Handle<GraphicsContext> ctx)
|
|||
rhi.update_texture(ctx, lighttable_, {0, 0, kPaletteSize, kLighttableRows}, PixelFormat::kR8, colormap_bytes);
|
||||
}
|
||||
|
||||
// FIXME: This is broken, encoremap should not be used directly.
|
||||
// Instead, use colormaps + COLORMAP_REMAPOFFSET. See R_ReInitColormaps.
|
||||
if (encoremap != nullptr)
|
||||
{
|
||||
tcb::span<const std::byte> encoremap_bytes = tcb::as_bytes(tcb::span(encoremap, kPaletteSize * kLighttableRows));
|
||||
rhi.update_texture(ctx, encore_lighttable_, {0, 0, kPaletteSize, kLighttableRows}, PixelFormat::kR8, encoremap_bytes);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Default colormap
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,8 +20,10 @@ namespace srb2::hwr2
|
|||
class PaletteManager
|
||||
{
|
||||
rhi::Handle<rhi::Texture> palette_;
|
||||
#if 0
|
||||
rhi::Handle<rhi::Texture> lighttable_;
|
||||
rhi::Handle<rhi::Texture> encore_lighttable_;
|
||||
#endif
|
||||
rhi::Handle<rhi::Texture> default_colormap_;
|
||||
|
||||
std::unordered_map<const uint8_t*, rhi::Handle<rhi::Texture>> colormaps_;
|
||||
|
|
@ -36,8 +38,10 @@ public:
|
|||
PaletteManager& operator=(PaletteManager&&);
|
||||
|
||||
rhi::Handle<rhi::Texture> palette() const noexcept { return palette_; }
|
||||
#if 0
|
||||
rhi::Handle<rhi::Texture> lighttable() const noexcept { return lighttable_; }
|
||||
rhi::Handle<rhi::Texture> encore_lighttable() const noexcept { return encore_lighttable_; }
|
||||
#endif
|
||||
rhi::Handle<rhi::Texture> default_colormap() const noexcept { return default_colormap_; }
|
||||
|
||||
void update(rhi::Rhi& rhi, rhi::Handle<rhi::GraphicsContext> ctx);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue