From 8653af6d620206c1a8bab284721256e9ea4e3b74 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 19 Sep 2021 13:33:18 +0300 Subject: [PATCH] Initialize Texture's format to an invalid value This makes it possible to determine if a texture has storage defined or not. --- source/core/pixelformat.h | 1 + source/core/texture.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/core/pixelformat.h b/source/core/pixelformat.h index 5a5302cd..2f603845 100644 --- a/source/core/pixelformat.h +++ b/source/core/pixelformat.h @@ -54,6 +54,7 @@ inadvisable for programs to rely on it. */ enum PixelFormat { + NO_PIXELFORMAT = 0, R8 = 0x4100|RED, R16F = 0x3200|RED, R32F = 0x3400|RED, diff --git a/source/core/texture.cpp b/source/core/texture.cpp index e607792c..877e4d10 100644 --- a/source/core/texture.cpp +++ b/source/core/texture.cpp @@ -26,8 +26,8 @@ Texture *Texture::scratch_binding = 0; Texture::Texture(GLenum t, ResourceManager *m): id(0), target(t), - format(RGB8), - storage_fmt(RGB8), + format(NO_PIXELFORMAT), + storage_fmt(format), swizzle(NO_SWIZZLE), use_srgb_format(false), auto_gen_mipmap(false) -- 2.45.2