summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/tests/dispatch_sanity.cpp2
-rw-r--r--src/mesa/main/teximage.c124
-rw-r--r--src/mesa/main/teximage.h20
3 files changed, 118 insertions, 28 deletions
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 0739025f1fb..109bbd08636 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -984,6 +984,8 @@ const struct function gl_core_functions_possible[] = {
{ "glCompressedTextureSubImage2D", 45, -1 },
{ "glCompressedTextureSubImage3D", 45, -1 },
{ "glGenerateTextureMipmap", 45, -1 },
+ { "glTextureStorage2DMultisample", 45, -1 },
+ { "glTextureStorage3DMultisample", 45, -1 },
{ NULL, 0, -1 }
};
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 4d2b9ab2cc4..84374c5a116 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5042,16 +5042,18 @@ is_renderable_texture_format(struct gl_context *ctx, GLenum internalformat)
/** GL_ARB_texture_multisample */
static GLboolean
-check_multisample_target(GLuint dims, GLenum target)
+check_multisample_target(GLuint dims, GLenum target, bool dsa)
{
switch(target) {
case GL_TEXTURE_2D_MULTISAMPLE:
- case GL_PROXY_TEXTURE_2D_MULTISAMPLE:
return dims == 2;
+ case GL_PROXY_TEXTURE_2D_MULTISAMPLE:
+ return dims == 2 && !dsa;
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
- case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY:
return dims == 3;
+ case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ return dims == 3 && !dsa;
default:
return GL_FALSE;
@@ -5059,19 +5061,20 @@ check_multisample_target(GLuint dims, GLenum target)
}
-static void
-teximagemultisample(GLuint dims, GLenum target, GLsizei samples,
- GLint internalformat, GLsizei width, GLsizei height,
- GLsizei depth, GLboolean fixedsamplelocations,
- GLboolean immutable, const char *func)
+void
+_mesa_texture_image_multisample(struct gl_context *ctx, GLuint dims,
+ struct gl_texture_object *texObj,
+ GLenum target, GLsizei samples,
+ GLint internalformat, GLsizei width,
+ GLsizei height, GLsizei depth,
+ GLboolean fixedsamplelocations,
+ GLboolean immutable, const char *func)
{
- struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GLboolean sizeOK, dimensionsOK, samplesOK;
mesa_format texFormat;
GLenum sample_count_error;
-
- GET_CURRENT_CONTEXT(ctx);
+ bool dsa = strstr(func, "ture") ? true : false;
if (!(ctx->Extensions.ARB_texture_multisample
&& _mesa_is_desktop_gl(ctx))) {
@@ -5079,9 +5082,15 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei samples,
return;
}
- if (!check_multisample_target(dims, target)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", func);
- return;
+ if (!check_multisample_target(dims, target, dsa)) {
+ if (dsa) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(target)", func);
+ return;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", func);
+ return;
+ }
}
/* check that the specified internalformat is color/depth/stencil-renderable;
@@ -5119,8 +5128,6 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei samples,
return;
}
- texObj = _mesa_get_current_tex_object(ctx, target);
-
if (immutable && (!texObj || (texObj->Name == 0))) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(texture object 0)",
@@ -5209,9 +5216,14 @@ _mesa_TexImage2DMultisample(GLenum target, GLsizei samples,
GLenum internalformat, GLsizei width,
GLsizei height, GLboolean fixedsamplelocations)
{
- teximagemultisample(2, target, samples, internalformat,
- width, height, 1, fixedsamplelocations, GL_FALSE,
- "glTexImage2DMultisample");
+ struct gl_texture_object *texObj;
+ GET_CURRENT_CONTEXT(ctx);
+ texObj = _mesa_get_current_tex_object(ctx, target);
+
+ _mesa_texture_image_multisample(ctx, 2, texObj, target, samples,
+ internalformat, width, height, 1,
+ fixedsamplelocations, GL_FALSE,
+ "glTexImage2DMultisample");
}
@@ -5221,9 +5233,14 @@ _mesa_TexImage3DMultisample(GLenum target, GLsizei samples,
GLsizei height, GLsizei depth,
GLboolean fixedsamplelocations)
{
- teximagemultisample(3, target, samples, internalformat,
- width, height, depth, fixedsamplelocations, GL_FALSE,
- "glTexImage3DMultisample");
+ struct gl_texture_object *texObj;
+ GET_CURRENT_CONTEXT(ctx);
+ texObj = _mesa_get_current_tex_object(ctx, target);
+
+ _mesa_texture_image_multisample(ctx, 3, texObj, target, samples,
+ internalformat, width, height, depth,
+ fixedsamplelocations, GL_FALSE,
+ "glTexImage3DMultisample");
}
@@ -5232,9 +5249,14 @@ _mesa_TexStorage2DMultisample(GLenum target, GLsizei samples,
GLenum internalformat, GLsizei width,
GLsizei height, GLboolean fixedsamplelocations)
{
- teximagemultisample(2, target, samples, internalformat,
- width, height, 1, fixedsamplelocations, GL_TRUE,
- "glTexStorage2DMultisample");
+ struct gl_texture_object *texObj;
+ GET_CURRENT_CONTEXT(ctx);
+ texObj = _mesa_get_current_tex_object(ctx, target);
+
+ _mesa_texture_image_multisample(ctx, 2, texObj, target, samples,
+ internalformat, width, height, 1,
+ fixedsamplelocations, GL_TRUE,
+ "glTexStorage2DMultisample");
}
void GLAPIENTRY
@@ -5243,7 +5265,53 @@ _mesa_TexStorage3DMultisample(GLenum target, GLsizei samples,
GLsizei height, GLsizei depth,
GLboolean fixedsamplelocations)
{
- teximagemultisample(3, target, samples, internalformat,
- width, height, depth, fixedsamplelocations, GL_TRUE,
- "glTexStorage3DMultisample");
+ struct gl_texture_object *texObj;
+ GET_CURRENT_CONTEXT(ctx);
+ texObj = _mesa_get_current_tex_object(ctx, target);
+
+ _mesa_texture_image_multisample(ctx, 3, texObj, target, samples,
+ internalformat, width, height, depth,
+ fixedsamplelocations, GL_TRUE,
+ "glTexStorage3DMultisample");
+}
+
+void GLAPIENTRY
+_mesa_TextureStorage2DMultisample(GLuint texture, GLsizei samples,
+ GLenum internalformat, GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations)
+{
+ struct gl_texture_object *texObj;
+ GET_CURRENT_CONTEXT(ctx);
+
+ texObj = _mesa_lookup_texture_err(ctx, texture,
+ "glTextureStorage2DMultisample");
+ if (!texObj)
+ return;
+
+ _mesa_texture_image_multisample(ctx, 2, texObj, texObj->Target, samples,
+ internalformat, width, height, 1,
+ fixedsamplelocations, GL_TRUE,
+ "glTextureStorage2DMultisample");
+}
+
+void GLAPIENTRY
+_mesa_TextureStorage3DMultisample(GLuint texture, GLsizei samples,
+ GLenum internalformat, GLsizei width,
+ GLsizei height, GLsizei depth,
+ GLboolean fixedsamplelocations)
+{
+ struct gl_texture_object *texObj;
+ GET_CURRENT_CONTEXT(ctx);
+
+ /* Get the texture object by Name. */
+ texObj = _mesa_lookup_texture_err(ctx, texture,
+ "glTextureStorage3DMultisample");
+ if (!texObj)
+ return;
+
+ _mesa_texture_image_multisample(ctx, 3, texObj, texObj->Target, samples,
+ internalformat, width, height, depth,
+ fixedsamplelocations, GL_TRUE,
+ "glTextureStorage3DMultisample");
}
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index 3fa3b51bd96..7dd122a041c 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -193,6 +193,15 @@ _mesa_copy_texture_sub_image(struct gl_context *ctx, GLuint dims,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint x, GLint y,
GLsizei width, GLsizei height, bool dsa);
+
+extern void
+_mesa_texture_image_multisample(struct gl_context *ctx, GLuint dims,
+ struct gl_texture_object *texObj,
+ GLenum target, GLsizei samples,
+ GLint internalformat, GLsizei width,
+ GLsizei height, GLsizei depth,
+ GLboolean fixedsamplelocations,
+ GLboolean immutable, const char *func);
/*@}*/
@@ -408,6 +417,17 @@ _mesa_TexStorage3DMultisample(GLenum target, GLsizei samples,
GLsizei height, GLsizei depth,
GLboolean fixedsamplelocations);
+void GLAPIENTRY
+_mesa_TextureStorage2DMultisample(GLuint texture, GLsizei samples,
+ GLenum internalformat, GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations);
+
+void GLAPIENTRY
+_mesa_TextureStorage3DMultisample(GLuint texture, GLsizei samples,
+ GLenum internalformat, GLsizei width,
+ GLsizei height, GLsizei depth,
+ GLboolean fixedsamplelocations);
/*@}*/
#ifdef __cplusplus