nvc0: enable GL_NV_viewport_array2

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-By: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4529>
This commit is contained in:
Ilia Mirkin 2020-04-10 23:47:04 -04:00
parent cd092bf937
commit 04a7ec7c8a
8 changed files with 21 additions and 2 deletions

View File

@ -467,6 +467,7 @@ enum SVSemantic
SV_VERTEX_COUNT, // gl_PatchVerticesIn
SV_LAYER,
SV_VIEWPORT_INDEX,
SV_VIEWPORT_MASK,
SV_YDIR,
SV_FACE,
SV_POINT_SIZE,

View File

@ -177,6 +177,7 @@ struct nv50_ir_prog_info
uint8_t globalAccess; /* 1 for read, 2 for wr, 3 for rw */
bool fp64; /* program uses fp64 math */
bool mul_zero_wins; /* program wants for x*0 = 0 */
bool layer_viewport_relative;
bool nv50styleSurfaces; /* generate gX[] access for raw buffers */
uint16_t texBindBase; /* base address for tex handles (nve4) */
uint16_t fbtexBindBase; /* base address for fbtex handle (nve4) */

View File

@ -1229,6 +1229,9 @@ void Source::scanProperty(const struct tgsi_full_property *prop)
case TGSI_PROPERTY_MUL_ZERO_WINS:
info->io.mul_zero_wins = prop->u[0].Data;
break;
case TGSI_PROPERTY_LAYER_VIEWPORT_RELATIVE:
info->io.layer_viewport_relative = prop->u[0].Data;
break;
default:
INFO("unhandled TGSI property %d\n", prop->Property.PropertyName);
break;
@ -1548,6 +1551,7 @@ bool Source::scanInstruction(const struct tgsi_full_instruction *inst)
info->out[dst.getIndex(0)].sn == TGSI_SEMANTIC_PRIMID ||
info->out[dst.getIndex(0)].sn == TGSI_SEMANTIC_LAYER ||
info->out[dst.getIndex(0)].sn == TGSI_SEMANTIC_VIEWPORT_INDEX ||
info->out[dst.getIndex(0)].sn == TGSI_SEMANTIC_VIEWPORT_MASK ||
info->out[dst.getIndex(0)].sn == TGSI_SEMANTIC_FOG)
info->out[dst.getIndex(0)].mask &= 1;

View File

@ -851,6 +851,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_FLOAT 0x38000000
#define NVC0_3D_VERTEX_ATTRIB_FORMAT_BGRA 0x80000000
#define NVC0_3D_LAYER_VIEWPORT_RELATIVE 0x000011f0
#define NVC0_3D_UNK1214 0x00001214
#define NVC0_3D_UNK1218 0x00001218

View File

@ -81,7 +81,7 @@ nvc0_shader_output_address(unsigned sn, unsigned si)
case TGSI_SEMANTIC_CLIPDIST: return 0x2c0 + si * 0x10;
case TGSI_SEMANTIC_CLIPVERTEX: return 0x270;
case TGSI_SEMANTIC_TEXCOORD: return 0x300 + si * 0x10;
/* case TGSI_SEMANTIC_VIEWPORT_MASK: return 0x3a0; */
case TGSI_SEMANTIC_VIEWPORT_MASK: return 0x3a0;
case TGSI_SEMANTIC_EDGEFLAG: return ~0;
default:
assert(!"invalid TGSI output semantic");
@ -272,6 +272,8 @@ nvc0_vtgp_gen_header(struct nvc0_program *vp, struct nv50_ir_prog_info *info)
if (info->io.genUserClip < 0)
vp->vp.num_ucps = PIPE_MAX_CLIP_PLANES + 1; /* prevent rebuilding */
vp->vp.layer_viewport_relative = info->io.layer_viewport_relative;
return 0;
}

View File

@ -41,6 +41,7 @@ struct nvc0_program {
uint8_t edgeflag; /* attribute index of edgeflag input */
bool need_vertex_id;
bool need_draw_parameters;
bool layer_viewport_relative; /* also applies go gp and tp */
} vp;
struct {
uint8_t early_z;

View File

@ -312,6 +312,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_CONSERVATIVE_RASTER_POST_DEPTH_COVERAGE:
case PIPE_CAP_PROGRAMMABLE_SAMPLE_LOCATIONS:
case PIPE_CAP_VIEWPORT_SWIZZLE:
case PIPE_CAP_VIEWPORT_MASK:
return class_3d >= GM200_3D_CLASS;
case PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_TRIANGLES:
return class_3d >= GP100_3D_CLASS;

View File

@ -257,6 +257,7 @@ nvc0_layer_validate(struct nvc0_context *nvc0)
struct nouveau_pushbuf *push = nvc0->base.pushbuf;
struct nvc0_program *last;
bool prog_selects_layer = false;
bool layer_viewport_relative = false;
if (nvc0->gmtyprog)
last = nvc0->gmtyprog;
@ -265,11 +266,17 @@ nvc0_layer_validate(struct nvc0_context *nvc0)
else
last = nvc0->vertprog;
if (last)
if (last) {
prog_selects_layer = !!(last->hdr[13] & (1 << 9));
layer_viewport_relative = last->vp.layer_viewport_relative;
}
BEGIN_NVC0(push, NVC0_3D(LAYER), 1);
PUSH_DATA (push, prog_selects_layer ? NVC0_3D_LAYER_USE_GP : 0);
if (nvc0->screen->eng3d->oclass >= GM200_3D_CLASS) {
IMMED_NVC0(push, NVC0_3D(LAYER_VIEWPORT_RELATIVE),
layer_viewport_relative);
}
}
void