[Fix]: some not-added stuff

This commit is contained in:
2025-11-02 23:51:19 +08:00
parent 1ea32e8538
commit 2f67620a6e
3 changed files with 42 additions and 1 deletions
@@ -31,6 +31,22 @@ namespace MobileGL::MG_Impl::GLImpl {
return true; return true;
} }
Bool ValidateBufferBindingPointTarget(BufferTarget target) {
if (target != BufferTarget::Uniform && target != BufferTarget::AtomicCounter &&
target != BufferTarget::TransformFeedback && target != BufferTarget::ShaderStorage) {
using namespace MG_Util;
String bufferTargetStr = ConvertBufferTargetToString(target);
String glTargetStr = ConvertGLEnumToString(ConvertBufferTargetToGLEnum(target));
MG_State::pGLContext->RecordError(
ErrorCode::InvalidEnum,
MakeShared<GenericErrorInfo>(
"MG_Impl/GLImpl/BufferImpl", "ValidateBufferTarget",
std::format("Target {} ({}) is not valid.", bufferTargetStr, glTargetStr)));
return false;
}
return true;
}
Bool ValidateBufferName(Uint index, Bool allowZero) { Bool ValidateBufferName(Uint index, Bool allowZero) {
if (index == 0) { if (index == 0) {
if (allowZero) return true; if (allowZero) return true;
@@ -8,5 +8,6 @@ namespace MobileGL::MG_Impl::GLImpl {
Bool ValidateBufferName(Uint index, Bool allowZero = false); Bool ValidateBufferName(Uint index, Bool allowZero = false);
Bool ValidateBufferUsage(BufferUsage usage); Bool ValidateBufferUsage(BufferUsage usage);
Bool ValidateBufferMappingAccess(Flags<BufferMappingAccessBit> accessBits); Bool ValidateBufferMappingAccess(Flags<BufferMappingAccessBit> accessBits);
Bool ValidateBufferBindingPointTarget(BufferTarget target);
} // namespace BufferImpl } // namespace BufferImpl
} // namespace MobileGL::MG_Impl::GLImpl } // namespace MobileGL::MG_Impl::GLImpl
+25 -1
View File
@@ -101,7 +101,7 @@ namespace MobileGL {
// represents a range of [start, end) // represents a range of [start, end)
struct Range1D { struct Range1D {
SizeT start = 0; SizeT start = 0;
SizeT end = 0; SizeT end = ~0u;
void Update(SizeT newStart, SizeT newEnd) { void Update(SizeT newStart, SizeT newEnd) {
assert(newStart <= newEnd); assert(newStart <= newEnd);
@@ -147,6 +147,30 @@ namespace MobileGL {
SharedPtr<ObjectType> m_boundObject; SharedPtr<ObjectType> m_boundObject;
}; };
template <typename ObjectType>
class BindingSlotRange1D: public BindingSlot<ObjectType> {
public:
using TargetEnum = typename ObjectType::TargetEnum;
BindingSlotRange1D() : BindingSlot<ObjectType>() {}
explicit BindingSlotRange1D(TargetEnum target, const Range1D& range = Range1D())
: BindingSlot<ObjectType>(target), m_range(range) {}
Range1D GetRange() const {
return m_range;
}
void SetRange(const Range1D& range) {
m_range = range;
}
void ClearRange() {
m_range = Range1D();
}
private:
Range1D m_range;
};
struct Version { struct Version {
Int Major; Int Major;
Int Minor; Int Minor;