nir_shader *s = nir_shader_clone(NULL, ir);
/* Lower this early so the backends don't have to worry about it */
- if (s->info.stage == MESA_SHADER_FRAGMENT)
+ if (s->info.stage == MESA_SHADER_FRAGMENT) {
NIR_PASS_V(s, nir_lower_fragcolor, state->key.fs.nr_cbufs);
+ if (state->key.fs.sprite_coord_enable) {
+ NIR_PASS_V(s, nir_lower_texcoord_replace,
+ state->key.fs.sprite_coord_enable,
+ true /* point coord is sysval */,
+ false /* Y-invert */);
+ }
+ }
+
/* Call out to Midgard compiler given the above NIR */
struct panfrost_compile_inputs inputs = {
.gpu_id = dev->gpu_id,
struct panfrost_context *ctx = batch->ctx;
+ /* If we change whether we're drawing points, or whether point sprites
+ * are enabled (specified in the rasterizer), we may need to rebind
+ * shaders accordingly. This implicitly covers the case of rebinding
+ * framebuffers, because all dirty flags are set there.
+ */
+ if ((ctx->dirty & PAN_DIRTY_RASTERIZER) ||
+ ((ctx->active_prim == PIPE_PRIM_POINTS) ^
+ (info->mode == PIPE_PRIM_POINTS))) {
+
+ ctx->active_prim = info->mode;
+ panfrost_update_shader_variant(ctx, PIPE_SHADER_FRAGMENT);
+ }
+
/* Take into account a negative bias */
ctx->indirect_draw = false;
ctx->vertex_count = draw->count + (info->index_size ? abs(draw->index_bias) : 0);
struct panfrost_device *dev = pan_device(ctx->base.screen);
struct pipe_framebuffer_state *fb = &ctx->pipe_framebuffer;
+ struct pipe_rasterizer_state *rast = (void *) ctx->rasterizer;
key->fs.nr_cbufs = fb->nr_cbufs;
+ /* Point sprite lowering needed on Bifrost and newer */
+ if (dev->arch >= 6 && rast && ctx->active_prim == PIPE_PRIM_POINTS) {
+ key->fs.sprite_coord_enable = rast->sprite_coord_enable;
+ }
+
if (dev->arch <= 5) {
u_foreach_bit(i, (nir->info.outputs_read >> FRAG_RESULT_DATA0)) {
enum pipe_format fmt = PIPE_FORMAT_R8G8B8A8_UNORM;
if (ctx->pipe_framebuffer.cbufs[i])
ctx->fb_rt_mask |= BITFIELD_BIT(i);
}
-
- /* We may need to generate a new variant if the fragment shader is
- * keyed to the framebuffer format or render target count */
- struct panfrost_shader_variants *fs = ctx->shader[PIPE_SHADER_FRAGMENT];
-
- if (fs && fs->variant_count)
- ctx->base.bind_fs_state(&ctx->base, fs);
}
static void
PAN_DIRTY_MSAA = BITFIELD_BIT(8),
PAN_DIRTY_OQ = BITFIELD_BIT(9),
PAN_DIRTY_RASTERIZER = BITFIELD_BIT(10),
+ PAN_DIRTY_POINTS = BITFIELD_BIT(11),
};
enum pan_dirty_shader {
* non-blendable formats
*/
enum pipe_format rt_formats[8];
+
+ /* From rasterize state, to lower point sprites */
+ uint16_t sprite_coord_enable;
};
struct panfrost_shader_key {
spec@arb_pixel_buffer_object@fbo-pbo-readpixels-small,Fail
spec@arb_pixel_buffer_object@fbo-pbo-readpixels-small@GL_DEPTH32F_STENCIL8-GL_DEPTH_STENCIL,Fail
spec@arb_pixel_buffer_object@fbo-pbo-readpixels-small@GL_DEPTH32F_STENCIL8-GL_STENCIL_INDEX,Fail
-spec@arb_point_sprite@arb_point_sprite-checkerboard,Fail
spec@arb_point_sprite@arb_point_sprite-mipmap,Fail
spec@arb_sample_shading@samplemask 2@0.250000 mask_in_one,Fail
spec@arb_sample_shading@samplemask 2@0.500000 mask_in_one,Fail
spec@!opengl 3.1@primitive-restart-xfb generated,Fail
spec@!opengl 3.1@primitive-restart-xfb written,Fail
spec@!opengl 3.1@required-texture-attachment-formats,Fail
-spec@!opengl 3.2@coord-replace-doesnt-eliminate-frag-tex-coords,Fail
spec@!opengl es 3.0@gles-3.0-transform-feedback-uniform-buffer-object,Fail
# VK-GL-CTS 1.3.1.0 uprev, aka when we dropped the custom caselist file.