mesa: always support occlusion queries
Excerpt from ARB_occlusion_query.txt: An implementation can either set QUERY_COUNTER_BITS_ARB to the value 0, or to some number greater than or equal to n. If an implementation returns 0 for QUERY_COUNTER_BITS_ARB, then the occlusion queries will always return that zero samples passed the occlusion test, and so an application should not use occlusion queries on that implementation. This looks more sane for drivers wanting desktop gl 1.5 without real hw support then just faking it. Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Emma Anholt <emma@anholt.net> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14361>
This commit is contained in:
parent
56886459c5
commit
0186e9e1c5
|
@ -277,6 +277,7 @@ _mesa_init_extensions(struct gl_extensions *extensions)
|
|||
extensions->ARB_internalformat_query = GL_TRUE;
|
||||
extensions->ARB_internalformat_query2 = GL_TRUE;
|
||||
extensions->ARB_map_buffer_range = GL_TRUE;
|
||||
extensions->ARB_occlusion_query = GL_TRUE;
|
||||
extensions->ARB_sync = GL_TRUE;
|
||||
extensions->ARB_texture_env_crossbar = GL_TRUE;
|
||||
extensions->ARB_vertex_program = GL_TRUE;
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
#include "queryobj.h"
|
||||
#include "mtypes.h"
|
||||
#include "pipe/p_context.h"
|
||||
#include "pipe/p_screen.h"
|
||||
#include "util/u_memory.h"
|
||||
|
||||
#include "state_tracker/st_cb_queryobj.h"
|
||||
|
@ -914,10 +916,16 @@ _mesa_GetQueryBufferObjectui64v(GLuint id, GLuint buffer, GLenum pname,
|
|||
void
|
||||
_mesa_init_queryobj(struct gl_context *ctx)
|
||||
{
|
||||
struct pipe_screen *screen = ctx->pipe->screen;
|
||||
|
||||
ctx->Query.QueryObjects = _mesa_NewHashTable();
|
||||
ctx->Query.CurrentOcclusionObject = NULL;
|
||||
|
||||
ctx->Const.QueryCounterBits.SamplesPassed = 64;
|
||||
if (screen->get_param(screen, PIPE_CAP_OCCLUSION_QUERY))
|
||||
ctx->Const.QueryCounterBits.SamplesPassed = 64;
|
||||
else
|
||||
ctx->Const.QueryCounterBits.SamplesPassed = 0;
|
||||
|
||||
ctx->Const.QueryCounterBits.TimeElapsed = 64;
|
||||
ctx->Const.QueryCounterBits.Timestamp = 64;
|
||||
ctx->Const.QueryCounterBits.PrimitivesGenerated = 64;
|
||||
|
|
|
@ -933,12 +933,12 @@ st_create_context(gl_api api, struct pipe_context *pipe,
|
|||
return NULL;
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
|
||||
ctx->pipe = pipe;
|
||||
if (!_mesa_initialize_context(ctx, api, visual, shareCtx, &funcs)) {
|
||||
align_free(ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ctx->pipe = pipe;
|
||||
st_debug_init();
|
||||
|
||||
if (pipe->screen->get_disk_shader_cache)
|
||||
|
|
|
@ -798,7 +798,6 @@ void st_init_extensions(struct pipe_screen *screen,
|
|||
{ o(ARB_gl_spirv), PIPE_CAP_GL_SPIRV },
|
||||
{ o(ARB_indirect_parameters), PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS },
|
||||
{ o(ARB_instanced_arrays), PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR },
|
||||
{ o(ARB_occlusion_query), PIPE_CAP_OCCLUSION_QUERY },
|
||||
{ o(ARB_occlusion_query2), PIPE_CAP_OCCLUSION_QUERY },
|
||||
{ o(ARB_pipeline_statistics_query), PIPE_CAP_QUERY_PIPELINE_STATISTICS },
|
||||
{ o(ARB_pipeline_statistics_query), PIPE_CAP_QUERY_PIPELINE_STATISTICS_SINGLE },
|
||||
|
|
Loading…
Reference in New Issue