[glutils,nostalgia/core] Move GlslVersion from GlUtils to Nostalgia Core

This commit is contained in:
Gary Talent 2023-12-04 00:40:25 -06:00
parent 7d9a1676e8
commit 140005799f
5 changed files with 12 additions and 13 deletions

View File

@ -16,8 +16,6 @@
namespace glutils {
constexpr ox::CStringView GlslVersion = "#version 330";
struct Empty {
virtual ~Empty() noexcept = default;
};

View File

@ -78,6 +78,7 @@ void setSprite(Context &ctx, Sprite const&s) noexcept;
}
namespace nostalgia::core::gl {
constexpr ox::CStringView GlslVersion = "#version 330";
void draw(core::Context&, ox::Size const&) noexcept;
}

View File

@ -372,10 +372,10 @@ ox::Error initGfx(
InitParams const&initParams) noexcept {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
const auto bgVshad = ox::sfmt(renderer::bgvshadTmpl, glutils::GlslVersion);
const auto bgFshad = ox::sfmt(renderer::bgfshadTmpl, glutils::GlslVersion);
const auto spriteVshad = ox::sfmt(renderer::spritevshadTmpl, glutils::GlslVersion);
const auto spriteFshad = ox::sfmt(renderer::spritefshadTmpl, glutils::GlslVersion);
const auto bgVshad = ox::sfmt(renderer::bgvshadTmpl, gl::GlslVersion);
const auto bgFshad = ox::sfmt(renderer::bgfshadTmpl, gl::GlslVersion);
const auto spriteVshad = ox::sfmt(renderer::spritevshadTmpl, gl::GlslVersion);
const auto spriteFshad = ox::sfmt(renderer::spritefshadTmpl, gl::GlslVersion);
auto &gctx = glctx(ctx);
oxReturnError(glutils::buildShaderProgram(bgVshad, bgFshad).moveTo(&gctx.bgShader));
oxReturnError(
@ -491,7 +491,7 @@ void setBgCbb(Context &ctx, uint_t bgIdx, uint_t cbbIdx) noexcept {
}
uint8_t bgStatus(Context &ctx) noexcept {
const auto &gctx = glctx(ctx);
auto const&gctx = glctx(ctx);
uint8_t out = 0;
for (uint_t i = 0; i < gctx.cbbs.size(); ++i) {
out |= static_cast<uint8_t>(static_cast<uint_t>(gctx.backgrounds[i].enabled) << i);
@ -507,7 +507,7 @@ void setBgStatus(Context &ctx, uint32_t status) noexcept {
}
bool bgStatus(Context &ctx, uint_t bg) noexcept {
const auto &gctx = glctx(ctx);
auto const&gctx = glctx(ctx);
return gctx.backgrounds[bg].enabled;
}

View File

@ -15,9 +15,9 @@ void TileSheetGrid::setPixelSizeMod(float sm) noexcept {
}
ox::Error TileSheetGrid::buildShader() noexcept {
const auto pixelLineVshad = ox::sfmt(VShad, glutils::GlslVersion);
const auto pixelLineFshad = ox::sfmt(FShad, glutils::GlslVersion);
const auto pixelLineGshad = ox::sfmt(GShad, glutils::GlslVersion);
const auto pixelLineVshad = ox::sfmt(VShad, gl::GlslVersion);
const auto pixelLineFshad = ox::sfmt(FShad, gl::GlslVersion);
const auto pixelLineGshad = ox::sfmt(GShad, gl::GlslVersion);
return glutils::buildShaderProgram(pixelLineVshad, pixelLineFshad, pixelLineGshad).moveTo(&m_shader);
}

View File

@ -17,8 +17,8 @@ void TileSheetPixels::setPixelSizeMod(float sm) noexcept {
}
ox::Error TileSheetPixels::buildShader() noexcept {
const auto Vshad = ox::sfmt(VShad, glutils::GlslVersion);
const auto Fshad = ox::sfmt(FShad, glutils::GlslVersion);
const auto Vshad = ox::sfmt(VShad, gl::GlslVersion);
const auto Fshad = ox::sfmt(FShad, gl::GlslVersion);
return glutils::buildShaderProgram(Vshad, Fshad).moveTo(&m_shader);
}