Commit c1984ed4 by Geoff Lang Committed by Commit Bot

Implement robust TexParameter and SamplerParameter entry points.

BUG=angleproject:1354 Change-Id: I3aa2dcb8603a839f9c07cd9dd41cb695d2e699f2 Reviewed-on: https://chromium-review.googlesource.com/395529 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent bd674557
...@@ -644,6 +644,29 @@ std::string ParseUniformName(const std::string &name, size_t *outSubscript) ...@@ -644,6 +644,29 @@ std::string ParseUniformName(const std::string &name, size_t *outSubscript)
return name.substr(0, open); return name.substr(0, open);
} }
template <>
GLuint ConvertToGLuint(GLfloat param)
{
return uiround<GLuint>(param);
}
template <>
GLint ConvertToGLint(GLfloat param)
{
return iround<GLint>(param);
}
template <>
GLint ConvertFromGLfloat(GLfloat param)
{
return iround<GLint>(param);
}
template <>
GLuint ConvertFromGLfloat(GLfloat param)
{
return uiround<GLuint>(param);
}
unsigned int ParseAndStripArrayIndex(std::string *name) unsigned int ParseAndStripArrayIndex(std::string *name)
{ {
unsigned int subscript = GL_INVALID_INDEX; unsigned int subscript = GL_INVALID_INDEX;
......
...@@ -68,6 +68,70 @@ bool IsTriangleMode(GLenum drawMode); ...@@ -68,6 +68,70 @@ bool IsTriangleMode(GLenum drawMode);
template <typename outT> outT iround(GLfloat value) { return static_cast<outT>(value > 0.0f ? floor(value + 0.5f) : ceil(value - 0.5f)); } template <typename outT> outT iround(GLfloat value) { return static_cast<outT>(value > 0.0f ? floor(value + 0.5f) : ceil(value - 0.5f)); }
template <typename outT> outT uiround(GLfloat value) { return static_cast<outT>(value + 0.5f); } template <typename outT> outT uiround(GLfloat value) { return static_cast<outT>(value + 0.5f); }
// Helper for converting arbitrary GL types to other GL types used in queries and state setting
template <typename ParamType>
GLuint ConvertToGLuint(ParamType param)
{
return static_cast<GLuint>(param);
}
template <>
GLuint ConvertToGLuint(GLfloat param);
template <typename ParamType>
GLint ConvertToGLint(ParamType param)
{
return static_cast<GLint>(param);
}
template <>
GLint ConvertToGLint(GLfloat param);
// Same conversion as uint
template <typename ParamType>
GLenum ConvertToGLenum(ParamType param)
{
return static_cast<GLenum>(ConvertToGLuint(param));
}
template <typename ParamType>
GLfloat ConvertToGLfloat(ParamType param)
{
return static_cast<GLfloat>(param);
}
template <typename ParamType>
ParamType ConvertFromGLfloat(GLfloat param)
{
return static_cast<ParamType>(param);
}
template <>
GLint ConvertFromGLfloat(GLfloat param);
template <>
GLuint ConvertFromGLfloat(GLfloat param);
template <typename ParamType>
ParamType ConvertFromGLenum(GLenum param)
{
return static_cast<ParamType>(param);
}
template <typename ParamType>
ParamType ConvertFromGLuint(GLuint param)
{
return static_cast<ParamType>(param);
}
template <typename ParamType>
ParamType ConvertFromGLint(GLint param)
{
return static_cast<ParamType>(param);
}
template <typename ParamType>
ParamType ConvertFromGLboolean(GLboolean param)
{
return static_cast<ParamType>(param ? GL_TRUE : GL_FALSE);
}
unsigned int ParseAndStripArrayIndex(std::string *name); unsigned int ParseAndStripArrayIndex(std::string *name);
} // namespace gl } // namespace gl
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "libANGLE/renderer/ContextImpl.h" #include "libANGLE/renderer/ContextImpl.h"
#include "libANGLE/renderer/EGLImplFactory.h" #include "libANGLE/renderer/EGLImplFactory.h"
#include "libANGLE/queryconversions.h" #include "libANGLE/queryconversions.h"
#include "libANGLE/queryutils.h"
namespace namespace
{ {
...@@ -2213,102 +2214,44 @@ void Context::setVertexAttribDivisor(GLuint index, GLuint divisor) ...@@ -2213,102 +2214,44 @@ void Context::setVertexAttribDivisor(GLuint index, GLuint divisor)
void Context::samplerParameteri(GLuint sampler, GLenum pname, GLint param) void Context::samplerParameteri(GLuint sampler, GLenum pname, GLint param)
{ {
mResourceManager->checkSamplerAllocation(mImplementation.get(), sampler); Sampler *samplerObject =
mResourceManager->checkSamplerAllocation(mImplementation.get(), sampler);
Sampler *samplerObject = getSampler(sampler); SetSamplerParameteri(samplerObject, pname, param);
ASSERT(samplerObject); }
// clang-format off void Context::samplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
switch (pname) {
{ Sampler *samplerObject =
case GL_TEXTURE_MIN_FILTER: samplerObject->setMinFilter(static_cast<GLenum>(param)); break; mResourceManager->checkSamplerAllocation(mImplementation.get(), sampler);
case GL_TEXTURE_MAG_FILTER: samplerObject->setMagFilter(static_cast<GLenum>(param)); break; SetSamplerParameteriv(samplerObject, pname, param);
case GL_TEXTURE_WRAP_S: samplerObject->setWrapS(static_cast<GLenum>(param)); break;
case GL_TEXTURE_WRAP_T: samplerObject->setWrapT(static_cast<GLenum>(param)); break;
case GL_TEXTURE_WRAP_R: samplerObject->setWrapR(static_cast<GLenum>(param)); break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT: samplerObject->setMaxAnisotropy(std::min(static_cast<GLfloat>(param), getExtensions().maxTextureAnisotropy)); break;
case GL_TEXTURE_MIN_LOD: samplerObject->setMinLod(static_cast<GLfloat>(param)); break;
case GL_TEXTURE_MAX_LOD: samplerObject->setMaxLod(static_cast<GLfloat>(param)); break;
case GL_TEXTURE_COMPARE_MODE: samplerObject->setCompareMode(static_cast<GLenum>(param)); break;
case GL_TEXTURE_COMPARE_FUNC: samplerObject->setCompareFunc(static_cast<GLenum>(param)); break;
default: UNREACHABLE(); break;
}
// clang-format on
} }
void Context::samplerParameterf(GLuint sampler, GLenum pname, GLfloat param) void Context::samplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
{ {
mResourceManager->checkSamplerAllocation(mImplementation.get(), sampler); Sampler *samplerObject =
mResourceManager->checkSamplerAllocation(mImplementation.get(), sampler);
Sampler *samplerObject = getSampler(sampler); SetSamplerParameterf(samplerObject, pname, param);
ASSERT(samplerObject);
// clang-format off
switch (pname)
{
case GL_TEXTURE_MIN_FILTER: samplerObject->setMinFilter(uiround<GLenum>(param)); break;
case GL_TEXTURE_MAG_FILTER: samplerObject->setMagFilter(uiround<GLenum>(param)); break;
case GL_TEXTURE_WRAP_S: samplerObject->setWrapS(uiround<GLenum>(param)); break;
case GL_TEXTURE_WRAP_T: samplerObject->setWrapT(uiround<GLenum>(param)); break;
case GL_TEXTURE_WRAP_R: samplerObject->setWrapR(uiround<GLenum>(param)); break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT: samplerObject->setMaxAnisotropy(std::min(param, getExtensions().maxTextureAnisotropy)); break;
case GL_TEXTURE_MIN_LOD: samplerObject->setMinLod(param); break;
case GL_TEXTURE_MAX_LOD: samplerObject->setMaxLod(param); break;
case GL_TEXTURE_COMPARE_MODE: samplerObject->setCompareMode(uiround<GLenum>(param)); break;
case GL_TEXTURE_COMPARE_FUNC: samplerObject->setCompareFunc(uiround<GLenum>(param)); break;
default: UNREACHABLE(); break;
}
// clang-format on
} }
GLint Context::getSamplerParameteri(GLuint sampler, GLenum pname) void Context::samplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
{ {
mResourceManager->checkSamplerAllocation(mImplementation.get(), sampler); Sampler *samplerObject =
mResourceManager->checkSamplerAllocation(mImplementation.get(), sampler);
Sampler *samplerObject = getSampler(sampler); SetSamplerParameterfv(samplerObject, pname, param);
ASSERT(samplerObject);
// clang-format off
switch (pname)
{
case GL_TEXTURE_MIN_FILTER: return static_cast<GLint>(samplerObject->getMinFilter());
case GL_TEXTURE_MAG_FILTER: return static_cast<GLint>(samplerObject->getMagFilter());
case GL_TEXTURE_WRAP_S: return static_cast<GLint>(samplerObject->getWrapS());
case GL_TEXTURE_WRAP_T: return static_cast<GLint>(samplerObject->getWrapT());
case GL_TEXTURE_WRAP_R: return static_cast<GLint>(samplerObject->getWrapR());
case GL_TEXTURE_MAX_ANISOTROPY_EXT: return static_cast<GLint>(samplerObject->getMaxAnisotropy());
case GL_TEXTURE_MIN_LOD: return iround<GLint>(samplerObject->getMinLod());
case GL_TEXTURE_MAX_LOD: return iround<GLint>(samplerObject->getMaxLod());
case GL_TEXTURE_COMPARE_MODE: return static_cast<GLint>(samplerObject->getCompareMode());
case GL_TEXTURE_COMPARE_FUNC: return static_cast<GLint>(samplerObject->getCompareFunc());
default: UNREACHABLE(); return 0;
}
// clang-format on
} }
GLfloat Context::getSamplerParameterf(GLuint sampler, GLenum pname) void Context::getSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
{ {
mResourceManager->checkSamplerAllocation(mImplementation.get(), sampler); const Sampler *samplerObject =
mResourceManager->checkSamplerAllocation(mImplementation.get(), sampler);
Sampler *samplerObject = getSampler(sampler); QuerySamplerParameteriv(samplerObject, pname, params);
ASSERT(samplerObject); }
// clang-format off void Context::getSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
switch (pname) {
{ const Sampler *samplerObject =
case GL_TEXTURE_MIN_FILTER: return static_cast<GLfloat>(samplerObject->getMinFilter()); mResourceManager->checkSamplerAllocation(mImplementation.get(), sampler);
case GL_TEXTURE_MAG_FILTER: return static_cast<GLfloat>(samplerObject->getMagFilter()); QuerySamplerParameterfv(samplerObject, pname, params);
case GL_TEXTURE_WRAP_S: return static_cast<GLfloat>(samplerObject->getWrapS());
case GL_TEXTURE_WRAP_T: return static_cast<GLfloat>(samplerObject->getWrapT());
case GL_TEXTURE_WRAP_R: return static_cast<GLfloat>(samplerObject->getWrapR());
case GL_TEXTURE_MAX_ANISOTROPY_EXT: return samplerObject->getMaxAnisotropy();
case GL_TEXTURE_MIN_LOD: return samplerObject->getMinLod();
case GL_TEXTURE_MAX_LOD: return samplerObject->getMaxLod();
case GL_TEXTURE_COMPARE_MODE: return static_cast<GLfloat>(samplerObject->getCompareMode());
case GL_TEXTURE_COMPARE_FUNC: return static_cast<GLfloat>(samplerObject->getCompareFunc());
default: UNREACHABLE(); return 0;
}
// clang-format on
} }
void Context::programParameteri(GLuint program, GLenum pname, GLint value) void Context::programParameteri(GLuint program, GLenum pname, GLint value)
......
...@@ -157,9 +157,12 @@ class Context final : public ValidationContext ...@@ -157,9 +157,12 @@ class Context final : public ValidationContext
void setVertexAttribDivisor(GLuint index, GLuint divisor); void setVertexAttribDivisor(GLuint index, GLuint divisor);
void samplerParameteri(GLuint sampler, GLenum pname, GLint param); void samplerParameteri(GLuint sampler, GLenum pname, GLint param);
void samplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
void samplerParameterf(GLuint sampler, GLenum pname, GLfloat param); void samplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
GLint getSamplerParameteri(GLuint sampler, GLenum pname); void samplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
GLfloat getSamplerParameterf(GLuint sampler, GLenum pname);
void getSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
void getSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
void programParameteri(GLuint program, GLenum pname, GLint value); void programParameteri(GLuint program, GLenum pname, GLint value);
......
...@@ -18,7 +18,9 @@ class Buffer; ...@@ -18,7 +18,9 @@ class Buffer;
class Framebuffer; class Framebuffer;
class Program; class Program;
class Renderbuffer; class Renderbuffer;
class Sampler;
class Shader; class Shader;
class Texture;
void QueryFramebufferAttachmentParameteriv(const Framebuffer *framebuffer, void QueryFramebufferAttachmentParameteriv(const Framebuffer *framebuffer,
GLenum attachment, GLenum attachment,
...@@ -28,6 +30,20 @@ void QueryBufferParameteriv(const Buffer *buffer, GLenum pname, GLint *params); ...@@ -28,6 +30,20 @@ void QueryBufferParameteriv(const Buffer *buffer, GLenum pname, GLint *params);
void QueryProgramiv(const Program *program, GLenum pname, GLint *params); void QueryProgramiv(const Program *program, GLenum pname, GLint *params);
void QueryRenderbufferiv(const Renderbuffer *renderbuffer, GLenum pname, GLint *params); void QueryRenderbufferiv(const Renderbuffer *renderbuffer, GLenum pname, GLint *params);
void QueryShaderiv(const Shader *shader, GLenum pname, GLint *params); void QueryShaderiv(const Shader *shader, GLenum pname, GLint *params);
void QueryTexParameterfv(const Texture *texture, GLenum pname, GLfloat *params);
void QueryTexParameteriv(const Texture *texture, GLenum pname, GLint *params);
void QuerySamplerParameterfv(const Sampler *sampler, GLenum pname, GLfloat *params);
void QuerySamplerParameteriv(const Sampler *sampler, GLenum pname, GLint *params);
void SetTexParameterf(Texture *texture, GLenum pname, GLfloat param);
void SetTexParameterfv(Texture *texture, GLenum pname, const GLfloat *params);
void SetTexParameteri(Texture *texture, GLenum pname, GLint param);
void SetTexParameteriv(Texture *texture, GLenum pname, const GLint *params);
void SetSamplerParameterf(Sampler *sampler, GLenum pname, GLfloat param);
void SetSamplerParameterfv(Sampler *sampler, GLenum pname, const GLfloat *params);
void SetSamplerParameteri(Sampler *sampler, GLenum pname, GLint param);
void SetSamplerParameteriv(Sampler *sampler, GLenum pname, const GLint *params);
} }
#endif // LIBANGLE_QUERYUTILS_H_ #endif // LIBANGLE_QUERYUTILS_H_
...@@ -436,7 +436,8 @@ gl::Error RenderStateCache::getSamplerState(const gl::SamplerState &samplerState ...@@ -436,7 +436,8 @@ gl::Error RenderStateCache::getSamplerState(const gl::SamplerState &samplerState
samplerDesc.AddressV = gl_d3d11::ConvertTextureWrap(samplerState.wrapT); samplerDesc.AddressV = gl_d3d11::ConvertTextureWrap(samplerState.wrapT);
samplerDesc.AddressW = gl_d3d11::ConvertTextureWrap(samplerState.wrapR); samplerDesc.AddressW = gl_d3d11::ConvertTextureWrap(samplerState.wrapR);
samplerDesc.MipLODBias = 0; samplerDesc.MipLODBias = 0;
samplerDesc.MaxAnisotropy = static_cast<UINT>(samplerState.maxAnisotropy); samplerDesc.MaxAnisotropy =
gl_d3d11::ConvertMaxAnisotropy(samplerState.maxAnisotropy, mDevice->GetFeatureLevel());
samplerDesc.ComparisonFunc = gl_d3d11::ConvertComparison(samplerState.compareFunc); samplerDesc.ComparisonFunc = gl_d3d11::ConvertComparison(samplerState.compareFunc);
samplerDesc.BorderColor[0] = 0.0f; samplerDesc.BorderColor[0] = 0.0f;
samplerDesc.BorderColor[1] = 0.0f; samplerDesc.BorderColor[1] = 0.0f;
......
...@@ -52,6 +52,7 @@ D3D11_STENCIL_OP ConvertStencilOp(GLenum stencilOp); ...@@ -52,6 +52,7 @@ D3D11_STENCIL_OP ConvertStencilOp(GLenum stencilOp);
D3D11_FILTER ConvertFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy, GLenum comparisonMode); D3D11_FILTER ConvertFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy, GLenum comparisonMode);
D3D11_TEXTURE_ADDRESS_MODE ConvertTextureWrap(GLenum wrap); D3D11_TEXTURE_ADDRESS_MODE ConvertTextureWrap(GLenum wrap);
UINT ConvertMaxAnisotropy(float maxAnisotropy, D3D_FEATURE_LEVEL featureLevel);
D3D11_QUERY ConvertQueryType(GLenum queryType); D3D11_QUERY ConvertQueryType(GLenum queryType);
......
...@@ -818,7 +818,9 @@ gl::Error Renderer9::setSamplerState(gl::SamplerType type, int index, gl::Textur ...@@ -818,7 +818,9 @@ gl::Error Renderer9::setSamplerState(gl::SamplerType type, int index, gl::Textur
mDevice->SetSamplerState(d3dSampler, D3DSAMP_MIPMAPLODBIAS, static_cast<DWORD>(lodBias)); mDevice->SetSamplerState(d3dSampler, D3DSAMP_MIPMAPLODBIAS, static_cast<DWORD>(lodBias));
if (getNativeExtensions().textureFilterAnisotropic) if (getNativeExtensions().textureFilterAnisotropic)
{ {
mDevice->SetSamplerState(d3dSampler, D3DSAMP_MAXANISOTROPY, (DWORD)samplerState.maxAnisotropy); DWORD maxAnisotropy =
std::min(mDeviceCaps.MaxAnisotropy, static_cast<DWORD>(samplerState.maxAnisotropy));
mDevice->SetSamplerState(d3dSampler, D3DSAMP_MAXANISOTROPY, maxAnisotropy);
} }
} }
......
...@@ -95,10 +95,6 @@ bool ValidateBlitFramebufferParameters(ValidationContext *context, ...@@ -95,10 +95,6 @@ bool ValidateBlitFramebufferParameters(ValidationContext *context,
bool ValidateGetVertexAttribParameters(Context *context, GLenum pname); bool ValidateGetVertexAttribParameters(Context *context, GLenum pname);
bool ValidateTexParamParameters(Context *context, GLenum target, GLenum pname, GLint param);
bool ValidateSamplerObjectParameter(Context *context, GLenum pname);
bool ValidateReadPixels(ValidationContext *context, bool ValidateReadPixels(ValidationContext *context,
GLint x, GLint x,
GLint y, GLint y,
...@@ -377,6 +373,72 @@ bool ValidateGetShaderivRobustANGLE(Context *context, ...@@ -377,6 +373,72 @@ bool ValidateGetShaderivRobustANGLE(Context *context,
GLsizei *length, GLsizei *length,
GLint *params); GLint *params);
bool ValidateGetTexParameterfv(Context *context, GLenum target, GLenum pname, GLfloat *params);
bool ValidateGetTexParameterfvRobustANGLE(Context *context,
GLenum target,
GLenum pname,
GLsizei bufSize,
GLsizei *length,
GLfloat *params);
bool ValidateGetTexParameteriv(Context *context, GLenum target, GLenum pname, GLint *params);
bool ValidateGetTexParameterivRobustANGLE(Context *context,
GLenum target,
GLenum pname,
GLsizei bufSize,
GLsizei *length,
GLint *params);
bool ValidateTexParameterf(Context *context, GLenum target, GLenum pname, GLfloat param);
bool ValidateTexParameterfv(Context *context, GLenum target, GLenum pname, const GLfloat *params);
bool ValidateTexParameterfvRobustANGLE(Context *context,
GLenum target,
GLenum pname,
GLsizei bufSize,
const GLfloat *params);
bool ValidateTexParameteri(Context *context, GLenum target, GLenum pname, GLint param);
bool ValidateTexParameteriv(Context *context, GLenum target, GLenum pname, const GLint *params);
bool ValidateTexParameterivRobustANGLE(Context *context,
GLenum target,
GLenum pname,
GLsizei bufSize,
const GLint *params);
bool ValidateGetSamplerParameterfv(Context *context, GLuint sampler, GLenum pname, GLfloat *params);
bool ValidateGetSamplerParameterfvRobustANGLE(Context *context,
GLuint sampler,
GLenum pname,
GLuint bufSize,
GLsizei *length,
GLfloat *params);
bool ValidateGetSamplerParameteriv(Context *context, GLuint sampler, GLenum pname, GLint *params);
bool ValidateGetSamplerParameterivRobustANGLE(Context *context,
GLuint sampler,
GLenum pname,
GLuint bufSize,
GLsizei *length,
GLint *params);
bool ValidateSamplerParameterf(Context *context, GLuint sampler, GLenum pname, GLfloat param);
bool ValidateSamplerParameterfv(Context *context,
GLuint sampler,
GLenum pname,
const GLfloat *params);
bool ValidateSamplerParameterfvRobustANGLE(Context *context,
GLuint sampler,
GLenum pname,
GLsizei bufSize,
const GLfloat *params);
bool ValidateSamplerParameteri(Context *context, GLuint sampler, GLenum pname, GLint param);
bool ValidateSamplerParameteriv(Context *context,
GLuint sampler,
GLenum pname,
const GLint *params);
bool ValidateSamplerParameterivRobustANGLE(Context *context,
GLuint sampler,
GLenum pname,
GLsizei bufSize,
const GLint *params);
// Error messages shared here for use in testing. // Error messages shared here for use in testing.
extern const char *g_ExceedsMaxElementErrorMessage; extern const char *g_ExceedsMaxElementErrorMessage;
} // namespace gl } // namespace gl
......
...@@ -1728,39 +1728,6 @@ bool ValidateBeginTransformFeedback(Context *context, GLenum primitiveMode) ...@@ -1728,39 +1728,6 @@ bool ValidateBeginTransformFeedback(Context *context, GLenum primitiveMode)
return true; return true;
} }
bool ValidateSamplerParameteri(Context *context, GLuint sampler, GLenum pname, GLint param)
{
if (context->getClientMajorVersion() < 3)
{
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
return false;
}
if (!context->isSampler(sampler))
{
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
if (!ValidateSamplerObjectParameter(context, pname))
{
return false;
}
if (!ValidateTexParamParameters(context, GL_TEXTURE_2D, pname, param))
{
return false;
}
return true;
}
bool ValidateSamplerParameterf(Context *context, GLuint sampler, GLenum pname, GLfloat param)
{
// The only float parameters are MIN_LOD and MAX_LOD. For these any value is permissible, so
// ValidateSamplerParameteri can be used for validation here.
return ValidateSamplerParameteri(context, sampler, pname, static_cast<GLint>(param));
}
bool ValidateGetBufferPointerv(Context *context, GLenum target, GLenum pname, GLvoid **params) bool ValidateGetBufferPointerv(Context *context, GLenum target, GLenum pname, GLvoid **params)
{ {
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
......
...@@ -291,9 +291,6 @@ bool ValidateGenOrDeleteCountES3(Context *context, GLint count); ...@@ -291,9 +291,6 @@ bool ValidateGenOrDeleteCountES3(Context *context, GLint count);
bool ValidateBeginTransformFeedback(Context *context, GLenum primitiveMode); bool ValidateBeginTransformFeedback(Context *context, GLenum primitiveMode);
bool ValidateSamplerParameteri(Context *context, GLuint sampler, GLenum pname, GLint param);
bool ValidateSamplerParameterf(Context *context, GLuint sampler, GLenum pname, GLfloat param);
bool ValidateGetBufferPointerv(Context *context, GLenum target, GLenum pname, GLvoid **params); bool ValidateGetBufferPointerv(Context *context, GLenum target, GLenum pname, GLvoid **params);
bool ValidateUnmapBuffer(Context *context, GLenum target); bool ValidateUnmapBuffer(Context *context, GLenum target);
bool ValidateMapBufferRange(Context *context, bool ValidateMapBufferRange(Context *context,
......
...@@ -2222,7 +2222,21 @@ ANGLE_EXPORT void GL_APIENTRY GetTexParameterfvRobustANGLE(GLenum target, ...@@ -2222,7 +2222,21 @@ ANGLE_EXPORT void GL_APIENTRY GetTexParameterfvRobustANGLE(GLenum target,
"(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = " "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = "
"0x%0.8p, GLfloat* params = 0x%0.8p)", "0x%0.8p, GLfloat* params = 0x%0.8p)",
target, pname, bufSize, length, params); target, pname, bufSize, length, params);
UNIMPLEMENTED();
Context *context = GetValidGlobalContext();
if (context)
{
GLsizei numParams = 0;
if (!ValidateGetTexParameterfvRobustANGLE(context, target, pname, bufSize, &numParams,
params))
{
return;
}
Texture *texture = context->getTargetTexture(target);
QueryTexParameterfv(texture, pname, params);
SetRobustLengthParam(length, numParams);
}
} }
ANGLE_EXPORT void GL_APIENTRY GetTexParameterivRobustANGLE(GLenum target, ANGLE_EXPORT void GL_APIENTRY GetTexParameterivRobustANGLE(GLenum target,
...@@ -2235,7 +2249,21 @@ ANGLE_EXPORT void GL_APIENTRY GetTexParameterivRobustANGLE(GLenum target, ...@@ -2235,7 +2249,21 @@ ANGLE_EXPORT void GL_APIENTRY GetTexParameterivRobustANGLE(GLenum target,
"(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = " "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = "
"0x%0.8p, GLfloat* params = 0x%0.8p)", "0x%0.8p, GLfloat* params = 0x%0.8p)",
target, pname, bufSize, length, params); target, pname, bufSize, length, params);
UNIMPLEMENTED();
Context *context = GetValidGlobalContext();
if (context)
{
GLsizei numParams = 0;
if (!ValidateGetTexParameterivRobustANGLE(context, target, pname, bufSize, &numParams,
params))
{
return;
}
Texture *texture = context->getTargetTexture(target);
QueryTexParameteriv(texture, pname, params);
SetRobustLengthParam(length, numParams);
}
} }
ANGLE_EXPORT void GL_APIENTRY GetUniformfvRobustANGLE(GLuint program, ANGLE_EXPORT void GL_APIENTRY GetUniformfvRobustANGLE(GLuint program,
...@@ -2407,7 +2435,18 @@ ANGLE_EXPORT void GL_APIENTRY TexParameterfvRobustANGLE(GLenum target, ...@@ -2407,7 +2435,18 @@ ANGLE_EXPORT void GL_APIENTRY TexParameterfvRobustANGLE(GLenum target,
"(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLfloat* params = " "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLfloat* params = "
"0x%0.8p)", "0x%0.8p)",
target, pname, bufSize, params); target, pname, bufSize, params);
UNIMPLEMENTED();
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateTexParameterfvRobustANGLE(context, target, pname, bufSize, params))
{
return;
}
Texture *texture = context->getTargetTexture(target);
SetTexParameterfv(texture, pname, params);
}
} }
ANGLE_EXPORT void GL_APIENTRY TexParameterivRobustANGLE(GLenum target, ANGLE_EXPORT void GL_APIENTRY TexParameterivRobustANGLE(GLenum target,
...@@ -2419,7 +2458,18 @@ ANGLE_EXPORT void GL_APIENTRY TexParameterivRobustANGLE(GLenum target, ...@@ -2419,7 +2458,18 @@ ANGLE_EXPORT void GL_APIENTRY TexParameterivRobustANGLE(GLenum target,
"(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLfloat* params = " "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLfloat* params = "
"0x%0.8p)", "0x%0.8p)",
target, pname, bufSize, params); target, pname, bufSize, params);
UNIMPLEMENTED();
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateTexParameterivRobustANGLE(context, target, pname, bufSize, params))
{
return;
}
Texture *texture = context->getTargetTexture(target);
SetTexParameteriv(texture, pname, params);
}
} }
ANGLE_EXPORT void GL_APIENTRY TexSubImage2DRobustANGLE(GLenum target, ANGLE_EXPORT void GL_APIENTRY TexSubImage2DRobustANGLE(GLenum target,
...@@ -2635,7 +2685,17 @@ ANGLE_EXPORT void GL_APIENTRY SamplerParameterivRobustANGLE(GLuint sampler, ...@@ -2635,7 +2685,17 @@ ANGLE_EXPORT void GL_APIENTRY SamplerParameterivRobustANGLE(GLuint sampler,
"(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufsize = %d, const GLint* params = " "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufsize = %d, const GLint* params = "
"0x%0.8p)", "0x%0.8p)",
sampler, pname, bufSize, param); sampler, pname, bufSize, param);
UNIMPLEMENTED();
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateSamplerParameterivRobustANGLE(context, sampler, pname, bufSize, param))
{
return;
}
context->samplerParameteriv(sampler, pname, param);
}
} }
ANGLE_EXPORT void GL_APIENTRY SamplerParameterfvRobustANGLE(GLuint sampler, ANGLE_EXPORT void GL_APIENTRY SamplerParameterfvRobustANGLE(GLuint sampler,
...@@ -2647,7 +2707,17 @@ ANGLE_EXPORT void GL_APIENTRY SamplerParameterfvRobustANGLE(GLuint sampler, ...@@ -2647,7 +2707,17 @@ ANGLE_EXPORT void GL_APIENTRY SamplerParameterfvRobustANGLE(GLuint sampler,
"(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufsize = %d, const GLfloat* params = " "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufsize = %d, const GLfloat* params = "
"0x%0.8p)", "0x%0.8p)",
sampler, pname, bufSize, param); sampler, pname, bufSize, param);
UNIMPLEMENTED();
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateSamplerParameterfvRobustANGLE(context, sampler, pname, bufSize, param))
{
return;
}
context->samplerParameterfv(sampler, pname, param);
}
} }
ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterivRobustANGLE(GLuint sampler, ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterivRobustANGLE(GLuint sampler,
...@@ -2660,7 +2730,20 @@ ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterivRobustANGLE(GLuint sampler, ...@@ -2660,7 +2730,20 @@ ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterivRobustANGLE(GLuint sampler,
"(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = " "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = "
"0x%0.8p, GLint* params = 0x%0.8p)", "0x%0.8p, GLint* params = 0x%0.8p)",
sampler, pname, bufSize, length, params); sampler, pname, bufSize, length, params);
UNIMPLEMENTED();
Context *context = GetValidGlobalContext();
if (context)
{
GLsizei numParams = 0;
if (!ValidateGetSamplerParameterivRobustANGLE(context, sampler, pname, bufSize, &numParams,
params))
{
return;
}
context->getSamplerParameteriv(sampler, pname, params);
SetRobustLengthParam(length, numParams);
}
} }
ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterfvRobustANGLE(GLuint sampler, ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterfvRobustANGLE(GLuint sampler,
...@@ -2673,7 +2756,20 @@ ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterfvRobustANGLE(GLuint sampler, ...@@ -2673,7 +2756,20 @@ ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterfvRobustANGLE(GLuint sampler,
"(GLuint sample = %ur, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = " "(GLuint sample = %ur, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = "
"0x%0.8p, GLfloat* params = 0x%0.8p)", "0x%0.8p, GLfloat* params = 0x%0.8p)",
sampler, pname, bufSize, length, params); sampler, pname, bufSize, length, params);
UNIMPLEMENTED();
Context *context = GetValidGlobalContext();
if (context)
{
GLsizei numParams = 0;
if (!ValidateGetSamplerParameterfvRobustANGLE(context, sampler, pname, bufSize, &numParams,
params))
{
return;
}
context->getSamplerParameterfv(sampler, pname, params);
SetRobustLengthParam(length, numParams);
}
} }
ANGLE_EXPORT void GL_APIENTRY GetFramebufferParameterivRobustANGLE(GLenum target, ANGLE_EXPORT void GL_APIENTRY GetFramebufferParameterivRobustANGLE(GLenum target,
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "libANGLE/validationES.h" #include "libANGLE/validationES.h"
#include "libANGLE/validationES3.h" #include "libANGLE/validationES3.h"
#include "libANGLE/queryconversions.h" #include "libANGLE/queryconversions.h"
#include "libANGLE/queryutils.h"
#include "common/debug.h" #include "common/debug.h"
...@@ -2271,7 +2272,20 @@ void GL_APIENTRY SamplerParameteri(GLuint sampler, GLenum pname, GLint param) ...@@ -2271,7 +2272,20 @@ void GL_APIENTRY SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
void GL_APIENTRY SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param) void GL_APIENTRY SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param)
{ {
SamplerParameteri(sampler, pname, *param); EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, const GLint* params = 0x%0.8p)", sampler,
pname, param);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() &&
!ValidateSamplerParameteriv(context, sampler, pname, param))
{
return;
}
context->samplerParameteriv(sampler, pname, param);
}
} }
void GL_APIENTRY SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) void GL_APIENTRY SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
...@@ -2293,34 +2307,37 @@ void GL_APIENTRY SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) ...@@ -2293,34 +2307,37 @@ void GL_APIENTRY SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
void GL_APIENTRY SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param) void GL_APIENTRY SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param)
{ {
SamplerParameterf(sampler, pname, *param); EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, const GLfloat* params = 0x%0.8p)", sampler,
} pname, param);
void GL_APIENTRY GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params)
{
EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", sampler, pname, params);
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (context->getClientMajorVersion() < 3) if (!context->skipValidation() &&
!ValidateSamplerParameterfv(context, sampler, pname, param))
{ {
context->handleError(Error(GL_INVALID_OPERATION));
return; return;
} }
if (!ValidateSamplerObjectParameter(context, pname)) context->samplerParameterfv(sampler, pname, param);
{ }
return; }
}
void GL_APIENTRY GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
{
EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", sampler, pname,
params);
if (!context->isSampler(sampler)) Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() &&
!ValidateGetSamplerParameteriv(context, sampler, pname, params))
{ {
context->handleError(Error(GL_INVALID_OPERATION));
return; return;
} }
*params = context->getSamplerParameteri(sampler, pname); context->getSamplerParameteriv(sampler, pname, params);
} }
} }
...@@ -2331,24 +2348,13 @@ void GL_APIENTRY GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* pa ...@@ -2331,24 +2348,13 @@ void GL_APIENTRY GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* pa
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (context->getClientMajorVersion() < 3) if (!context->skipValidation() &&
{ !ValidateGetSamplerParameterfv(context, sampler, pname, params))
context->handleError(Error(GL_INVALID_OPERATION));
return;
}
if (!ValidateSamplerObjectParameter(context, pname))
{
return;
}
if (!context->isSampler(sampler))
{ {
context->handleError(Error(GL_INVALID_OPERATION));
return; return;
} }
*params = context->getSamplerParameterf(sampler, pname); context->getSamplerParameterfv(sampler, pname, params);
} }
} }
......
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