return GL_TRUE;
}
-void GLAPIENTRY
-_mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
+static struct gl_sampler_object *
+sampler_parameter_error_check(struct gl_context *ctx, GLuint sampler,
+ const char *name)
{
struct gl_sampler_object *sampObj;
- GLuint res;
- GET_CURRENT_CONTEXT(ctx);
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
- /* '3.8.2 Sampler Objects' section of the GL-ES 3.0 specification states:
- *
- * "An INVALID_OPERATION error is generated if sampler is not the name
- * of a sampler object previously returned from a call to GenSamplers."
+ /* OpenGL 4.5 spec, section "8.2 Sampler Objects", page 176 of the PDF
+ * states:
*
+ * "An INVALID_OPERATION error is generated if sampler is not the name
+ * of a sampler object previously returned from a call to
+ * GenSamplers."
*/
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glSamplerParameteri(sampler %u)", sampler);
- return;
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid sampler)", name);
+ return NULL;
}
+ return sampObj;
+}
+
+void GLAPIENTRY
+_mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
+{
+ struct gl_sampler_object *sampObj;
+ GLuint res;
+ GET_CURRENT_CONTEXT(ctx);
+
+ sampObj = sampler_parameter_error_check(ctx, sampler,
+ "glSamplerParameteri");
+ if (!sampObj)
+ return;
+
switch (pname) {
case GL_TEXTURE_WRAP_S:
res = set_sampler_wrap_s(ctx, sampObj, param);
GLuint res;
GET_CURRENT_CONTEXT(ctx);
- sampObj = _mesa_lookup_samplerobj(ctx, sampler);
- if (!sampObj) {
- /* '3.8.2 Sampler Objects' section of the GL-ES 3.0 specification states:
- *
- * "An INVALID_OPERATION error is generated if sampler is not the name
- * of a sampler object previously returned from a call to GenSamplers."
- *
- */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glSamplerParameterf(sampler %u)", sampler);
+ sampObj = sampler_parameter_error_check(ctx, sampler,
+ "glSamplerParameterf");
+ if (!sampObj)
return;
- }
switch (pname) {
case GL_TEXTURE_WRAP_S:
GLuint res;
GET_CURRENT_CONTEXT(ctx);
- sampObj = _mesa_lookup_samplerobj(ctx, sampler);
- if (!sampObj) {
- /* '3.8.2 Sampler Objects' section of the GL-ES 3.0 specification states:
- *
- * "An INVALID_OPERATION error is generated if sampler is not the name
- * of a sampler object previously returned from a call to GenSamplers."
- */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glSamplerParameteriv(sampler %u)", sampler);
+ sampObj = sampler_parameter_error_check(ctx, sampler,
+ "glSamplerParameteriv");
+ if (!sampObj)
return;
- }
switch (pname) {
case GL_TEXTURE_WRAP_S:
GLuint res;
GET_CURRENT_CONTEXT(ctx);
- sampObj = _mesa_lookup_samplerobj(ctx, sampler);
- if (!sampObj) {
- /* '3.8.2 Sampler Objects' section of the GL-ES 3.0 specification states:
- *
- * "An INVALID_OPERATION error is generated if sampler is not the name
- * of a sampler object previously returned from a call to GenSamplers."
- *
- */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glSamplerParameterfv(sampler %u)", sampler);
+ sampObj = sampler_parameter_error_check(ctx, sampler,
+ "glSamplerParameterfv");
+ if (!sampObj)
return;
- }
switch (pname) {
case GL_TEXTURE_WRAP_S:
GLuint res;
GET_CURRENT_CONTEXT(ctx);
- sampObj = _mesa_lookup_samplerobj(ctx, sampler);
- if (!sampObj) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glSamplerParameterIiv(sampler %u)", sampler);
+ sampObj = sampler_parameter_error_check(ctx, sampler,
+ "glSamplerParameterIiv");
+ if (!sampObj)
return;
- }
switch (pname) {
case GL_TEXTURE_WRAP_S:
GLuint res;
GET_CURRENT_CONTEXT(ctx);
- sampObj = _mesa_lookup_samplerobj(ctx, sampler);
- if (!sampObj) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glSamplerParameterIuiv(sampler %u)", sampler);
+ sampObj = sampler_parameter_error_check(ctx, sampler,
+ "glSamplerParameterIuiv");
+ if (!sampObj)
return;
- }
switch (pname) {
case GL_TEXTURE_WRAP_S:
struct gl_sampler_object *sampObj;
GET_CURRENT_CONTEXT(ctx);
- sampObj = _mesa_lookup_samplerobj(ctx, sampler);
- if (!sampObj) {
- /* '3.8.2 Sampler Objects' section of the GL-ES 3.0 specification states:
- *
- * "An INVALID_OPERATION error is generated if sampler is not the name
- * of a sampler object previously returned from a call to GenSamplers."
- *
- */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetSamplerParameteriv(sampler %u)", sampler);
+ sampObj = sampler_parameter_error_check(ctx, sampler,
+ "glGetSamplerParameteriv");
+ if (!sampObj)
return;
- }
switch (pname) {
case GL_TEXTURE_WRAP_S:
struct gl_sampler_object *sampObj;
GET_CURRENT_CONTEXT(ctx);
- sampObj = _mesa_lookup_samplerobj(ctx, sampler);
- if (!sampObj) {
- /* '3.8.2 Sampler Objects' section of the GL-ES 3.0 specification states:
- *
- * "An INVALID_OPERATION error is generated if sampler is not the name
- * of a sampler object previously returned from a call to GenSamplers."
- *
- */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetSamplerParameterfv(sampler %u)", sampler);
+ sampObj = sampler_parameter_error_check(ctx, sampler,
+ "glGetSamplerParameterfv");
+ if (!sampObj)
return;
- }
switch (pname) {
case GL_TEXTURE_WRAP_S:
struct gl_sampler_object *sampObj;
GET_CURRENT_CONTEXT(ctx);
- sampObj = _mesa_lookup_samplerobj(ctx, sampler);
- if (!sampObj) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetSamplerParameterIiv(sampler %u)",
- sampler);
+ sampObj = sampler_parameter_error_check(ctx, sampler,
+ "glGetSamplerParameterIiv");
+ if (!sampObj)
return;
- }
switch (pname) {
case GL_TEXTURE_WRAP_S:
struct gl_sampler_object *sampObj;
GET_CURRENT_CONTEXT(ctx);
- sampObj = _mesa_lookup_samplerobj(ctx, sampler);
- if (!sampObj) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetSamplerParameterIuiv(sampler %u)",
- sampler);
+ sampObj = sampler_parameter_error_check(ctx, sampler,
+ "glGetSamplerParameterIuiv");
+ if (!sampObj)
return;
- }
switch (pname) {
case GL_TEXTURE_WRAP_S: