Panagiotis Christopoulos Charitos преди 10 години
родител
ревизия
e236d2f9e3

+ 0 - 1
include/anki/Config.h.cmake

@@ -151,7 +151,6 @@
 #	define ANKI_RESTRICT
 #	define ANKI_USE_RESULT
 #endif
-
 /// @}
 
 #endif

+ 1 - 0
include/anki/Gr.h

@@ -18,6 +18,7 @@
 
 #include "anki/gr/BufferHandle.h"
 #include "anki/gr/TextureHandle.h"
+#include "anki/gr/SamplerHandle.h"
 #include "anki/gr/ShaderHandle.h"
 
 #include "anki/gr/FramebufferHandle.h"

+ 6 - 1
include/anki/gr/Common.h

@@ -47,6 +47,8 @@ class OcclusionQueryImpl;
 class OcclusionQueryHandle;
 class CommandBufferImpl;
 class CommandBufferHandle;
+class ResourceGroupImpl;
+class ResourceGroupHandle;
 class GrManager;
 class GrManagerImpl;
 struct FramebufferInitializer;
@@ -70,10 +72,13 @@ using GrAllocator = HeapAllocator<T>;
 /// @{
 
 // Some constants
-const U MAX_VERTEX_ATTRIBUTES = 16;
+const U MAX_VERTEX_ATTRIBUTES = 8;
 const U MAX_COLOR_ATTACHMENTS = 4;
 const U MAX_MIPMAPS = 16;
 const U MAX_TEXTURE_LAYERS = 32;
+const U MAX_TEXTURE_BINDINGS = 8;
+const U MAX_UNIFORM_BUFFER_BINDINGS = 4;
+const U MAX_STORAGE_BUFFER_BINDINGS = 4;
 
 /// GL generic callback
 using SwapBuffersCallback = void(*)(void*);

+ 41 - 0
include/anki/gr/ResourceGroupCommon.h

@@ -0,0 +1,41 @@
+// Copyright (C) 2009-2015, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#ifndef ANKI_GR_RESOURCE_GROUP_COMMON_H
+#define ANKI_GR_RESOURCE_GROUP_COMMON_H
+
+#include "anki/gr/Common.h"
+#include "anki/gr/TextureHandle.h"
+
+namespace anki {
+
+/// @addtogroup graphics
+/// @{
+
+/// Buffer binding point.
+class BufferBinding
+{
+public:
+	BufferHandle m_buffer;
+	PtrSize m_offset = 0;
+};
+
+/// Resource group initializer.
+class ResourceGroupInitializer
+{
+public:
+	Array<TextureHandle, MAX_TEXTURE_BINDINGS> m_textures;
+	Array<SamplerHandle, MAX_TEXTURE_BINDINGS> m_samplers;
+	Array<BufferBinding, MAX_UNIFORM_BUFFER_BINDINGS> m_uniformBuffers;
+	Array<BufferBinding, MAX_STORAGE_BUFFER_BINDINGS> m_storageBuffers;
+	Array<BufferBinding, MAX_ATTRIBUTES> m_storageBuffers;
+	BufferBinding m_indexBuffer;
+};
+/// @}
+
+} // end namespace anki
+
+#endif
+

+ 34 - 0
include/anki/gr/ResourceGroupHandle.h

@@ -0,0 +1,34 @@
+// Copyright (C) 2009-2015, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#ifndef ANKI_GR_RESOURCE_GROUP_HANDLE_H
+#define ANKI_GR_RESOURCE_GROUP_HANDLE_H
+
+#include "anki/gr/GrHandle.h"
+#include "anki/gr/ResourceGroupCommon.h"
+
+namespace anki {
+
+/// @addtogroup graphics
+/// @{
+
+/// A collection of resource binding.
+class ResourceGroupHandle: public GrHandle<ResourceGroupImpl>
+{
+public:
+	using Base = GrHandle<ResourceGroupImpl>;
+
+	ResourceGroupHandle();
+
+	~ResourceGroupHandle();
+
+	/// Create resource group.
+	ANKI_USE_RESULT Error create(GrManager* manager);
+};
+
+} // end namespace anki
+
+#endif
+

+ 44 - 0
include/anki/gr/SamplerHandle.h

@@ -0,0 +1,44 @@
+// Copyright (C) 2009-2015, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#ifndef ANKI_GR_SAMPLER_HANDLE_H
+#define ANKI_GR_SAMPLER_HANDLE_H
+
+#include "anki/gr/TextureSamplerCommon.h"
+#include "anki/gr/GrHandle.h"
+
+namespace anki {
+
+/// @addtogroup graphics
+/// @{
+
+/// Sampler handle.
+class SamplerHandle: public GrHandle<SamplerImpl>
+{
+public:
+	using Base = GrHandle<SamplerImpl>;
+	using Initializer = SamplerInitializer;
+
+	/// Create husk.
+	SamplerHandle();
+
+	~SamplerHandle();
+
+	/// Create the sampler
+	ANKI_USE_RESULT Error create(CommandBufferHandle& commands, 
+		const Initializer& init);
+
+	/// Bind to a unit
+	void bind(CommandBufferHandle& commands, U32 unit);
+
+	/// Bind default sampler
+	static void bindDefault(CommandBufferHandle& commands, U32 unit);
+};
+/// @}
+
+} // end namespace anki
+
+#endif
+

+ 1 - 24
include/anki/gr/TextureHandle.h

@@ -7,7 +7,7 @@
 #define ANKI_GR_TEXTURE_HANDLE_H
 
 #include "anki/gr/GrHandle.h"
-#include "anki/gr/TextureCommon.h"
+#include "anki/gr/TextureSamplerCommon.h"
 
 namespace anki {
 
@@ -35,29 +35,6 @@ public:
 	/// Generate mips
 	void generateMipmaps(CommandBufferHandle& commands);
 };
-
-/// Sampler handle
-class SamplerHandle: public GrHandle<SamplerImpl>
-{
-public:
-	using Base = GrHandle<SamplerImpl>;
-	using Initializer = SamplerInitializer;
-
-	/// Create husk.
-	SamplerHandle();
-
-	~SamplerHandle();
-
-	/// Create the sampler
-	ANKI_USE_RESULT Error create(CommandBufferHandle& commands, 
-		const Initializer& init);
-
-	/// Bind to a unit
-	void bind(CommandBufferHandle& commands, U32 unit);
-
-	/// Bind default sampler
-	static void bindDefault(CommandBufferHandle& commands, U32 unit);
-};
 /// @}
 
 } // end namespace anki

+ 2 - 2
include/anki/gr/TextureCommon.h → include/anki/gr/TextureSamplerCommon.h

@@ -3,8 +3,8 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#ifndef ANKI_GR_TEXTURE_COMMON_H
-#define ANKI_GR_TEXTURE_COMMON_H
+#ifndef ANKI_GR_TEXTURE_SAMPLER_COMMON_H
+#define ANKI_GR_TEXTURE_SAMPLER_COMMON_H
 
 #include "anki/gr/Common.h"
 

+ 60 - 0
include/anki/gr/gl/SamplerImpl.h

@@ -0,0 +1,60 @@
+// Copyright (C) 2009-2015, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#ifndef ANKI_GR_GL_SAMPLER_IMPL_H
+#define ANKI_GR_GL_SAMPLER_IMPL_H
+
+#include "anki/gr/gl/GlObject.h"
+
+namespace anki {
+
+/// @addtogroup opengl
+/// @{
+
+/// Sampler GL object.
+class SamplerImpl: public GlObject
+{
+public:
+	using Base = GlObject;
+
+	SamplerImpl(GrManager* manager)
+	:	Base(manager)
+	{}
+
+	~SamplerImpl()
+	{
+		destroy();
+	}
+
+	ANKI_USE_RESULT Error create(const SamplerInitializer& sinit);
+
+	/// Bind the texture to a specified unit
+	void bind(U32 unit) const
+	{
+		ANKI_ASSERT(isCreated());
+		glBindSampler(unit, m_glName);
+	}
+
+	/// Unbind sampler from unit
+	static void unbind(U32 unit)
+	{
+		glBindSampler(unit, 0);
+	}
+
+private:
+	void destroy()
+	{
+		if(m_glName)
+		{
+			glDeleteSamplers(1, &m_glName);
+			m_glName = 0;
+		}
+	}
+};
+/// @}
+
+} // end namespace anki
+
+#endif

+ 0 - 41
include/anki/gr/gl/TextureImpl.h

@@ -84,47 +84,6 @@ private:
 
 	static U32 computeMaxMipmapCount(U32 w, U32 h);
 };
-
-/// Sampler container
-class SamplerImpl: public GlObject
-{
-public:
-	using Base = GlObject;
-
-	SamplerImpl(GrManager* manager)
-	:	Base(manager)
-	{}
-
-	~SamplerImpl()
-	{
-		destroy();
-	}
-
-	ANKI_USE_RESULT Error create(const SamplerInitializer& sinit);
-
-	/// Bind the texture to a specified unit
-	void bind(U32 unit) const
-	{
-		ANKI_ASSERT(isCreated());
-		glBindSampler(unit, m_glName);
-	}
-
-	/// Unbind sampler from unit
-	static void unbind(U32 unit)
-	{
-		glBindSampler(unit, 0);
-	}
-
-private:
-	void destroy()
-	{
-		if(m_glName)
-		{
-			glDeleteSamplers(1, &m_glName);
-			m_glName = 0;
-		}
-	}
-};
 /// @}
 
 } // end namespace anki

+ 26 - 27
shaders/PpsSslr.frag.glsl

@@ -12,53 +12,51 @@
 const float PI = 3.14159265358979323846;
 const float ONE = 0.9;
 
-layout(location = 0) in vec2 inTexCoords;
+layout(location = 0) in vec2 in_texCoords;
 
-layout(location = 0) out vec3 outColor;
+layout(location = 0) out vec3 out_color;
 
-layout(std140, binding = 0) readonly buffer bCommon
+layout(std140, binding = 0) readonly buffer _blk
 {
-	vec4 uProjectionParams;
+	vec4 u_projectionParams;
 
 	/// The projection matrix
-	mat4 uProjectionMatrix;
+	mat4 u_projectionMatrix;
 };
 
-layout(binding = 0) uniform sampler2D uIsRt;
-layout(binding = 1) uniform sampler2D uMsDepthRt;
-layout(binding = 2) uniform sampler2D uMsRt;
+layout(binding = 0) uniform sampler2D u_isRt;
+layout(binding = 1) uniform sampler2D u_msDepthRt;
+layout(binding = 2) uniform sampler2D u_msRt;
 
 // Returns the Z of the position in view space
 float readZ(in vec2 uv)
 {
-	float depth = textureLod(uMsDepthRt, uv, 1.0).r;
-	float z = uProjectionParams.z / (uProjectionParams.w + depth);
+	float depth = textureLod(u_msDepthRt, uv, 1.0).r;
+	float z = u_projectionParams.z / (u_projectionParams.w + depth);
 	return z;
 }
 
 // Read position in view space
 vec3 readPosition(in vec2 uv)
 {
-	float depth = textureLod(uMsDepthRt, uv, 1.0).r;
-
 	vec3 fragPosVspace;
 	fragPosVspace.z = readZ(uv);
 	
 	fragPosVspace.xy = 
-		(2.0 * uv - 1.0) * uProjectionParams.xy * fragPosVspace.z;
+		(2.0 * uv - 1.0) * u_projectionParams.xy * fragPosVspace.z;
 
 	return fragPosVspace;
 }
 
 vec3 project(vec3 p)
 {
-	vec4 a = uProjectionMatrix * vec4(p, 1.0);
+	vec4 a = u_projectionMatrix * vec4(p, 1.0);
 	return a.xyz / a.w;
 }
 
 vec2 projectXy(vec3 p)
 {
-	vec4 a = uProjectionMatrix * vec4(p, 1.0);
+	vec4 a = u_projectionMatrix * vec4(p, 1.0);
 	return a.xy / a.w;
 }
 
@@ -66,17 +64,17 @@ void main()
 {
 	vec3 normal;
 	float specColor;
-	readNormalSpecularColorFromGBuffer(uMsRt, inTexCoords, normal, specColor);
+	readNormalSpecularColorFromGBuffer(u_msRt, in_texCoords, normal, specColor);
 
-	//outColor = vec3(0.5, 0.0, 0.0);
-	outColor = vec3(0.0);
+	//out_color = vec3(0.5, 0.0, 0.0);
+	out_color = vec3(0.0);
 
 	if(specColor < 0.5)
 	{
 		return;
 	}
 
-	vec3 p0 = readPosition(inTexCoords);
+	vec3 p0 = readPosition(in_texCoords);
 
 	// Reflection direction
 	vec3 eye = normalize(p0);
@@ -92,7 +90,7 @@ void main()
 	float t = -p0.z / (r.z + 0.0000001);
 	vec3 p1 = p0 + r * t;
 
-	vec2 pp0 = inTexCoords * 2.0 - 1.0;
+	vec2 pp0 = in_texCoords * 2.0 - 1.0;
 	vec2 pp1 = projectXy(p1);
 
 	// Calculate the ray from p0 to p1 in 2D space and get the number of
@@ -118,14 +116,14 @@ void main()
 		vec2 comp = abs(ndc);
 		if(comp.x > ONE || comp.y > ONE)
 		{
-			//outColor = vec3(1, 0.0, 1);
+			//out_color = vec3(1, 0.0, 1);
 			return;
 		}
 
 		// 'a' is ray that passes through the eye and into ndc
 		vec3 a;
 		a.z = -1.0;
-		a.xy = ndc * uProjectionParams.xy * a.z; // Unproject
+		a.xy = ndc * u_projectionParams.xy * a.z; // Unproject
 		a = normalize(a);
 
 		// Compute the intersection between 'a' (before normalization) and r
@@ -157,9 +155,9 @@ void main()
 			factor *= 1.0 - length(pp0);
 			factor *= specColor;
 
-			outColor = textureRt(uIsRt, texCoord).rgb * factor;
+			out_color = textureLod(u_isRt, texCoord, 0.0).rgb * factor;
 
-			//outColor = vec3(1.0 - abs(pp0.xy), 0.0);
+			//out_color = vec3(1.0 - abs(pp0.xy), 0.0);
 			return;
 		}
 	}
@@ -181,7 +179,7 @@ void main()
 
 		vec3 texCoord = posNdc.xyz * 0.5 + 0.5;
 
-		float depth = textureRt(uMsDepthRt, texCoord.xy).r;
+		float depth = textureRt(u_msDepthRt, texCoord.xy).r;
 
 		float diffDepth = texCoord.z - depth;
 
@@ -194,8 +192,9 @@ void main()
 
 			float factor = 1.0 - length(posNdc.xy);
 
-			outColor = textureRt(uIsRt, texCoord.xy).rgb * (factor * specColor);
-			//outColor = vec3(diffDepth);
+			out_color = 
+				textureRt(u_isRt, texCoord.xy).rgb * (factor * specColor);
+			//out_color = vec3(diffDepth);
 			return;
 		}
 	}

+ 120 - 0
src/gr/gl/SamplerHandle.cpp

@@ -0,0 +1,120 @@
+// Copyright (C) 2009-2015, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include "anki/gr/SamplerHandle.h"
+#include "anki/gr/gl/SamplerImpl.h"
+#include "anki/gr/GrManager.h"
+#include "anki/gr/gl/DeferredDeleter.h"	
+
+namespace anki {
+
+//==============================================================================
+// SamplerCommands                                                             =
+//==============================================================================
+
+//==============================================================================
+class CreateSamplerCommand: public GlCommand
+{
+public:
+	SamplerHandle m_sampler;
+	SamplerInitializer m_init;
+
+	CreateSamplerCommand(const SamplerHandle& sampler, 
+		const SamplerInitializer& init)
+	:	m_sampler(sampler),
+		m_init(init)
+	{}
+
+	Error operator()(CommandBufferImpl* commands)
+	{
+		ANKI_ASSERT(commands);
+
+		Error err = m_sampler.get().create(m_init);
+
+		GlObject::State oldState = m_sampler.get().setStateAtomically(
+			(err) ? GlObject::State::ERROR : GlObject::State::CREATED);
+		ANKI_ASSERT(oldState == GlObject::State::TO_BE_CREATED);
+		(void)oldState;
+
+		return err;
+	}
+};
+
+//==============================================================================
+class BindSamplerCommand: public GlCommand
+{
+public:
+	SamplerHandle m_sampler;
+	U8 m_unit;
+
+	BindSamplerCommand(SamplerHandle& sampler, U8 unit)
+	:	m_sampler(sampler), 
+		m_unit(unit)
+	{}
+
+	Error operator()(CommandBufferImpl*)
+	{
+		m_sampler.get().bind(m_unit);
+		return ErrorCode::NONE;
+	}
+};
+
+//==============================================================================
+class BindDefaultSamplerCommand: public GlCommand
+{
+public:
+	U32 m_unit;
+
+	BindDefaultSamplerCommand(U32 unit)
+	:	m_unit(unit)
+	{}
+
+	Error operator()(CommandBufferImpl*)
+	{
+		SamplerImpl::unbind(m_unit);
+		return ErrorCode::NONE;
+	}
+};
+
+//==============================================================================
+// SamplerHandle                                                               =
+//==============================================================================
+
+//==============================================================================
+SamplerHandle::SamplerHandle()
+{}
+
+//==============================================================================
+SamplerHandle::~SamplerHandle()
+{}
+
+//==============================================================================
+Error SamplerHandle::create(CommandBufferHandle& commands, 
+	const SamplerInitializer& init)
+{
+	using DeleteCommand = DeleteObjectCommand<SamplerImpl>;
+	using Deleter = DeferredDeleter<SamplerImpl, DeleteCommand>;
+
+	Base::create(commands.get().getManager(), Deleter());
+	get().setStateAtomically(GlObject::State::TO_BE_CREATED);
+	commands.get().pushBackNewCommand<CreateSamplerCommand>(*this, init);
+
+	return ErrorCode::NONE;
+}
+
+//==============================================================================
+void SamplerHandle::bind(CommandBufferHandle& commands, U32 unit)
+{
+	ANKI_ASSERT(isCreated());
+	commands.get().pushBackNewCommand<BindSamplerCommand>(*this, unit);
+}
+
+//==============================================================================
+void SamplerHandle::bindDefault(CommandBufferHandle& commands, U32 unit)
+{
+	commands.get().pushBackNewCommand<BindDefaultSamplerCommand>(unit);
+}
+
+} // end namespace anki

+ 60 - 0
src/gr/gl/SamplerImpl.cpp

@@ -0,0 +1,60 @@
+// Copyright (C) 2009-2015, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include "anki/gr/gl/SamplerImpl.h"
+#include "anki/gr/TextureSamplerCommon.h"
+
+namespace anki {
+
+//==============================================================================
+Error SamplerImpl::create(const SamplerInitializer& sinit)
+{
+	glGenSamplers(1, &m_glName);
+	ANKI_ASSERT(m_glName);
+	
+	if(sinit.m_repeat)
+	{
+		glSamplerParameteri(m_glName, GL_TEXTURE_WRAP_S, GL_REPEAT);
+		glSamplerParameteri(m_glName, GL_TEXTURE_WRAP_T, GL_REPEAT);
+	}
+	else
+	{
+		glSamplerParameteri(m_glName, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+		glSamplerParameteri(m_glName, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+	}
+
+	// Set filtering type
+	switch(sinit.m_filterType)
+	{
+	case SamplingFilter::NEAREST:
+		glSamplerParameteri(m_glName, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+		glSamplerParameteri(m_glName, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+		break;
+	case SamplingFilter::LINEAR:
+		glSamplerParameteri(m_glName, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+		glSamplerParameteri(m_glName, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+		break;
+	case SamplingFilter::TRILINEAR:
+		glSamplerParameteri(m_glName, 
+			GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+		glSamplerParameteri(m_glName, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+		break;
+	default:
+		ANKI_ASSERT(0);
+		break;
+	}
+
+#if ANKI_GL == ANKI_GL_DESKTOP
+	if(sinit.m_anisotropyLevel > 1)
+	{
+		glSamplerParameteri(m_glName, GL_TEXTURE_MAX_ANISOTROPY_EXT, 
+			GLint(sinit.m_anisotropyLevel));
+	}
+#endif
+	
+	return ErrorCode::NONE;
+}
+
+} // end namespace anki

+ 0 - 107
src/gr/gl/TextureHandle.cpp

@@ -164,112 +164,5 @@ void TextureHandle::generateMipmaps(CommandBufferHandle& commands)
 	commands.get().pushBackNewCommand<GenMipmapsCommand>(*this);
 }
 
-//==============================================================================
-// SamplerCommands                                                             =
-//==============================================================================
-
-//==============================================================================
-class CreateSamplerCommand: public GlCommand
-{
-public:
-	SamplerHandle m_sampler;
-	SamplerInitializer m_init;
-
-	CreateSamplerCommand(const SamplerHandle& sampler, 
-		const SamplerInitializer& init)
-	:	m_sampler(sampler),
-		m_init(init)
-	{}
-
-	Error operator()(CommandBufferImpl* commands)
-	{
-		ANKI_ASSERT(commands);
-
-		Error err = m_sampler.get().create(m_init);
-
-		GlObject::State oldState = m_sampler.get().setStateAtomically(
-			(err) ? GlObject::State::ERROR : GlObject::State::CREATED);
-		ANKI_ASSERT(oldState == GlObject::State::TO_BE_CREATED);
-		(void)oldState;
-
-		return err;
-	}
-};
-
-//==============================================================================
-class BindSamplerCommand: public GlCommand
-{
-public:
-	SamplerHandle m_sampler;
-	U8 m_unit;
-
-	BindSamplerCommand(SamplerHandle& sampler, U8 unit)
-	:	m_sampler(sampler), 
-		m_unit(unit)
-	{}
-
-	Error operator()(CommandBufferImpl*)
-	{
-		m_sampler.get().bind(m_unit);
-		return ErrorCode::NONE;
-	}
-};
-
-//==============================================================================
-class BindDefaultSamplerCommand: public GlCommand
-{
-public:
-	U32 m_unit;
-
-	BindDefaultSamplerCommand(U32 unit)
-	:	m_unit(unit)
-	{}
-
-	Error operator()(CommandBufferImpl*)
-	{
-		SamplerImpl::unbind(m_unit);
-		return ErrorCode::NONE;
-	}
-};
-
-//==============================================================================
-// SamplerHandle                                                               =
-//==============================================================================
-
-//==============================================================================
-SamplerHandle::SamplerHandle()
-{}
-
-//==============================================================================
-SamplerHandle::~SamplerHandle()
-{}
-
-//==============================================================================
-Error SamplerHandle::create(CommandBufferHandle& commands, 
-	const SamplerInitializer& init)
-{
-	using DeleteCommand = DeleteObjectCommand<SamplerImpl>;
-	using Deleter = DeferredDeleter<SamplerImpl, DeleteCommand>;
-
-	Base::create(commands.get().getManager(), Deleter());
-	get().setStateAtomically(GlObject::State::TO_BE_CREATED);
-	commands.get().pushBackNewCommand<CreateSamplerCommand>(*this, init);
-
-	return ErrorCode::NONE;
-}
-
-//==============================================================================
-void SamplerHandle::bind(CommandBufferHandle& commands, U32 unit)
-{
-	ANKI_ASSERT(isCreated());
-	commands.get().pushBackNewCommand<BindSamplerCommand>(*this, unit);
-}
-
-//==============================================================================
-void SamplerHandle::bindDefault(CommandBufferHandle& commands, U32 unit)
-{
-	commands.get().pushBackNewCommand<BindDefaultSamplerCommand>(unit);
-}
-
 } // end namespace anki
 

+ 1 - 54
src/gr/gl/TextureImpl.cpp

@@ -4,7 +4,7 @@
 // http://www.anki3d.org/LICENSE
 
 #include "anki/gr/gl/TextureImpl.h"
-#include "anki/gr/TextureCommon.h"
+#include "anki/gr/TextureSamplerCommon.h"
 #include "anki/gr/gl/Error.h"
 #include "anki/util/Functions.h"
 #include "anki/util/DArray.h"
@@ -461,57 +461,4 @@ U32 TextureImpl::computeMaxMipmapCount(U32 w, U32 h)
 	return count;
 }
 
-//==============================================================================
-// SamplerImpl                                                                 =
-//==============================================================================
-
-//==============================================================================
-Error SamplerImpl::create(const SamplerInitializer& sinit)
-{
-	glGenSamplers(1, &m_glName);
-	ANKI_ASSERT(m_glName);
-	
-	if(sinit.m_repeat)
-	{
-		glSamplerParameteri(m_glName, GL_TEXTURE_WRAP_S, GL_REPEAT);
-		glSamplerParameteri(m_glName, GL_TEXTURE_WRAP_T, GL_REPEAT);
-	}
-	else
-	{
-		glSamplerParameteri(m_glName, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-		glSamplerParameteri(m_glName, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-	}
-
-	// Set filtering type
-	switch(sinit.m_filterType)
-	{
-	case SamplingFilter::NEAREST:
-		glSamplerParameteri(m_glName, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-		glSamplerParameteri(m_glName, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-		break;
-	case SamplingFilter::LINEAR:
-		glSamplerParameteri(m_glName, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-		glSamplerParameteri(m_glName, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-		break;
-	case SamplingFilter::TRILINEAR:
-		glSamplerParameteri(m_glName, 
-			GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
-		glSamplerParameteri(m_glName, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-		break;
-	default:
-		ANKI_ASSERT(0);
-		break;
-	}
-
-#if ANKI_GL == ANKI_GL_DESKTOP
-	if(sinit.m_anisotropyLevel > 1)
-	{
-		glSamplerParameteri(m_glName, GL_TEXTURE_MAX_ANISOTROPY_EXT, 
-			GLint(sinit.m_anisotropyLevel));
-	}
-#endif
-	
-	return ErrorCode::NONE;
-}
-
 } // end namespace anki