Adding functionality to stencils

Two minor features are required for the blitFramebuffer
implementation in OpenGL ES 3:
- lockStencil with x,y coordinates
- getting the stencil format (new getStencilFormat function)

Change-Id: I83ccccefe70dbbedd05b5d82bc75d30f689c4abe
Reviewed-on: https://swiftshader-review.googlesource.com/7490
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Renderer/Surface.cpp b/src/Renderer/Surface.cpp
index 5ddea4a..d972574 100644
--- a/src/Renderer/Surface.cpp
+++ b/src/Renderer/Surface.cpp
@@ -1426,7 +1426,7 @@
 		internal.unlockRect();
 	}
 
-	void *Surface::lockStencil(int front, Accessor client)
+	void *Surface::lockStencil(int x, int y, int front, Accessor client)
 	{
 		resource->lock(client);
 
@@ -1435,7 +1435,7 @@
 			stencil.buffer = allocateBuffer(stencil.width, stencil.height, stencil.depth, stencil.format);
 		}
 
-		return stencil.lockRect(0, 0, front, LOCK_READWRITE);   // FIXME
+		return stencil.lockRect(x, y, front, LOCK_READWRITE);   // FIXME
 	}
 
 	void Surface::unlockStencil()
@@ -3258,7 +3258,7 @@
 		unsigned int fill = maskedS;
 		fill = fill | (fill << 8) | (fill << 16) + (fill << 24);
 
-		char *buffer = (char*)lockStencil(0, PUBLIC);
+		char *buffer = (char*)lockStencil(0, 0, 0, PUBLIC);
 
 		// Stencil buffers are assumed to use quad layout
 		for(int z = 0; z < stencil.depth; z++)