Added OpenGL ES 3.0 parameters to buffers and textures
Added parameters to support:
- Mapping a subset of a buffer
- New texture features like swizzling, min/max LOD,
texture comparison modes, etc.
Change-Id: Iffd961a3aeab33cb95892f93d78d3888ce60e401
Reviewed-on: https://swiftshader-review.googlesource.com/2780
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/OpenGL/libGLESv2/Buffer.cpp b/src/OpenGL/libGLESv2/Buffer.cpp
index 5fb1c6b..b162a5f 100644
--- a/src/OpenGL/libGLESv2/Buffer.cpp
+++ b/src/OpenGL/libGLESv2/Buffer.cpp
@@ -27,6 +27,10 @@
mContents = 0;
mSize = 0;
mUsage = GL_DYNAMIC_DRAW;
+ mIsMapped = false;
+ mOffset = 0;
+ mLength = 0;
+ mAccess = 0;
}
Buffer::~Buffer()
@@ -75,6 +79,33 @@
}
}
+void* Buffer::mapRange(GLintptr offset, GLsizeiptr length, GLbitfield access)
+{
+ if(mContents)
+ {
+ char* buffer = (char*)mContents->lock(sw::PUBLIC);
+ mIsMapped = true;
+ mOffset = offset;
+ mLength = length;
+ mAccess = access;
+ return buffer + offset;
+ }
+ return nullptr;
+}
+
+bool Buffer::unmap()
+{
+ if(mContents)
+ {
+ mContents->unlock();
+ }
+ mIsMapped = false;
+ mOffset = 0;
+ mLength = 0;
+ mAccess = 0;
+ return true;
+}
+
sw::Resource *Buffer::getResource()
{
return mContents;