mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
nouveau/codegen: Add capability to pre-specify tessellation domain
In the case of SPIRV tessellation shaders, the execution mode can be specified in the tessellation control shader. So we need a way to know the domain when compiling the tessellation evaluation shader. Acked-by: M Henning <drawoc@darkrefraction.com> Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24327>
This commit is contained in:
parent
df5d1ef2b5
commit
cdece16cf4
2 changed files with 18 additions and 1 deletions
|
|
@ -103,6 +103,9 @@ struct nv50_ir_prog_info
|
||||||
uint32_t gridInfoBase; /* base address for NTID,NCTAID */
|
uint32_t gridInfoBase; /* base address for NTID,NCTAID */
|
||||||
uint16_t numThreads[3]; /* max number of threads */
|
uint16_t numThreads[3]; /* max number of threads */
|
||||||
} cp;
|
} cp;
|
||||||
|
struct {
|
||||||
|
uint8_t prespecified_domain; /* MESA_PRIM_{QUADS,TRIANGLES,LINES}, POINTS if unspecified */
|
||||||
|
} tese;
|
||||||
} prop;
|
} prop;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
|
|
@ -2916,6 +2916,18 @@ NVC0LoweringPass::handleLDST(Instruction *i)
|
||||||
void
|
void
|
||||||
NVC0LoweringPass::readTessCoord(LValue *dst, int c)
|
NVC0LoweringPass::readTessCoord(LValue *dst, int c)
|
||||||
{
|
{
|
||||||
|
// GLSL requires domain qualifier to be defined in TES while SPIRV allows
|
||||||
|
// domain to be defined in TES and/or TCS
|
||||||
|
uint8_t domain = prog->driver_out->prop.tp.domain;
|
||||||
|
const bool tese_defined_domain =
|
||||||
|
domain == MESA_PRIM_LINES ||
|
||||||
|
domain == MESA_PRIM_TRIANGLES ||
|
||||||
|
domain == MESA_PRIM_QUADS;
|
||||||
|
|
||||||
|
if (!tese_defined_domain) {
|
||||||
|
domain = prog->driver->prop.tese.prespecified_domain;
|
||||||
|
}
|
||||||
|
|
||||||
Value *laneid = bld.getSSA();
|
Value *laneid = bld.getSSA();
|
||||||
Value *x, *y;
|
Value *x, *y;
|
||||||
|
|
||||||
|
|
@ -2930,7 +2942,8 @@ NVC0LoweringPass::readTessCoord(LValue *dst, int c)
|
||||||
y = dst;
|
y = dst;
|
||||||
} else {
|
} else {
|
||||||
assert(c == 2);
|
assert(c == 2);
|
||||||
if (prog->driver_out->prop.tp.domain != MESA_PRIM_TRIANGLES) {
|
if (domain != MESA_PRIM_TRIANGLES) {
|
||||||
|
// optimize out tesscoord.z
|
||||||
bld.mkMov(dst, bld.loadImm(NULL, 0));
|
bld.mkMov(dst, bld.loadImm(NULL, 0));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -2943,6 +2956,7 @@ NVC0LoweringPass::readTessCoord(LValue *dst, int c)
|
||||||
bld.mkFetch(y, TYPE_F32, FILE_SHADER_OUTPUT, 0x2f4, NULL, laneid);
|
bld.mkFetch(y, TYPE_F32, FILE_SHADER_OUTPUT, 0x2f4, NULL, laneid);
|
||||||
|
|
||||||
if (c == 2) {
|
if (c == 2) {
|
||||||
|
// compute tesscoord.z from x, y
|
||||||
bld.mkOp2(OP_ADD, TYPE_F32, dst, x, y);
|
bld.mkOp2(OP_ADD, TYPE_F32, dst, x, y);
|
||||||
bld.mkOp2(OP_SUB, TYPE_F32, dst, bld.loadImm(NULL, 1.0f), dst);
|
bld.mkOp2(OP_SUB, TYPE_F32, dst, bld.loadImm(NULL, 1.0f), dst);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue