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) ...@@ -32,6 +32,7 @@ Texture::Texture(rx::Renderer *renderer, GLuint id) : RefCountObject(id)
mSamplerState.magFilter = GL_LINEAR; mSamplerState.magFilter = GL_LINEAR;
mSamplerState.wrapS = GL_REPEAT; mSamplerState.wrapS = GL_REPEAT;
mSamplerState.wrapT = GL_REPEAT; mSamplerState.wrapT = GL_REPEAT;
mSamplerState.wrapR = GL_REPEAT;
mSamplerState.maxAnisotropy = 1.0f; mSamplerState.maxAnisotropy = 1.0f;
mSamplerState.lodOffset = 0; mSamplerState.lodOffset = 0;
mUsage = GL_NONE; mUsage = GL_NONE;
...@@ -107,6 +108,21 @@ bool Texture::setWrapT(GLenum wrap) ...@@ -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) // Returns true on successful max anisotropy update (valid anisotropy value)
bool Texture::setMaxAnisotropy(float textureMaxAnisotropy, float contextMaxAnisotropy) bool Texture::setMaxAnisotropy(float textureMaxAnisotropy, float contextMaxAnisotropy)
{ {
...@@ -155,6 +171,11 @@ GLenum Texture::getWrapT() const ...@@ -155,6 +171,11 @@ GLenum Texture::getWrapT() const
return mSamplerState.wrapT; return mSamplerState.wrapT;
} }
GLenum Texture::getWrapR() const
{
return mSamplerState.wrapR;
}
float Texture::getMaxAnisotropy() const float Texture::getMaxAnisotropy() const
{ {
return mSamplerState.maxAnisotropy; return mSamplerState.maxAnisotropy;
......
...@@ -69,6 +69,7 @@ class Texture : public RefCountObject ...@@ -69,6 +69,7 @@ class Texture : public RefCountObject
bool setMagFilter(GLenum filter); bool setMagFilter(GLenum filter);
bool setWrapS(GLenum wrap); bool setWrapS(GLenum wrap);
bool setWrapT(GLenum wrap); bool setWrapT(GLenum wrap);
bool setWrapR(GLenum wrap);
bool setMaxAnisotropy(float textureMaxAnisotropy, float contextMaxAnisotropy); bool setMaxAnisotropy(float textureMaxAnisotropy, float contextMaxAnisotropy);
bool setUsage(GLenum usage); bool setUsage(GLenum usage);
...@@ -76,6 +77,7 @@ class Texture : public RefCountObject ...@@ -76,6 +77,7 @@ class Texture : public RefCountObject
GLenum getMagFilter() const; GLenum getMagFilter() const;
GLenum getWrapS() const; GLenum getWrapS() const;
GLenum getWrapT() const; GLenum getWrapT() const;
GLenum getWrapR() const;
float getMaxAnisotropy() const; float getMaxAnisotropy() const;
int getLodOffset(); int getLodOffset();
void getSamplerState(SamplerState *sampler); void getSamplerState(SamplerState *sampler);
......
...@@ -103,6 +103,7 @@ struct SamplerState ...@@ -103,6 +103,7 @@ struct SamplerState
GLenum magFilter; GLenum magFilter;
GLenum wrapS; GLenum wrapS;
GLenum wrapT; GLenum wrapT;
GLenum wrapR;
float maxAnisotropy; float maxAnisotropy;
int lodOffset; int lodOffset;
}; };
......
...@@ -4029,6 +4029,13 @@ void __stdcall glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) ...@@ -4029,6 +4029,13 @@ void __stdcall glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
case GL_TEXTURE_WRAP_T: case GL_TEXTURE_WRAP_T:
*params = (GLfloat)texture->getWrapT(); *params = (GLfloat)texture->getWrapT();
break; 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: case GL_TEXTURE_IMMUTABLE_FORMAT_EXT:
*params = (GLfloat)(texture->isImmutable() ? GL_TRUE : GL_FALSE); *params = (GLfloat)(texture->isImmutable() ? GL_TRUE : GL_FALSE);
break; break;
...@@ -4091,6 +4098,13 @@ void __stdcall glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) ...@@ -4091,6 +4098,13 @@ void __stdcall glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
case GL_TEXTURE_WRAP_T: case GL_TEXTURE_WRAP_T:
*params = texture->getWrapT(); *params = texture->getWrapT();
break; 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: case GL_TEXTURE_IMMUTABLE_FORMAT_EXT:
*params = texture->isImmutable() ? GL_TRUE : GL_FALSE; *params = texture->isImmutable() ? GL_TRUE : GL_FALSE;
break; break;
...@@ -5732,6 +5746,12 @@ void __stdcall glTexParameterf(GLenum target, GLenum pname, GLfloat param) ...@@ -5732,6 +5746,12 @@ void __stdcall glTexParameterf(GLenum target, GLenum pname, GLfloat param)
return gl::error(GL_INVALID_ENUM); return gl::error(GL_INVALID_ENUM);
} }
break; 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: case GL_TEXTURE_MIN_FILTER:
if (!texture->setMinFilter((GLenum)param)) if (!texture->setMinFilter((GLenum)param))
{ {
...@@ -5814,6 +5834,12 @@ void __stdcall glTexParameteri(GLenum target, GLenum pname, GLint param) ...@@ -5814,6 +5834,12 @@ void __stdcall glTexParameteri(GLenum target, GLenum pname, GLint param)
return gl::error(GL_INVALID_ENUM); return gl::error(GL_INVALID_ENUM);
} }
break; 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: case GL_TEXTURE_MIN_FILTER:
if (!texture->setMinFilter((GLenum)param)) if (!texture->setMinFilter((GLenum)param))
{ {
......
...@@ -378,7 +378,7 @@ ID3D11SamplerState *RenderStateCache::getSamplerState(const gl::SamplerState &sa ...@@ -378,7 +378,7 @@ ID3D11SamplerState *RenderStateCache::getSamplerState(const gl::SamplerState &sa
samplerDesc.Filter = gl_d3d11::ConvertFilter(samplerState.minFilter, samplerState.magFilter, samplerState.maxAnisotropy); samplerDesc.Filter = gl_d3d11::ConvertFilter(samplerState.minFilter, samplerState.magFilter, samplerState.maxAnisotropy);
samplerDesc.AddressU = gl_d3d11::ConvertTextureWrap(samplerState.wrapS); samplerDesc.AddressU = gl_d3d11::ConvertTextureWrap(samplerState.wrapS);
samplerDesc.AddressV = gl_d3d11::ConvertTextureWrap(samplerState.wrapT); 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.MipLODBias = static_cast<float>(samplerState.lodOffset);
samplerDesc.MaxAnisotropy = samplerState.maxAnisotropy; samplerDesc.MaxAnisotropy = samplerState.maxAnisotropy;
samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; 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