lima: Expose GL_EXT_clip_control

Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Andreas Baierl <ichgeh@imkreisrum.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12804>
This commit is contained in:
Andreas Baierl 2021-09-10 14:33:55 +02:00 committed by Marge Bot
parent 7405b7fbcd
commit d1798ad1b5
5 changed files with 18 additions and 8 deletions

View file

@ -213,7 +213,7 @@ GL 4.4, GLSL 4.40 -- all DONE: i965/gen8+, nvc0, r600, radeonsi, llvmpipe, zink
GL 4.5, GLSL 4.50 -- all DONE: nvc0, r600, radeonsi, llvmpipe, zink
GL_ARB_ES3_1_compatibility DONE (i965/hsw+, softpipe, virgl)
GL_ARB_clip_control DONE (freedreno, i965, nv50, softpipe, swr, virgl)
GL_ARB_clip_control DONE (freedreno, i965, nv50, softpipe, swr, virgl, lima)
GL_ARB_conditional_render_inverted DONE (freedreno, i965, nv50, softpipe, swr, virgl, panfrost)
GL_ARB_cull_distance DONE (freedreno/a6xx, i965, nv50, softpipe, swr, virgl)
GL_ARB_derivative_control DONE (i965, nv50, softpipe, virgl)

View file

@ -600,8 +600,7 @@ lima_calculate_depth_test(struct pipe_depth_stencil_alpha_state *depth,
return (depth->depth_enabled && depth->depth_writemask) |
((int)func << 1) |
(offset_scale << 16) |
(offset_units << 24) |
0x30; /* find out what is this */
(offset_units << 24);
}
static void
@ -647,6 +646,11 @@ lima_pack_render_state(struct lima_context *ctx, const struct pipe_draw_info *in
struct pipe_rasterizer_state *rst = &ctx->rasterizer->base;
render->depth_test = lima_calculate_depth_test(&ctx->zsa->base, rst);
if (!rst->depth_clip_near || ctx->viewport.near == 0.0f)
render->depth_test |= 0x10; /* don't clip depth near */
if (!rst->depth_clip_far || ctx->viewport.far == 1.0f)
render->depth_test |= 0x20; /* don't clip depth far */
ushort far, near;
near = float_to_ushort(ctx->viewport.near);

View file

@ -489,7 +489,11 @@ parse_rsw(FILE *fp, uint32_t *value, int i, uint32_t *helper)
if (*value & 0x1000)
fprintf(fp, ", shader writes stencil");
fprintf(fp, " */\n\t\t\t\t\t\t/* %s(3)", render_state_infos[i].info);
fprintf(fp, ": unknown bits 4-9: 0x%08x", *value & 0x000003f0);
if ((*value & 0x00000010) == 0x00000010)
fprintf(fp, ": ignore depth clip near");
if ((*value & 0x00000020) == 0x00000020)
fprintf(fp, ", ignore depth clip far");
fprintf(fp, ", unknown bits 6-9: 0x%08x", *value & 0x000003c0);
fprintf(fp, ", unknown bits 13-15: 0x%08x */\n", *value & 0x00000e000);
break;
case 4: /* DEPTH RANGE */

View file

@ -101,6 +101,7 @@ lima_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
case PIPE_CAP_ACCELERATED:
case PIPE_CAP_UMA:
case PIPE_CAP_CLIP_HALFZ:
case PIPE_CAP_NATIVE_FENCE_FD:
case PIPE_CAP_FRAGMENT_SHADER_TEXTURE_LOD:
case PIPE_CAP_TEXTURE_SWIZZLE:

View file

@ -29,6 +29,7 @@
#include "util/u_helpers.h"
#include "util/u_debug.h"
#include "util/u_framebuffer.h"
#include "util/u_viewport.h"
#include "pipe/p_state.h"
@ -218,11 +219,11 @@ lima_set_viewport_states(struct pipe_context *pctx,
/* reverse calculate the parameter of glDepthRange */
float near, far;
near = viewport->translate[2] - viewport->scale[2];
far = viewport->translate[2] + viewport->scale[2];
bool halfz = ctx->rasterizer && ctx->rasterizer->base.clip_halfz;
util_viewport_zmin_zmax(viewport, halfz, &near, &far);
ctx->viewport.near = MIN2(near, far);
ctx->viewport.far = MAX2(near, far);
ctx->viewport.near = ctx->rasterizer && ctx->rasterizer->base.depth_clip_near ? near : 0.0f;
ctx->viewport.far = ctx->rasterizer && ctx->rasterizer->base.depth_clip_far ? far : 1.0f;
ctx->viewport.transform = *viewport;
ctx->dirty |= LIMA_CONTEXT_DIRTY_VIEWPORT;