aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/texparam.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-04-08 08:17:23 +0200
committermarha <marha@users.sourceforge.net>2013-04-08 08:17:23 +0200
commit95fb19d661154ba8cfc6c793a0daa25657294b3b (patch)
tree4abbb540731ff40c75c4a4282670dba886e60cd7 /mesalib/src/mesa/main/texparam.c
parent176eab9e8277db1549bfc6c9ae805c4e1858f0b0 (diff)
downloadvcxsrv-95fb19d661154ba8cfc6c793a0daa25657294b3b.tar.gz
vcxsrv-95fb19d661154ba8cfc6c793a0daa25657294b3b.tar.bz2
vcxsrv-95fb19d661154ba8cfc6c793a0daa25657294b3b.zip
fontconfig libXau mesa xserver xkeyboard-config git update 8 Apr 2013
xserver commit 8928f8fa0bb154ce437af703ff702016f0dcf127 xkeyboard-config commit e5c6729f3679fe87a703eb1d7ec1cf0a61814ca8 libXau commit f5a57d8a21a34d7084cce294e24c0422e02ef8ef fontconfig commit 18bf57c70aafcad031c0b43756b754dcaf6a756a mesa commit eff66bc9f855fff5c4f5f57f247254a97431e8ad
Diffstat (limited to 'mesalib/src/mesa/main/texparam.c')
-rw-r--r--mesalib/src/mesa/main/texparam.c91
1 files changed, 89 insertions, 2 deletions
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index bd2f75170..f60eb204e 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -31,6 +31,7 @@
#include <stdbool.h>
#include "main/glheader.h"
+#include "main/blend.h"
#include "main/colormac.h"
#include "main/context.h"
#include "main/enums.h"
@@ -175,6 +176,16 @@ get_texobj(struct gl_context *ctx, GLenum target, GLboolean get)
return texUnit->CurrentTex[TEXTURE_CUBE_ARRAY_INDEX];
}
break;
+ case GL_TEXTURE_2D_MULTISAMPLE:
+ if (ctx->Extensions.ARB_texture_storage_multisample) {
+ return texUnit->CurrentTex[TEXTURE_2D_MULTISAMPLE_INDEX];
+ }
+ break;
+ case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ if (ctx->Extensions.ARB_texture_storage_multisample) {
+ return texUnit->CurrentTex[TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX];
+ }
+ break;
default:
;
}
@@ -250,6 +261,20 @@ incomplete(struct gl_context *ctx, struct gl_texture_object *texObj)
}
+static GLboolean
+target_allows_setting_sampler_parameters(GLenum target)
+{
+ switch (target) {
+ case GL_TEXTURE_2D_MULTISAMPLE:
+ case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ return GL_FALSE;
+
+ default:
+ return GL_TRUE;
+ }
+}
+
+
/**
* Set an integer-valued texture parameter
* \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
@@ -261,6 +286,9 @@ set_tex_parameteri(struct gl_context *ctx,
{
switch (pname) {
case GL_TEXTURE_MIN_FILTER:
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.MinFilter == params[0])
return GL_FALSE;
switch (params[0]) {
@@ -286,6 +314,9 @@ set_tex_parameteri(struct gl_context *ctx,
return GL_FALSE;
case GL_TEXTURE_MAG_FILTER:
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.MagFilter == params[0])
return GL_FALSE;
switch (params[0]) {
@@ -300,6 +331,9 @@ set_tex_parameteri(struct gl_context *ctx,
return GL_FALSE;
case GL_TEXTURE_WRAP_S:
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.WrapS == params[0])
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
@@ -310,6 +344,9 @@ set_tex_parameteri(struct gl_context *ctx,
return GL_FALSE;
case GL_TEXTURE_WRAP_T:
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.WrapT == params[0])
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
@@ -320,6 +357,9 @@ set_tex_parameteri(struct gl_context *ctx,
return GL_FALSE;
case GL_TEXTURE_WRAP_R:
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.WrapR == params[0])
return GL_FALSE;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
@@ -335,6 +375,11 @@ set_tex_parameteri(struct gl_context *ctx,
if (texObj->BaseLevel == params[0])
return GL_FALSE;
+
+ if ((texObj->Target == GL_TEXTURE_2D_MULTISAMPLE ||
+ texObj->Target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) && params[0] != 0)
+ goto invalid_operation;
+
if (params[0] < 0 ||
(texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0)) {
_mesa_error(ctx, GL_INVALID_VALUE,
@@ -348,6 +393,7 @@ set_tex_parameteri(struct gl_context *ctx,
case GL_TEXTURE_MAX_LEVEL:
if (texObj->MaxLevel == params[0])
return GL_FALSE;
+
if (params[0] < 0 || texObj->Target == GL_TEXTURE_RECTANGLE_ARB) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glTexParameter(param=%d)", params[0]);
@@ -373,6 +419,10 @@ set_tex_parameteri(struct gl_context *ctx,
case GL_TEXTURE_COMPARE_MODE_ARB:
if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_shadow)
|| _mesa_is_gles3(ctx)) {
+
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.CompareMode == params[0])
return GL_FALSE;
if (params[0] == GL_NONE ||
@@ -388,6 +438,10 @@ set_tex_parameteri(struct gl_context *ctx,
case GL_TEXTURE_COMPARE_FUNC_ARB:
if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_shadow)
|| _mesa_is_gles3(ctx)) {
+
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.CompareFunc == params[0])
return GL_FALSE;
switch (params[0]) {
@@ -489,7 +543,11 @@ set_tex_parameteri(struct gl_context *ctx,
case GL_TEXTURE_SRGB_DECODE_EXT:
if (_mesa_is_desktop_gl(ctx)
&& ctx->Extensions.EXT_texture_sRGB_decode) {
- GLenum decode = params[0];
+ GLenum decode = params[0];
+
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (decode == GL_DECODE_EXT || decode == GL_SKIP_DECODE_EXT) {
if (texObj->Sampler.sRGBDecode != decode) {
flush(ctx);
@@ -504,6 +562,10 @@ set_tex_parameteri(struct gl_context *ctx,
if (_mesa_is_desktop_gl(ctx)
&& ctx->Extensions.AMD_seamless_cubemap_per_texture) {
GLenum param = params[0];
+
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (param != GL_TRUE && param != GL_FALSE) {
goto invalid_param;
}
@@ -528,6 +590,11 @@ invalid_param:
_mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param=%s)",
_mesa_lookup_enum_by_nr(params[0]));
return GL_FALSE;
+
+invalid_operation:
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(pname=%s)",
+ _mesa_lookup_enum_by_nr(pname));
+ return GL_FALSE;
}
@@ -545,6 +612,9 @@ set_tex_parameterf(struct gl_context *ctx,
if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
goto invalid_pname;
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.MinLod == params[0])
return GL_FALSE;
flush(ctx);
@@ -555,6 +625,9 @@ set_tex_parameterf(struct gl_context *ctx,
if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
goto invalid_pname;
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.MaxLod == params[0])
return GL_FALSE;
flush(ctx);
@@ -571,6 +644,9 @@ set_tex_parameterf(struct gl_context *ctx,
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
if (ctx->Extensions.EXT_texture_filter_anisotropic) {
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.MaxAnisotropy == params[0])
return GL_FALSE;
if (params[0] < 1.0) {
@@ -598,6 +674,9 @@ set_tex_parameterf(struct gl_context *ctx,
if (ctx->API != API_OPENGL_COMPAT)
goto invalid_pname;
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
if (texObj->Sampler.LodBias != params[0]) {
flush(ctx);
texObj->Sampler.LodBias = params[0];
@@ -609,6 +688,9 @@ set_tex_parameterf(struct gl_context *ctx,
if (!_mesa_is_desktop_gl(ctx))
goto invalid_pname;
+ if (!target_allows_setting_sampler_parameters(texObj->Target))
+ goto invalid_operation;
+
flush(ctx);
/* ARB_texture_float disables clamping */
if (ctx->Extensions.ARB_texture_float) {
@@ -633,6 +715,11 @@ invalid_pname:
_mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=%s)",
_mesa_lookup_enum_by_nr(pname));
return GL_FALSE;
+
+invalid_operation:
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(pname=%s)",
+ _mesa_lookup_enum_by_nr(pname));
+ return GL_FALSE;
}
@@ -1329,7 +1416,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
if (ctx->NewState & (_NEW_BUFFERS | _NEW_FRAG_CLAMP))
_mesa_update_state_locked(ctx);
- if (ctx->Color._ClampFragmentColor) {
+ if (_mesa_get_clamp_fragment_color(ctx)) {
params[0] = CLAMP(obj->Sampler.BorderColor.f[0], 0.0F, 1.0F);
params[1] = CLAMP(obj->Sampler.BorderColor.f[1], 0.0F, 1.0F);
params[2] = CLAMP(obj->Sampler.BorderColor.f[2], 0.0F, 1.0F);