Parcourir la source

GL refactoring. Won't compile

Panagiotis Christopoulos Charitos il y a 10 ans
Parent
commit
a07f53d508
64 fichiers modifiés avec 972 ajouts et 813 suppressions
  1. 8 8
      include/anki/Gl.h
  2. 0 60
      include/anki/gl/GlPipelineHandle.h
  3. 0 92
      include/anki/gl/GlTextureHandle.h
  4. 15 20
      include/anki/gr/BufferHandle.h
  5. 6 10
      include/anki/gr/ClientBufferHandle.h
  6. 6 7
      include/anki/gr/ClientBufferImpl.h
  7. 17 21
      include/anki/gr/CommandBufferHandle.h
  8. 189 0
      include/anki/gr/Enums.h
  9. 13 16
      include/anki/gr/FramebufferHandle.h
  10. 21 0
      include/anki/gr/GlCommon.h
  11. 2 3
      include/anki/gr/GlContainerHandle.h
  12. 6 8
      include/anki/gr/GlDevice.h
  13. 1 1
      include/anki/gr/GlError.h
  14. 1 1
      include/anki/gr/GlHandle.h
  15. 3 4
      include/anki/gr/GlHandleDeferredDeleter.h
  16. 1 2
      include/anki/gr/GlSync.h
  17. 3 4
      include/anki/gr/GlSyncHandles.h
  18. 9 12
      include/anki/gr/OcclusionQueryHandle.h
  19. 55 0
      include/anki/gr/PipelineHandle.h
  20. 7 11
      include/anki/gr/ShaderHandle.h
  21. 87 0
      include/anki/gr/TextureHandle.h
  22. 6 7
      include/anki/gr/gl/BufferImpl.h
  23. 17 21
      include/anki/gr/gl/CommandBufferImpl.h
  24. 12 15
      include/anki/gr/gl/FramebufferImpl.h
  25. 3 4
      include/anki/gr/gl/GlObject.h
  26. 6 6
      include/anki/gr/gl/OcclusionQueryImpl.h
  27. 9 10
      include/anki/gr/gl/PipelineImpl.h
  28. 16 17
      include/anki/gr/gl/Queue.h
  29. 6 6
      include/anki/gr/gl/ShaderImpl.h
  30. 4 5
      include/anki/gr/gl/State.h
  31. 7 8
      include/anki/gr/gl/TextureImpl.h
  32. 1 1
      include/anki/resource/ProgramPrePreprocessor.h
  33. 1 1
      include/anki/ui/UiPainter.h
  34. 1 1
      include/anki/ui/UiPainterDevice.h
  35. 24 21
      include/anki/util/File.h
  36. 2 2
      src/CMakeLists.txt
  37. 0 5
      src/gl/CMakeLists.txt
  38. 5 0
      src/gr/CMakeLists.txt
  39. 11 11
      src/gr/ClientBufferHandle.cpp
  40. 1 1
      src/gr/GlCommon.cpp
  41. 3 3
      src/gr/GlDevice.cpp
  42. 1 1
      src/gr/GlError.cpp
  43. 1 1
      src/gr/GlSync.cpp
  44. 7 7
      src/gr/GlSyncHandles.cpp
  45. 21 21
      src/gr/OcclusionQueryHandle.cpp
  46. 45 45
      src/gr/gl/BufferHandle.cpp
  47. 7 7
      src/gr/gl/BufferImpl.cpp
  48. 84 84
      src/gr/gl/CommandBufferHandle.cpp
  49. 12 12
      src/gr/gl/CommandBufferImpl.cpp
  50. 23 23
      src/gr/gl/FramebufferHandle.cpp
  51. 12 12
      src/gr/gl/FramebufferImpl.cpp
  52. 6 6
      src/gr/gl/OcclusionQueryImpl.cpp
  53. 28 28
      src/gr/gl/PipelineHandle.cpp
  54. 12 12
      src/gr/gl/PipelineImpl.cpp
  55. 22 22
      src/gr/gl/Queue.cpp
  56. 20 20
      src/gr/gl/ShaderHandle.cpp
  57. 4 4
      src/gr/gl/ShaderImpl.cpp
  58. 5 6
      src/gr/gl/State.cpp
  59. 62 62
      src/gr/gl/TextureHandle.cpp
  60. 11 11
      src/gr/gl/TextureImpl.cpp
  61. 1 1
      src/renderer/Deformer.cpp
  62. 1 1
      src/resource/CMakeLists.txt
  63. 1 1
      src/ui/UiPainter.cpp
  64. 1 1
      src/ui/UiPainterDevice.cpp

+ 8 - 8
include/anki/Gl.h

@@ -24,15 +24,15 @@
 /// @defgroup opengl_other OpenGL uncategorized interfaces 
 /// @ingroup opengl
 
-#include "anki/gl/GlBufferHandle.h"
-#include "anki/gl/GlTextureHandle.h"
-#include "anki/gl/GlShaderHandle.h"
+#include "anki/gr/GlBufferHandle.h"
+#include "anki/gr/GlTextureHandle.h"
+#include "anki/gr/GlShaderHandle.h"
 
-#include "anki/gl/GlFramebufferHandle.h"
-#include "anki/gl/GlPipelineHandle.h"
+#include "anki/gr/GlFramebufferHandle.h"
+#include "anki/gr/GlPipelineHandle.h"
 
-#include "anki/gl/GlCommandBufferHandle.h"
-#include "anki/gl/GlOcclusionQueryHandle.h"
-#include "anki/gl/GlDevice.h"
+#include "anki/gr/GlCommandBufferHandle.h"
+#include "anki/gr/GlOcclusionQueryHandle.h"
+#include "anki/gr/GlDevice.h"
 
 #endif

+ 0 - 60
include/anki/gl/GlPipelineHandle.h

@@ -1,60 +0,0 @@
-// Copyright (C) 2009-2015, Panagiotis Christopoulos Charitos.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#ifndef ANKI_GL_GL_PIPELINE_HANDLE_H
-#define ANKI_GL_GL_PIPELINE_HANDLE_H
-
-#include "anki/gl/GlContainerHandle.h"
-
-namespace anki {
-
-// Forward
-class GlCommandBufferHandle;
-class GlPipeline;
-class GlShaderHandle;
-
-/// @addtogroup opengl_other
-/// @{
-
-/// Program pipeline handle
-class GlPipelineHandle: public GlContainerHandle<GlPipeline>
-{
-public:
-	using Base = GlContainerHandle<GlPipeline>;
-
-	GlPipelineHandle();
-
-	~GlPipelineHandle();
-
-	/// Create a pipeline
-	ANKI_USE_RESULT Error create(
-		GlCommandBufferHandle& commands,
-		const GlShaderHandle* progsBegin, const GlShaderHandle* progsEnd)
-	{
-		return commonConstructor(commands, progsBegin, progsEnd);
-	}
-
-	/// Create using initializer list
-	ANKI_USE_RESULT Error create(
-		GlCommandBufferHandle& commands,
-		std::initializer_list<GlShaderHandle> progs);
-
-	/// Bind it to the state
-	void bind(GlCommandBufferHandle& commands);
-
-	/// Get an attached program. It may serialize
-	GlShaderHandle getAttachedProgram(GLenum type) const;
-
-public:
-	ANKI_USE_RESULT Error commonConstructor(GlCommandBufferHandle& commands,
-		const GlShaderHandle* progsBegin, const GlShaderHandle* progsEnd);
-};
-
-/// @}
-
-} // end namespace anki
-
-#endif
-

+ 0 - 92
include/anki/gl/GlTextureHandle.h

@@ -1,92 +0,0 @@
-// Copyright (C) 2009-2015, Panagiotis Christopoulos Charitos.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#ifndef ANKI_GL_GL_TEXTURE_HANDLE_H
-#define ANKI_GL_GL_TEXTURE_HANDLE_H
-
-#include "anki/gl/GlContainerHandle.h"
-#include "anki/gl/GlClientBufferHandle.h"
-
-namespace anki {
-
-// Forward
-class GlTexture;
-class GlSampler;
-
-/// @addtogroup opengl_containers
-/// @{
-
-/// Texture handle
-class GlTextureHandle: public GlContainerHandle<GlTexture>
-{
-public:
-	using Base = GlContainerHandle<GlTexture>;
-
-	using Filter = GlTextureFilter;
-
-	/// Texture handle initializer
-	class Initializer: public GlTextureInitializerBase
-	{
-	public:
-		Array2d<GlClientBufferHandle, 
-			ANKI_GL_MAX_MIPMAPS, ANKI_GL_MAX_TEXTURE_LAYERS> m_data;
-	};
-
-	/// Create husk
-	GlTextureHandle();
-
-	~GlTextureHandle();
-
-	/// Create the texture
-	Error create(GlCommandBufferHandle& commands, const Initializer& init);
-
-	/// Bind to a unit
-	void bind(GlCommandBufferHandle& commands, U32 unit);
-
-	/// Change filtering type
-	void setFilter(GlCommandBufferHandle& commands, Filter filter);
-
-	/// Generate mips
-	void generateMipmaps(GlCommandBufferHandle& commands);
-
-	/// Set a texture parameter
-	void setParameter(
-		GlCommandBufferHandle& commands, GLenum param, GLint value);
-};
-
-/// Sampler handle
-class GlSamplerHandle: public GlContainerHandle<GlSampler>
-{
-public:
-	using Base = GlContainerHandle<GlSampler>;
-
-	using Filter = GlTextureFilter;
-
-	/// Create husk
-	GlSamplerHandle();
-
-	~GlSamplerHandle();
-
-	/// Create the sampler
-	ANKI_USE_RESULT Error create(GlCommandBufferHandle& commands);
-
-	/// Bind to a unit
-	void bind(GlCommandBufferHandle& commands, U32 unit);
-
-	/// Change filtering type
-	void setFilter(GlCommandBufferHandle& commands, Filter filter);
-
-	/// Set a texture parameter
-	void setParameter(GlCommandBufferHandle& commands, GLenum param, GLint value);
-
-	/// Bind default sampler
-	static void bindDefault(GlCommandBufferHandle& commands, U32 unit);
-};
-
-/// @}
-
-} // end namespace anki
-
-#endif

+ 15 - 20
include/anki/gl/GlBufferHandle.h → include/anki/gr/BufferHandle.h

@@ -6,34 +6,29 @@
 #ifndef ANKI_GL_GL_BUFFER_HANDLE_H
 #define ANKI_GL_GL_BUFFER_HANDLE_H
 
-#include "anki/gl/GlContainerHandle.h"
+#include "anki/gr/GlContainerHandle.h"
 
 namespace anki {
 
-// Forward
-class GlBuffer;
-class GlClientBufferHandle;
-class GlCommandBufferHandle;
-
 /// @addtogroup opengl_containers
 /// @{
 
 /// GPU buffer handle
-class GlBufferHandle: public GlContainerHandle<GlBuffer>
+class BufferHandle: public GlContainerHandle<BufferImpl>
 {
 public:
-	using Base = GlContainerHandle<GlBuffer>;
+	using Base = GlContainerHandle<BufferImpl>;
 
-	GlBufferHandle();
+	BufferHandle();
 
-	~GlBufferHandle();
+	~BufferHandle();
 
 	/// Create the buffer with data
-	ANKI_USE_RESULT Error create(GlCommandBufferHandle& commands, GLenum target, 
-		GlClientBufferHandle& data, GLbitfield flags);
+	ANKI_USE_RESULT Error create(CommandBufferHandle& commands, GLenum target, 
+		ClientBufferHandle& data, GLbitfield flags);
 
 	/// Create the buffer without data
-	ANKI_USE_RESULT Error create(GlCommandBufferHandle& commands, GLenum target, 
+	ANKI_USE_RESULT Error create(CommandBufferHandle& commands, GLenum target, 
 		PtrSize size, GLbitfield flags);
 
 	/// Get buffer size. It may serialize 
@@ -47,18 +42,18 @@ public:
 
 	/// Write data to the buffer
 	void write(
-		GlCommandBufferHandle& commands, 
-		GlClientBufferHandle& data, PtrSize readOffset,
+		CommandBufferHandle& commands, 
+		ClientBufferHandle& data, PtrSize readOffset,
 		PtrSize writeOffset, PtrSize size);
 
 	/// Bind to the state as uniform/shader storage buffer
-	void bindShaderBuffer(GlCommandBufferHandle& commands, U32 bindingPoint)
+	void bindShaderBuffer(CommandBufferHandle& commands, U32 bindingPoint)
 	{
 		bindShaderBufferInternal(commands, -1, -1, bindingPoint);
 	}
 
 	/// Bind to the state as uniform/shader storage buffer
-	void bindShaderBuffer(GlCommandBufferHandle& commands,
+	void bindShaderBuffer(CommandBufferHandle& commands,
 		U32 offset, U32 size, U32 bindingPoint)
 	{
 		bindShaderBufferInternal(commands, offset, size, bindingPoint);
@@ -66,7 +61,7 @@ public:
 
 	/// Bind to the state as vertex buffer
 	void bindVertexBuffer(
-		GlCommandBufferHandle& commands, 
+		CommandBufferHandle& commands, 
 		U32 elementSize,
 		GLenum type,
 		Bool normalized,
@@ -75,10 +70,10 @@ public:
 		U32 attribLocation);
 
 	/// Bind to the state as index buffer
-	void bindIndexBuffer(GlCommandBufferHandle& commands);
+	void bindIndexBuffer(CommandBufferHandle& commands);
 
 private:
-	void bindShaderBufferInternal(GlCommandBufferHandle& commands,
+	void bindShaderBufferInternal(CommandBufferHandle& commands,
 		I32 offset, I32 size, U32 bindingPoint);
 };
 

+ 6 - 10
include/anki/gl/GlClientBufferHandle.h → include/anki/gr/ClientBufferHandle.h

@@ -6,26 +6,22 @@
 #ifndef ANKI_GL_GL_CLIENT_BUFFER_HANDLE_H
 #define ANKI_GL_GL_CLIENT_BUFFER_HANDLE_H
 
-#include "anki/gl/GlHandle.h"
+#include "anki/gr/GlHandle.h"
 
 namespace anki {
 
-// Forward
-class GlClientBuffer;
-class GlCommandBufferHandle;
-
 /// @addtogroup opengl_other
 /// @{
 
 /// Client buffer handle
-class GlClientBufferHandle: public GlHandle<GlClientBuffer>
+class ClientBufferHandle: public GlHandle<ClientBufferImpl>
 {
 public:
-	using Base = GlHandle<GlClientBuffer>;
+	using Base = GlHandle<ClientBufferImpl>;
 
-	GlClientBufferHandle();
+	ClientBufferHandle();
 
-	~GlClientBufferHandle();
+	~ClientBufferHandle();
 
 	/// Create the buffer using preallocated memory or memory from the chain
 	/// @param chain The command buffer this client memory belongs to
@@ -33,7 +29,7 @@ public:
 	/// @param preallocatedMem Preallocated memory. Can be nullptr
 	/// @return The address of the new memory
 	ANKI_USE_RESULT Error create(
-		GlCommandBufferHandle& chain, PtrSize size, void* preallocatedMem);
+		CommandBufferHandle& chain, PtrSize size, void* preallocatedMem);
 
 	/// Get the base address
 	void* getBaseAddress();

+ 6 - 7
include/anki/gl/GlClientBuffer.h → include/anki/gr/ClientBufferImpl.h

@@ -3,10 +3,10 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#ifndef ANKI_GL_GL_CLIENT_BUFFER_H
-#define ANKI_GL_GL_CLIENT_BUFFER_H
+#ifndef ANKI_GR_CLIENT_BUFFER_IMPL_H
+#define ANKI_GR_CLIENT_BUFFER_IMPL_H
 
-#include "anki/gl/GlCommon.h"
+#include "anki/gr/GlCommon.h"
 #include <memory>
 
 namespace anki {
@@ -15,14 +15,14 @@ namespace anki {
 /// @{
 
 /// A client buffer used to pass data to and from the server
-class GlClientBuffer: public NonCopyable
+class ClientBufferImpl: public NonCopyable
 {
 public:
 	/// Default constructor
-	GlClientBuffer()
+	ClientBufferImpl()
 	{}
 
-	~GlClientBuffer()
+	~ClientBufferImpl()
 	{
 		destroy();
 	}
@@ -91,7 +91,6 @@ private:
 		}
 	}
 };
-
 /// @}
 
 } // end namespace anki

+ 17 - 21
include/anki/gl/GlCommandBufferHandle.h → include/anki/gr/CommandBufferHandle.h

@@ -3,43 +3,40 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#ifndef ANKI_GL_GL_COMMAND_BUFFER_HANDLE_H
-#define ANKI_GL_GL_COMMAND_BUFFER_HANDLE_H
+#ifndef ANKI_GR_COMMAND_BUFFER_HANDLE_H
+#define ANKI_GR_COMMAND_BUFFER_HANDLE_H
 
-#include "anki/gl/GlHandle.h"
-#include "anki/gl/GlCommandBuffer.h"
+#include "anki/gr/GlHandle.h"
+#include "anki/gr/gl/CommandBufferImpl.h"
 
 namespace anki {
 
 // Forward
 class GlDevice;
-class GlTextureHandle;
-class GlBufferHandle;
-class GlOcclusionQueryHandle;
 
 /// @addtogroup opengl_other
 /// @{
 
 /// Command buffer handle
-class GlCommandBufferHandle: public GlHandle<GlCommandBuffer>
+class CommandBufferHandle: public GlHandle<CommandBufferImpl>
 {
 public:
-	using Base = GlHandle<GlCommandBuffer>;
+	using Base = GlHandle<CommandBufferImpl>;
 	using UserCallback = Error(*)(void*);
 
-	GlCommandBufferHandle();
+	CommandBufferHandle();
 
-	~GlCommandBufferHandle();
+	~CommandBufferHandle();
 
 	/// Create command buffer
 	ANKI_USE_RESULT Error create(GlDevice* gl, 
-		GlCommandBufferInitHints hints = GlCommandBufferInitHints());
+		CommandBufferImplInitHints hints = CommandBufferImplInitHints());
 
 	/// Add a user command at the end of the command buffer
 	void pushBackUserCommand(UserCallback callback, void* data);
 
 	/// Add another command buffer for execution
-	void pushBackOtherCommandBuffer(GlCommandBufferHandle& commands);
+	void pushBackOtherCommandBuffer(CommandBufferHandle& commands);
 
 	/// Flush command buffer for deffered execution.
 	void flush();
@@ -48,7 +45,7 @@ public:
 	void finish();
 
 	/// Compute initialization hints
-	GlCommandBufferInitHints computeInitHints() const
+	CommandBufferImplInitHints computeInitHints() const
 	{
 		return _get().computeInitHints();
 	}
@@ -139,7 +136,7 @@ public:
 	/// @param first The unit where the first texture will be bound.
 	/// @param textures The array of textures.
 	/// @param count The count of textures
-	void bindTextures(U32 first, GlTextureHandle textures[], U32 count);
+	void bindTextures(U32 first, TextureHandle textures[], U32 count);
 	/// @}
 
 	/// @name Drawcalls
@@ -151,19 +148,19 @@ public:
 	void drawArrays(GLenum mode, U32 count, U32 instanceCount = 1,
 		U32 first = 0, U32 baseInstance = 0);
 
-	void drawElementsConditional(GlOcclusionQueryHandle& query, 
+	void drawElementsConditional(OcclusionQueryHandle& query, 
 		GLenum mode, U8 indexSize, 
 		U32 count, U32 instanceCount = 1, U32 firstIndex = 0,
 		U32 baseVertex = 0, U32 baseInstance = 0);
 
-	void drawArraysConditional(GlOcclusionQueryHandle& query,
+	void drawArraysConditional(OcclusionQueryHandle& query,
 		GLenum mode, U32 count, U32 instanceCount = 1,
 		U32 first = 0, U32 baseInstance = 0);
 	/// @}
 
 	/// @name Other operations
 	/// @{
-	void copyTextureToBuffer(GlTextureHandle& from, GlBufferHandle& To);
+	void copyTextureToBuffer(TextureHandle& from, BufferHandle& To);
 	/// @}
 
 	/// @privatesection
@@ -178,12 +175,12 @@ public:
 		return _get().getGlobalAllocator();
 	}
 
-	GlQueue& _getQueue()
+	Queue& _getQueue()
 	{
 		return _get().getQueue();
 	}
 
-	const GlQueue& _getQueue() const
+	const Queue& _getQueue() const
 	{
 		return _get().getQueue();
 	}
@@ -203,7 +200,6 @@ public:
 	}
 	/// @}
 };
-
 /// @}
 
 } // end namespace anki

+ 189 - 0
include/anki/gr/Enums.h

@@ -0,0 +1,189 @@
+// Copyright (C) 2009-2015, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#ifndef ANKI_GL_ENUMS_H
+#define ANKI_GL_ENUMS_H
+
+#include "anki/util/StdTypes.h"
+
+namespace anki {
+
+/// @addtogroup opengl_other
+/// @{
+
+// Some constants
+const U MAX_VERTEX_ATTRIBUTES = 16;
+const U MAX_COLOR_ATTACHMENTS = 4;
+
+// Enums
+enum PrimitiveTopology: U8
+{
+	POINTS,
+	LINES,
+	LINE_STIP,
+	TRIANGLES,
+	TRIANGLE_STRIP,
+	PATCHES
+};
+
+enum class FillMode: U8
+{
+	POINTS,
+	WIREFRAME,
+	SOLID
+};
+
+enum class CullMode: U8
+{
+	NONE,
+	FRONT,
+	BACK,
+	FRONT_AND_BACK
+};
+
+enum class DepthCompareFunction: U8
+{
+	ALWAYS,
+	LESS,
+	EQUAL,
+	LESS_EQUAL,
+	GREATER,
+	GREATER_EQUAL,
+	NOT_EQUAL,
+	NEVER
+};
+
+enum class BlendMethod: U8
+{
+	ZERO,
+	ONE,
+	SRC_COLOR,
+	ONE_MINUS_SRC_COLOR,
+    DEST_COLOR,
+    ONE_MINUS_DEST_COLOR,
+    SRC_ALPHA,
+    ONE_MINUS_SRC_ALPHA,
+    DEST_ALPHA,
+    ONE_MINUS_DEST_ALPHA,
+    CONSTANT_COLOR,
+    ONE_MINUS_CONSTANT_COLOR,
+    CONSTANT_ALPHA,
+    ONE_MINUS_CONSTANT_ALPHA,
+    SRC_ALPHA_SATURATE,
+    SRC1_COLOR,
+    ONE_MINUS_SRC1_COLOR,
+    SRC1_ALPHA,
+    ONE_MINUS_SRC1_ALPHA
+};
+
+enum class BlendFunction: U8
+{
+	ADD,
+	SUBTRACT,
+	REVERSE_SUBTRACT,
+	MIN,
+	MAX
+};
+
+enum class VertexStepRate: U8
+{
+	VERTEX,
+	INSTANCE,
+	DRAW
+};
+
+enum class ComponentFormat: U8
+{
+	R8,
+	R8G8,
+	R8G8B8,
+	R8G8B8A8,
+	R16,
+	R16G16,
+	R16G16B16,
+	R16G16B16A16,
+	R32,
+	R32G32,
+	R32G32B32,
+	R32G32B32A32,
+
+	// Special
+	R10G10B10A2,
+
+	// Compressed
+	R8G8B8_S3TC, ///< DXT1
+	R8G8B8_ETC2,
+	R8G8B8A8_S3TC, ///< DXT5
+	R8G8B8A8_ETC2
+};
+
+enum class TransformFormat: U8
+{
+	UNORM,
+	SNORM,
+	UINT,
+	SINT,
+	FLOAT
+};
+
+enum class ImageType: U8
+{
+	_1D,
+	_2D,
+	_3D,
+	_2D_ARRAY,
+	CUBE
+};
+
+enum class TextureFilter: U8
+{
+	NEAREST,
+	LINEAR,
+	TRILINEAR
+};
+
+enum class ShaderType: U8
+{
+	VERTEX,
+	TESSELLATION_CONTROL,
+	TESSELLATION_EVALUATION,
+	GEOMETRY,
+	FRAGMENT,
+	COMPUTE
+};
+
+enum class ShaderVariableDataType: U8
+{
+	FLOAT,
+	VEC2,
+	VEC3,
+	VEC4,
+	MAT3,
+	MAT4,
+	SAMPLER_2D,
+	SAMPLER_3D,
+	SAMPLER_2D_ARRAY,
+	SAMPLER_CUBE,
+
+	NUMERICS_FIRST = FLOAT,
+	NUMERICS_LAST = MAT4,
+
+	SAMPLERS_FIRST = SAMPLER_2D,
+	SAMPLERS_LAST = SAMPLER_CUBE
+};
+
+/// Format for images and vertex attributes.
+struct PixelFormat
+{
+	ComponentFormat m_components = ComponentFormat::R8;
+	TransformFormat m_transform = TransformFormat::UNORM;
+	Bool8 m_srgb = false;
+};
+/// @}
+
+} // end namespace anki
+
+#endif
+

+ 13 - 16
include/anki/gl/GlFramebufferHandle.h → include/anki/gr/FramebufferHandle.h

@@ -6,27 +6,24 @@
 #ifndef ANKI_GL_GL_FRAMEBUFFER_HANDLE_H
 #define ANKI_GL_GL_FRAMEBUFFER_HANDLE_H
 
-#include "anki/gl/GlContainerHandle.h"
-#include "anki/gl/GlFramebuffer.h"
+#include "anki/gr/GlContainerHandle.h"
+#include "anki/gr/gl/FramebufferImpl.h" // XXX
 
 namespace anki {
 
-// Forward
-class GlCommandBufferHandle;
-
 /// @addtogroup opengl_other
 /// @{
 
 /// Attachment.
 struct GlAttachment
 {
-	GlTextureHandle m_texture;
+	TextureHandle m_texture;
 	U32 m_layer = 0;
 	GlAttachmentLoadOperation m_loadOp;
 	GlAttachmentStoreOperation m_storeOp;
 };
 
-/// GlFramebuffer initializer.
+/// GlFramebuffer initializer. XXX
 struct GlFramebufferInitializer
 {
 	GlAttachment* m_colorAttachments = nullptr;
@@ -35,26 +32,26 @@ struct GlFramebufferInitializer
 };
 
 /// Framebuffer handle
-class GlFramebufferHandle: public GlContainerHandle<GlFramebuffer>
+class FramebufferHandle: public GlContainerHandle<FramebufferImpl>
 {
 public:
-	using Base = GlContainerHandle<GlFramebuffer>;
-	using Attachment = GlFramebuffer::Attachment;
+	using Base = GlContainerHandle<FramebufferImpl>;
+	using Attachment = FramebufferImpl::Attachment;
 	using Initializer = GlFramebufferInitializer;
 
-	GlFramebufferHandle();
+	FramebufferHandle();
 
-	~GlFramebufferHandle();
+	~FramebufferHandle();
 
 	/// Create a framebuffer
 	ANKI_USE_RESULT Error create(
-		GlCommandBufferHandle& commands,
+		CommandBufferHandle& commands,
 		const std::initializer_list<Attachment>& attachments);
 
 	/// Bind it to the state
 	/// @param commands The command buffer
 	/// @param invalidate If true invalidate the FB after binding it
-	void bind(GlCommandBufferHandle& commands, Bool invalidate);
+	void bind(CommandBufferHandle& commands, Bool invalidate);
 
 	/// Blit another framebuffer to this
 	/// @param[in, out] commands The command buffer
@@ -63,8 +60,8 @@ public:
 	/// @param[in] destRect The destination rectangle
 	/// @param attachmentMask The attachments to blit
 	/// @param linear Perform linean filtering
-	void blit(GlCommandBufferHandle& commands,
-		const GlFramebufferHandle& b, 
+	void blit(CommandBufferHandle& commands,
+		const FramebufferHandle& b, 
 		const Array<U32, 4>& sourceRect,
 		const Array<U32, 4>& destRect, 
 		GLbitfield attachmentMask,

+ 21 - 0
include/anki/gl/GlCommon.h → include/anki/gr/GlCommon.h

@@ -32,6 +32,27 @@
 
 namespace anki {
 
+// Forward
+class BufferImpl;
+class BufferHandle;
+class ShaderImpl;
+class ShaderHandle;
+class PipelineImpl;
+class PipelineHandle;
+class FramebufferImpl;
+class FramebufferHandle;
+class TextureImpl;
+class TextureHandle;
+class SamplerImpl;
+class SamplerHandle;
+class OcclusionQueryImpl;
+class OcclusionQueryHandle;
+class ClientBufferImpl;
+class ClientBufferHandle;
+class CommandBufferImpl;
+class CommandBufferHandle;
+class Queue;
+
 /// @addtogroup opengl_private
 /// @{
 

+ 2 - 3
include/anki/gl/GlContainerHandle.h → include/anki/gr/GlContainerHandle.h

@@ -6,8 +6,8 @@
 #ifndef ANKI_GL_GL_CONTAINER_HANDLE_H
 #define ANKI_GL_GL_CONTAINER_HANDLE_H
 
-#include "anki/gl/GlHandle.h"
-#include "anki/gl/GlDevice.h"
+#include "anki/gr/GlHandle.h"
+#include "anki/gr/GlDevice.h"
 
 namespace anki {
 
@@ -46,7 +46,6 @@ protected:
 		return err;
 	}
 };
-
 /// @}
 
 

+ 6 - 8
include/anki/gl/GlDevice.h → include/anki/gr/GlDevice.h

@@ -6,9 +6,8 @@
 #ifndef ANKI_GL_GL_DEVICE_H
 #define ANKI_GL_GL_DEVICE_H
 
-#include "anki/gl/GlCommon.h"
-#include "anki/util/Singleton.h"
-#include "anki/gl/GlQueue.h"
+#include "anki/gr/GlCommon.h"
+#include "anki/gr/gl/Queue.h"
 
 namespace anki {
 
@@ -33,7 +32,7 @@ public:
 		void* allocUserData, 
 		const CString& cacheDir);
 
-	/// Start the queue thread. @see GlQueue::start
+	/// Start the queue thread. @see Queue::start
 	ANKI_USE_RESULT Error startServer(
 		GlMakeCurrentCallback makeCurrentCb, void* makeCurrentCbData, void* ctx,
 		GlCallback swapBuffersCallback, void* swapBuffersCbData,
@@ -55,12 +54,12 @@ public:
 		return m_alloc;
 	}
 
-	GlQueue& _getQueue() 
+	Queue& _getQueue() 
 	{
 		return *m_queue;
 	}
 
-	const GlQueue& _getQueue() const
+	const Queue& _getQueue() const
 	{
 		return *m_queue;
 	}
@@ -73,14 +72,13 @@ public:
 	/// @}
 
 private:
-	GlQueue* m_queue = nullptr;
+	Queue* m_queue = nullptr;
 	HeapAllocator<U8> m_alloc; ///< Keep it last to be deleted last
 	char* m_cacheDir = nullptr;
 	Bool8 m_queueStarted = false;
 
 	void destroy();
 };
-
 /// @}
 
 } // end namespace anki

+ 1 - 1
include/anki/gl/GlError.h → include/anki/gr/GlError.h

@@ -7,7 +7,7 @@
 #define ANKI_GL_GL_ERROR_H
 
 #include "anki/Config.h"
-#include "anki/gl/GlCommon.h"
+#include "anki/gr/GlCommon.h"
 
 namespace anki {
 

+ 1 - 1
include/anki/gl/GlHandle.h → include/anki/gr/GlHandle.h

@@ -6,7 +6,7 @@
 #ifndef ANKI_GL_GL_HANDLE_H
 #define ANKI_GL_GL_HANDLE_H
 
-#include "anki/gl/GlCommon.h"
+#include "anki/gr/GlCommon.h"
 #include "anki/util/Atomic.h"
 
 namespace anki {

+ 3 - 4
include/anki/gl/GlHandleDeferredDeleter.h → include/anki/gr/GlHandleDeferredDeleter.h

@@ -6,8 +6,8 @@
 #ifndef ANKI_GL_GL_HANDLE_DEFERRED_DELETER_H
 #define ANKI_GL_GL_HANDLE_DEFERRED_DELETER_H
 
-#include "anki/gl/GlDevice.h"
-#include "anki/gl/GlCommandBufferHandle.h"
+#include "anki/gr/GlDevice.h"
+#include "anki/gr/CommandBufferHandle.h"
 
 namespace anki {
 
@@ -31,7 +31,7 @@ public:
 		/// If not the server thread then create a command for the server thread
 		if(!manager->_getQueue().isServerThread())
 		{
-			GlCommandBufferHandle commands;
+			CommandBufferHandle commands;
 			
 			Error err = commands.create(manager);
 			if(!err)
@@ -51,7 +51,6 @@ public:
 		}
 	}
 };
-
 /// @}
 
 } // end namespace anki

+ 1 - 2
include/anki/gl/GlSync.h → include/anki/gr/GlSync.h

@@ -6,7 +6,7 @@
 #ifndef ANKI_GL_GL_SYNC_H
 #define ANKI_GL_GL_SYNC_H
 
-#include "anki/gl/GlCommon.h"
+#include "anki/gr/GlCommon.h"
 #include "anki/util/Thread.h"
 
 namespace anki {
@@ -28,7 +28,6 @@ public:
 private:
 	Barrier m_barrier;
 };
-
 /// @}
 
 } // end namespace anki

+ 3 - 4
include/anki/gl/GlSyncHandles.h → include/anki/gr/GlSyncHandles.h

@@ -6,13 +6,12 @@
 #ifndef ANKI_GL_GL_SYNC_HANDLES_H
 #define ANKI_GL_GL_SYNC_HANDLES_H
 
-#include "anki/gl/GlHandle.h"
+#include "anki/gr/GlHandle.h"
 
 namespace anki {
 
 // Forward
 class GlClientSync;
-class GlCommandBufferHandle;
 
 /// @addtogroup opengl_other
 /// @{
@@ -27,11 +26,11 @@ public:
 
 	~GlClientSyncHandle();
 
-	ANKI_USE_RESULT Error create(GlCommandBufferHandle& commands);
+	ANKI_USE_RESULT Error create(CommandBufferHandle& commands);
 
 	/// Fire a command that adds a waits for the client. The client should call 
 	/// wait some time after this call or the server will keep waiting forever
-	void sync(GlCommandBufferHandle& commands);
+	void sync(CommandBufferHandle& commands);
 
 	/// Wait for the server. You need to call sync first or the client will
 	/// keep waiting forever

+ 9 - 12
include/anki/gl/GlOcclusionQueryHandle.h → include/anki/gr/OcclusionQueryHandle.h

@@ -3,38 +3,35 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#ifndef ANKI_GL_GL_OCCLUSION_QUERY_HANDLE_H
-#define ANKI_GL_GL_OCCLUSION_QUERY_HANDLE_H
+#ifndef ANKI_GR_OCCLUSION_QUERY_HANDLE_H
+#define ANKI_GR_OCCLUSION_QUERY_HANDLE_H
 
-#include "anki/gl/GlContainerHandle.h"
+#include "anki/gr/GlContainerHandle.h"
 
 namespace anki {
 
-// Forward
-class GlOcclusionQuery;
-
 /// @addtogroup opengl_other
 /// @{
 
 /// Occlusion query handle.
-class GlOcclusionQueryHandle: public GlContainerHandle<GlOcclusionQuery>
+class OcclusionQueryHandle: public GlContainerHandle<OcclusionQueryImpl>
 {
 public:
-	using Base = GlContainerHandle<GlOcclusionQuery>;
+	using Base = GlContainerHandle<OcclusionQueryImpl>;
 	using ResultBit = GlOcclusionQueryResultBit;
 
-	GlOcclusionQueryHandle();
+	OcclusionQueryHandle();
 
-	~GlOcclusionQueryHandle();
+	~OcclusionQueryHandle();
 
 	/// Create a query.
 	ANKI_USE_RESULT Error create(GlDevice* dev, ResultBit condRenderingBit);
 
 	/// Begin query.
-	void begin(GlCommandBufferHandle& commands);
+	void begin(CommandBufferHandle& commands);
 
 	/// End query.
-	void end(GlCommandBufferHandle& commands);
+	void end(CommandBufferHandle& commands);
 };
 /// @}
 

+ 55 - 0
include/anki/gr/PipelineHandle.h

@@ -0,0 +1,55 @@
+// Copyright (C) 2009-2015, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#ifndef ANKI_GR_PIPELINE_HANDLE_H
+#define ANKI_GR_PIPELINE_HANDLE_H
+
+#include "anki/gr/GlContainerHandle.h"
+
+namespace anki {
+
+/// @addtogroup opengl_other
+/// @{
+
+/// Program pipeline handle
+class PipelineHandle: public GlContainerHandle<PipelineImpl>
+{
+public:
+	using Base = GlContainerHandle<PipelineImpl>;
+
+	PipelineHandle();
+
+	~PipelineHandle();
+
+	/// Create a pipeline
+	ANKI_USE_RESULT Error create(
+		CommandBufferHandle& commands,
+		const ShaderHandle* progsBegin, const ShaderHandle* progsEnd)
+	{
+		return commonConstructor(commands, progsBegin, progsEnd);
+	}
+
+	/// Create using initializer list
+	ANKI_USE_RESULT Error create(
+		CommandBufferHandle& commands,
+		std::initializer_list<ShaderHandle> progs);
+
+	/// Bind it to the state
+	void bind(CommandBufferHandle& commands);
+
+	/// Get an attached program. It may serialize
+	ShaderHandle getAttachedProgram(GLenum type) const;
+
+public:
+	ANKI_USE_RESULT Error commonConstructor(CommandBufferHandle& commands,
+		const ShaderHandle* progsBegin, const ShaderHandle* progsEnd);
+};
+
+/// @}
+
+} // end namespace anki
+
+#endif
+

+ 7 - 11
include/anki/gl/GlShaderHandle.h → include/anki/gr/ShaderHandle.h

@@ -6,30 +6,26 @@
 #ifndef ANKI_GL_GL_SHADER_HANDLE_H
 #define ANKI_GL_GL_SHADER_HANDLE_H
 
-#include "anki/gl/GlContainerHandle.h"
+#include "anki/gr/GlContainerHandle.h"
 
 namespace anki {
 
-// Forward
-class GlShader;
-class GlClientBufferHandle;
-
 /// @addtogroup opengl_containers
 /// @{
 
 /// Program handle
-class GlShaderHandle: public GlContainerHandle<GlShader>
+class ShaderHandle: public GlContainerHandle<ShaderImpl>
 {
 public:
-	using Base = GlContainerHandle<GlShader>;
+	using Base = GlContainerHandle<ShaderImpl>;
 
-	GlShaderHandle();
+	ShaderHandle();
 
-	~GlShaderHandle();
+	~ShaderHandle();
 
 	/// Create shader program.
-	ANKI_USE_RESULT Error create(GlCommandBufferHandle& commands, 
-		GLenum shaderType, const GlClientBufferHandle& source);
+	ANKI_USE_RESULT Error create(CommandBufferHandle& commands, 
+		GLenum shaderType, const ClientBufferHandle& source);
 
 	/// @name Accessors
 	/// They will sync client with server.

+ 87 - 0
include/anki/gr/TextureHandle.h

@@ -0,0 +1,87 @@
+// Copyright (C) 2009-2015, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#ifndef ANKI_GL_GL_TEXTURE_HANDLE_H
+#define ANKI_GL_GL_TEXTURE_HANDLE_H
+
+#include "anki/gr/GlContainerHandle.h"
+#include "anki/gr/ClientBufferHandle.h"
+
+namespace anki {
+
+/// @addtogroup opengl_containers
+/// @{
+
+/// Texture handle
+class TextureHandle: public GlContainerHandle<TextureImpl>
+{
+public:
+	using Base = GlContainerHandle<TextureImpl>;
+
+	using Filter = GlTextureFilter;
+
+	/// Texture handle initializer
+	class Initializer: public GlTextureInitializerBase
+	{
+	public:
+		Array2d<ClientBufferHandle, 
+			ANKI_GL_MAX_MIPMAPS, ANKI_GL_MAX_TEXTURE_LAYERS> m_data;
+	};
+
+	/// Create husk
+	TextureHandle();
+
+	~TextureHandle();
+
+	/// Create the texture
+	Error create(CommandBufferHandle& commands, const Initializer& init);
+
+	/// Bind to a unit
+	void bind(CommandBufferHandle& commands, U32 unit);
+
+	/// Change filtering type
+	void setFilter(CommandBufferHandle& commands, Filter filter);
+
+	/// Generate mips
+	void generateMipmaps(CommandBufferHandle& commands);
+
+	/// Set a texture parameter
+	void setParameter(
+		CommandBufferHandle& commands, GLenum param, GLint value);
+};
+
+/// Sampler handle
+class SamplerHandle: public GlContainerHandle<SamplerImpl>
+{
+public:
+	using Base = GlContainerHandle<SamplerImpl>;
+
+	using Filter = GlTextureFilter;
+
+	/// Create husk
+	SamplerHandle();
+
+	~SamplerHandle();
+
+	/// Create the sampler
+	ANKI_USE_RESULT Error create(CommandBufferHandle& commands);
+
+	/// Bind to a unit
+	void bind(CommandBufferHandle& commands, U32 unit);
+
+	/// Change filtering type
+	void setFilter(CommandBufferHandle& commands, Filter filter);
+
+	/// Set a texture parameter
+	void setParameter(CommandBufferHandle& commands, GLenum param, GLint value);
+
+	/// Bind default sampler
+	static void bindDefault(CommandBufferHandle& commands, U32 unit);
+};
+/// @}
+
+} // end namespace anki
+
+#endif

+ 6 - 7
include/anki/gl/GlBuffer.h → include/anki/gr/gl/BufferImpl.h

@@ -3,10 +3,10 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#ifndef ANKI_GL_GL_BUFFER_H
-#define ANKI_GL_GL_BUFFER_H
+#ifndef ANKI_GR_GL_BUFFER_H
+#define ANKI_GR_GL_BUFFER_H
 
-#include "anki/gl/GlObject.h"
+#include "anki/gr/gl/GlObject.h"
 
 namespace anki {
 
@@ -15,17 +15,17 @@ namespace anki {
 	
 /// A wrapper for OpenGL buffer objects (vertex arrays, texture buffers etc)
 /// to prevent us from making idiotic errors. It's storage immutable
-class GlBuffer: public GlObject
+class BufferImpl: public GlObject
 {
 public:
 	using Base = GlObject;
 
 	/// Default
-	GlBuffer()
+	BufferImpl()
 	{}
 
 	/// It deletes the BO
-	~GlBuffer()
+	~BufferImpl()
 	{
 		destroy();
 	}
@@ -114,7 +114,6 @@ private:
 	/// Delete the BO
 	void destroy();
 };
-
 /// @}
 
 } // end namespace anki

+ 17 - 21
include/anki/gl/GlCommandBuffer.h → include/anki/gr/gl/CommandBufferImpl.h

@@ -3,19 +3,15 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#ifndef ANKI_GL_GL_COMMAND_BUFFER_H
-#define ANKI_GL_GL_COMMAND_BUFFER_H
+#ifndef ANKI_GR_GL_COMMAND_BUFFER_IMPL_H
+#define ANKI_GR_GL_COMMAND_BUFFER_IMPL_H
 
-#include "anki/gl/GlCommon.h"
+#include "anki/gr/GlCommon.h"
 #include "anki/util/Assert.h"
 #include "anki/util/Allocator.h"
 
 namespace anki {
 
-// Forward 
-class GlQueue;
-class GlCommandBuffer;
-
 /// @addtogroup opengl_private
 /// @{
 
@@ -29,7 +25,7 @@ public:
 	{}
 
 	/// Execute command
-	virtual ANKI_USE_RESULT Error operator()(GlCommandBuffer*) = 0;
+	virtual ANKI_USE_RESULT Error operator()(CommandBufferImpl*) = 0;
 };
 
 /// A common command that deletes an object
@@ -47,7 +43,7 @@ public:
 		ANKI_ASSERT(m_ptr);
 	}
 
-	Error operator()(GlCommandBuffer*) override
+	Error operator()(CommandBufferImpl*) override
 	{
 		m_alloc.deleteInstance(m_ptr);
 		return ErrorCode::NONE;
@@ -56,9 +52,9 @@ public:
 
 /// Command buffer initialization hints. They are used to optimize the 
 /// allocators of a command buffer
-class GlCommandBufferInitHints
+class CommandBufferImplInitHints
 {
-	friend class GlCommandBuffer;
+	friend class CommandBufferImpl;
 
 private:
 	enum
@@ -70,13 +66,13 @@ private:
 };
 
 /// A number of GL commands organized in a chain
-class GlCommandBuffer: public NonCopyable
+class CommandBufferImpl: public NonCopyable
 {
 public:
 	/// Default constructor
-	GlCommandBuffer() = default;
+	CommandBufferImpl() = default;
 
-	~GlCommandBuffer()
+	~CommandBufferImpl()
 	{
 		destroy();
 	}
@@ -84,8 +80,8 @@ public:
 	/// Default constructor
 	/// @param server The command buffers server
 	/// @param hints Hints to optimize the command's allocator
-	ANKI_USE_RESULT Error create(GlQueue* server, 
-		const GlCommandBufferInitHints& hints);
+	ANKI_USE_RESULT Error create(Queue* server, 
+		const CommandBufferImplInitHints& hints);
 
 	/// Get he allocator
 	GlCommandBufferAllocator<U8> getAllocator() const
@@ -95,18 +91,18 @@ public:
 
 	GlAllocator<U8> getGlobalAllocator() const;
 
-	GlQueue& getQueue()
+	Queue& getQueue()
 	{
 		return *m_server;
 	}
 
-	const GlQueue& getQueue() const
+	const Queue& getQueue() const
 	{
 		return *m_server;
 	}
 
 	/// Compute initialization hints
-	GlCommandBufferInitHints computeInitHints() const;
+	CommandBufferImplInitHints computeInitHints() const;
 
 	/// Create a new command and add it to the chain
 	template<typename TCommand, typename... TArgs>
@@ -130,7 +126,7 @@ public:
 	}
 
 private:
-	GlQueue* m_server = nullptr;
+	Queue* m_server = nullptr;
 	GlCommand* m_firstCommand = nullptr;
 	GlCommand* m_lastCommand = nullptr;
 	GlCommandBufferAllocator<U8> m_alloc;
@@ -145,7 +141,7 @@ private:
 
 //==============================================================================
 template<typename TCommand, typename... TArgs>
-void GlCommandBuffer::pushBackNewCommand(TArgs&&... args)
+void CommandBufferImpl::pushBackNewCommand(TArgs&&... args)
 {
 	ANKI_ASSERT(m_immutable == false);
 	TCommand* newCommand = m_alloc.template newInstance<TCommand>(

+ 12 - 15
include/anki/gl/GlFramebuffer.h → include/anki/gr/gl/FramebufferImpl.h

@@ -3,22 +3,19 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#ifndef ANKI_GL_GL_FRAMEBUFFER_H
-#define ANKI_GL_GL_FRAMEBUFFER_H
+#ifndef ANKI_GR_GL_FRAMEBUFFER_IMPL_H
+#define ANKI_GR_GL_FRAMEBUFFER_IMPL_H
 
-#include "anki/gl/GlObject.h"
-#include "anki/gl/GlTextureHandle.h"
+#include "anki/gr/gl/GlObject.h"
+#include "anki/gr/TextureHandle.h"
 
 namespace anki {
 
-// Forward
-class GlTexture;
-
 /// @addtogroup opengl_private
 /// @{
 
 /// Framebuffer
-class GlFramebuffer: public GlObject
+class FramebufferImpl: public GlObject
 {
 public:
 	using Base = GlObject;
@@ -32,20 +29,20 @@ public:
 		Attachment()
 		{}
 
-		Attachment(const GlTextureHandle& tex, GLenum point, U32 layer = 0)
+		Attachment(const TextureHandle& tex, GLenum point, U32 layer = 0)
 		:	m_tex(tex), 
 			m_point(point), 
 			m_layer(layer)
 		{}
 
-		GlTextureHandle m_tex;
+		TextureHandle m_tex;
 		GLenum m_point;
 		U32 m_layer;
 	};
 
-	GlFramebuffer() = default;
+	FramebufferImpl() = default;
 
-	~GlFramebuffer()
+	~FramebufferImpl()
 	{
 		destroy();
 	}
@@ -60,15 +57,15 @@ public:
 	void bind(Bool invalidate);
 
 	/// Blit another framebuffer to this
-	void blit(const GlFramebuffer& fb, const Array<U32, 4>& sourceRect,
+	void blit(const FramebufferImpl& fb, const Array<U32, 4>& sourceRect,
 		const Array<U32, 4>& destRect, GLbitfield attachmentMask, Bool linear);
 
 private:
-	Array<GlTextureHandle, MAX_COLOR_ATTACHMENTS + 1> m_attachments;
+	Array<TextureHandle, MAX_COLOR_ATTACHMENTS + 1> m_attachments;
 	Bool8 m_bindDefault = false;
 
 	/// Attach a texture
-	static void attachTextureInternal(GLenum attachment, const GlTexture& tex, 
+	static void attachTextureInternal(GLenum attachment, const TextureImpl& tex, 
 		const U32 layer);
 
 	/// Create the FBO

+ 3 - 4
include/anki/gl/GlObject.h → include/anki/gr/gl/GlObject.h

@@ -3,10 +3,10 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#ifndef ANKI_GL_GL_OBJECT_H
-#define ANKI_GL_GL_OBJECT_H
+#ifndef ANKI_GR_GL_OBJECT_H
+#define ANKI_GR_GL_OBJECT_H
 
-#include "anki/gl/GlCommon.h"
+#include "anki/gr/GlCommon.h"
 
 namespace anki {
 
@@ -44,7 +44,6 @@ public:
 protected:
 	GLuint m_glName; ///< OpenGL name
 };
-
 /// @}
 
 } // end namespace anki

+ 6 - 6
include/anki/gl/GlOcclusionQuery.h → include/anki/gr/gl/OcclusionQueryImpl.h

@@ -3,10 +3,10 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#ifndef ANKI_GL_GL_OCCLUSION_QUERY_H
-#define ANKI_GL_GL_OCCLUSION_QUERY_H
+#ifndef ANKI_GR_GL_OCCLUSION_QUERY_H
+#define ANKI_GR_GL_OCCLUSION_QUERY_H
 
-#include "anki/gl/GlObject.h"
+#include "anki/gr/gl/GlObject.h"
 
 namespace anki {
 
@@ -14,7 +14,7 @@ namespace anki {
 /// @{
 
 /// Occlusion query.
-class GlOcclusionQuery: public GlObject
+class OcclusionQueryImpl: public GlObject
 {
 public:
 	using Base = GlObject;
@@ -26,9 +26,9 @@ public:
 		NOT_VISIBLE
 	};
 
-	GlOcclusionQuery() = default;
+	OcclusionQueryImpl() = default;
 
-	~GlOcclusionQuery()
+	~OcclusionQueryImpl()
 	{
 		destroy();
 	}

+ 9 - 10
include/anki/gl/GlPipeline.h → include/anki/gr/gl/PipelineImpl.h

@@ -6,8 +6,8 @@
 #ifndef ANKI_GL_GL_PIPELINE_H
 #define ANKI_GL_GL_PIPELINE_H
 
-#include "anki/gl/GlObject.h"
-#include "anki/gl/GlShaderHandle.h"
+#include "anki/gr/gl/GlObject.h"
+#include "anki/gr/ShaderHandle.h"
 
 namespace anki {
 
@@ -15,39 +15,38 @@ namespace anki {
 /// @{
 
 /// Program pipeline
-class GlPipeline: public GlObject
+class PipelineImpl: public GlObject
 {
 public:
 	using Base = GlObject;
 
-	GlPipeline() = default;
+	PipelineImpl() = default;
 
-	~GlPipeline()
+	~PipelineImpl()
 	{
 		destroy();
 	}
 
 	ANKI_USE_RESULT Error create(
-		const GlShaderHandle* progsBegin, const GlShaderHandle* progsEnd,
+		const ShaderHandle* progsBegin, const ShaderHandle* progsEnd,
 		GlAllocator<U8> alloc);
 
-	GlShaderHandle getAttachedProgram(GLenum type) const;
+	ShaderHandle getAttachedProgram(GLenum type) const;
 
 	/// Bind the pipeline to the state
 	void bind();
 
 private:
-	Array<GlShaderHandle, 6> m_shaders;
+	Array<ShaderHandle, 6> m_shaders;
 
 	/// Create pipeline object
 	void createPpline();
 
 	/// Attach all the programs
-	void attachProgramsInternal(const GlShaderHandle* progs, PtrSize count);
+	void attachProgramsInternal(const ShaderHandle* progs, PtrSize count);
 
 	void destroy();
 };
-
 /// @}
 
 } // end namespace anki

+ 16 - 17
include/anki/gl/GlQueue.h → include/anki/gr/gl/Queue.h

@@ -3,12 +3,12 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#ifndef ANKI_GL_GL_QUEUE_H
-#define ANKI_GL_GL_QUEUE_H
+#ifndef ANKI_GR_GL_QUEUE_H
+#define ANKI_GR_GL_QUEUE_H
 
-#include "anki/gl/GlCommandBufferHandle.h"
-#include "anki/gl/GlSyncHandles.h"
-#include "anki/gl/GlState.h"
+#include "anki/gr/CommandBufferHandle.h"
+#include "anki/gr/GlSyncHandles.h"
+#include "anki/gr/gl/State.h"
 #include "anki/util/Thread.h"
 
 namespace anki {
@@ -21,13 +21,13 @@ class GlDevice;
 
 /// Command queue. It's essentialy a queue of command buffers waiting for 
 /// execution and a server
-class GlQueue
+class Queue
 {
 public:
-	GlQueue(GlDevice* device, 
+	Queue(GlDevice* device, 
 		AllocAlignedCallback alloc, void* allocUserData);
 
-	~GlQueue();
+	~Queue();
 
 	GlDevice& getDevice()
 	{
@@ -51,12 +51,12 @@ public:
 		return m_allocCbUserData;
 	}
 
-	GlState& getState()
+	State& getState()
 	{
 		return m_state;
 	}
 
-	const GlState& getState() const
+	const State& getState() const
 	{
 		return m_state;
 	}
@@ -77,10 +77,10 @@ public:
 	void stop();
 
 	/// Push a command buffer to the queue for deferred execution
-	void flushCommandBuffer(GlCommandBufferHandle& commands);
+	void flushCommandBuffer(CommandBufferHandle& commands);
 
 	/// Push a command buffer to the queue and wait for it
-	void finishCommandBuffer(GlCommandBufferHandle& commands);
+	void finishCommandBuffer(CommandBufferHandle& commands);
 
 	/// Sync the client and server
 	void syncClientServer();
@@ -99,7 +99,7 @@ private:
 	AllocAlignedCallback m_allocCb;
 	void* m_allocCbUserData;
 
-	Array<GlCommandBufferHandle, 128> m_queue; ///< Command queue
+	Array<CommandBufferHandle, 128> m_queue; ///< Command queue
 	U64 m_tail; ///< Tail of queue
 	U64 m_head; ///< Head of queue. Points to the end
 	U8 m_renderingThreadSignal; ///< Signal to the thread
@@ -111,7 +111,7 @@ private:
 	void* m_ctx = nullptr; ///< Pointer to the system GL context
 	GlMakeCurrentCallback m_makeCurrentCb; ///< Making a context current
 
-	GlCommandBufferHandle m_swapBuffersCommands;
+	CommandBufferHandle m_swapBuffersCommands;
 	GlCallback m_swapBuffersCallback;
 	void* m_swapBuffersCbData;
 	ConditionVariable m_frameCondVar;
@@ -120,12 +120,12 @@ private:
 
 	Thread::Id m_serverThreadId;
 	
-	GlState m_state;
+	State m_state;
 	GLuint m_defaultVao;
 
 	/// A special command buffer that is called every time we want to wait for 
 	/// the server
-	GlCommandBufferHandle m_syncCommands;
+	CommandBufferHandle m_syncCommands;
 	GlClientSyncHandle m_sync;
 
 	GLuint m_copyFbo = MAX_U32; ///< FBO for copying from tex to buffer.
@@ -138,7 +138,6 @@ private:
 
 	static Error swapBuffersInternal(void* self);
 };
-
 /// @}
 
 } // end namespace anki

+ 6 - 6
include/anki/gl/GlShader.h → include/anki/gr/gl/ShaderImpl.h

@@ -3,10 +3,10 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#ifndef ANKI_GL_GL_SHADER_H
-#define ANKI_GL_GL_SHADER_H
+#ifndef ANKI_GR_GL_SHADER_IMPL_H
+#define ANKI_GR_GL_SHADER_IMPL_H
 
-#include "anki/gl/GlObject.h"
+#include "anki/gr/gl/GlObject.h"
 
 namespace anki {
 
@@ -15,7 +15,7 @@ namespace anki {
 
 /// Shader program. It only contains a single shader and it can be combined 
 /// with other programs in a program pipiline.
-class GlShader: public GlObject
+class ShaderImpl: public GlObject
 {
 	friend class GlProgramVariable;
 	friend class GlProgramBlock;
@@ -23,9 +23,9 @@ class GlShader: public GlObject
 public:
 	using Base = GlObject;
 
-	GlShader() = default;
+	ShaderImpl() = default;
 
-	~GlShader()
+	~ShaderImpl()
 	{
 		destroy();
 	}

+ 4 - 5
include/anki/gl/GlState.h → include/anki/gr/gl/State.h

@@ -6,7 +6,7 @@
 #ifndef ANKI_GL_GL_STATE_H
 #define ANKI_GL_GL_STATE_H
 
-#include "anki/gl/GlCommon.h"
+#include "anki/gr/GlCommon.h"
 
 namespace anki {
 
@@ -14,7 +14,7 @@ namespace anki {
 /// @{
 
 /// Knowing the ventor allows some optimizations
-enum class GlGpu: U8
+enum class GpuVendor: U8
 {
 	UNKNOWN,
 	ARM,
@@ -23,11 +23,11 @@ enum class GlGpu: U8
 
 /// Part of the global state. It's essentialy a cache of the state mainly used
 /// for optimizations and other stuff
-class GlState
+class State
 {
 public:
 	I32 m_version = -1; ///< Minor major GL version. Something like 430
-	GlGpu m_gpu = GlGpu::UNKNOWN;
+	GpuVendor m_gpu = GpuVendor::UNKNOWN;
 	U32 m_texUnitsCount = 0;
 	Bool8 m_registerMessages = false;
 	U32 m_uniBuffOffsetAlignment = 0;
@@ -48,7 +48,6 @@ public:
 	/// Call this from the server
 	void init();
 };
-
 /// @}
 
 } // end namespace anki

+ 7 - 8
include/anki/gl/GlTexture.h → include/anki/gr/gl/TextureImpl.h

@@ -6,7 +6,7 @@
 #ifndef ANKI_GL_GL_TEXTURE_H
 #define ANKI_GL_GL_TEXTURE_H
 
-#include "anki/gl/GlObject.h"
+#include "anki/gr/gl/GlObject.h"
 #include "anki/util/Array.h"
 
 namespace anki {
@@ -15,7 +15,7 @@ namespace anki {
 /// @{
 
 /// Texture container
-class GlTexture: public GlObject
+class TextureImpl: public GlObject
 {
 public:
 	using Base = GlObject;
@@ -42,9 +42,9 @@ public:
 		}
 	};
 
-	GlTexture() = default;
+	TextureImpl() = default;
 
-	~GlTexture()
+	~TextureImpl()
 	{
 		destroy();
 	}
@@ -128,15 +128,15 @@ private:
 };
 
 /// Sampler container
-class GlSampler: public GlObject
+class SamplerImpl: public GlObject
 {
 public:
 	using Base = GlObject;
 	using Filter = GlTextureFilter;
 
-	GlSampler() = default;
+	SamplerImpl() = default;
 
-	~GlSampler()
+	~SamplerImpl()
 	{
 		destroy();
 	}
@@ -181,7 +181,6 @@ private:
 		}
 	}
 };
-
 /// @}
 
 } // end namespace anki

+ 1 - 1
include/anki/resource/ProgramPrePreprocessor.h

@@ -9,7 +9,7 @@
 #include "anki/resource/ResourceManager.h"
 #include "anki/util/StdTypes.h"
 #include "anki/util/StringList.h"
-#include "anki/gl/GlCommon.h"
+#include "anki/gr/GlCommon.h"
 
 namespace anki {
 

+ 1 - 1
include/anki/ui/UiPainter.h

@@ -7,7 +7,7 @@
 #define ANKI_UI_UI_PAINTER_H
 
 #include "anki/ui/UiCommon.h"
-#include "anki/gl/Gl.h"
+#include "anki/gr/Gl.h"
 
 namespace anki {
 

+ 1 - 1
include/anki/ui/UiPainterDevice.h

@@ -6,7 +6,7 @@
 #ifndef ANKI_UI_UI_PAINTER_DEVICE_H
 #define ANKI_UI_UI_PAINTER_DEVICE_H
 
-#include "anki/gl/Fbo.h"
+#include "anki/gr/Fbo.h"
 #include "anki/Math.h"
 
 namespace anki {

+ 24 - 21
include/anki/util/File.h

@@ -97,27 +97,7 @@ public:
 	/// Read all the contents of a text file
 	/// If the file is not rewined it will probably fail
 	template<typename TAlloc>
-	ANKI_USE_RESULT Error readAllText(TAlloc alloc, StringBase<TAlloc>& out)
-	{
-		Error err = ErrorCode::NONE;
-		PtrSize size = getSize();
-
-		if(size != 0)
-		{
-			err = out.create(alloc, '?', size);
-
-			if(!err)
-			{
-				err = read(&out[0], size);
-			}
-		}
-		else
-		{
-			err = ErrorCode::FUNCTION_FAILED;
-		}
-		
-		return err;
-	}
+	ANKI_USE_RESULT Error readAllText(TAlloc alloc, StringBase<TAlloc>& out);
 
 	/// Read 32bit unsigned integer. Set the endianness if the file's 
 	/// endianness is different from the machine's
@@ -188,6 +168,29 @@ private:
 	}
 };
 
+//==============================================================================
+template<typename TAlloc>
+inline Error File::readAllText(TAlloc alloc, StringBase<TAlloc>& out)
+{
+	Error err = ErrorCode::NONE;
+	PtrSize size = getSize();
+
+	if(size != 0)
+	{
+		err = out.create(alloc, '?', size);
+
+		if(!err)
+		{
+			err = read(&out[0], size);
+		}
+	}
+	else
+	{
+		err = ErrorCode::FUNCTION_FAILED;
+	}
+	
+	return err;
+}
 /// @}
 
 } // end namespace anki

+ 2 - 2
src/CMakeLists.txt

@@ -21,7 +21,7 @@ endif()
 #
 # Add anki sub libraries
 #
-set(ANKI_SUB_DIRS core script renderer scene event input physics resource misc gl collision math util)
+set(ANKI_SUB_DIRS core script renderer scene event input physics resource misc gr collision math util)
 
 set(ANKI_LIBS "")
 
@@ -35,7 +35,7 @@ endif()
 
 add_library(anki Dummy.cpp "${_SYS_SRC}")
 
-target_link_libraries(anki ankicore ankiscript ankirenderer ankiscene ankievent ankiinput ankiphysics ankiresource ankimisc ankigl ankicollision ankimath ankiutil ankitinyxml2 ankilua ankiz ankinewton ${LIB_SDL} ${ANKI_GPERFTOOLS_LIBS} ${_SYS})
+target_link_libraries(anki ankicore ankiscript ankirenderer ankiscene ankievent ankiinput ankiphysics ankiresource ankimisc ankigr ankicollision ankimath ankiutil ankitinyxml2 ankilua ankiz ankinewton ${LIB_SDL} ${ANKI_GPERFTOOLS_LIBS} ${_SYS})
 
 set_target_properties(anki PROPERTIES LINKER_LANGUAGE CXX)
 

+ 0 - 5
src/gl/CMakeLists.txt

@@ -1,5 +0,0 @@
-file(GLOB_RECURSE ANKI_GL_SOURCES *.cpp)
-file(GLOB_RECURSE ANKI_GL_HEADERS *.h)
-
-add_library(ankigl ${ANKI_GL_SOURCES} ${ANKI_GL_HEADERS})
-target_link_libraries(ankigl ankiutil)

+ 5 - 0
src/gr/CMakeLists.txt

@@ -0,0 +1,5 @@
+file(GLOB_RECURSE ANKI_GR_SOURCES *.cpp)
+file(GLOB_RECURSE ANKI_GR_HEADERS *.h)
+
+add_library(ankigr ${ANKI_GR_SOURCES} ${ANKI_GR_HEADERS})
+target_link_libraries(ankigr ankiutil)

+ 11 - 11
src/gl/GlClientBufferHandle.cpp → src/gr/ClientBufferHandle.cpp

@@ -3,30 +3,30 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlClientBufferHandle.h"
-#include "anki/gl/GlClientBuffer.h"
-#include "anki/gl/GlCommandBufferHandle.h"
-#include "anki/gl/GlDevice.h"
+#include "anki/gr/ClientBufferHandle.h"
+#include "anki/gr/ClientBufferImpl.h"
+#include "anki/gr/CommandBufferHandle.h"
+#include "anki/gr/GlDevice.h"
 #include "anki/core/Counters.h"
 
 namespace anki {
 
 //==============================================================================
-GlClientBufferHandle::GlClientBufferHandle()
+ClientBufferHandle::ClientBufferHandle()
 {}
 
 //==============================================================================
-GlClientBufferHandle::~GlClientBufferHandle()
+ClientBufferHandle::~ClientBufferHandle()
 {}
 
 //==============================================================================
-Error GlClientBufferHandle::create(
-	GlCommandBufferHandle& commands, PtrSize size, void* preallocatedMem)
+Error ClientBufferHandle::create(
+	CommandBufferHandle& commands, PtrSize size, void* preallocatedMem)
 {
 	ANKI_ASSERT(!isCreated());
 
 	using Deleter = GlHandleDefaultDeleter<
-		GlClientBuffer, GlCommandBufferAllocator<GlClientBuffer>>;
+		ClientBufferImpl, GlCommandBufferAllocator<ClientBufferImpl>>;
 
 	auto alloc = commands._getAllocator();
 	Error err = _createSimple(alloc, Deleter());
@@ -49,13 +49,13 @@ Error GlClientBufferHandle::create(
 }
 
 //==============================================================================
-void* GlClientBufferHandle::getBaseAddress()
+void* ClientBufferHandle::getBaseAddress()
 {
 	return _get().getBaseAddress();
 }
 
 //==============================================================================
-PtrSize GlClientBufferHandle::getSize() const
+PtrSize ClientBufferHandle::getSize() const
 {
 	return _get().getSize();
 }

+ 1 - 1
src/gl/GlCommon.cpp → src/gr/GlCommon.cpp

@@ -3,7 +3,7 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlCommon.h"
+#include "anki/gr/GlCommon.h"
 
 namespace anki {
 

+ 3 - 3
src/gl/GlDevice.cpp → src/gr/GlDevice.cpp

@@ -3,7 +3,7 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlDevice.h"
+#include "anki/gr/GlDevice.h"
 #include "anki/core/Timestamp.h"
 #include <cstring>
 
@@ -22,7 +22,7 @@ Error GlDevice::create(
 	std::memcpy(m_cacheDir, &cacheDir[0], len + 1);
 
 	// Create queue
-	m_queue = m_alloc.newInstance<GlQueue>(
+	m_queue = m_alloc.newInstance<Queue>(
 		this, alloc, allocUserData);
 
 #if ANKI_QUEUE_DISABLE_ASYNC
@@ -86,7 +86,7 @@ void GlDevice::swapBuffers()
 //==============================================================================
 PtrSize GlDevice::getBufferOffsetAlignment(GLenum target) const
 {
-	const GlState& state = m_queue->getState();
+	const State& state = m_queue->getState();
 
 	if(target == GL_UNIFORM_BUFFER)
 	{

+ 1 - 1
src/gl/GlError.cpp → src/gr/GlError.cpp

@@ -3,7 +3,7 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlError.h"
+#include "anki/gr/GlError.h"
 #include "anki/util/Logger.h"
 #include <cstring>
 

+ 1 - 1
src/gl/GlSync.cpp → src/gr/GlSync.cpp

@@ -3,7 +3,7 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlSync.h"
+#include "anki/gr/GlSync.h"
 #include "anki/util/Logger.h"
 
 namespace anki {

+ 7 - 7
src/gl/GlSyncHandles.cpp → src/gr/GlSyncHandles.cpp

@@ -3,10 +3,10 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlSyncHandles.h"
-#include "anki/gl/GlSync.h"
-#include "anki/gl/GlCommandBufferHandle.h"
-#include "anki/gl/GlDevice.h"
+#include "anki/gr/GlSyncHandles.h"
+#include "anki/gr/GlSync.h"
+#include "anki/gr/CommandBufferHandle.h"
+#include "anki/gr/GlDevice.h"
 #include "anki/core/Counters.h"
 
 
@@ -23,7 +23,7 @@ public:
 	:	m_sync(s)
 	{}
 
-	Error operator()(GlCommandBuffer*)
+	Error operator()(CommandBufferImpl*)
 	{
 		ANKI_COUNTER_START_TIMER(GL_SERVER_WAIT_TIME);
 		m_sync._get().wait();
@@ -42,7 +42,7 @@ GlClientSyncHandle::~GlClientSyncHandle()
 {}
 
 //==============================================================================
-Error GlClientSyncHandle::create(GlCommandBufferHandle& commands)
+Error GlClientSyncHandle::create(CommandBufferHandle& commands)
 {
 	auto alloc = commands._getGlobalAllocator();
 
@@ -54,7 +54,7 @@ Error GlClientSyncHandle::create(GlCommandBufferHandle& commands)
 }
 
 //==============================================================================
-void GlClientSyncHandle::sync(GlCommandBufferHandle& commands)
+void GlClientSyncHandle::sync(CommandBufferHandle& commands)
 {
 	commands._pushBackNewCommand<GlClientSyncWaitCommand>(*this);
 }

+ 21 - 21
src/gl/GlOcclusionQueryHandle.cpp → src/gr/OcclusionQueryHandle.cpp

@@ -3,35 +3,35 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlOcclusionQueryHandle.h"
-#include "anki/gl/GlOcclusionQuery.h"
-#include "anki/gl/GlHandleDeferredDeleter.h"
+#include "anki/gr/OcclusionQueryHandle.h"
+#include "anki/gr/gl/OcclusionQueryImpl.h"
+#include "anki/gr/GlHandleDeferredDeleter.h"
 
 namespace anki {
 
 //==============================================================================
-GlOcclusionQueryHandle::GlOcclusionQueryHandle()
+OcclusionQueryHandle::OcclusionQueryHandle()
 {}
 
 //==============================================================================
-GlOcclusionQueryHandle::~GlOcclusionQueryHandle()
+OcclusionQueryHandle::~OcclusionQueryHandle()
 {}
 
 //==============================================================================
-Error GlOcclusionQueryHandle::create(GlDevice* dev, ResultBit condRenderingBit)
+Error OcclusionQueryHandle::create(GlDevice* dev, ResultBit condRenderingBit)
 {
 	class Command: public GlCommand
 	{
 	public:	
-		GlOcclusionQueryHandle m_handle;
+		OcclusionQueryHandle m_handle;
 		ResultBit m_condRenderingBit;
 
-		Command(GlOcclusionQueryHandle& handle, ResultBit condRenderingBit)
+		Command(OcclusionQueryHandle& handle, ResultBit condRenderingBit)
 		:	m_handle(handle),
 			m_condRenderingBit(condRenderingBit)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
 			Error err = m_handle._get().create(m_condRenderingBit);
 
@@ -44,12 +44,12 @@ Error GlOcclusionQueryHandle::create(GlDevice* dev, ResultBit condRenderingBit)
 		}
 	};
 
-	using Alloc = GlAllocator<GlOcclusionQuery>;
-	using DeleteCommand = GlDeleteObjectCommand<GlOcclusionQuery, Alloc>;
+	using Alloc = GlAllocator<OcclusionQueryImpl>;
+	using DeleteCommand = GlDeleteObjectCommand<OcclusionQueryImpl, Alloc>;
 	using Deleter = 
-		GlHandleDeferredDeleter<GlOcclusionQuery, Alloc, DeleteCommand>;
+		GlHandleDeferredDeleter<OcclusionQueryImpl, Alloc, DeleteCommand>;
 
-	GlCommandBufferHandle cmd;
+	CommandBufferHandle cmd;
 	Error err = cmd.create(dev);
 
 	if(!err)
@@ -69,18 +69,18 @@ Error GlOcclusionQueryHandle::create(GlDevice* dev, ResultBit condRenderingBit)
 }
 
 //==============================================================================
-void GlOcclusionQueryHandle::begin(GlCommandBufferHandle& commands)
+void OcclusionQueryHandle::begin(CommandBufferHandle& commands)
 {
 	class Command: public GlCommand
 	{
 	public:
-		GlOcclusionQueryHandle m_handle;
+		OcclusionQueryHandle m_handle;
 
-		Command(GlOcclusionQueryHandle& handle)
+		Command(OcclusionQueryHandle& handle)
 		:	m_handle(handle)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
 			m_handle._get().begin();
 			return ErrorCode::NONE;
@@ -91,18 +91,18 @@ void GlOcclusionQueryHandle::begin(GlCommandBufferHandle& commands)
 }
 
 //==============================================================================
-void GlOcclusionQueryHandle::end(GlCommandBufferHandle& commands)
+void OcclusionQueryHandle::end(CommandBufferHandle& commands)
 {
 	class Command: public GlCommand
 	{
 	public:
-		GlOcclusionQueryHandle m_handle;
+		OcclusionQueryHandle m_handle;
 
-		Command(GlOcclusionQueryHandle& handle)
+		Command(OcclusionQueryHandle& handle)
 		:	m_handle(handle)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
 			m_handle._get().end();
 			return ErrorCode::NONE;

+ 45 - 45
src/gl/GlBufferHandle.cpp → src/gr/gl/BufferHandle.cpp

@@ -3,11 +3,11 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlBufferHandle.h"
-#include "anki/gl/GlHandleDeferredDeleter.h"
-#include "anki/gl/GlClientBufferHandle.h"
-#include "anki/gl/GlBuffer.h"
-#include "anki/gl/GlDevice.h"
+#include "anki/gr/BufferHandle.h"
+#include "anki/gr/GlHandleDeferredDeleter.h"
+#include "anki/gr/ClientBufferHandle.h"
+#include "anki/gr/gl/BufferImpl.h"
+#include "anki/gr/GlDevice.h"
 
 namespace anki {
 
@@ -16,15 +16,15 @@ namespace anki {
 class GlBufferCreateCommand: public GlCommand
 {
 public:
-	GlBufferHandle m_buff;
+	BufferHandle m_buff;
 	GLenum m_target;
-	GlClientBufferHandle m_data;
+	ClientBufferHandle m_data;
 	PtrSize m_size;
 	GLbitfield m_flags;
 	Bool8 m_empty;
 
 	GlBufferCreateCommand(
-		GlBufferHandle buff, GLenum target, GlClientBufferHandle data, 
+		BufferHandle buff, GLenum target, ClientBufferHandle data, 
 		GLenum flags)
 	:	m_buff(buff), 
 		m_target(target), 
@@ -34,7 +34,7 @@ public:
 	{}
 
 	GlBufferCreateCommand(
-		GlBufferHandle buff, GLenum target, PtrSize size, GLenum flags)
+		BufferHandle buff, GLenum target, PtrSize size, GLenum flags)
 	:	m_buff(buff), 
 		m_target(target), 
 		m_size(size), 
@@ -42,7 +42,7 @@ public:
 		m_empty(true)
 	{}
 
-	Error operator()(GlCommandBuffer*)
+	Error operator()(CommandBufferImpl*)
 	{
 		Error err = ErrorCode::NONE;
 
@@ -67,25 +67,25 @@ public:
 };
 
 //==============================================================================
-GlBufferHandle::GlBufferHandle()
+BufferHandle::BufferHandle()
 {}
 
 //==============================================================================
-GlBufferHandle::~GlBufferHandle()
+BufferHandle::~BufferHandle()
 {}
 
 //==============================================================================
-Error GlBufferHandle::create(GlCommandBufferHandle& commands,
-	GLenum target, GlClientBufferHandle& data, GLenum flags)
+Error BufferHandle::create(CommandBufferHandle& commands,
+	GLenum target, ClientBufferHandle& data, GLenum flags)
 {
 	ANKI_ASSERT(!isCreated());
 
-	using Alloc = GlAllocator<GlBuffer>;
+	using Alloc = GlAllocator<BufferImpl>;
 
 	using DeleteCommand = 
-		GlDeleteObjectCommand<GlBuffer, GlAllocator<U8>>;
+		GlDeleteObjectCommand<BufferImpl, GlAllocator<U8>>;
 
-	using Deleter = GlHandleDeferredDeleter<GlBuffer, Alloc, DeleteCommand>;
+	using Deleter = GlHandleDeferredDeleter<BufferImpl, Alloc, DeleteCommand>;
 
 	Error err = _createAdvanced(
 		&commands._getQueue().getDevice(),
@@ -105,17 +105,17 @@ Error GlBufferHandle::create(GlCommandBufferHandle& commands,
 }
 
 //==============================================================================
-Error GlBufferHandle::create(GlCommandBufferHandle& commands,
+Error BufferHandle::create(CommandBufferHandle& commands,
 	GLenum target, PtrSize size, GLenum flags)
 {
 	ANKI_ASSERT(!isCreated());
 
-	using Alloc = GlAllocator<GlBuffer>;
+	using Alloc = GlAllocator<BufferImpl>;
 
 	using DeleteCommand = 
-		GlDeleteObjectCommand<GlBuffer, GlAllocator<U8>>;
+		GlDeleteObjectCommand<BufferImpl, GlAllocator<U8>>;
 
-	using Deleter = GlHandleDeferredDeleter<GlBuffer, Alloc, DeleteCommand>;
+	using Deleter = GlHandleDeferredDeleter<BufferImpl, Alloc, DeleteCommand>;
 
 	Error err = _createAdvanced(
 		&commands._getQueue().getDevice(),
@@ -135,26 +135,26 @@ Error GlBufferHandle::create(GlCommandBufferHandle& commands,
 }
 
 //==============================================================================
-void GlBufferHandle::write(GlCommandBufferHandle& commands, 
-	GlClientBufferHandle& data, PtrSize readOffset, PtrSize writeOffset, 
+void BufferHandle::write(CommandBufferHandle& commands, 
+	ClientBufferHandle& data, PtrSize readOffset, PtrSize writeOffset, 
 	PtrSize size)
 {
 	class Command: public GlCommand
 	{
 	public:
-		GlBufferHandle m_buff;
-		GlClientBufferHandle m_data;
+		BufferHandle m_buff;
+		ClientBufferHandle m_data;
 		PtrSize m_readOffset;
 		PtrSize m_writeOffset;
 		PtrSize m_size;
 
-		Command(GlBufferHandle& buff, GlClientBufferHandle& data, 
+		Command(BufferHandle& buff, ClientBufferHandle& data, 
 			PtrSize readOffset, PtrSize writeOffset, PtrSize size)
 			:	m_buff(buff), m_data(data), m_readOffset(readOffset), 
 				m_writeOffset(writeOffset), m_size(size)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
 			ANKI_ASSERT(m_readOffset + m_size <= m_data.getSize());
 
@@ -173,22 +173,22 @@ void GlBufferHandle::write(GlCommandBufferHandle& commands,
 }
 
 //==============================================================================
-void GlBufferHandle::bindShaderBufferInternal(GlCommandBufferHandle& commands,
+void BufferHandle::bindShaderBufferInternal(CommandBufferHandle& commands,
 	I32 offset, I32 size, U32 bindingPoint)
 {
 	class Command: public GlCommand
 	{
 	public:
-		GlBufferHandle m_buff;
+		BufferHandle m_buff;
 		I32 m_offset;
 		I32 m_size;
 		U8 m_binding;
 
-		Command(GlBufferHandle& buff, I32 offset, I32 size, U8 binding)
+		Command(BufferHandle& buff, I32 offset, I32 size, U8 binding)
 			: m_buff(buff), m_offset(offset), m_size(size), m_binding(binding)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
 			U32 offset = (m_offset != -1) ? m_offset : 0;
 			U32 size = (m_size != -1) ? m_size : m_buff._get().getSize();
@@ -204,8 +204,8 @@ void GlBufferHandle::bindShaderBufferInternal(GlCommandBufferHandle& commands,
 }
 
 //==============================================================================
-void GlBufferHandle::bindVertexBuffer(
-	GlCommandBufferHandle& commands, 
+void BufferHandle::bindVertexBuffer(
+	CommandBufferHandle& commands, 
 	U32 elementSize,
 	GLenum type,
 	Bool normalized,
@@ -216,7 +216,7 @@ void GlBufferHandle::bindVertexBuffer(
 	class Command: public GlCommand
 	{
 	public:
-		GlBufferHandle m_buff;
+		BufferHandle m_buff;
 		U32 m_elementSize;
 		GLenum m_type;
 		Bool8 m_normalized;
@@ -224,7 +224,7 @@ void GlBufferHandle::bindVertexBuffer(
 		U32 m_offset;
 		U32 m_attribLocation;
 
-		Command(GlBufferHandle& buff, U32 elementSize, GLenum type, 
+		Command(BufferHandle& buff, U32 elementSize, GLenum type, 
 			Bool8 normalized, U32 stride, U32 offset, U32 attribLocation)
 		:	m_buff(buff), 
 			m_elementSize(elementSize), 
@@ -237,9 +237,9 @@ void GlBufferHandle::bindVertexBuffer(
 			ANKI_ASSERT(m_elementSize != 0);
 		}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
-			GlBuffer& buff = m_buff._get();
+			BufferImpl& buff = m_buff._get();
 			ANKI_ASSERT(m_offset < m_buff.getSize());
 			
 			buff.setTarget(GL_ARRAY_BUFFER);
@@ -264,20 +264,20 @@ void GlBufferHandle::bindVertexBuffer(
 }
 
 //==============================================================================
-void GlBufferHandle::bindIndexBuffer(GlCommandBufferHandle& commands)
+void BufferHandle::bindIndexBuffer(CommandBufferHandle& commands)
 {
 	class Command: public GlCommand
 	{
 	public:
-		GlBufferHandle m_buff;
+		BufferHandle m_buff;
 
-		Command(GlBufferHandle& buff)
+		Command(BufferHandle& buff)
 		:	m_buff(buff)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
-			GlBuffer& buff = m_buff._get();
+			BufferImpl& buff = m_buff._get();
 			buff.setTarget(GL_ELEMENT_ARRAY_BUFFER);
 			buff.bind();
 
@@ -290,19 +290,19 @@ void GlBufferHandle::bindIndexBuffer(GlCommandBufferHandle& commands)
 }
 
 //==============================================================================
-PtrSize GlBufferHandle::getSize() const
+PtrSize BufferHandle::getSize() const
 {
 	return (serializeOnGetter()) ? 0 : _get().getSize();
 }
 
 //==============================================================================
-GLenum GlBufferHandle::getTarget() const
+GLenum BufferHandle::getTarget() const
 {
 	return (serializeOnGetter()) ? GL_NONE : _get().getTarget();
 }
 
 //==============================================================================
-void* GlBufferHandle::getPersistentMappingAddress()
+void* BufferHandle::getPersistentMappingAddress()
 {
 	return 
 		(serializeOnGetter()) ? nullptr : _get().getPersistentMappingAddress();

+ 7 - 7
src/gl/GlBuffer.cpp → src/gr/gl/BufferImpl.cpp

@@ -4,15 +4,15 @@
 // http://www.anki3d.org/LICENSE
 
 #include <cstring>
-#include "anki/gl/GlBuffer.h"
-#include "anki/gl/GlError.h"
+#include "anki/gr/gl/BufferImpl.h"
+#include "anki/gr/GlError.h"
 #include "anki/util/Logger.h"
 #include <cmath>
 
 namespace anki {
 
 //==============================================================================
-void GlBuffer::destroy()
+void BufferImpl::destroy()
 {
 	if(isCreated())
 	{
@@ -22,7 +22,7 @@ void GlBuffer::destroy()
 }
 
 //==============================================================================
-Error GlBuffer::create(GLenum target, U32 sizeInBytes,
+Error BufferImpl::create(GLenum target, U32 sizeInBytes,
 	const void* dataPtr, GLbitfield flags)
 {
 	ANKI_ASSERT(!isCreated());
@@ -88,7 +88,7 @@ Error GlBuffer::create(GLenum target, U32 sizeInBytes,
 }
 
 //==============================================================================
-void GlBuffer::write(void* buff, U32 offset, U32 size)
+void BufferImpl::write(void* buff, U32 offset, U32 size)
 {
 	ANKI_ASSERT(isCreated());
 	ANKI_ASSERT(offset + size <= size);
@@ -98,7 +98,7 @@ void GlBuffer::write(void* buff, U32 offset, U32 size)
 }
 
 //==============================================================================
-void GlBuffer::setBinding(GLuint binding) const
+void BufferImpl::setBinding(GLuint binding) const
 {
 	ANKI_ASSERT(isCreated());
 	ANKI_ASSERT(m_target == GL_SHADER_STORAGE_BUFFER 
@@ -107,7 +107,7 @@ void GlBuffer::setBinding(GLuint binding) const
 }
 
 //==============================================================================
-void GlBuffer::setBindingRange(
+void BufferImpl::setBindingRange(
 	GLuint binding, PtrSize offset, PtrSize size) const
 {
 	ANKI_ASSERT(isCreated());

+ 84 - 84
src/gl/GlCommandBufferHandle.cpp → src/gr/gl/CommandBufferHandle.cpp

@@ -3,16 +3,16 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlCommandBufferHandle.h"
-#include "anki/gl/GlDevice.h"
-#include "anki/gl/GlSyncHandles.h"
-#include "anki/gl/GlFramebuffer.h"
-#include "anki/gl/GlTextureHandle.h"
-#include "anki/gl/GlTexture.h"
-#include "anki/gl/GlBufferHandle.h"
-#include "anki/gl/GlBuffer.h"
-#include "anki/gl/GlOcclusionQueryHandle.h"
-#include "anki/gl/GlOcclusionQuery.h"
+#include "anki/gr/CommandBufferHandle.h"
+#include "anki/gr/GlDevice.h"
+#include "anki/gr/GlSyncHandles.h"
+#include "anki/gr/gl/FramebufferImpl.h"
+#include "anki/gr/TextureHandle.h"
+#include "anki/gr/gl/TextureImpl.h"
+#include "anki/gr/BufferHandle.h"
+#include "anki/gr/gl/BufferImpl.h"
+#include "anki/gr/OcclusionQueryHandle.h"
+#include "anki/gr/gl/OcclusionQueryImpl.h"
 #include "anki/core/Counters.h"
 #include <utility>
 
@@ -25,7 +25,7 @@ namespace anki {
 	{ \
 	public: \
 		Command() = default \
-		Error operator()(GlCommandBuffer*) \
+		Error operator()(CommandBufferImpl*) \
 		{ \
 			glfunc_(); \
 			return ErrorCode::NONE; \
@@ -41,7 +41,7 @@ namespace anki {
 		Command(type_ v) \
 		:	m_value(v) \
 		{} \
-		Error operator()(GlCommandBuffer*) \
+		Error operator()(CommandBufferImpl*) \
 		{ \
 			glfunc_(m_value); \
 			return ErrorCode::NONE; \
@@ -58,7 +58,7 @@ namespace anki {
 		{ \
 			m_value = {{a, b}}; \
 		} \
-		Error operator()(GlCommandBuffer*) \
+		Error operator()(CommandBufferImpl*) \
 		{ \
 			glfunc_(m_value[0], m_value[1]); \
 			return ErrorCode::NONE; \
@@ -75,7 +75,7 @@ namespace anki {
 		{ \
 			m_value = {{a, b, c}}; \
 		} \
-		Error operator()(GlCommandBuffer*) \
+		Error operator()(CommandBufferImpl*) \
 		{ \
 			glfunc_(m_value[0], m_value[1], m_value[2]); \
 			return ErrorCode::NONE; \
@@ -92,7 +92,7 @@ namespace anki {
 		{ \
 			m_value = {{a, b, c, d}}; \
 		} \
-		Error operator()(GlCommandBuffer*) \
+		Error operator()(CommandBufferImpl*) \
 		{ \
 			glfunc_(m_value[0], m_value[1], m_value[2], m_value[3]); \
 			return ErrorCode::NONE; \
@@ -108,7 +108,7 @@ namespace anki {
 		Command(Bool enable) \
 		:	m_enable(enable) \
 		{} \
-		Error operator()(GlCommandBuffer*) \
+		Error operator()(CommandBufferImpl*) \
 		{ \
 			if(m_enable) \
 			{ \
@@ -124,27 +124,27 @@ namespace anki {
 	_pushBackNewCommand<Command>(enable_)
 
 //==============================================================================
-GlCommandBufferHandle::GlCommandBufferHandle()
+CommandBufferHandle::CommandBufferHandle()
 {}
 
 //==============================================================================
-GlCommandBufferHandle::~GlCommandBufferHandle()
+CommandBufferHandle::~CommandBufferHandle()
 {}
 
 //==============================================================================
-Error GlCommandBufferHandle::create(GlDevice* gl, 
-	GlCommandBufferInitHints hints)
+Error CommandBufferHandle::create(GlDevice* gl, 
+	CommandBufferImplInitHints hints)
 {
 	ANKI_ASSERT(!isCreated());
 	ANKI_ASSERT(gl);
 
-	using Alloc = GlAllocator<GlCommandBuffer>;
+	using Alloc = GlAllocator<CommandBufferImpl>;
 	Alloc alloc = gl->_getAllocator();
 
 	Error err = _createAdvanced(
 		gl,
 		alloc, 
-		GlHandleDefaultDeleter<GlCommandBuffer, Alloc>());
+		GlHandleDefaultDeleter<CommandBufferImpl, Alloc>());
 
 	if(!err)
 	{
@@ -155,7 +155,7 @@ Error GlCommandBufferHandle::create(GlDevice* gl,
 }
 
 //==============================================================================
-void GlCommandBufferHandle::pushBackUserCommand(
+void CommandBufferHandle::pushBackUserCommand(
 	UserCallback callback, void* data)
 {
 	class Command: public GlCommand
@@ -171,7 +171,7 @@ void GlCommandBufferHandle::pushBackUserCommand(
 			ANKI_ASSERT(m_callback);
 		}
 
-		Error operator()(GlCommandBuffer* commands)
+		Error operator()(CommandBufferImpl* commands)
 		{
 			return (*m_callback)(m_userData);
 		}
@@ -181,19 +181,19 @@ void GlCommandBufferHandle::pushBackUserCommand(
 }
 
 //==============================================================================
-void GlCommandBufferHandle::pushBackOtherCommandBuffer(
-	GlCommandBufferHandle& commands)
+void CommandBufferHandle::pushBackOtherCommandBuffer(
+	CommandBufferHandle& commands)
 {
 	class Command: public GlCommand
 	{
 	public:
-		GlCommandBufferHandle m_commands;
+		CommandBufferHandle m_commands;
 
-		Command(GlCommandBufferHandle& commands)
+		Command(CommandBufferHandle& commands)
 		:	m_commands(commands)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
 			return m_commands._executeAllCommands();
 		}
@@ -204,43 +204,43 @@ void GlCommandBufferHandle::pushBackOtherCommandBuffer(
 }
 
 //==============================================================================
-void GlCommandBufferHandle::flush()
+void CommandBufferHandle::flush()
 {
 	_get().getQueue().flushCommandBuffer(*this);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::finish()
+void CommandBufferHandle::finish()
 {
 	_get().getQueue().finishCommandBuffer(*this);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::setClearColor(F32 r, F32 g, F32 b, F32 a)
+void CommandBufferHandle::setClearColor(F32 r, F32 g, F32 b, F32 a)
 {
 	ANKI_STATE_CMD_4(F32, glClearColor, r, g, b, a);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::setClearDepth(F32 value)
+void CommandBufferHandle::setClearDepth(F32 value)
 {
 	ANKI_STATE_CMD_1(F32, glClearDepth, value);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::setClearStencil(U32 value)
+void CommandBufferHandle::setClearStencil(U32 value)
 {
 	ANKI_STATE_CMD_1(U32, glClearStencil, value);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::clearBuffers(U32 mask)
+void CommandBufferHandle::clearBuffers(U32 mask)
 {
 	ANKI_STATE_CMD_1(U32, glClear, mask);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::setViewport(U16 minx, U16 miny, U16 maxx, U16 maxy)
+void CommandBufferHandle::setViewport(U16 minx, U16 miny, U16 maxx, U16 maxy)
 {
 	class Command: public GlCommand
 	{
@@ -252,7 +252,7 @@ void GlCommandBufferHandle::setViewport(U16 minx, U16 miny, U16 maxx, U16 maxy)
 			m_value = {{a, b, c, d}};
 		}
 
-		Error operator()(GlCommandBuffer* commands)
+		Error operator()(CommandBufferImpl* commands)
 		{
 			GlState& state = commands->getQueue().getState();
 
@@ -274,70 +274,70 @@ void GlCommandBufferHandle::setViewport(U16 minx, U16 miny, U16 maxx, U16 maxy)
 }
 
 //==============================================================================
-void GlCommandBufferHandle::setColorWriteMask(
+void CommandBufferHandle::setColorWriteMask(
 	Bool red, Bool green, Bool blue, Bool alpha)
 {
 	ANKI_STATE_CMD_4(Bool8, glColorMask, red, green, blue, alpha);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::enableDepthTest(Bool enable)
+void CommandBufferHandle::enableDepthTest(Bool enable)
 {
 	ANKI_STATE_CMD_ENABLE(GL_DEPTH_TEST, enable);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::setDepthFunction(GLenum func)
+void CommandBufferHandle::setDepthFunction(GLenum func)
 {
 	ANKI_STATE_CMD_1(GLenum, glDepthFunc, func);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::setDepthWriteMask(Bool write)
+void CommandBufferHandle::setDepthWriteMask(Bool write)
 {
 	ANKI_STATE_CMD_1(Bool8, glDepthMask, write);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::enableStencilTest(Bool enable)
+void CommandBufferHandle::enableStencilTest(Bool enable)
 {
 	ANKI_STATE_CMD_ENABLE(GL_STENCIL_TEST, enable);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::setStencilFunction(
+void CommandBufferHandle::setStencilFunction(
 	GLenum function, U32 reference, U32 mask)
 {
 	ANKI_STATE_CMD_3(U32, glStencilFunc, function, reference, mask);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::setStencilPlaneMask(U32 mask)
+void CommandBufferHandle::setStencilPlaneMask(U32 mask)
 {
 	ANKI_STATE_CMD_1(U32, glStencilMask, mask);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::setStencilOperations(GLenum stencFail, GLenum depthFail, 
+void CommandBufferHandle::setStencilOperations(GLenum stencFail, GLenum depthFail, 
 	GLenum depthPass)
 {
 	ANKI_STATE_CMD_3(GLenum, glStencilOp, stencFail, depthFail, depthPass);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::enableBlend(Bool enable)
+void CommandBufferHandle::enableBlend(Bool enable)
 {
 	ANKI_STATE_CMD_ENABLE(GL_BLEND, enable);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::setBlendEquation(GLenum equation)
+void CommandBufferHandle::setBlendEquation(GLenum equation)
 {
 	ANKI_STATE_CMD_1(GLenum, glBlendEquation, equation);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::setBlendFunctions(GLenum sfactor, GLenum dfactor)
+void CommandBufferHandle::setBlendFunctions(GLenum sfactor, GLenum dfactor)
 {
 	class Command: public GlCommand
 	{
@@ -349,7 +349,7 @@ void GlCommandBufferHandle::setBlendFunctions(GLenum sfactor, GLenum dfactor)
 			: m_sfactor(sfactor), m_dfactor(dfactor)
 		{}
 
-		Error operator()(GlCommandBuffer* commands)
+		Error operator()(CommandBufferImpl* commands)
 		{
 			GlState& state = commands->getQueue().getState();
 
@@ -370,55 +370,55 @@ void GlCommandBufferHandle::setBlendFunctions(GLenum sfactor, GLenum dfactor)
 }
 
 //==============================================================================
-void GlCommandBufferHandle::setBlendColor(F32 r, F32 g, F32 b, F32 a)
+void CommandBufferHandle::setBlendColor(F32 r, F32 g, F32 b, F32 a)
 {
 	ANKI_STATE_CMD_4(F32, glBlendColor, r, g, b, a);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::enablePrimitiveRestart(Bool enable)
+void CommandBufferHandle::enablePrimitiveRestart(Bool enable)
 {
 	ANKI_STATE_CMD_ENABLE(GL_PRIMITIVE_RESTART, enable);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::setPatchVertexCount(U32 count)
+void CommandBufferHandle::setPatchVertexCount(U32 count)
 {
 	ANKI_STATE_CMD_2(GLint, glPatchParameteri, GL_PATCH_VERTICES, count);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::enableCulling(Bool enable)
+void CommandBufferHandle::enableCulling(Bool enable)
 {
 	ANKI_STATE_CMD_ENABLE(GL_CULL_FACE, enable);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::setCullFace(GLenum mode)
+void CommandBufferHandle::setCullFace(GLenum mode)
 {
 	ANKI_STATE_CMD_1(GLenum, glCullFace, mode);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::setPolygonOffset(F32 factor, F32 units)
+void CommandBufferHandle::setPolygonOffset(F32 factor, F32 units)
 {
 	ANKI_STATE_CMD_2(F32, glPolygonOffset, factor, units);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::enablePolygonOffset(Bool enable)
+void CommandBufferHandle::enablePolygonOffset(Bool enable)
 {
 	ANKI_STATE_CMD_ENABLE(GL_POLYGON_OFFSET_FILL, enable);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::setPolygonMode(GLenum face, GLenum mode)
+void CommandBufferHandle::setPolygonMode(GLenum face, GLenum mode)
 {
 	ANKI_STATE_CMD_2(GLenum, glPolygonMode, face, mode);
 }
 
 //==============================================================================
-void GlCommandBufferHandle::enablePointSize(Bool enable)
+void CommandBufferHandle::enablePointSize(Bool enable)
 {
 	ANKI_STATE_CMD_ENABLE(GL_PROGRAM_POINT_SIZE, enable);
 }
@@ -429,16 +429,16 @@ class BindTexturesCommand: public GlCommand
 public:
 	static const U MAX_BIND_TEXTURES = 8;
 
-	Array<GlTextureHandle, MAX_BIND_TEXTURES> m_texes;
+	Array<TextureHandle, MAX_BIND_TEXTURES> m_texes;
 	U32 m_texCount;
 	U32 m_first;
 
 	BindTexturesCommand(
-		GlTextureHandle textures[], U count, U32 first)
+		TextureHandle textures[], U count, U32 first)
 	:	m_first(first)
 	{
 		m_texCount = count;
-		GlTextureHandle* t = textures;
+		TextureHandle* t = textures;
 		while(count-- != 0)
 		{
 			m_texes[count] = *t;
@@ -446,7 +446,7 @@ public:
 		}
 	}
 
-	Error operator()(GlCommandBuffer* commands)
+	Error operator()(CommandBufferImpl* commands)
 	{
 		Array<GLuint, MAX_BIND_TEXTURES> names;
 
@@ -463,8 +463,8 @@ public:
 	}
 };
 
-void GlCommandBufferHandle::bindTextures(U32 first, 
-	GlTextureHandle textures[], U32 count)
+void CommandBufferHandle::bindTextures(U32 first, 
+	TextureHandle textures[], U32 count)
 {
 	ANKI_ASSERT(count > 0);
 
@@ -478,20 +478,20 @@ public:
 	GLenum m_mode;
 	U8 m_indexSize;
 	GlDrawElementsIndirectInfo m_info;
-	GlOcclusionQueryHandle m_query;
+	OcclusionQueryHandle m_query;
 
 	DrawElementsCondCommand(
 		GLenum mode,
 		U8 indexSize,
 		GlDrawElementsIndirectInfo& info,
-		GlOcclusionQueryHandle query = GlOcclusionQueryHandle())
+		OcclusionQueryHandle query = OcclusionQueryHandle())
 	:	m_mode(mode),
 		m_indexSize(indexSize),
 		m_info(info),
 		m_query(query)
 	{}
 
-	Error operator()(GlCommandBuffer*)
+	Error operator()(CommandBufferImpl*)
 	{
 		ANKI_ASSERT(m_indexSize != 0);
 
@@ -530,7 +530,7 @@ public:
 	}
 };
 
-void GlCommandBufferHandle::drawElements(
+void CommandBufferHandle::drawElements(
 	GLenum mode, U8 indexSize, U32 count, U32 instanceCount, U32 firstIndex,
 	U32 baseVertex, U32 baseInstance)
 {
@@ -546,18 +546,18 @@ class DrawArraysCondCommand: public GlCommand
 public:
 	GLenum m_mode;
 	GlDrawArraysIndirectInfo m_info;
-	GlOcclusionQueryHandle m_query;
+	OcclusionQueryHandle m_query;
 
 	DrawArraysCondCommand(
 		GLenum mode,
 		GlDrawArraysIndirectInfo& info, 
-		GlOcclusionQueryHandle query = GlOcclusionQueryHandle())
+		OcclusionQueryHandle query = OcclusionQueryHandle())
 	:	m_mode(mode),
 		m_info(info),
 		m_query(query)
 	{}
 
-	Error operator()(GlCommandBuffer*)
+	Error operator()(CommandBufferImpl*)
 	{
 		if(!m_query.isCreated() || !m_query._get().skipDrawcall())
 		{
@@ -575,7 +575,7 @@ public:
 	}
 };
 
-void GlCommandBufferHandle::drawArrays(
+void CommandBufferHandle::drawArrays(
 	GLenum mode, U32 count, U32 instanceCount, U32 first, U32 baseInstance)
 {
 	GlDrawArraysIndirectInfo info(count, instanceCount, first, baseInstance);
@@ -584,8 +584,8 @@ void GlCommandBufferHandle::drawArrays(
 }
 
 //==============================================================================
-void GlCommandBufferHandle::drawElementsConditional(
-	GlOcclusionQueryHandle& query,
+void CommandBufferHandle::drawElementsConditional(
+	OcclusionQueryHandle& query,
 	GLenum mode, U8 indexSize, U32 count, U32 instanceCount, U32 firstIndex,
 	U32 baseVertex, U32 baseInstance)
 {
@@ -596,8 +596,8 @@ void GlCommandBufferHandle::drawElementsConditional(
 }
 
 //==============================================================================
-void GlCommandBufferHandle::drawArraysConditional(
-	GlOcclusionQueryHandle& query,
+void CommandBufferHandle::drawArraysConditional(
+	OcclusionQueryHandle& query,
 	GLenum mode, U32 count, U32 instanceCount, U32 first, U32 baseInstance)
 {
 	GlDrawArraysIndirectInfo info(count, instanceCount, first, baseInstance);
@@ -609,18 +609,18 @@ void GlCommandBufferHandle::drawArraysConditional(
 class CopyBuffTex: public GlCommand
 {
 public:
-	GlTextureHandle m_tex;
-	GlBufferHandle m_buff;
+	TextureHandle m_tex;
+	BufferHandle m_buff;
 
-	CopyBuffTex(GlTextureHandle& from, GlBufferHandle& to)
+	CopyBuffTex(TextureHandle& from, BufferHandle& to)
 	:	m_tex(from),
 		m_buff(to)
 	{}
 
-	Error operator()(GlCommandBuffer* cmd)
+	Error operator()(CommandBufferImpl* cmd)
 	{
-		GlTexture& tex = m_tex._get();
-		GlBuffer& buff = m_buff._get();
+		TextureImpl& tex = m_tex._get();
+		BufferImpl& buff = m_buff._get();
 
 		// Bind
 		GLuint copyFbo = cmd->getQueue().getCopyFbo();
@@ -666,8 +666,8 @@ public:
 	}
 };
 
-void GlCommandBufferHandle::copyTextureToBuffer(
-	GlTextureHandle& from, GlBufferHandle& to)
+void CommandBufferHandle::copyTextureToBuffer(
+	TextureHandle& from, BufferHandle& to)
 {
 	_pushBackNewCommand<CopyBuffTex>(from, to);
 }

+ 12 - 12
src/gl/GlCommandBuffer.cpp → src/gr/gl/CommandBufferImpl.cpp

@@ -3,10 +3,10 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlCommandBuffer.h"
-#include "anki/gl/GlQueue.h"
-#include "anki/gl/GlDevice.h"
-#include "anki/gl/GlError.h"
+#include "anki/gr/gl/CommandBufferImpl.h"
+#include "anki/gr/gl/Queue.h"
+#include "anki/gr/GlDevice.h"
+#include "anki/gr/GlError.h"
 #include "anki/util/Logger.h"
 #include "anki/core/Counters.h"
 #include <cstring>
@@ -14,8 +14,8 @@
 namespace anki {
 
 //==============================================================================
-Error GlCommandBuffer::create(GlQueue* server, 
-	const GlCommandBufferInitHints& hints)
+Error CommandBufferImpl::create(Queue* server, 
+	const CommandBufferImplInitHints& hints)
 {
 	ANKI_ASSERT(server);
 
@@ -25,7 +25,7 @@ Error GlCommandBuffer::create(GlQueue* server,
 		m_server->getAllocationCallback(),
 		m_server->getAllocationCallbackUserData(),
 		hints.m_chunkSize, 
-		GlCommandBufferInitHints::MAX_CHUNK_SIZE, 
+		CommandBufferImplInitHints::MAX_CHUNK_SIZE, 
 		ChainMemoryPool::ChunkGrowMethod::ADD,
 		hints.m_chunkSize);
 
@@ -33,7 +33,7 @@ Error GlCommandBuffer::create(GlQueue* server,
 }
 
 //==============================================================================
-void GlCommandBuffer::destroy()
+void CommandBufferImpl::destroy()
 {
 #if ANKI_DEBUG
 	if(!m_executed && m_firstCommand)
@@ -58,13 +58,13 @@ void GlCommandBuffer::destroy()
 }
 
 //==============================================================================
-GlAllocator<U8> GlCommandBuffer::getGlobalAllocator() const
+GlAllocator<U8> CommandBufferImpl::getGlobalAllocator() const
 {
 	return m_server->getDevice()._getAllocator();
 }
 
 //==============================================================================
-Error GlCommandBuffer::executeAllCommands()
+Error CommandBufferImpl::executeAllCommands()
 {
 	ANKI_ASSERT(m_firstCommand != nullptr && "Empty command buffer");
 	ANKI_ASSERT(m_lastCommand != nullptr && "Empty command buffer");
@@ -88,9 +88,9 @@ Error GlCommandBuffer::executeAllCommands()
 }
 
 //==============================================================================
-GlCommandBufferInitHints GlCommandBuffer::computeInitHints() const
+CommandBufferImplInitHints CommandBufferImpl::computeInitHints() const
 {
-	GlCommandBufferInitHints out;
+	CommandBufferImplInitHints out;
 	out.m_chunkSize = m_alloc.getMemoryPool().getAllocatedSize() + 16;
 
 	ANKI_COUNTER_INC(GL_QUEUES_SIZE, 

+ 23 - 23
src/gl/GlFramebufferHandle.cpp → src/gr/gl/FramebufferHandle.cpp

@@ -3,42 +3,42 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlFramebufferHandle.h"
-#include "anki/gl/GlHandleDeferredDeleter.h"
+#include "anki/gr/FramebufferHandle.h"
+#include "anki/gr/GlHandleDeferredDeleter.h"
 
 namespace anki {
 
 //==============================================================================
-GlFramebufferHandle::GlFramebufferHandle()
+FramebufferHandle::FramebufferHandle()
 {}
 
 //==============================================================================
-GlFramebufferHandle::~GlFramebufferHandle()
+FramebufferHandle::~FramebufferHandle()
 {}
 
 //==============================================================================
-Error GlFramebufferHandle::create(
-	GlCommandBufferHandle& commands,
+Error FramebufferHandle::create(
+	CommandBufferHandle& commands,
 	const std::initializer_list<Attachment>& attachments)
 {
 	using Attachments = 
-		Array<Attachment, GlFramebuffer::MAX_COLOR_ATTACHMENTS + 1>;
+		Array<Attachment, FramebufferImpl::MAX_COLOR_ATTACHMENTS + 1>;
 
 	class Command: public GlCommand
 	{
 	public:
 		Attachments m_attachments;
 		U8 m_size;
-		GlFramebufferHandle m_fb;
+		FramebufferHandle m_fb;
 
-		Command(GlFramebufferHandle& handle, const Attachments& attachments, 
+		Command(FramebufferHandle& handle, const Attachments& attachments, 
 			U size)
 		:	m_attachments(attachments), 
 			m_size(size), 
 			m_fb(handle)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
 			Attachment* begin;
 			Attachment* end;
@@ -64,10 +64,10 @@ Error GlFramebufferHandle::create(
 		}
 	};
 
-	using Alloc = GlAllocator<GlFramebuffer>;
-	using DeleteCommand = GlDeleteObjectCommand<GlFramebuffer, Alloc>;
+	using Alloc = GlAllocator<FramebufferImpl>;
+	using DeleteCommand = GlDeleteObjectCommand<FramebufferImpl, Alloc>;
 	using Deleter = 
-		GlHandleDeferredDeleter<GlFramebuffer, Alloc, DeleteCommand>;
+		GlHandleDeferredDeleter<FramebufferImpl, Alloc, DeleteCommand>;
 
 	Error err = _createAdvanced(
 		&commands._get().getQueue().getDevice(),
@@ -92,20 +92,20 @@ Error GlFramebufferHandle::create(
 }
 
 //==============================================================================
-void GlFramebufferHandle::bind(GlCommandBufferHandle& commands, Bool invalidate)
+void FramebufferHandle::bind(CommandBufferHandle& commands, Bool invalidate)
 {
 	class Command: public GlCommand
 	{
 	public:
-		GlFramebufferHandle m_fb;
+		FramebufferHandle m_fb;
 		Bool8 m_invalidate;
 
-		Command(GlFramebufferHandle& fb, Bool invalidate)
+		Command(FramebufferHandle& fb, Bool invalidate)
 		:	m_fb(fb), 
 			m_invalidate(invalidate)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
 			m_fb._get().bind(m_invalidate);
 			return ErrorCode::NONE;
@@ -116,8 +116,8 @@ void GlFramebufferHandle::bind(GlCommandBufferHandle& commands, Bool invalidate)
 }
 
 //==============================================================================
-void GlFramebufferHandle::blit(GlCommandBufferHandle& commands,
-	const GlFramebufferHandle& b, 
+void FramebufferHandle::blit(CommandBufferHandle& commands,
+	const FramebufferHandle& b, 
 	const Array<U32, 4>& sourceRect,
 	const Array<U32, 4>& destRect, 
 	GLbitfield attachmentMask,
@@ -126,14 +126,14 @@ void GlFramebufferHandle::blit(GlCommandBufferHandle& commands,
 	class Command: public GlCommand
 	{
 	public:
-		GlFramebufferHandle m_fbDest;
-		GlFramebufferHandle m_fbSrc;
+		FramebufferHandle m_fbDest;
+		FramebufferHandle m_fbSrc;
 		Array<U32, 4> m_sourceRect;
 		Array<U32, 4> m_destRect;
 		GLbitfield m_attachmentMask;
 		Bool8 m_linear;
 
-		Command(GlFramebufferHandle& fbDest, const GlFramebufferHandle& fbSrc,
+		Command(FramebufferHandle& fbDest, const FramebufferHandle& fbSrc,
 			const Array<U32, 4>& sourceRect,
 			const Array<U32, 4>& destRect,
 			GLbitfield attachmentMask,
@@ -146,7 +146,7 @@ void GlFramebufferHandle::blit(GlCommandBufferHandle& commands,
 			m_linear(linear)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
 			m_fbDest._get().blit(m_fbSrc._get(), m_sourceRect, m_destRect, 
 				m_attachmentMask, m_linear);

+ 12 - 12
src/gl/GlFramebuffer.cpp → src/gr/gl/FramebufferImpl.cpp

@@ -3,14 +3,14 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlFramebuffer.h"
-#include "anki/gl/GlTexture.h"
+#include "anki/gr/gl/FramebufferImpl.h"
+#include "anki/gr/gl/TextureImpl.h"
 #include "anki/util/Logger.h"
 
 namespace anki {
 
 //==============================================================================
-Error GlFramebuffer::create(
+Error FramebufferImpl::create(
 	Attachment* attachmentsBegin, Attachment* attachmentsEnd)
 {
 	if(attachmentsBegin == nullptr || attachmentsEnd == nullptr)
@@ -55,7 +55,7 @@ Error GlFramebuffer::create(
 }
 
 //==============================================================================
-void GlFramebuffer::destroy()
+void FramebufferImpl::destroy()
 {
 	if(m_glName != 0)
 	{
@@ -65,7 +65,7 @@ void GlFramebuffer::destroy()
 }
 
 //==============================================================================
-Error GlFramebuffer::createFbo(
+Error FramebufferImpl::createFbo(
 	const Array<U, MAX_COLOR_ATTACHMENTS + 1>& layers,
 	GLenum depthStencilBindingPoint)
 {
@@ -85,7 +85,7 @@ Error GlFramebuffer::createFbo(
 			continue;
 		}
 		
-		const GlTexture& tex = m_attachments[i]._get();
+		const TextureImpl& tex = m_attachments[i]._get();
 		attachTextureInternal(GL_COLOR_ATTACHMENT0 + i, tex, layers[i]);
 	}
 
@@ -94,7 +94,7 @@ Error GlFramebuffer::createFbo(
 	{
 		ANKI_ASSERT(depthStencilBindingPoint != GL_NONE);
 
-		const GlTexture& tex = m_attachments[MAX_COLOR_ATTACHMENTS]._get();
+		const TextureImpl& tex = m_attachments[MAX_COLOR_ATTACHMENTS]._get();
 		attachTextureInternal(depthStencilBindingPoint, tex, 
 			layers[MAX_COLOR_ATTACHMENTS]);
 	}
@@ -112,8 +112,8 @@ Error GlFramebuffer::createFbo(
 }
 
 //==============================================================================
-void GlFramebuffer::attachTextureInternal(
-	GLenum attachment, const GlTexture& tex, const U32 layer)
+void FramebufferImpl::attachTextureInternal(
+	GLenum attachment, const TextureImpl& tex, const U32 layer)
 {
 	const GLenum target = GL_FRAMEBUFFER;
 	switch(tex.getTarget())
@@ -144,7 +144,7 @@ void GlFramebuffer::attachTextureInternal(
 }
 
 //==============================================================================
-void GlFramebuffer::bind(Bool invalidate)
+void FramebufferImpl::bind(Bool invalidate)
 {
 	if(m_bindDefault)
 	{
@@ -174,7 +174,7 @@ void GlFramebuffer::bind(Bool invalidate)
 		// Invalidate
 		if(invalidate)
 		{
-			static const Array<GLenum, GlFramebuffer::MAX_COLOR_ATTACHMENTS + 1>
+			static const Array<GLenum, FramebufferImpl::MAX_COLOR_ATTACHMENTS + 1>
 				ATTACHMENT_TOKENS = {{
 					GL_DEPTH_STENCIL_ATTACHMENT, GL_COLOR_ATTACHMENT0, 
 					GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, 
@@ -188,7 +188,7 @@ void GlFramebuffer::bind(Bool invalidate)
 }
 
 //==============================================================================
-void GlFramebuffer::blit(const GlFramebuffer& b, 
+void FramebufferImpl::blit(const FramebufferImpl& b, 
 	const Array<U32, 4>& sourceRect,
 	const Array<U32, 4>& destRect, 
 	GLbitfield attachmentMask, Bool linear)

+ 6 - 6
src/gl/GlOcclusionQuery.cpp → src/gr/gl/OcclusionQueryImpl.cpp

@@ -3,12 +3,12 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlOcclusionQuery.h"
+#include "anki/gr/gl/OcclusionQueryImpl.h"
 
 namespace anki {
 
 //==============================================================================
-Error GlOcclusionQuery::create(GlOcclusionQueryResultBit condRenderingBit)
+Error OcclusionQueryImpl::create(GlOcclusionQueryResultBit condRenderingBit)
 {
 	glGenQueries(1, &m_glName);
 	ANKI_ASSERT(m_glName != 0);
@@ -17,21 +17,21 @@ Error GlOcclusionQuery::create(GlOcclusionQueryResultBit condRenderingBit)
 }
 
 //==============================================================================
-void GlOcclusionQuery::begin()
+void OcclusionQueryImpl::begin()
 {
 	ANKI_ASSERT(isCreated());
 	glBeginQuery(GL_ANY_SAMPLES_PASSED_CONSERVATIVE, m_glName);
 }
 
 //==============================================================================
-void GlOcclusionQuery::end()
+void OcclusionQueryImpl::end()
 {
 	ANKI_ASSERT(isCreated());
 	glEndQuery(GL_ANY_SAMPLES_PASSED_CONSERVATIVE);
 }
 
 //==============================================================================
-GlOcclusionQuery::Result GlOcclusionQuery::getResult() const
+OcclusionQueryImpl::Result OcclusionQueryImpl::getResult() const
 {
 	ANKI_ASSERT(isCreated());
 	Result result = Result::NOT_AVAILABLE;
@@ -49,7 +49,7 @@ GlOcclusionQuery::Result GlOcclusionQuery::getResult() const
 }
 
 //==============================================================================
-void GlOcclusionQuery::destroy()
+void OcclusionQueryImpl::destroy()
 {
 	if(m_glName != 0)
 	{

+ 28 - 28
src/gl/GlPipelineHandle.cpp → src/gr/gl/PipelineHandle.cpp

@@ -3,29 +3,29 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlPipelineHandle.h"
-#include "anki/gl/GlPipeline.h"
-#include "anki/gl/GlHandleDeferredDeleter.h"
+#include "anki/gr/PipelineHandle.h"
+#include "anki/gr/gl/PipelineImpl.h"
+#include "anki/gr/GlHandleDeferredDeleter.h"
 
 namespace anki {
 
 //==============================================================================
-GlPipelineHandle::GlPipelineHandle()
+PipelineHandle::PipelineHandle()
 {}
 
 //==============================================================================
-GlPipelineHandle::~GlPipelineHandle()
+PipelineHandle::~PipelineHandle()
 {}
 
 //==============================================================================
-Error GlPipelineHandle::create(
-	GlCommandBufferHandle& commands,
-	std::initializer_list<GlShaderHandle> iprogs)
+Error PipelineHandle::create(
+	CommandBufferHandle& commands,
+	std::initializer_list<ShaderHandle> iprogs)
 {
-	Array<GlShaderHandle, 6> progs;
+	Array<ShaderHandle, 6> progs;
 
 	U count = 0;
-	for(GlShaderHandle prog : iprogs)
+	for(ShaderHandle prog : iprogs)
 	{
 		progs[count++] = prog;
 	}
@@ -34,30 +34,30 @@ Error GlPipelineHandle::create(
 }
 
 //==============================================================================
-Error GlPipelineHandle::commonConstructor(
-	GlCommandBufferHandle& commands,
-	const GlShaderHandle* progsBegin, const GlShaderHandle* progsEnd)
+Error PipelineHandle::commonConstructor(
+	CommandBufferHandle& commands,
+	const ShaderHandle* progsBegin, const ShaderHandle* progsEnd)
 {
 	class Command: public GlCommand
 	{
 	public:
-		GlPipelineHandle m_ppline;
-		Array<GlShaderHandle, 6> m_progs;
+		PipelineHandle m_ppline;
+		Array<ShaderHandle, 6> m_progs;
 		U8 m_progsCount;
 
-		Command(GlPipelineHandle& ppline, 
-			const GlShaderHandle* progsBegin, const GlShaderHandle* progsEnd)
+		Command(PipelineHandle& ppline, 
+			const ShaderHandle* progsBegin, const ShaderHandle* progsEnd)
 		:	m_ppline(ppline)
 		{
 			m_progsCount = 0;
-			const GlShaderHandle* prog = progsBegin;
+			const ShaderHandle* prog = progsBegin;
 			do
 			{
 				m_progs[m_progsCount++] = *prog;
 			} while(++prog != progsEnd);
 		}
 
-		Error operator()(GlCommandBuffer* cmdb)
+		Error operator()(CommandBufferImpl* cmdb)
 		{
 			Error err = m_ppline._get().create(
 				&m_progs[0], &m_progs[0] + m_progsCount,
@@ -72,10 +72,10 @@ Error GlPipelineHandle::commonConstructor(
 		}
 	};
 
-	using Alloc = GlAllocator<GlPipeline>;
-	using DeleteCommand = GlDeleteObjectCommand<GlPipeline, Alloc>;
+	using Alloc = GlAllocator<PipelineImpl>;
+	using DeleteCommand = GlDeleteObjectCommand<PipelineImpl, Alloc>;
 	using Deleter = 
-		GlHandleDeferredDeleter<GlPipeline, Alloc, DeleteCommand>;
+		GlHandleDeferredDeleter<PipelineImpl, Alloc, DeleteCommand>;
 
 	Error err = _createAdvanced(
 		&commands._get().getQueue().getDevice(),
@@ -93,20 +93,20 @@ Error GlPipelineHandle::commonConstructor(
 }
 
 //==============================================================================
-void GlPipelineHandle::bind(GlCommandBufferHandle& commands)
+void PipelineHandle::bind(CommandBufferHandle& commands)
 {
 	ANKI_ASSERT(isCreated());
 
 	class Command: public GlCommand
 	{
 	public:
-		GlPipelineHandle m_ppline;
+		PipelineHandle m_ppline;
 
-		Command(GlPipelineHandle& ppline)
+		Command(PipelineHandle& ppline)
 		:	m_ppline(ppline)
 		{}
 
-		Error operator()(GlCommandBuffer* commands)
+		Error operator()(CommandBufferImpl* commands)
 		{
 			GlState& state = commands->getQueue().getState();
 
@@ -125,7 +125,7 @@ void GlPipelineHandle::bind(GlCommandBufferHandle& commands)
 }
 
 //==============================================================================
-GlShaderHandle GlPipelineHandle::getAttachedProgram(GLenum type) const
+ShaderHandle PipelineHandle::getAttachedProgram(GLenum type) const
 {
 	ANKI_ASSERT(isCreated());
 	Error err = serializeOnGetter();
@@ -135,7 +135,7 @@ GlShaderHandle GlPipelineHandle::getAttachedProgram(GLenum type) const
 	}
 	else
 	{
-		return GlShaderHandle();
+		return ShaderHandle();
 	}
 }
 

+ 12 - 12
src/gl/GlPipeline.cpp → src/gr/gl/PipelineImpl.cpp

@@ -3,15 +3,15 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlPipeline.h"
-#include "anki/gl/GlShader.h"
+#include "anki/gr/gl/PipelineImpl.h"
+#include "anki/gr/gl/ShaderImpl.h"
 #include "anki/util/Logger.h"
 
 namespace anki {
 
 //==============================================================================
-Error GlPipeline::create(
-	const GlShaderHandle* progsBegin, const GlShaderHandle* progsEnd,
+Error PipelineImpl::create(
+	const ShaderHandle* progsBegin, const ShaderHandle* progsEnd,
 	GlAllocator<U8> alloc)
 {
 	ANKI_ASSERT(progsBegin != nullptr && progsEnd != nullptr);
@@ -29,7 +29,7 @@ Error GlPipeline::create(
 
 	for(U i = 0; i < m_shaders.size(); i++)
 	{
-		GlShaderHandle& prog = m_shaders[i];
+		ShaderHandle& prog = m_shaders[i];
 
 		if(prog.isCreated())
 		{
@@ -73,7 +73,7 @@ Error GlPipeline::create(
 }
 
 //==============================================================================
-void GlPipeline::destroy()
+void PipelineImpl::destroy()
 {
 	if(m_glName)
 	{
@@ -83,13 +83,13 @@ void GlPipeline::destroy()
 }
 
 //==============================================================================
-void GlPipeline::attachProgramsInternal(
-	const GlShaderHandle* progs, PtrSize count)
+void PipelineImpl::attachProgramsInternal(
+	const ShaderHandle* progs, PtrSize count)
 {
 	U mask = 0;
 	while(count-- != 0)
 	{
-		const GlShaderHandle& prog = progs[count];
+		const ShaderHandle& prog = progs[count];
 		ShaderType type = computeShaderTypeIndex(prog._get().getType());
 		U idx = enumToType(type);
 
@@ -123,19 +123,19 @@ void GlPipeline::attachProgramsInternal(
 }
 
 //==============================================================================
-void GlPipeline::bind()
+void PipelineImpl::bind()
 {
 	ANKI_ASSERT(isCreated());
 	glBindProgramPipeline(m_glName);
 }
 
 //==============================================================================
-GlShaderHandle GlPipeline::getAttachedProgram(GLenum type) const
+ShaderHandle PipelineImpl::getAttachedProgram(GLenum type) const
 {
 	ANKI_ASSERT(isCreated());
 	ShaderType stype = computeShaderTypeIndex(type);
 	U idx = enumToType(stype);
-	GlShaderHandle prog = m_shaders[idx];
+	ShaderHandle prog = m_shaders[idx];
 	ANKI_ASSERT(prog.isCreated() && "Asking for non-created program");
 	return prog;
 }

+ 22 - 22
src/gl/GlQueue.cpp → src/gr/gl/Queue.cpp

@@ -3,17 +3,17 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlQueue.h"
-#include "anki/gl/GlCommandBuffer.h"
-#include "anki/gl/GlSyncHandles.h"
-#include "anki/gl/GlDevice.h"
+#include "anki/gr/gl/Queue.h"
+#include "anki/gr/gl/CommandBufferImpl.h"
+#include "anki/gr/GlSyncHandles.h"
+#include "anki/gr/GlDevice.h"
 #include "anki/util/Logger.h"
 #include "anki/core/Counters.h"
 
 namespace anki {
 
 //==============================================================================
-GlQueue::GlQueue(GlDevice* device, 
+Queue::Queue(GlDevice* device, 
 	AllocAlignedCallback allocCb, void* allocCbUserData)
 :	m_device(device), 
 	m_allocCb(allocCb),
@@ -27,11 +27,11 @@ GlQueue::GlQueue(GlDevice* device,
 }
 
 //==============================================================================
-GlQueue::~GlQueue()
+Queue::~Queue()
 {}
 
 //==============================================================================
-void GlQueue::flushCommandBuffer(GlCommandBufferHandle& commands)
+void Queue::flushCommandBuffer(CommandBufferHandle& commands)
 {
 	commands._get().makeImmutable();
 
@@ -66,7 +66,7 @@ void GlQueue::flushCommandBuffer(GlCommandBufferHandle& commands)
 }
 
 //==============================================================================
-void GlQueue::finishCommandBuffer(GlCommandBufferHandle& commands)
+void Queue::finishCommandBuffer(CommandBufferHandle& commands)
 {
 #if !ANKI_QUEUE_DISABLE_ASYNC
 	flushCommandBuffer(commands);
@@ -79,7 +79,7 @@ void GlQueue::finishCommandBuffer(GlCommandBufferHandle& commands)
 }
 
 //==============================================================================
-Error GlQueue::start(
+Error Queue::start(
 	GlMakeCurrentCallback makeCurrentCb, void* makeCurrentCbData, void* ctx,
 	GlCallback swapBuffersCallback, void* swapBuffersCbData,
 	Bool registerMessages)
@@ -139,7 +139,7 @@ Error GlQueue::start(
 }
 
 //==============================================================================
-void GlQueue::stop()
+void Queue::stop()
 {
 #if !ANKI_QUEUE_DISABLE_ASYNC
 	{
@@ -158,7 +158,7 @@ void GlQueue::stop()
 }
 
 //==============================================================================
-void GlQueue::prepare()
+void Queue::prepare()
 {
 	ANKI_ASSERT(m_makeCurrentCb && m_ctx);
 	(*m_makeCurrentCb)(m_makeCurrentCbData, m_ctx);
@@ -186,7 +186,7 @@ void GlQueue::prepare()
 }
 
 //==============================================================================
-void GlQueue::finish()
+void Queue::finish()
 {
 	// Iterate the queue and release the refcounts
 	for(U i = 0; i < m_queue.size(); i++)
@@ -197,7 +197,7 @@ void GlQueue::finish()
 			m_queue[i]._get().makeExecuted();
 
 			// Release
-			m_queue[i] = GlCommandBufferHandle();
+			m_queue[i] = CommandBufferHandle();
 		}
 	}
 
@@ -210,21 +210,21 @@ void GlQueue::finish()
 }
 
 //==============================================================================
-Error GlQueue::threadCallback(Thread::Info& info)
+Error Queue::threadCallback(Thread::Info& info)
 {
-	GlQueue* queue = reinterpret_cast<GlQueue*>(info.m_userData);
+	Queue* queue = reinterpret_cast<Queue*>(info.m_userData);
 	queue->threadLoop();
 	return ErrorCode::NONE;
 }
 
 //==============================================================================
-void GlQueue::threadLoop()
+void Queue::threadLoop()
 {
 	prepare();
 
 	while(1)
 	{
-		GlCommandBufferHandle cmd;
+		CommandBufferHandle cmd;
 
 		// Wait for something
 		{
@@ -244,7 +244,7 @@ void GlQueue::threadLoop()
 			U64 idx = m_head % m_queue.size();
 			// Pop a command
 			cmd = m_queue[idx];
-			m_queue[idx] = GlCommandBufferHandle(); // Insert empty cmd buffer
+			m_queue[idx] = CommandBufferHandle(); // Insert empty cmd buffer
 
 			++m_head;
 		}
@@ -262,7 +262,7 @@ void GlQueue::threadLoop()
 }
 
 //==============================================================================
-void GlQueue::syncClientServer()
+void Queue::syncClientServer()
 {
 #if !ANKI_QUEUE_DISABLE_ASYNC
 	flushCommandBuffer(m_syncCommands);
@@ -271,10 +271,10 @@ void GlQueue::syncClientServer()
 }
 
 //==============================================================================
-Error GlQueue::swapBuffersInternal(void* ptr)
+Error Queue::swapBuffersInternal(void* ptr)
 {
 	ANKI_ASSERT(ptr);
-	GlQueue& self = *reinterpret_cast<GlQueue*>(ptr);
+	Queue& self = *reinterpret_cast<Queue*>(ptr);
 
 	// Do the swap buffers
 	self.m_swapBuffersCallback(self.m_swapBuffersCbData);
@@ -291,7 +291,7 @@ Error GlQueue::swapBuffersInternal(void* ptr)
 }
 
 //==============================================================================
-void GlQueue::swapBuffers()
+void Queue::swapBuffers()
 {
 	// Wait for the rendering thread to finish swap buffers...
 	{

+ 20 - 20
src/gl/GlShaderHandle.cpp → src/gr/gl/ShaderHandle.cpp

@@ -3,31 +3,31 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlShaderHandle.h"
-#include "anki/gl/GlDevice.h"
-#include "anki/gl/GlClientBufferHandle.h"
-#include "anki/gl/GlHandleDeferredDeleter.h"
-#include "anki/gl/GlShader.h"
+#include "anki/gr/ShaderHandle.h"
+#include "anki/gr/GlDevice.h"
+#include "anki/gr/ClientBufferHandle.h"
+#include "anki/gr/GlHandleDeferredDeleter.h"
+#include "anki/gr/gl/ShaderImpl.h"
 
 namespace anki {
 
 //==============================================================================
 /// Create program command
-class GlShaderCreateCommand: public GlCommand
+class ShaderCreateCommand: public GlCommand
 {
 public:
-	GlShaderHandle m_shader;
+	ShaderHandle m_shader;
 	GLenum m_type;
-	GlClientBufferHandle m_source;
+	ClientBufferHandle m_source;
 
-	GlShaderCreateCommand(GlShaderHandle shader, 
-		GLenum type, GlClientBufferHandle source)
+	ShaderCreateCommand(ShaderHandle shader, 
+		GLenum type, ClientBufferHandle source)
 	:	m_shader(shader), 
 		m_type(type), 
 		m_source(source)
 	{}
 
-	Error operator()(GlCommandBuffer* commands)
+	Error operator()(CommandBufferImpl* commands)
 	{
 		Error err = m_shader._get().create(m_type, 
 			reinterpret_cast<const char*>(m_source.getBaseAddress()),
@@ -44,20 +44,20 @@ public:
 };
 
 //==============================================================================
-GlShaderHandle::GlShaderHandle()
+ShaderHandle::ShaderHandle()
 {}
 
 //==============================================================================
-GlShaderHandle::~GlShaderHandle()
+ShaderHandle::~ShaderHandle()
 {}
 
 //==============================================================================
-Error GlShaderHandle::create(GlCommandBufferHandle& commands, 
-	GLenum type, const GlClientBufferHandle& source)
+Error ShaderHandle::create(CommandBufferHandle& commands, 
+	GLenum type, const ClientBufferHandle& source)
 {
-	using Alloc = GlAllocator<GlShader>;
-	using DeleteCommand = GlDeleteObjectCommand<GlShader, Alloc>;
-	using Deleter = GlHandleDeferredDeleter<GlShader, Alloc, DeleteCommand>;
+	using Alloc = GlAllocator<ShaderImpl>;
+	using DeleteCommand = GlDeleteObjectCommand<ShaderImpl, Alloc>;
+	using Deleter = GlHandleDeferredDeleter<ShaderImpl, Alloc, DeleteCommand>;
 
 	Error err = _createAdvanced(
 		&commands._get().getQueue().getDevice(),
@@ -68,7 +68,7 @@ Error GlShaderHandle::create(GlCommandBufferHandle& commands,
 	{
 		_setState(GlHandleState::TO_BE_CREATED);
 
-		commands._pushBackNewCommand<GlShaderCreateCommand>(
+		commands._pushBackNewCommand<ShaderCreateCommand>(
 			*this, type, source);
 	}
 
@@ -76,7 +76,7 @@ Error GlShaderHandle::create(GlCommandBufferHandle& commands,
 }
 
 //==============================================================================
-GLenum GlShaderHandle::getType() const
+GLenum ShaderHandle::getType() const
 {
 	return (serializeOnGetter()) ? GL_NONE : _get().getType();
 }

+ 4 - 4
src/gl/GlShader.cpp → src/gr/gl/ShaderImpl.cpp

@@ -3,7 +3,7 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlShader.h"
+#include "anki/gr/gl/ShaderImpl.h"
 #include "anki/util/StringList.h"
 #include "anki/util/Logger.h"
 
@@ -16,7 +16,7 @@
 namespace anki {
 
 //==============================================================================
-Error GlShader::create(GLenum type, const CString& source, 
+Error ShaderImpl::create(GLenum type, const CString& source, 
 	GlAllocator<U8>& alloc, const CString& cacheDir)
 {
 	ANKI_ASSERT(source);
@@ -122,7 +122,7 @@ Error GlShader::create(GLenum type, const CString& source,
 }
 
 //==============================================================================
-Error GlShader::handleError(GlAllocator<U8>& alloc, String& src)
+Error ShaderImpl::handleError(GlAllocator<U8>& alloc, String& src)
 {
 	Error err = ErrorCode::NONE;
 
@@ -176,7 +176,7 @@ Error GlShader::handleError(GlAllocator<U8>& alloc, String& src)
 }
 
 //==============================================================================
-void GlShader::destroy()
+void ShaderImpl::destroy()
 {
 	if(m_glName != 0)
 	{

+ 5 - 6
src/gl/GlState.cpp → src/gr/gl/State.cpp

@@ -3,8 +3,8 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlState.h"
-#include "anki/gl/GlBuffer.h"
+#include "anki/gr/gl/State.h"
+#include "anki/gr/gl/BufferImpl.h"
 #include "anki/util/Logger.h"
 #include <algorithm>
 #include <cstring>
@@ -78,7 +78,7 @@ void oglMessagesCallback(GLenum source,
 #endif
 
 //==============================================================================
-void GlState::init()
+void State::init()
 {
 	// GL version
 	GLint major, minor;
@@ -91,11 +91,11 @@ void GlState::init()
 
 	if(glstr.find("ARM") != CString::NPOS)
 	{
-		m_gpu = GlGpu::ARM;
+		m_gpu = GpuVendor::ARM;
 	}
 	else if(glstr.find("NVIDIA") != CString::NPOS)
 	{
-		m_gpu = GlGpu::NVIDIA;
+		m_gpu = GpuVendor::NVIDIA;
 	}
 
 	// Max tex units
@@ -140,4 +140,3 @@ void GlState::init()
 
 } // end namespace anki
 
-

+ 62 - 62
src/gl/GlTextureHandle.cpp → src/gr/gl/TextureHandle.cpp

@@ -3,46 +3,46 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlTextureHandle.h"
-#include "anki/gl/GlTexture.h"
-#include "anki/gl/GlDevice.h"
-#include "anki/gl/GlHandleDeferredDeleter.h"	
+#include "anki/gr/TextureHandle.h"
+#include "anki/gr/gl/TextureImpl.h"
+#include "anki/gr/GlDevice.h"
+#include "anki/gr/GlHandleDeferredDeleter.h"	
 
 namespace anki {
 
 //==============================================================================
-// GlTextureHandle                                                             =
+// TextureHandle                                                               =
 //==============================================================================
 
 //==============================================================================
-GlTextureHandle::GlTextureHandle()
+TextureHandle::TextureHandle()
 {}
 
 //==============================================================================
-GlTextureHandle::~GlTextureHandle()
+TextureHandle::~TextureHandle()
 {}
 
 //==============================================================================
-Error GlTextureHandle::create(
-	GlCommandBufferHandle& commands, const Initializer& init)
+Error TextureHandle::create(
+	CommandBufferHandle& commands, const Initializer& init)
 {
 	class Command: public GlCommand
 	{
 	public:
-		GlTextureHandle m_tex;
-		GlTextureHandle::Initializer m_init;
+		TextureHandle m_tex;
+		TextureHandle::Initializer m_init;
 
 		Command(
-			GlTextureHandle tex, 
-			const GlTextureHandle::Initializer& init)
+			TextureHandle tex, 
+			const TextureHandle::Initializer& init)
 		:	m_tex(tex), 
 			m_init(init)
 		{}
 
-		Error operator()(GlCommandBuffer* commands)
+		Error operator()(CommandBufferImpl* commands)
 		{
 			ANKI_ASSERT(commands);
-			GlTexture::Initializer init;
+			TextureImpl::Initializer init;
 
 			static_cast<GlTextureInitializerBase&>(init) = m_init;
 
@@ -99,12 +99,12 @@ Error GlTextureHandle::create(
 
 	ANKI_ASSERT(!isCreated());
 
-	using Alloc = GlAllocator<GlTexture>;
+	using Alloc = GlAllocator<TextureImpl>;
 
 	using DeleteCommand = 
-		GlDeleteObjectCommand<GlTexture, Alloc>;
+		GlDeleteObjectCommand<TextureImpl, Alloc>;
 
-	using Deleter = GlHandleDeferredDeleter<GlTexture, Alloc, DeleteCommand>;
+	using Deleter = GlHandleDeferredDeleter<TextureImpl, Alloc, DeleteCommand>;
 
 	Error err = _createAdvanced(
 		&commands._getQueue().getDevice(),
@@ -123,20 +123,20 @@ Error GlTextureHandle::create(
 }
 
 //==============================================================================
-void GlTextureHandle::bind(GlCommandBufferHandle& commands, U32 unit)
+void TextureHandle::bind(CommandBufferHandle& commands, U32 unit)
 {
 	class Command: public GlCommand
 	{
 	public:
-		GlTextureHandle m_tex;
+		TextureHandle m_tex;
 		U32 m_unit;
 
-		Command(GlTextureHandle& tex, U32 unit)
+		Command(TextureHandle& tex, U32 unit)
 		:	m_tex(tex), 
 			m_unit(unit)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
 			m_tex._get().bind(m_unit);
 			return ErrorCode::NONE;
@@ -148,20 +148,20 @@ void GlTextureHandle::bind(GlCommandBufferHandle& commands, U32 unit)
 }
 
 //==============================================================================
-void GlTextureHandle::setFilter(GlCommandBufferHandle& commands, Filter filter)
+void TextureHandle::setFilter(CommandBufferHandle& commands, Filter filter)
 {
 	class Command: public GlCommand
 	{
 	public:
-		GlTextureHandle m_tex;
-		GlTexture::Filter m_filter;
+		TextureHandle m_tex;
+		TextureImpl::Filter m_filter;
 
-		Command(GlTextureHandle tex, GlTexture::Filter filter)
+		Command(TextureHandle tex, TextureImpl::Filter filter)
 		:	m_tex(tex), 
 			m_filter(filter)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
 			m_tex._get().setFilter(m_filter);
 			return ErrorCode::NONE;
@@ -173,18 +173,18 @@ void GlTextureHandle::setFilter(GlCommandBufferHandle& commands, Filter filter)
 }
 
 //==============================================================================
-void GlTextureHandle::generateMipmaps(GlCommandBufferHandle& commands)
+void TextureHandle::generateMipmaps(CommandBufferHandle& commands)
 {
 	class Command: public GlCommand
 	{
 	public:
-		GlTextureHandle m_tex;
+		TextureHandle m_tex;
 
-		Command(GlTextureHandle tex)
+		Command(TextureHandle tex)
 		:	m_tex(tex)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
 			m_tex._get().generateMipmaps();
 			return ErrorCode::NONE;
@@ -196,7 +196,7 @@ void GlTextureHandle::generateMipmaps(GlCommandBufferHandle& commands)
 }
 
 //==============================================================================
-void GlTextureHandle::setParameter(GlCommandBufferHandle& commands, 
+void TextureHandle::setParameter(CommandBufferHandle& commands, 
 	GLenum param, GLint value)
 {
 	ANKI_ASSERT(isCreated());
@@ -204,17 +204,17 @@ void GlTextureHandle::setParameter(GlCommandBufferHandle& commands,
 	class Command: public GlCommand
 	{
 	public:
-		GlTextureHandle m_tex;
+		TextureHandle m_tex;
 		GLenum m_param;
 		GLint m_value;
 
-		Command(GlTextureHandle& tex, GLenum param, GLint value)
+		Command(TextureHandle& tex, GLenum param, GLint value)
 		:	m_tex(tex), 
 			m_param(param), 
 			m_value(value)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
 			m_tex._get().setParameter(m_param, m_value);
 			return ErrorCode::NONE;
@@ -226,30 +226,30 @@ void GlTextureHandle::setParameter(GlCommandBufferHandle& commands,
 }
 
 //==============================================================================
-// GlSamplerHandle                                                             =
+// SamplerHandle                                                               =
 //==============================================================================
 
 //==============================================================================
-GlSamplerHandle::GlSamplerHandle()
+SamplerHandle::SamplerHandle()
 {}
 
 //==============================================================================
-GlSamplerHandle::~GlSamplerHandle()
+SamplerHandle::~SamplerHandle()
 {}
 
 //==============================================================================
-Error GlSamplerHandle::create(GlCommandBufferHandle& commands)
+Error SamplerHandle::create(CommandBufferHandle& commands)
 {
 	class Command: public GlCommand
 	{
 	public:
-		GlSamplerHandle m_sampler;
+		SamplerHandle m_sampler;
 
-		Command(const GlSamplerHandle& sampler)
+		Command(const SamplerHandle& sampler)
 		:	m_sampler(sampler)
 		{}
 
-		Error operator()(GlCommandBuffer* commands)
+		Error operator()(CommandBufferImpl* commands)
 		{
 			ANKI_ASSERT(commands);
 
@@ -264,11 +264,11 @@ Error GlSamplerHandle::create(GlCommandBufferHandle& commands)
 		}
 	};
 
-	using Alloc = GlAllocator<GlSampler>;
+	using Alloc = GlAllocator<SamplerImpl>;
 
-	using DeleteCommand = GlDeleteObjectCommand<GlSampler, Alloc>;
+	using DeleteCommand = GlDeleteObjectCommand<SamplerImpl, Alloc>;
 
-	using Deleter = GlHandleDeferredDeleter<GlSampler, Alloc, DeleteCommand>;
+	using Deleter = GlHandleDeferredDeleter<SamplerImpl, Alloc, DeleteCommand>;
 
 	Error err = _createAdvanced(
 		&commands._getQueue().getDevice(),
@@ -285,20 +285,20 @@ Error GlSamplerHandle::create(GlCommandBufferHandle& commands)
 }
 
 //==============================================================================
-void GlSamplerHandle::bind(GlCommandBufferHandle& commands, U32 unit)
+void SamplerHandle::bind(CommandBufferHandle& commands, U32 unit)
 {
 	class Command: public GlCommand
 	{
 	public:
-		GlSamplerHandle m_sampler;
+		SamplerHandle m_sampler;
 		U32 m_unit;
 
-		Command(GlSamplerHandle& sampler, U32 unit)
+		Command(SamplerHandle& sampler, U32 unit)
 		:	m_sampler(sampler), 
 			m_unit(unit)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
 			m_sampler._get().bind(m_unit);
 			return ErrorCode::NONE;
@@ -310,20 +310,20 @@ void GlSamplerHandle::bind(GlCommandBufferHandle& commands, U32 unit)
 }
 
 //==============================================================================
-void GlSamplerHandle::setFilter(GlCommandBufferHandle& commands, Filter filter)
+void SamplerHandle::setFilter(CommandBufferHandle& commands, Filter filter)
 {
 	class Command: public GlCommand
 	{
 	public:
-		GlSamplerHandle m_sampler;
-		GlSamplerHandle::Filter m_filter;
+		SamplerHandle m_sampler;
+		SamplerHandle::Filter m_filter;
 
-		Command(const GlSamplerHandle& sampler, GlSamplerHandle::Filter filter)
+		Command(const SamplerHandle& sampler, SamplerHandle::Filter filter)
 		:	m_sampler(sampler), 
 			m_filter(filter)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
 			m_sampler._get().setFilter(m_filter);
 			return ErrorCode::NONE;
@@ -335,23 +335,23 @@ void GlSamplerHandle::setFilter(GlCommandBufferHandle& commands, Filter filter)
 }
 
 //==============================================================================
-void GlSamplerHandle::setParameter(
-	GlCommandBufferHandle& commands, GLenum param, GLint value)
+void SamplerHandle::setParameter(
+	CommandBufferHandle& commands, GLenum param, GLint value)
 {
 	class Command: public GlCommand
 	{
 	public:
-		GlSamplerHandle m_sampler;
+		SamplerHandle m_sampler;
 		GLenum m_param;
 		GLint m_value;
 
-		Command(GlSamplerHandle& sampler, GLenum param, GLint value)
+		Command(SamplerHandle& sampler, GLenum param, GLint value)
 		:	m_sampler(sampler), 
 			m_param(param), 
 			m_value(value)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
 			m_sampler._get().setParameter(m_param, m_value);
 			return ErrorCode::NONE;
@@ -363,7 +363,7 @@ void GlSamplerHandle::setParameter(
 }
 
 //==============================================================================
-void GlSamplerHandle::bindDefault(GlCommandBufferHandle& commands, U32 unit)
+void SamplerHandle::bindDefault(CommandBufferHandle& commands, U32 unit)
 {
 	class Command: public GlCommand
 	{
@@ -374,9 +374,9 @@ void GlSamplerHandle::bindDefault(GlCommandBufferHandle& commands, U32 unit)
 		:	m_unit(unit)
 		{}
 
-		Error operator()(GlCommandBuffer*)
+		Error operator()(CommandBufferImpl*)
 		{
-			GlSampler::unbind(m_unit);
+			SamplerImpl::unbind(m_unit);
 			return ErrorCode::NONE;
 		}
 	};

+ 11 - 11
src/gl/GlTexture.cpp → src/gr/gl/TextureImpl.cpp

@@ -3,8 +3,8 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include "anki/gl/GlTexture.h"
-#include "anki/gl/GlError.h"
+#include "anki/gr/gl/TextureImpl.h"
+#include "anki/gr/GlError.h"
 #include "anki/util/Functions.h"
 #include "anki/util/DArray.h"
 
@@ -97,11 +97,11 @@ static void getTextureInformation(
 }
 
 //==============================================================================
-// GlTexture                                                                   =
+// TextureImpl                                                                 =
 //==============================================================================
 
 //==============================================================================
-Error GlTexture::create(const Initializer& init, 
+Error TextureImpl::create(const Initializer& init, 
 	GlAllocator<U8>& alloc)
 {
 	// Sanity checks
@@ -347,7 +347,7 @@ Error GlTexture::create(const Initializer& init,
 }
 
 //==============================================================================
-void GlTexture::destroy()
+void TextureImpl::destroy()
 {
 	if(isCreated())
 	{
@@ -357,7 +357,7 @@ void GlTexture::destroy()
 }
 
 //==============================================================================
-void GlTexture::bind(U32 unit) const
+void TextureImpl::bind(U32 unit) const
 {
 	ANKI_ASSERT(isCreated());
 	glActiveTexture(GL_TEXTURE0 + unit);
@@ -365,7 +365,7 @@ void GlTexture::bind(U32 unit) const
 }
 
 //==============================================================================
-void GlTexture::setFilterNoBind(Filter filterType)
+void TextureImpl::setFilterNoBind(Filter filterType)
 {
 	switch(filterType)
 	{
@@ -391,7 +391,7 @@ void GlTexture::setFilterNoBind(Filter filterType)
 }
 
 //==============================================================================
-void GlTexture::setMipmapsRange(U32 baseLevel, U32 maxLevel)
+void TextureImpl::setMipmapsRange(U32 baseLevel, U32 maxLevel)
 {	
 	bind(0);
 	glTexParameteri(m_target, GL_TEXTURE_BASE_LEVEL, baseLevel);
@@ -399,18 +399,18 @@ void GlTexture::setMipmapsRange(U32 baseLevel, U32 maxLevel)
 }
 
 //==============================================================================
-void GlTexture::generateMipmaps()
+void TextureImpl::generateMipmaps()
 {
 	bind(0);
 	glGenerateMipmap(m_target);
 }
 
 //==============================================================================
-// GlSampler                                                                   =
+// SamplerImpl                                                                 =
 //==============================================================================
 
 //==============================================================================
-void GlSampler::setFilter(const Filter filterType)
+void SamplerImpl::setFilter(const Filter filterType)
 {
 	ANKI_ASSERT(isCreated());
 	switch(filterType)

+ 1 - 1
src/renderer/Deformer.cpp

@@ -7,7 +7,7 @@
 #include "anki/resource/ProgramResource.h"
 #include "anki/resource/Material.h"
 #include "anki/scene/SkinNode.h"
-#include "anki/gl/GlState.h"
+#include "anki/gr/GlState.h"
 
 namespace anki {
 

+ 1 - 1
src/resource/CMakeLists.txt

@@ -2,4 +2,4 @@ file(GLOB_RECURSE ANKI_RSRC_SOURCES *.cpp)
 file(GLOB_RECURSE ANKI_RSRC_HEADERS *.h)
 
 add_library(ankiresource ${ANKI_RSRC_SOURCES} ${ANKI_RSRC_HEADERS})
-target_link_libraries(ankiresource ankiphysics ankigl)
+target_link_libraries(ankiresource ankiphysics ankigr)

+ 1 - 1
src/ui/UiPainter.cpp

@@ -4,7 +4,7 @@
 // http://www.anki3d.org/LICENSE
 
 #include "anki/ui/UiPainter.h"
-#include "anki/gl/GlState.h"
+#include "anki/gr/GlState.h"
 #include "anki/resource/TextureResource.h"
 #include "anki/util/Logger.h"
 #include "anki/ui/UiFont.h"

+ 1 - 1
src/ui/UiPainterDevice.cpp

@@ -4,7 +4,7 @@
 // http://www.anki3d.org/LICENSE
 
 #include "anki/ui/UiPainterDevice.h"
-#include "anki/gl/Texture.h"
+#include "anki/gr/Texture.h"
 
 namespace anki {