summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenri Verbeet <hverbeet@gmail.com>2018-03-26 19:06:08 +0430
committerJuan A. Suarez Romero <jasuarez@igalia.com>2018-04-10 14:21:11 +0000
commit25a49b8e7c0d7cd94713299ae50bab2b6a87d448 (patch)
tree76e833c4f8c73c1da33689791185ade5837a73ba
parentba371c7262a484391cace9d5e17635ed14c58692 (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: <mesa-stable@lists.freedesktop.org> Signed-off-by: Henri Verbeet <hverbeet@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com> (cherry picked from commit 0b73c86b8030a7f7cb35fc85c83eff7f2b8c24a4)
-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 d7643a52dfe..27a56fbaca5 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);
}
@@ -5838,9 +5838,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 */
@@ -5867,9 +5867,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 18452db24d6..4cd702cfc51 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 */
}