mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 09:10:11 +01:00
mesa: add ARB_sparse_texture query in glGetInternalformativ
Add new parameter of glGetInternalformativ for ARB_sparse_texture. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14223>
This commit is contained in:
parent
1a616c4b29
commit
b1c32a6c8c
2 changed files with 48 additions and 0 deletions
|
|
@ -143,6 +143,18 @@ _legal_parameters(struct gl_context *ctx, GLenum target, GLenum internalformat,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GL_NUM_VIRTUAL_PAGE_SIZES_ARB:
|
||||||
|
case GL_VIRTUAL_PAGE_SIZE_X_ARB:
|
||||||
|
case GL_VIRTUAL_PAGE_SIZE_Y_ARB:
|
||||||
|
case GL_VIRTUAL_PAGE_SIZE_Z_ARB:
|
||||||
|
if (!_mesa_has_ARB_sparse_texture(ctx)) {
|
||||||
|
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||||
|
"glGetInternalformativ(pname=%s)",
|
||||||
|
_mesa_enum_to_string(pname));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case GL_SRGB_DECODE_ARB:
|
case GL_SRGB_DECODE_ARB:
|
||||||
/* The ARB_internalformat_query2 spec says:
|
/* The ARB_internalformat_query2 spec says:
|
||||||
*
|
*
|
||||||
|
|
@ -325,6 +337,10 @@ _set_default_response(GLenum pname, GLint buffer[16])
|
||||||
case GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT:
|
case GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT:
|
||||||
case GL_TEXTURE_COMPRESSED_BLOCK_SIZE:
|
case GL_TEXTURE_COMPRESSED_BLOCK_SIZE:
|
||||||
case GL_NUM_TILING_TYPES_EXT:
|
case GL_NUM_TILING_TYPES_EXT:
|
||||||
|
case GL_NUM_VIRTUAL_PAGE_SIZES_ARB:
|
||||||
|
case GL_VIRTUAL_PAGE_SIZE_X_ARB:
|
||||||
|
case GL_VIRTUAL_PAGE_SIZE_Y_ARB:
|
||||||
|
case GL_VIRTUAL_PAGE_SIZE_Z_ARB:
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -1574,6 +1590,13 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
|
||||||
buffer[0] = (GLint)0;
|
buffer[0] = (GLint)0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GL_NUM_VIRTUAL_PAGE_SIZES_ARB:
|
||||||
|
case GL_VIRTUAL_PAGE_SIZE_X_ARB:
|
||||||
|
case GL_VIRTUAL_PAGE_SIZE_Y_ARB:
|
||||||
|
case GL_VIRTUAL_PAGE_SIZE_Z_ARB:
|
||||||
|
st_QueryInternalFormat(ctx, target, internalformat, pname, buffer);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
unreachable("bad param");
|
unreachable("bad param");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1510,6 +1510,31 @@ st_QueryInternalFormat(struct gl_context *ctx, GLenum target,
|
||||||
0, 0, PIPE_BIND_SAMPLER_REDUCTION_MINMAX);
|
0, 0, PIPE_BIND_SAMPLER_REDUCTION_MINMAX);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GL_NUM_VIRTUAL_PAGE_SIZES_ARB:
|
||||||
|
case GL_VIRTUAL_PAGE_SIZE_X_ARB:
|
||||||
|
case GL_VIRTUAL_PAGE_SIZE_Y_ARB:
|
||||||
|
case GL_VIRTUAL_PAGE_SIZE_Z_ARB: {
|
||||||
|
mesa_format format = st_ChooseTextureFormat(ctx, target, internalFormat, GL_NONE, GL_NONE);
|
||||||
|
enum pipe_format pformat = st_mesa_format_to_pipe_format(st, format);
|
||||||
|
|
||||||
|
if (pformat != PIPE_FORMAT_NONE) {
|
||||||
|
struct pipe_screen *screen = st->screen;
|
||||||
|
enum pipe_texture_target ptarget = gl_target_to_pipe(target);
|
||||||
|
|
||||||
|
if (pname == GL_NUM_VIRTUAL_PAGE_SIZES_ARB)
|
||||||
|
params[0] = screen->get_sparse_texture_virtual_page_size(
|
||||||
|
screen, ptarget, pformat, 0, 0, NULL, NULL, NULL);
|
||||||
|
else {
|
||||||
|
int *args[3] = {0};
|
||||||
|
args[pname - GL_VIRTUAL_PAGE_SIZE_X_ARB] = params;
|
||||||
|
|
||||||
|
/* 16 comes from the caller _mesa_GetInternalformativ() */
|
||||||
|
screen->get_sparse_texture_virtual_page_size(
|
||||||
|
screen, ptarget, pformat, 0, 16, args[0], args[1], args[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
/* For the rest of the pnames, we call back the Mesa's default
|
/* For the rest of the pnames, we call back the Mesa's default
|
||||||
* function for drivers that don't implement ARB_internalformat_query2.
|
* function for drivers that don't implement ARB_internalformat_query2.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue