mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
mesa: fix ms fallback texture creation
when a ms fallback texture is created, it has to actually be a ms texture in order to be consistent with driver expectations for a given sampler in a shader this adds sample querying to both ends of the fallback creation to ensure that a sample count is passed to the driver affects: KHR-GL46.sample_variables.position.fixed.samples_0 Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22492>
This commit is contained in:
parent
c29359a008
commit
d2ccdc3e8d
2 changed files with 31 additions and 8 deletions
|
|
@ -1084,12 +1084,27 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex, bool is
|
|||
/* initialize level[0] texture image */
|
||||
texImage = _mesa_get_tex_image(ctx, texObj, faceTarget, 0);
|
||||
|
||||
_mesa_init_teximage_fields(ctx, texImage,
|
||||
width,
|
||||
(dims > 1) ? height : 1,
|
||||
(dims > 2) ? depth : 1,
|
||||
0, /* border */
|
||||
is_depth ? GL_DEPTH_COMPONENT : GL_RGBA, texFormat);
|
||||
GLenum internalFormat = is_depth ? GL_DEPTH_COMPONENT : GL_RGBA;
|
||||
if (tex == TEXTURE_2D_MULTISAMPLE_INDEX ||
|
||||
tex == TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX) {
|
||||
int samples[16];
|
||||
st_QueryInternalFormat(ctx, 0, internalFormat, GL_SAMPLES, samples);
|
||||
_mesa_init_teximage_fields_ms(ctx, texImage,
|
||||
width,
|
||||
(dims > 1) ? height : 1,
|
||||
(dims > 2) ? depth : 1,
|
||||
0, /* border */
|
||||
internalFormat, texFormat,
|
||||
samples[0],
|
||||
GL_TRUE);
|
||||
} else {
|
||||
_mesa_init_teximage_fields(ctx, texImage,
|
||||
width,
|
||||
(dims > 1) ? height : 1,
|
||||
(dims > 2) ? depth : 1,
|
||||
0, /* border */
|
||||
internalFormat, texFormat);
|
||||
}
|
||||
_mesa_update_texture_object_swizzle(ctx, texObj);
|
||||
if (ctx->st->can_null_texture && is_depth) {
|
||||
texObj->NullTexture = GL_TRUE;
|
||||
|
|
|
|||
|
|
@ -1071,14 +1071,22 @@ guess_and_alloc_texture(struct st_context *st,
|
|||
width, height, depth,
|
||||
&ptWidth, &ptHeight, &ptDepth, &ptLayers);
|
||||
|
||||
enum pipe_texture_target target = gl_target_to_pipe(stObj->Target);
|
||||
unsigned nr_samples = 0;
|
||||
if (stObj->TargetIndex == TEXTURE_2D_MULTISAMPLE_INDEX ||
|
||||
stObj->TargetIndex == TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX) {
|
||||
int samples[16];
|
||||
st_QueryInternalFormat(st->ctx, 0, stImage->InternalFormat, GL_SAMPLES, samples);
|
||||
nr_samples = samples[0];
|
||||
}
|
||||
stObj->pt = st_texture_create(st,
|
||||
gl_target_to_pipe(stObj->Target),
|
||||
target,
|
||||
fmt,
|
||||
lastLevel,
|
||||
ptWidth,
|
||||
ptHeight,
|
||||
ptDepth,
|
||||
ptLayers, 0,
|
||||
ptLayers, nr_samples,
|
||||
bindings,
|
||||
false);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue