~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/gallium/drivers/r600/r600_pipe.c

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
224
224
        rctx->b.gfx.flush = r600_context_gfx_flush;
225
225
 
226
226
        u_suballocator_init(&rctx->allocator_fetch_shader, &rctx->b.b, 64 * 1024,
227
 
                            0, PIPE_USAGE_DEFAULT, 0, FALSE);
 
227
                            0, PIPE_USAGE_DEFAULT, 0, false);
228
228
 
229
229
        rctx->isa = calloc(1, sizeof(struct r600_isa));
230
230
        if (!rctx->isa || r600_isa_init(rctx, rctx->isa))
254
254
        return NULL;
255
255
}
256
256
 
257
 
static bool is_nir_enabled(struct r600_common_screen *screen) {
258
 
   return !(screen->debug_flags & DBG_USE_TGSI);
259
 
}
260
 
 
261
257
/*
262
258
 * pipe_screen
263
259
 */
318
314
        case PIPE_CAP_QUERY_MEMORY_INFO:
319
315
        case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
320
316
        case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
321
 
        case PIPE_CAP_CLEAR_TEXTURE:
322
317
        case PIPE_CAP_LEGACY_MATH_RULES:
323
318
        case PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX:
324
319
        case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
327
322
 
328
323
        case PIPE_CAP_NIR_ATOMICS_AS_DEREF:
329
324
        case PIPE_CAP_GL_SPIRV:
330
 
                return is_nir_enabled(&rscreen->b);
 
325
                return 1;
331
326
 
332
327
        case PIPE_CAP_TEXTURE_TRANSFER_MODES:
333
328
                return PIPE_TEXTURE_TRANSFER_BLIT;
367
362
        case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
368
363
                return 4;
369
364
        case PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY:
370
 
                if (!is_nir_enabled(&rscreen->b))
371
 
                        return 140;
372
 
                FALLTHROUGH;
373
365
        case PIPE_CAP_GLSL_FEATURE_LEVEL:
374
366
                if (family >= CHIP_CEDAR)
375
 
                   return is_nir_enabled(&rscreen->b) ? 450 : 430;
 
367
                   return 450;
376
368
                return 330;
377
369
 
378
370
        /* Supported except the original R600. */
423
415
                    rscreen->b.family == CHIP_CYPRESS ||
424
416
                    rscreen->b.family == CHIP_HEMLOCK)
425
417
                        return 1;
426
 
                if (is_nir_enabled(&rscreen->b) &&
427
 
                        rscreen->b.family >= CHIP_CEDAR)
 
418
                if (rscreen->b.family >= CHIP_CEDAR)
428
419
                        return 1;
429
420
                return 0;
430
421
 
431
422
        case PIPE_CAP_TWO_SIDED_COLOR:
432
 
                return !is_nir_enabled(&rscreen->b);
 
423
                return 0;
433
424
        case PIPE_CAP_INT64_DIVMOD:
434
 
                /* it is actually not supported, but the nir lowering handles this corectly wheras
 
425
                /* it is actually not supported, but the nir lowering handles this correctly whereas
435
426
                 * the glsl lowering path seems to not initialize the buildins correctly.
436
427
                 */
437
 
                return is_nir_enabled(&rscreen->b);
 
428
                return 1;
438
429
        case PIPE_CAP_CULL_DISTANCE:
439
430
                return 1;
440
431
 
504
495
        case PIPE_CAP_QUERY_TIMESTAMP:
505
496
                return rscreen->b.info.clock_crystal_freq != 0;
506
497
 
 
498
        case PIPE_CAP_TIMER_RESOLUTION:
 
499
                /* Conversion to nanos from cycles per millisecond */
 
500
                return DIV_ROUND_UP(1000000, rscreen->b.info.clock_crystal_freq);
 
501
 
507
502
        case PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET:
508
503
        case PIPE_CAP_MIN_TEXEL_OFFSET:
509
504
                return -8;
598
593
        case PIPE_SHADER_CAP_MAX_CONST_BUFFER0_SIZE:
599
594
                if (shader == PIPE_SHADER_COMPUTE) {
600
595
                        uint64_t max_const_buffer_size;
601
 
                        enum pipe_shader_ir ir_type = is_nir_enabled(&rscreen->b) ?
602
 
                                PIPE_SHADER_IR_NIR: PIPE_SHADER_IR_TGSI;
603
 
                        pscreen->get_compute_param(pscreen, ir_type,
 
596
                        pscreen->get_compute_param(pscreen, PIPE_SHADER_IR_NIR,
604
597
                                                   PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE,
605
598
                                                   &max_const_buffer_size);
606
599
                        return MIN2(max_const_buffer_size, INT_MAX);
633
626
        case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
634
627
        case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
635
628
                return 16;
636
 
        case PIPE_SHADER_CAP_PREFERRED_IR:
637
 
                if (rscreen->b.debug_flags & DBG_USE_TGSI)
638
 
                        return PIPE_SHADER_IR_TGSI;
639
 
                return PIPE_SHADER_IR_NIR;
640
629
        case PIPE_SHADER_CAP_SUPPORTED_IRS: {
641
630
                int ir = 0;
642
631
                if (shader == PIPE_SHADER_COMPUTE)
643
632
                        ir = 1 << PIPE_SHADER_IR_NATIVE;
644
 
                ir |= 1 << PIPE_SHADER_IR_TGSI;
645
 
                if (is_nir_enabled(&rscreen->b)) {
646
 
                        ir |= 1 << PIPE_SHADER_IR_NIR;
647
 
                }
 
633
                ir |= 1 << PIPE_SHADER_IR_NIR;
648
634
                return ir;
649
635
        }
650
636
        case PIPE_SHADER_CAP_DROUND_SUPPORTED:
728
714
        }
729
715
 
730
716
        rscreen->b.debug_flags |= debug_get_flags_option("R600_DEBUG", r600_debug_options, 0);
731
 
        if (debug_get_bool_option("R600_DEBUG_COMPUTE", FALSE))
 
717
        if (debug_get_bool_option("R600_DEBUG_COMPUTE", false))
732
718
                rscreen->b.debug_flags |= DBG_COMPUTE;
733
 
        if (debug_get_bool_option("R600_DUMP_SHADERS", FALSE))
 
719
        if (debug_get_bool_option("R600_DUMP_SHADERS", false))
734
720
                rscreen->b.debug_flags |= DBG_ALL_SHADERS | DBG_FS;
735
 
        if (!debug_get_bool_option("R600_HYPERZ", TRUE))
 
721
        if (!debug_get_bool_option("R600_HYPERZ", true))
736
722
                rscreen->b.debug_flags |= DBG_NO_HYPERZ;
737
723
 
738
724
        if (rscreen->b.family == CHIP_UNKNOWN) {
741
727
                return NULL;
742
728
        }
743
729
 
744
 
   if (is_nir_enabled(&rscreen->b))
745
 
       rscreen->b.b.finalize_nir = r600_finalize_nir;
 
730
        rscreen->b.b.finalize_nir = r600_finalize_nir;
746
731
 
747
732
        rscreen->b.has_streamout = true;
748
733