mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Feat] (MG_State/TextureState): Stubs for unimplemented texture types.
This commit is contained in:
@@ -104,27 +104,32 @@ namespace MobileGL {
|
|||||||
return m_textureStorage.GetLevelCount();
|
return m_textureStorage.GetLevelCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
const IntVec3 TextureObjectWithOneMipmap::GetMipmapTexelSize(TextureUploadTarget target, Uint mipmapLevel) const {
|
const IntVec3 TextureObjectWithOneMipmap::GetMipmapTexelSize(TextureUploadTarget target,
|
||||||
|
Uint mipmapLevel) const {
|
||||||
return m_textureStorage.GetTexelSize(GetIndexOfTextureUploadTarget(target), mipmapLevel);
|
return m_textureStorage.GetTexelSize(GetIndexOfTextureUploadTarget(target), mipmapLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
const SizeT TextureObjectWithOneMipmap::GetMipmapByteSize(TextureUploadTarget target, Uint mipmapLevel) const {
|
const SizeT TextureObjectWithOneMipmap::GetMipmapByteSize(TextureUploadTarget target,
|
||||||
|
Uint mipmapLevel) const {
|
||||||
return m_textureStorage.GetByteSize(GetIndexOfTextureUploadTarget(target), mipmapLevel);
|
return m_textureStorage.GetByteSize(GetIndexOfTextureUploadTarget(target), mipmapLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureObjectWithOneMipmap::AllocateStorage(TextureUploadTarget uploadTarget, Uint mipmapLevel,
|
void TextureObjectWithOneMipmap::AllocateStorage(TextureUploadTarget uploadTarget, Uint mipmapLevel,
|
||||||
MipmapInput input) {
|
MipmapInput input) {
|
||||||
m_textureStorage.AllocateLevel(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel, input);
|
m_textureStorage.AllocateLevel(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureObjectWithOneMipmap::UpdateMipmapSubData(TextureUploadTarget uploadTarget, Uint mipmapLevel,
|
void TextureObjectWithOneMipmap::UpdateMipmapSubData(TextureUploadTarget uploadTarget, Uint mipmapLevel,
|
||||||
DataPtr input) {
|
DataPtr input) {
|
||||||
m_textureStorage.UpdateSubData(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel, input);
|
m_textureStorage.UpdateSubData(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* TextureObjectWithOneMipmap::MapMipmapData(TextureUploadTarget uploadTarget, Uint mipmapLevel) {
|
void* TextureObjectWithOneMipmap::MapMipmapData(TextureUploadTarget uploadTarget, Uint mipmapLevel) {
|
||||||
return m_textureStorage.MapData(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel);
|
return m_textureStorage.MapData(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureObjectWithOneMipmap::MarkStorageDirty(TextureUploadTarget uploadTarget, Uint mipmapLevel, bool dirty) {
|
void TextureObjectWithOneMipmap::MarkStorageDirty(TextureUploadTarget uploadTarget, Uint mipmapLevel,
|
||||||
|
bool dirty) {
|
||||||
m_textureStorage.MarkDirty(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel, dirty);
|
m_textureStorage.MarkDirty(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel, dirty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,8 +145,7 @@ namespace MobileGL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bool TextureObjectWithOneMipmap::IsComplete() const {
|
Bool TextureObjectWithOneMipmap::IsComplete() const {
|
||||||
if (!TextureObjectBase::IsComplete())
|
if (!TextureObjectBase::IsComplete()) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
SizeT levelCount = m_textureStorage.GetLevelCount();
|
SizeT levelCount = m_textureStorage.GetLevelCount();
|
||||||
if (levelCount == 0) {
|
if (levelCount == 0) {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace MobileGL {
|
|||||||
UintVec2 m_levelRange = {0, 1000};
|
UintVec2 m_levelRange = {0, 1000};
|
||||||
};
|
};
|
||||||
|
|
||||||
class TextureObjectWithOneMipmap: public TextureObjectBase {
|
class TextureObjectWithOneMipmap : public TextureObjectBase {
|
||||||
public:
|
public:
|
||||||
TextureObjectWithOneMipmap(TextureTarget target, Uint externalIndex): TextureObjectBase(target, externalIndex) {}
|
TextureObjectWithOneMipmap(TextureTarget target, Uint externalIndex): TextureObjectBase(target, externalIndex) {}
|
||||||
virtual ~TextureObjectWithOneMipmap() = default;
|
virtual ~TextureObjectWithOneMipmap() = default;
|
||||||
@@ -99,6 +99,7 @@ namespace MobileGL {
|
|||||||
|
|
||||||
IntVec3 GetBaseSize() const override;
|
IntVec3 GetBaseSize() const override;
|
||||||
Bool IsComplete() const override;
|
Bool IsComplete() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TextureStorage<1> m_textureStorage;
|
TextureStorage<1> m_textureStorage;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,10 +7,11 @@ namespace MobileGL {
|
|||||||
: TextureObjectWithOneMipmap(TextureTarget::Texture1D, externalIndex) {}
|
: TextureObjectWithOneMipmap(TextureTarget::Texture1D, externalIndex) {}
|
||||||
|
|
||||||
Uint TextureObject1D::GetIndexOfTextureUploadTarget(TextureUploadTarget target) const {
|
Uint TextureObject1D::GetIndexOfTextureUploadTarget(TextureUploadTarget target) const {
|
||||||
MOBILEGL_ASSERT(target == TextureUploadTarget::Texture1D || target == TextureUploadTarget::ProxyTexture1D,
|
MOBILEGL_ASSERT(target == TextureUploadTarget::Texture1D ||
|
||||||
|
target == TextureUploadTarget::ProxyTexture1D,
|
||||||
"Invalid TextureUploadTarget!");
|
"Invalid TextureUploadTarget!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
} // namespace GLState
|
||||||
}
|
} // namespace MG_State
|
||||||
}
|
} // namespace MobileGL
|
||||||
@@ -7,13 +7,12 @@ namespace MobileGL {
|
|||||||
class TextureObject1D : public TextureObjectWithOneMipmap {
|
class TextureObject1D : public TextureObjectWithOneMipmap {
|
||||||
public:
|
public:
|
||||||
explicit TextureObject1D(Uint externalIndex);
|
explicit TextureObject1D(Uint externalIndex);
|
||||||
const Vector<TextureUploadTarget>& GetUploadTargets() const override {
|
const Vector<TextureUploadTarget>& GetUploadTargets() const override { return m_uploadTargets; }
|
||||||
return m_uploadTargets;
|
|
||||||
}
|
|
||||||
protected:
|
protected:
|
||||||
Uint GetIndexOfTextureUploadTarget(TextureUploadTarget target) const override;
|
Uint GetIndexOfTextureUploadTarget(TextureUploadTarget target) const override;
|
||||||
const Vector<TextureUploadTarget> m_uploadTargets {TextureUploadTarget::Texture1D};
|
const Vector<TextureUploadTarget> m_uploadTargets{TextureUploadTarget::Texture1D};
|
||||||
};
|
};
|
||||||
}
|
} // namespace GLState
|
||||||
}
|
} // namespace MG_State
|
||||||
}
|
} // namespace MobileGL
|
||||||
|
|||||||
@@ -7,10 +7,11 @@ namespace MobileGL {
|
|||||||
: TextureObjectWithOneMipmap(TextureTarget::Texture2D, externalIndex) {}
|
: TextureObjectWithOneMipmap(TextureTarget::Texture2D, externalIndex) {}
|
||||||
|
|
||||||
Uint TextureObject2D::GetIndexOfTextureUploadTarget(TextureUploadTarget target) const {
|
Uint TextureObject2D::GetIndexOfTextureUploadTarget(TextureUploadTarget target) const {
|
||||||
MOBILEGL_ASSERT(target == TextureUploadTarget::Texture2D || target == TextureUploadTarget::ProxyTexture2D,
|
MOBILEGL_ASSERT(target == TextureUploadTarget::Texture2D ||
|
||||||
|
target == TextureUploadTarget::ProxyTexture2D,
|
||||||
"Invalid TextureUploadTarget!");
|
"Invalid TextureUploadTarget!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
} // namespace GLState
|
||||||
}
|
} // namespace MG_State
|
||||||
}
|
} // namespace MobileGL
|
||||||
@@ -7,13 +7,12 @@ namespace MobileGL {
|
|||||||
class TextureObject2D : public TextureObjectWithOneMipmap {
|
class TextureObject2D : public TextureObjectWithOneMipmap {
|
||||||
public:
|
public:
|
||||||
explicit TextureObject2D(Uint externalIndex);
|
explicit TextureObject2D(Uint externalIndex);
|
||||||
const Vector<TextureUploadTarget>& GetUploadTargets() const override {
|
const Vector<TextureUploadTarget>& GetUploadTargets() const override { return m_uploadTargets; }
|
||||||
return m_uploadTargets;
|
|
||||||
}
|
|
||||||
protected:
|
protected:
|
||||||
Uint GetIndexOfTextureUploadTarget(TextureUploadTarget target) const override;
|
Uint GetIndexOfTextureUploadTarget(TextureUploadTarget target) const override;
|
||||||
const Vector<TextureUploadTarget> m_uploadTargets {TextureUploadTarget::Texture2D};
|
const Vector<TextureUploadTarget> m_uploadTargets{TextureUploadTarget::Texture2D};
|
||||||
};
|
};
|
||||||
}
|
} // namespace GLState
|
||||||
}
|
} // namespace MG_State
|
||||||
}
|
} // namespace MobileGL
|
||||||
|
|||||||
@@ -12,45 +12,39 @@ namespace MobileGL {
|
|||||||
return m_textureStorage.GetLevelCount();
|
return m_textureStorage.GetLevelCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
const IntVec3 TextureObject2DCube::GetMipmapTexelSize(TextureUploadTarget target,
|
const IntVec3 TextureObject2DCube::GetMipmapTexelSize(TextureUploadTarget target, Uint mipmapLevel) const {
|
||||||
Uint mipmapLevel) const {
|
|
||||||
return m_textureStorage.GetTexelSize(GetIndexOfTextureUploadTarget(target), mipmapLevel);
|
return m_textureStorage.GetTexelSize(GetIndexOfTextureUploadTarget(target), mipmapLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
const SizeT TextureObject2DCube::GetMipmapByteSize(TextureUploadTarget target,
|
const SizeT TextureObject2DCube::GetMipmapByteSize(TextureUploadTarget target, Uint mipmapLevel) const {
|
||||||
Uint mipmapLevel) const {
|
|
||||||
return m_textureStorage.GetByteSize(GetIndexOfTextureUploadTarget(target), mipmapLevel);
|
return m_textureStorage.GetByteSize(GetIndexOfTextureUploadTarget(target), mipmapLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void TextureObject2DCube::AllocateStorage(TextureUploadTarget uploadTarget, Uint mipmapLevel,
|
||||||
TextureObject2DCube::AllocateStorage(TextureUploadTarget uploadTarget, Uint mipmapLevel,
|
MipmapInput input) {
|
||||||
MipmapInput input) {
|
|
||||||
m_textureStorage.AllocateLevel(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel, input);
|
m_textureStorage.AllocateLevel(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureObject2DCube::UpdateMipmapSubData(TextureUploadTarget uploadTarget,
|
void TextureObject2DCube::UpdateMipmapSubData(TextureUploadTarget uploadTarget, Uint mipmapLevel,
|
||||||
Uint mipmapLevel, DataPtr input) {
|
DataPtr input) {
|
||||||
m_textureStorage.UpdateSubData(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel, input);
|
m_textureStorage.UpdateSubData(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void* TextureObject2DCube::MapMipmapData(TextureUploadTarget uploadTarget, Uint mipmapLevel) {
|
||||||
TextureObject2DCube::MapMipmapData(TextureUploadTarget uploadTarget, Uint mipmapLevel) {
|
|
||||||
return m_textureStorage.MapData(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel);
|
return m_textureStorage.MapData(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureObject2DCube::MarkStorageDirty(TextureUploadTarget uploadTarget,
|
void TextureObject2DCube::MarkStorageDirty(TextureUploadTarget uploadTarget, Uint mipmapLevel, bool dirty) {
|
||||||
Uint mipmapLevel, bool dirty) {
|
|
||||||
m_textureStorage.MarkDirty(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel, dirty);
|
m_textureStorage.MarkDirty(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel, dirty);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextureObject2DCube::IsStorageDirty(TextureUploadTarget uploadTarget,
|
bool TextureObject2DCube::IsStorageDirty(TextureUploadTarget uploadTarget, Uint mipmapLevel) const {
|
||||||
Uint mipmapLevel) const {
|
|
||||||
return m_textureStorage.IsDirty(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel);
|
return m_textureStorage.IsDirty(GetIndexOfTextureUploadTarget(uploadTarget), mipmapLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint
|
Uint TextureObject2DCube::GetIndexOfTextureUploadTarget(TextureUploadTarget target) const {
|
||||||
TextureObject2DCube::GetIndexOfTextureUploadTarget(TextureUploadTarget target) const {
|
MOBILEGL_ASSERT(TextureUploadTarget::CubeMapPositiveX <= target &&
|
||||||
MOBILEGL_ASSERT(TextureUploadTarget::CubeMapPositiveX <= target && target <= TextureUploadTarget::ProxyCubeMap,
|
target <= TextureUploadTarget::ProxyCubeMap,
|
||||||
"Invalid TextureUploadTarget!");
|
"Invalid TextureUploadTarget!");
|
||||||
return (Uint)target - (Uint)TextureUploadTarget::CubeMapPositiveX;
|
return (Uint)target - (Uint)TextureUploadTarget::CubeMapPositiveX;
|
||||||
}
|
}
|
||||||
@@ -63,8 +57,7 @@ namespace MobileGL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bool TextureObject2DCube::IsComplete() const {
|
Bool TextureObject2DCube::IsComplete() const {
|
||||||
if (!TextureObjectBase::IsComplete())
|
if (!TextureObjectBase::IsComplete()) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
SizeT levelCount = m_textureStorage.GetLevelCount();
|
SizeT levelCount = m_textureStorage.GetLevelCount();
|
||||||
if (levelCount == 0) {
|
if (levelCount == 0) {
|
||||||
@@ -73,7 +66,7 @@ namespace MobileGL {
|
|||||||
|
|
||||||
for (SizeT t = 0; t < 6; ++t) {
|
for (SizeT t = 0; t < 6; ++t) {
|
||||||
for (SizeT i = 0; i < levelCount; ++i) {
|
for (SizeT i = 0; i < levelCount; ++i) {
|
||||||
const auto &levelSize = m_textureStorage.GetTexelSize(t, i);
|
const auto& levelSize = m_textureStorage.GetTexelSize(t, i);
|
||||||
if (levelSize.x() <= 0 || levelSize.y() <= 0 || levelSize.z() <= 0) {
|
if (levelSize.x() <= 0 || levelSize.y() <= 0 || levelSize.z() <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -83,6 +76,6 @@ namespace MobileGL {
|
|||||||
// TODO: add more completeness checks based on texture type and mipmap levels
|
// TODO: add more completeness checks based on texture type and mipmap levels
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
} // namespace GLState
|
||||||
}
|
} // namespace MG_State
|
||||||
}
|
} // namespace MobileGL
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ namespace MobileGL {
|
|||||||
public:
|
public:
|
||||||
explicit TextureObject2DCube(Uint externalIndex);
|
explicit TextureObject2DCube(Uint externalIndex);
|
||||||
|
|
||||||
const Vector<TextureUploadTarget>& GetUploadTargets() const override {
|
const Vector<TextureUploadTarget>& GetUploadTargets() const override { return m_uploadTargets; }
|
||||||
return m_uploadTargets;
|
|
||||||
}
|
|
||||||
|
|
||||||
Uint GetMipmapLevelCount() const override;
|
Uint GetMipmapLevelCount() const override;
|
||||||
const IntVec3 GetMipmapTexelSize(TextureUploadTarget target, Uint mipmapLevel) const override;
|
const IntVec3 GetMipmapTexelSize(TextureUploadTarget target, Uint mipmapLevel) const override;
|
||||||
@@ -23,18 +21,16 @@ namespace MobileGL {
|
|||||||
|
|
||||||
IntVec3 GetBaseSize() const override;
|
IntVec3 GetBaseSize() const override;
|
||||||
Bool IsComplete() const override;
|
Bool IsComplete() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Uint GetIndexOfTextureUploadTarget(TextureUploadTarget target) const override;
|
Uint GetIndexOfTextureUploadTarget(TextureUploadTarget target) const override;
|
||||||
TextureStorage<6> m_textureStorage;
|
TextureStorage<6> m_textureStorage;
|
||||||
const Vector<TextureUploadTarget> m_uploadTargets {
|
const Vector<TextureUploadTarget> m_uploadTargets{
|
||||||
TextureUploadTarget::CubeMapPositiveX,
|
TextureUploadTarget::CubeMapPositiveX, TextureUploadTarget::CubeMapNegativeX,
|
||||||
TextureUploadTarget::CubeMapNegativeX,
|
TextureUploadTarget::CubeMapPositiveY, TextureUploadTarget::CubeMapNegativeY,
|
||||||
TextureUploadTarget::CubeMapPositiveY,
|
TextureUploadTarget::CubeMapPositiveZ, TextureUploadTarget::CubeMapNegativeZ,
|
||||||
TextureUploadTarget::CubeMapNegativeY,
|
|
||||||
TextureUploadTarget::CubeMapPositiveZ,
|
|
||||||
TextureUploadTarget::CubeMapNegativeZ,
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
} // namespace GLState
|
||||||
}
|
} // namespace MG_State
|
||||||
}
|
} // namespace MobileGL
|
||||||
|
|||||||
@@ -7,10 +7,11 @@ namespace MobileGL {
|
|||||||
: TextureObjectWithOneMipmap(TextureTarget::Texture3D, externalIndex) {}
|
: TextureObjectWithOneMipmap(TextureTarget::Texture3D, externalIndex) {}
|
||||||
|
|
||||||
Uint TextureObject3D::GetIndexOfTextureUploadTarget(TextureUploadTarget target) const {
|
Uint TextureObject3D::GetIndexOfTextureUploadTarget(TextureUploadTarget target) const {
|
||||||
MOBILEGL_ASSERT(target == TextureUploadTarget::Texture3D || target == TextureUploadTarget::ProxyTexture3D,
|
MOBILEGL_ASSERT(target == TextureUploadTarget::Texture3D ||
|
||||||
|
target == TextureUploadTarget::ProxyTexture3D,
|
||||||
"Invalid TextureUploadTarget!");
|
"Invalid TextureUploadTarget!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
} // namespace GLState
|
||||||
}
|
} // namespace MG_State
|
||||||
}
|
} // namespace MobileGL
|
||||||
@@ -7,13 +7,12 @@ namespace MobileGL {
|
|||||||
class TextureObject3D : public TextureObjectWithOneMipmap {
|
class TextureObject3D : public TextureObjectWithOneMipmap {
|
||||||
public:
|
public:
|
||||||
explicit TextureObject3D(Uint externalIndex);
|
explicit TextureObject3D(Uint externalIndex);
|
||||||
const Vector<TextureUploadTarget>& GetUploadTargets() const override {
|
const Vector<TextureUploadTarget>& GetUploadTargets() const override { return m_uploadTargets; }
|
||||||
return m_uploadTargets;
|
|
||||||
}
|
|
||||||
protected:
|
protected:
|
||||||
Uint GetIndexOfTextureUploadTarget(TextureUploadTarget target) const override;
|
Uint GetIndexOfTextureUploadTarget(TextureUploadTarget target) const override;
|
||||||
const Vector<TextureUploadTarget> m_uploadTargets {TextureUploadTarget::Texture3D};
|
const Vector<TextureUploadTarget> m_uploadTargets{TextureUploadTarget::Texture3D};
|
||||||
};
|
};
|
||||||
}
|
} // namespace GLState
|
||||||
}
|
} // namespace MG_State
|
||||||
}
|
} // namespace MobileGL
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "MG_State/GLState/TextureState/TextureEnum.h"
|
||||||
|
#include "TextureObject.h"
|
||||||
|
|
||||||
|
namespace MobileGL {
|
||||||
|
namespace MG_State {
|
||||||
|
namespace GLState {
|
||||||
|
/* These texture types are not yet implemented:
|
||||||
|
* TextureRectangle,
|
||||||
|
* Texture2DMultisample,
|
||||||
|
* TextureBuffer,
|
||||||
|
* Texture1DArray,
|
||||||
|
* Texture2DArray,
|
||||||
|
* TextureCubeMapArray,
|
||||||
|
* Texture2DMultisampleArray
|
||||||
|
*/
|
||||||
|
#define STUB_TEXTURE_OBJECT_CLASS_DEFINITION(className, texTarget, uploadTargets) \
|
||||||
|
class className : public TextureObjectWithOneMipmap { \
|
||||||
|
public: \
|
||||||
|
explicit className(Uint externalIndex) : TextureObjectWithOneMipmap(texTarget, externalIndex) {} \
|
||||||
|
const Vector<TextureUploadTarget>& GetUploadTargets() const override { return m_uploadTargets; } \
|
||||||
|
\
|
||||||
|
protected: \
|
||||||
|
Uint GetIndexOfTextureUploadTarget(TextureUploadTarget target) const override { return 0; } \
|
||||||
|
const Vector<TextureUploadTarget> m_uploadTargets = uploadTargets; \
|
||||||
|
};
|
||||||
|
|
||||||
|
STUB_TEXTURE_OBJECT_CLASS_DEFINITION(TextureObjectRectangle, TextureTarget::TextureRectangle,
|
||||||
|
{TextureUploadTarget::TextureRectangle});
|
||||||
|
|
||||||
|
STUB_TEXTURE_OBJECT_CLASS_DEFINITION(TextureObject2DMultisample, TextureTarget::Texture2DMultisample,
|
||||||
|
{TextureUploadTarget::Texture2DMultisample});
|
||||||
|
|
||||||
|
STUB_TEXTURE_OBJECT_CLASS_DEFINITION(TextureObjectBuffer, TextureTarget::TextureBuffer,
|
||||||
|
{TextureUploadTarget::Unknown});
|
||||||
|
|
||||||
|
STUB_TEXTURE_OBJECT_CLASS_DEFINITION(TextureObject1DArray, TextureTarget::Texture1DArray,
|
||||||
|
{TextureUploadTarget::Texture1DArray});
|
||||||
|
|
||||||
|
STUB_TEXTURE_OBJECT_CLASS_DEFINITION(TextureObject2DArray, TextureTarget::Texture2DArray,
|
||||||
|
{TextureUploadTarget::Texture2D});
|
||||||
|
|
||||||
|
STUB_TEXTURE_OBJECT_CLASS_DEFINITION(TextureObjectCubeMapArray, TextureTarget::TextureCubeMapArray,
|
||||||
|
{TextureUploadTarget::CubeMapArray});
|
||||||
|
|
||||||
|
STUB_TEXTURE_OBJECT_CLASS_DEFINITION(TextureObject2DMultisampleArray,
|
||||||
|
TextureTarget::Texture2DMultisampleArray,
|
||||||
|
{TextureUploadTarget::Texture2DMultisampleArray});
|
||||||
|
#undef STUB_TEXTURE_OBJECT_CLASS_DEFINITION
|
||||||
|
|
||||||
|
} // namespace GLState
|
||||||
|
} // namespace MG_State
|
||||||
|
} // namespace MobileGL
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
#include "TextureState.h"
|
#include "TextureState.h"
|
||||||
#include "MG_State/GLState/TextureState/TextureObject.h"
|
#include "Defines.h"
|
||||||
#include "MG_State/GLState/TextureState/TextureObject1D.h"
|
#include "TextureEnum.h"
|
||||||
#include "MG_State/GLState/TextureState/TextureObject2D.h"
|
#include "TextureObject.h"
|
||||||
#include "MG_State/GLState/TextureState/TextureObject3D.h"
|
#include "TextureObject1D.h"
|
||||||
#include "MG_Util/Types.h"
|
#include "TextureObject2D.h"
|
||||||
|
#include "TextureObject3D.h"
|
||||||
#include "TextureObject2DCube.h"
|
#include "TextureObject2DCube.h"
|
||||||
|
#include "TextureObjectStubs.h"
|
||||||
|
|
||||||
namespace MobileGL {
|
namespace MobileGL {
|
||||||
namespace MG_State {
|
namespace MG_State {
|
||||||
@@ -44,8 +46,31 @@ namespace MobileGL {
|
|||||||
case TextureTarget::Texture3D:
|
case TextureTarget::Texture3D:
|
||||||
textureObject = MakeShared<TextureObject3D>(index);
|
textureObject = MakeShared<TextureObject3D>(index);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// These texture types are stubbed:
|
||||||
|
case TextureTarget::TextureRectangle:
|
||||||
|
textureObject = MakeShared<TextureObjectRectangle>(index);
|
||||||
|
break;
|
||||||
|
case TextureTarget::Texture2DMultisample:
|
||||||
|
textureObject = MakeShared<TextureObject2DMultisample>(index);
|
||||||
|
break;
|
||||||
|
case TextureTarget::TextureBuffer:
|
||||||
|
textureObject = MakeShared<TextureObjectBuffer>(index);
|
||||||
|
break;
|
||||||
|
case TextureTarget::Texture1DArray:
|
||||||
|
textureObject = MakeShared<TextureObject1DArray>(index);
|
||||||
|
break;
|
||||||
|
case TextureTarget::Texture2DArray:
|
||||||
|
textureObject = MakeShared<TextureObject2DArray>(index);
|
||||||
|
break;
|
||||||
|
case TextureTarget::TextureCubeMapArray:
|
||||||
|
textureObject = MakeShared<TextureObjectCubeMapArray>(index);
|
||||||
|
break;
|
||||||
|
case TextureTarget::Texture2DMultisampleArray:
|
||||||
|
textureObject = MakeShared<TextureObject2DMultisampleArray>(index);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// TODO: implement more texture types
|
MOBILEGL_ASSERT(false, "Unimplemented texture type when creating texture object!: %d", (int)target);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,9 +97,8 @@ namespace MobileGL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TextureUnit& TextureState::GetUnitObject(Int unit) {
|
TextureUnit& TextureState::GetUnitObject(Int unit) {
|
||||||
if (unit < 0 || unit >= MAX_TEXTURE_IMAGE_UNITS) {
|
MOBILEGL_ASSERT(unit >= 0 && unit < MAX_TEXTURE_IMAGE_UNITS, "Texture unit is out of range: %d > %d",
|
||||||
THROW_EXCEPTION("Active texture unit is out of range");
|
unit, MAX_TEXTURE_IMAGE_UNITS - 1);
|
||||||
}
|
|
||||||
return m_textureUnits[unit];
|
return m_textureUnits[unit];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "TextureUnit.h"
|
#include "TextureUnit.h"
|
||||||
#include "MG_Util/Types.h"
|
|
||||||
|
|
||||||
namespace MobileGL {
|
namespace MobileGL {
|
||||||
namespace MG_State {
|
namespace MG_State {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <Includes.h>
|
#include <Includes.h>
|
||||||
#include "MG_State/GLState/SamplerState/SamplerObject.h"
|
#include <MG_State/GLState/SamplerState/SamplerObject.h>
|
||||||
#include "MG_Util/Types.h"
|
|
||||||
#include "TextureObject.h"
|
#include "TextureObject.h"
|
||||||
|
|
||||||
namespace MobileGL {
|
namespace MobileGL {
|
||||||
|
|||||||
Reference in New Issue
Block a user