summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHenri Verbeet <[email protected]>2018-03-26 19:06:08 +0430
committerJuan A. Suarez Romero <[email protected]>2018-04-12 21:49:28 +0200
commit510f4f33623080ecce2718a0839ad0502e45860a (patch)
treeef3f94ea4a92038d365a02832a61766189288ef4 /src
parent51265b844b2365f43749566130aea2f4b77fb464 (diff)
mesa: Inherit texture view multi-sample information from the original texture images.
Found running "The Witness" in Wine. Without this patch, texture views created on multi-sample textures would have a GL_TEXTURE_SAMPLES of 0. All things considered such views actually work surprisingly well, but when combined with (plain) multi-sample textures in a framebuffer object, the resulting FBO is incomplete because the sample counts don't match. CC: <[email protected]> Signed-off-by: Henri Verbeet <[email protected]> Reviewed-by: Brian Paul <[email protected]> (cherry picked from commit 0b73c86b8030a7f7cb35fc85c83eff7f2b8c24a4)
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/teximage.c20
-rw-r--r--src/mesa/main/teximage.h8
-rw-r--r--src/mesa/main/textureview.c12
3 files changed, 26 insertions, 14 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index e5f8bb0718f..5cff8b6e7e9 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -837,8 +837,8 @@ clear_teximage_fields(struct gl_texture_image *img)
* Fills in the fields of \p img with the given information.
* Note: width, height and depth include the border.
*/
-static void
-init_teximage_fields_ms(struct gl_context *ctx,
+void
+_mesa_init_teximage_fields_ms(struct gl_context *ctx,
struct gl_texture_image *img,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum internalFormat,
@@ -950,8 +950,8 @@ _mesa_init_teximage_fields(struct gl_context *ctx,
GLint border, GLenum internalFormat,
mesa_format format)
{
- init_teximage_fields_ms(ctx, img, width, height, depth, border,
- internalFormat, format, 0, GL_TRUE);
+ _mesa_init_teximage_fields_ms(ctx, img, width, height, depth, border,
+ internalFormat, format, 0, GL_TRUE);
}
@@ -5853,9 +5853,9 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims,
if (_mesa_is_proxy_texture(target)) {
if (samplesOK && dimensionsOK && sizeOK) {
- init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
- internalformat, texFormat,
- samples, fixedsamplelocations);
+ _mesa_init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
+ internalformat, texFormat,
+ samples, fixedsamplelocations);
}
else {
/* clear all image fields */
@@ -5882,9 +5882,9 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims,
ctx->Driver.FreeTextureImageBuffer(ctx, texImage);
- init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
- internalformat, texFormat,
- samples, fixedsamplelocations);
+ _mesa_init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
+ internalformat, texFormat,
+ samples, fixedsamplelocations);
if (width > 0 && height > 0 && depth > 0) {
if (memObj) {
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index 2e950bf42bb..bf790af2766 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -130,6 +130,14 @@ _mesa_init_teximage_fields(struct gl_context *ctx,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum internalFormat,
mesa_format format);
+extern void
+_mesa_init_teximage_fields_ms(struct gl_context *ctx,
+ struct gl_texture_image *img,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLint border, GLenum internalFormat,
+ mesa_format format,
+ GLuint numSamples,
+ GLboolean fixedSampleLocations);
extern mesa_format
diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
index 89af068fae8..9a064ffd718 100644
--- a/src/mesa/main/textureview.c
+++ b/src/mesa/main/textureview.c
@@ -304,7 +304,8 @@ initialize_texture_fields(struct gl_context *ctx,
struct gl_texture_object *texObj,
GLint levels,
GLsizei width, GLsizei height, GLsizei depth,
- GLenum internalFormat, mesa_format texFormat)
+ GLenum internalFormat, mesa_format texFormat,
+ GLuint numSamples, GLboolean fixedSampleLocations)
{
const GLuint numFaces = _mesa_num_tex_faces(target);
GLint level, levelWidth = width, levelHeight = height, levelDepth = depth;
@@ -326,9 +327,10 @@ initialize_texture_fields(struct gl_context *ctx,
return GL_FALSE;
}
- _mesa_init_teximage_fields(ctx, texImage,
+ _mesa_init_teximage_fields_ms(ctx, texImage,
levelWidth, levelHeight, levelDepth,
- 0, internalFormat, texFormat);
+ 0, internalFormat, texFormat,
+ numSamples, fixedSampleLocations);
}
_mesa_next_mipmap_level_size(target, 0,
@@ -676,7 +678,9 @@ texture_view(struct gl_context *ctx, struct gl_texture_object *origTexObj,
if (!initialize_texture_fields(ctx, target, texObj, newViewNumLevels,
width, height, depth,
- internalformat, texFormat)) {
+ internalformat, texFormat,
+ origTexImage->NumSamples,
+ origTexImage->FixedSampleLocations)) {
return; /* Already recorded error */
}