Commit a85f6f13 by Jamie Madill Committed by Shannon Woods

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
parent f898990d
...@@ -2244,6 +2244,12 @@ void Context::applyTextures(SamplerType type) ...@@ -2244,6 +2244,12 @@ void Context::applyTextures(SamplerType type)
SamplerState samplerState; SamplerState samplerState;
texture->getSamplerState(&samplerState); texture->getSamplerState(&samplerState);
if (mState.samplers[textureUnit] != 0)
{
Sampler *samplerObject = getSampler(mState.samplers[textureUnit]);
samplerObject->getState(&samplerState);
}
if (texture->isSamplerComplete(samplerState)) if (texture->isSamplerComplete(samplerState))
{ {
mRenderer->setSamplerState(type, samplerIndex, samplerState); mRenderer->setSamplerState(type, samplerIndex, samplerState);
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
// sampler object. Sampler objects store some state needed to sample textures. // sampler object. Sampler objects store some state needed to sample textures.
#include "libGLESv2/Sampler.h" #include "libGLESv2/Sampler.h"
#include "libGLESv2/angletypes.h"
namespace gl namespace gl
{ {
...@@ -27,4 +28,15 @@ Sampler::Sampler(GLuint id) ...@@ -27,4 +28,15 @@ Sampler::Sampler(GLuint id)
{ {
} }
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
}
} }
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
namespace gl namespace gl
{ {
struct SamplerState;
class Sampler : public RefCountObject class Sampler : public RefCountObject
{ {
...@@ -30,6 +31,8 @@ class Sampler : public RefCountObject ...@@ -30,6 +31,8 @@ class Sampler : public RefCountObject
void setComparisonMode(GLenum comparisonMode) { mComparisonMode = comparisonMode; } void setComparisonMode(GLenum comparisonMode) { mComparisonMode = comparisonMode; }
void setComparisonFunc(GLenum comparisonFunc) { mComparisonFunc = comparisonFunc; } void setComparisonFunc(GLenum comparisonFunc) { mComparisonFunc = comparisonFunc; }
void getState(SamplerState *samplerState) const;
private: private:
GLenum mMinFilter; GLenum mMinFilter;
GLenum mMagFilter; GLenum mMagFilter;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment