uint16_t vastc_srgb, fastc_srgb;
};
+static inline unsigned
+ir3_tess_mode(unsigned gl_tess_mode)
+{
+ switch (gl_tess_mode) {
+ case GL_ISOLINES:
+ return IR3_TESS_ISOLINES;
+ case GL_TRIANGLES:
+ return IR3_TESS_TRIANGLES;
+ case GL_QUADS:
+ return IR3_TESS_QUADS;
+ default:
+ unreachable("bad tessmode");
+ }
+}
+
static inline bool
ir3_shader_key_equal(struct ir3_shader_key *a, struct ir3_shader_key *b)
{
emit.key.ds = ctx->prog.ds;
shader_info *ds_info = &emit.key.ds->nir->info;
- switch (ds_info->tess.primitive_mode) {
- case GL_ISOLINES:
- emit.key.key.tessellation = IR3_TESS_ISOLINES;
- break;
- case GL_TRIANGLES:
- emit.key.key.tessellation = IR3_TESS_TRIANGLES;
- break;
- case GL_QUADS:
- emit.key.key.tessellation = IR3_TESS_QUADS;
- break;
- default:
- unreachable("bad tessmode");
- }
+ emit.key.key.tessellation = ir3_tess_mode(ds_info->tess.primitive_mode);
}
if (emit.key.gs)
* (as otherwise nothing will trigger the shader to be
* actually compiled)
*/
- static struct ir3_shader_key key; /* static is implicitly zeroed */
+ struct ir3_shader_key key = {
+ .tessellation = IR3_TESS_NONE,
+ };
+
+ switch (nir->info.stage) {
+ case MESA_SHADER_TESS_EVAL:
+ key.tessellation = ir3_tess_mode(nir->info.tess.primitive_mode);
+ break;
+
+ case MESA_SHADER_TESS_CTRL:
+ /* The primitive_mode field, while it exists for TCS, is not
+ * populated (since separable shaders between TCS/TES are legal,
+ * so TCS wouldn't have access to TES's declaration). Make a
+ * guess so that we shader-db something plausible for TCS.
+ */
+ if (nir->info.outputs_written & VARYING_BIT_TESS_LEVEL_INNER)
+ key.tessellation = IR3_TESS_TRIANGLES;
+ else
+ key.tessellation = IR3_TESS_ISOLINES;
+ break;
+
+ case MESA_SHADER_GEOMETRY:
+ key.has_gs = true;
+ break;
+
+ default:
+ break;
+ }
+
ir3_shader_variant(shader, key, false, debug);
if (nir->info.stage == MESA_SHADER_VERTEX)