Added the GL_TEXTURE_WRAP_R parameter.

TRAC #22705 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods Author: Geoff Lang git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2168 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent c1fdf6ba
......@@ -32,6 +32,7 @@ Texture::Texture(rx::Renderer *renderer, GLuint id) : RefCountObject(id)
mSamplerState.magFilter = GL_LINEAR;
mSamplerState.wrapS = GL_REPEAT;
mSamplerState.wrapT = GL_REPEAT;
mSamplerState.wrapR = GL_REPEAT;
mSamplerState.maxAnisotropy = 1.0f;
mSamplerState.lodOffset = 0;
mUsage = GL_NONE;
......@@ -107,6 +108,21 @@ bool Texture::setWrapT(GLenum wrap)
}
}
// Returns true on successful wrap state update (valid enum parameter)
bool Texture::setWrapR(GLenum wrap)
{
switch (wrap)
{
case GL_REPEAT:
case GL_CLAMP_TO_EDGE:
case GL_MIRRORED_REPEAT:
mSamplerState.wrapR = wrap;
return true;
default:
return false;
}
}
// Returns true on successful max anisotropy update (valid anisotropy value)
bool Texture::setMaxAnisotropy(float textureMaxAnisotropy, float contextMaxAnisotropy)
{
......@@ -155,6 +171,11 @@ GLenum Texture::getWrapT() const
return mSamplerState.wrapT;
}
GLenum Texture::getWrapR() const
{
return mSamplerState.wrapR;
}
float Texture::getMaxAnisotropy() const
{
return mSamplerState.maxAnisotropy;
......
......@@ -69,6 +69,7 @@ class Texture : public RefCountObject
bool setMagFilter(GLenum filter);
bool setWrapS(GLenum wrap);
bool setWrapT(GLenum wrap);
bool setWrapR(GLenum wrap);
bool setMaxAnisotropy(float textureMaxAnisotropy, float contextMaxAnisotropy);
bool setUsage(GLenum usage);
......@@ -76,6 +77,7 @@ class Texture : public RefCountObject
GLenum getMagFilter() const;
GLenum getWrapS() const;
GLenum getWrapT() const;
GLenum getWrapR() const;
float getMaxAnisotropy() const;
int getLodOffset();
void getSamplerState(SamplerState *sampler);
......
......@@ -103,6 +103,7 @@ struct SamplerState
GLenum magFilter;
GLenum wrapS;
GLenum wrapT;
GLenum wrapR;
float maxAnisotropy;
int lodOffset;
};
......
......@@ -4029,6 +4029,13 @@ void __stdcall glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
case GL_TEXTURE_WRAP_T:
*params = (GLfloat)texture->getWrapT();
break;
case GL_TEXTURE_WRAP_R:
if (context->getClientVersion() < 3)
{
return gl::error(GL_INVALID_ENUM);
}
*params = (GLfloat)texture->getWrapR();
break;
case GL_TEXTURE_IMMUTABLE_FORMAT_EXT:
*params = (GLfloat)(texture->isImmutable() ? GL_TRUE : GL_FALSE);
break;
......@@ -4091,6 +4098,13 @@ void __stdcall glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
case GL_TEXTURE_WRAP_T:
*params = texture->getWrapT();
break;
case GL_TEXTURE_WRAP_R:
if (context->getClientVersion() < 3)
{
return gl::error(GL_INVALID_ENUM);
}
*params = texture->getWrapR();
break;
case GL_TEXTURE_IMMUTABLE_FORMAT_EXT:
*params = texture->isImmutable() ? GL_TRUE : GL_FALSE;
break;
......@@ -5732,6 +5746,12 @@ void __stdcall glTexParameterf(GLenum target, GLenum pname, GLfloat param)
return gl::error(GL_INVALID_ENUM);
}
break;
case GL_TEXTURE_WRAP_R:
if (context->getClientVersion() < 3 || !texture->setWrapR((GLenum)param))
{
return gl::error(GL_INVALID_ENUM);
}
break;
case GL_TEXTURE_MIN_FILTER:
if (!texture->setMinFilter((GLenum)param))
{
......@@ -5814,6 +5834,12 @@ void __stdcall glTexParameteri(GLenum target, GLenum pname, GLint param)
return gl::error(GL_INVALID_ENUM);
}
break;
case GL_TEXTURE_WRAP_R:
if (context->getClientVersion() < 3 || !texture->setWrapR((GLenum)param))
{
return gl::error(GL_INVALID_ENUM);
}
break;
case GL_TEXTURE_MIN_FILTER:
if (!texture->setMinFilter((GLenum)param))
{
......
......@@ -378,7 +378,7 @@ ID3D11SamplerState *RenderStateCache::getSamplerState(const gl::SamplerState &sa
samplerDesc.Filter = gl_d3d11::ConvertFilter(samplerState.minFilter, samplerState.magFilter, samplerState.maxAnisotropy);
samplerDesc.AddressU = gl_d3d11::ConvertTextureWrap(samplerState.wrapS);
samplerDesc.AddressV = gl_d3d11::ConvertTextureWrap(samplerState.wrapT);
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.AddressW = gl_d3d11::ConvertTextureWrap(samplerState.wrapR);
samplerDesc.MipLODBias = static_cast<float>(samplerState.lodOffset);
samplerDesc.MaxAnisotropy = samplerState.maxAnisotropy;
samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
......
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