Use the currently bound sampler object combined with the internal texture state to determine the
current filtering and address modes at draw time.
TRAC #23453
Signed-off-by: Nicolas Capens
Signed-off-by: Shannon Woods
Authored-by: Jamie Madill
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index b6072f7..3525e89 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -2244,6 +2244,12 @@
SamplerState samplerState;
texture->getSamplerState(&samplerState);
+ if (mState.samplers[textureUnit] != 0)
+ {
+ Sampler *samplerObject = getSampler(mState.samplers[textureUnit]);
+ samplerObject->getState(&samplerState);
+ }
+
if (texture->isSamplerComplete(samplerState))
{
mRenderer->setSamplerState(type, samplerIndex, samplerState);
diff --git a/src/libGLESv2/Sampler.cpp b/src/libGLESv2/Sampler.cpp
index 65a113e..4e3f231 100644
--- a/src/libGLESv2/Sampler.cpp
+++ b/src/libGLESv2/Sampler.cpp
@@ -9,6 +9,7 @@
// sampler object. Sampler objects store some state needed to sample textures.
#include "libGLESv2/Sampler.h"
+#include "libGLESv2/angletypes.h"
namespace gl
{
@@ -27,4 +28,15 @@
{
}
+void Sampler::getState(SamplerState *samplerState) const
+{
+ samplerState->minFilter = mMinFilter;
+ samplerState->magFilter = mMagFilter;
+ samplerState->wrapS = mWrapS;
+ samplerState->wrapT = mWrapT;
+ samplerState->wrapR = mWrapR;
+
+ // TODO: comparison mode/func, min/max LOD
+}
+
}
diff --git a/src/libGLESv2/Sampler.h b/src/libGLESv2/Sampler.h
index 5d1b4c1..6be5a1e 100644
--- a/src/libGLESv2/Sampler.h
+++ b/src/libGLESv2/Sampler.h
@@ -14,6 +14,7 @@
namespace gl
{
+struct SamplerState;
class Sampler : public RefCountObject
{
@@ -30,6 +31,8 @@
void setComparisonMode(GLenum comparisonMode) { mComparisonMode = comparisonMode; }
void setComparisonFunc(GLenum comparisonFunc) { mComparisonFunc = comparisonFunc; }
+ void getState(SamplerState *samplerState) const;
+
private:
GLenum mMinFilter;
GLenum mMagFilter;