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>
This commit is contained in:
parent
e45fe0ed66
commit
0b73c86b80
|
@ -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,7 +950,7 @@ _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,
|
||||
_mesa_init_teximage_fields_ms(ctx, img, width, height, depth, border,
|
||||
internalFormat, format, 0, GL_TRUE);
|
||||
}
|
||||
|
||||
|
@ -5891,7 +5891,7 @@ 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,
|
||||
_mesa_init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
|
||||
internalformat, texFormat,
|
||||
samples, fixedsamplelocations);
|
||||
}
|
||||
|
@ -5920,7 +5920,7 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims,
|
|||
|
||||
ctx->Driver.FreeTextureImageBuffer(ctx, texImage);
|
||||
|
||||
init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
|
||||
_mesa_init_teximage_fields_ms(ctx, texImage, width, height, depth, 0,
|
||||
internalformat, texFormat,
|
||||
samples, fixedsamplelocations);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue