2021-06-24 13:09:35 +02:00
|
|
|
|
/*
|
|
|
|
|
|
* Copyright © Microsoft Corporation
|
|
|
|
|
|
*
|
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
|
|
*
|
|
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
|
|
* Software.
|
|
|
|
|
|
*
|
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
|
|
* IN THE SOFTWARE.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef DZN_NIR_H
|
|
|
|
|
|
#define DZN_NIR_H
|
|
|
|
|
|
|
|
|
|
|
|
#define D3D12_IGNORE_SDK_LAYERS
|
2022-03-25 17:08:50 +01:00
|
|
|
|
#define COBJMACROS
|
2022-04-30 05:30:22 +08:00
|
|
|
|
#include <unknwn.h>
|
2021-06-24 13:09:35 +02:00
|
|
|
|
#include <directx/d3d12.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "nir.h"
|
|
|
|
|
|
|
|
|
|
|
|
struct dzn_indirect_draw_rewrite_params {
|
|
|
|
|
|
uint32_t draw_buf_stride;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct dzn_indirect_draw_triangle_fan_rewrite_params {
|
|
|
|
|
|
uint32_t draw_buf_stride;
|
|
|
|
|
|
uint32_t triangle_fan_index_buf_stride;
|
|
|
|
|
|
uint64_t triangle_fan_index_buf_start;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2022-06-13 16:22:38 +02:00
|
|
|
|
struct dzn_indirect_draw_triangle_fan_prim_restart_rewrite_params {
|
|
|
|
|
|
uint32_t draw_buf_stride;
|
|
|
|
|
|
uint32_t triangle_fan_index_buf_stride;
|
|
|
|
|
|
uint64_t triangle_fan_index_buf_start;
|
|
|
|
|
|
uint64_t exec_buf_start;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2021-06-24 13:09:35 +02:00
|
|
|
|
struct dzn_triangle_fan_rewrite_index_params {
|
2022-04-06 17:30:33 +02:00
|
|
|
|
uint32_t first_index;
|
2021-06-24 13:09:35 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
2022-06-13 16:22:38 +02:00
|
|
|
|
struct dzn_triangle_fan_prim_restart_rewrite_index_params {
|
|
|
|
|
|
uint32_t first_index;
|
|
|
|
|
|
uint32_t index_count;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2021-06-24 13:09:35 +02:00
|
|
|
|
struct dzn_indirect_triangle_fan_rewrite_index_exec_params {
|
|
|
|
|
|
uint64_t new_index_buf;
|
|
|
|
|
|
struct dzn_triangle_fan_rewrite_index_params params;
|
|
|
|
|
|
struct {
|
|
|
|
|
|
uint32_t x, y, z;
|
|
|
|
|
|
} group_count;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2022-06-13 16:22:38 +02:00
|
|
|
|
struct dzn_indirect_triangle_fan_prim_restart_rewrite_index_exec_params {
|
|
|
|
|
|
uint64_t new_index_buf;
|
|
|
|
|
|
struct dzn_triangle_fan_prim_restart_rewrite_index_params params;
|
|
|
|
|
|
uint64_t index_count_ptr;
|
|
|
|
|
|
struct {
|
|
|
|
|
|
uint32_t x, y, z;
|
|
|
|
|
|
} group_count;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-03-25 11:44:25 -07:00
|
|
|
|
struct dzn_indirect_draw_type {
|
|
|
|
|
|
union {
|
|
|
|
|
|
struct {
|
|
|
|
|
|
uint8_t indexed : 1;
|
|
|
|
|
|
uint8_t indirect_count : 1;
|
|
|
|
|
|
uint8_t draw_params : 1;
|
|
|
|
|
|
uint8_t draw_id : 1;
|
|
|
|
|
|
uint8_t triangle_fan : 1;
|
|
|
|
|
|
uint8_t triangle_fan_primitive_restart : 1;
|
|
|
|
|
|
};
|
|
|
|
|
|
uint8_t value;
|
|
|
|
|
|
};
|
2021-06-24 13:09:35 +02:00
|
|
|
|
};
|
2024-03-25 11:44:25 -07:00
|
|
|
|
#define DZN_NUM_INDIRECT_DRAW_TYPES (1 << 6)
|
2021-06-24 13:09:35 +02:00
|
|
|
|
|
|
|
|
|
|
nir_shader *
|
2024-03-25 11:44:25 -07:00
|
|
|
|
dzn_nir_indirect_draw_shader(struct dzn_indirect_draw_type type);
|
2021-06-24 13:09:35 +02:00
|
|
|
|
|
|
|
|
|
|
nir_shader *
|
|
|
|
|
|
dzn_nir_triangle_fan_rewrite_index_shader(uint8_t old_index_size);
|
|
|
|
|
|
|
2022-06-13 16:22:38 +02:00
|
|
|
|
nir_shader *
|
|
|
|
|
|
dzn_nir_triangle_fan_prim_restart_rewrite_index_shader(uint8_t old_index_size);
|
|
|
|
|
|
|
2023-05-03 11:18:52 -07:00
|
|
|
|
enum dzn_blit_resolve_mode {
|
|
|
|
|
|
dzn_blit_resolve_none,
|
|
|
|
|
|
dzn_blit_resolve_average,
|
|
|
|
|
|
dzn_blit_resolve_min,
|
|
|
|
|
|
dzn_blit_resolve_max,
|
|
|
|
|
|
dzn_blit_resolve_sample_zero,
|
|
|
|
|
|
};
|
2021-06-24 13:09:35 +02:00
|
|
|
|
struct dzn_nir_blit_info {
|
|
|
|
|
|
union {
|
|
|
|
|
|
struct {
|
|
|
|
|
|
uint32_t src_samples : 6;
|
|
|
|
|
|
uint32_t loc : 4;
|
|
|
|
|
|
uint32_t out_type : 4;
|
|
|
|
|
|
uint32_t sampler_dim : 4;
|
|
|
|
|
|
uint32_t src_is_array : 1;
|
2023-05-03 11:18:52 -07:00
|
|
|
|
uint32_t resolve_mode : 3;
|
2024-01-26 10:56:55 -08:00
|
|
|
|
uint32_t stencil_fallback : 1;
|
|
|
|
|
|
uint32_t padding : 9;
|
2021-06-24 13:09:35 +02:00
|
|
|
|
};
|
|
|
|
|
|
const uint32_t hash_key;
|
|
|
|
|
|
};
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
nir_shader *
|
|
|
|
|
|
dzn_nir_blit_vs(void);
|
|
|
|
|
|
|
|
|
|
|
|
nir_shader *
|
|
|
|
|
|
dzn_nir_blit_fs(const struct dzn_nir_blit_info *info);
|
|
|
|
|
|
|
2023-04-21 11:13:12 -07:00
|
|
|
|
struct dzn_nir_point_gs_info {
|
|
|
|
|
|
unsigned cull_mode;
|
|
|
|
|
|
bool front_ccw;
|
|
|
|
|
|
bool depth_bias;
|
|
|
|
|
|
bool depth_bias_dynamic;
|
|
|
|
|
|
DXGI_FORMAT ds_fmt;
|
|
|
|
|
|
/* Constant values */
|
|
|
|
|
|
float constant_depth_bias;
|
|
|
|
|
|
float slope_scaled_depth_bias;
|
|
|
|
|
|
float depth_bias_clamp;
|
|
|
|
|
|
/* Used for loading dynamic values */
|
|
|
|
|
|
struct {
|
|
|
|
|
|
uint32_t register_space;
|
|
|
|
|
|
uint32_t base_shader_register;
|
|
|
|
|
|
} runtime_data_cbv;
|
|
|
|
|
|
};
|
2023-04-03 15:17:45 -07:00
|
|
|
|
nir_shader *
|
2023-04-21 11:13:12 -07:00
|
|
|
|
dzn_nir_polygon_point_mode_gs(const nir_shader *vs, struct dzn_nir_point_gs_info *info);
|
2023-04-03 15:17:45 -07:00
|
|
|
|
|
2021-06-24 13:09:35 +02:00
|
|
|
|
#endif
|