nine: change cap macros to use pipe_caps access

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32955>
This commit is contained in:
Qiang Yu 2025-01-09 16:00:57 +08:00 committed by Marge Bot
parent 5c0d4a6225
commit aa9fa085fe
3 changed files with 32 additions and 33 deletions

View file

@ -561,10 +561,10 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
}
#define D3DPIPECAP(pcap, d3dcap) \
(screen->get_param(screen, PIPE_CAP_##pcap) ? (d3dcap) : 0)
(screen->caps.pcap ? (d3dcap) : 0)
#define D3DNPIPECAP(pcap, d3dcap) \
(screen->get_param(screen, PIPE_CAP_##pcap) ? 0 : (d3dcap))
(screen->caps.pcap ? 0 : (d3dcap))
pCaps->DeviceType = DeviceType;
@ -625,12 +625,12 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
/*D3DPMISCCAPS_CLIPTLVERTS |*/
D3DPMISCCAPS_TSSARGTEMP |
D3DPMISCCAPS_BLENDOP |
D3DPIPECAP(INDEP_BLEND_ENABLE, D3DPMISCCAPS_INDEPENDENTWRITEMASKS) |
D3DPIPECAP(indep_blend_enable, D3DPMISCCAPS_INDEPENDENTWRITEMASKS) |
D3DPMISCCAPS_PERSTAGECONSTANT |
/*D3DPMISCCAPS_POSTBLENDSRGBCONVERT |*/ /* TODO: advertise if Ex and dx10 able card */
D3DPMISCCAPS_FOGANDSPECULARALPHA | /* Note: documentation of the flag is wrong */
D3DPIPECAP(BLEND_EQUATION_SEPARATE, D3DPMISCCAPS_SEPARATEALPHABLEND) |
D3DPIPECAP(MIXED_COLORBUFFER_FORMATS, D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS) |
D3DPIPECAP(blend_equation_separate, D3DPMISCCAPS_SEPARATEALPHABLEND) |
D3DPIPECAP(mixed_colorbuffer_formats, D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS) |
D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING |
D3DPMISCCAPS_FOGVERTEXCLAMPED;
if (!screen->get_param(screen, PIPE_CAP_VS_WINDOW_SPACE_POSITION) &&
@ -638,7 +638,7 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
pCaps->PrimitiveMiscCaps |= D3DPMISCCAPS_CLIPTLVERTS;
pCaps->RasterCaps =
D3DPIPECAP(ANISOTROPIC_FILTER, D3DPRASTERCAPS_ANISOTROPY) |
D3DPIPECAP(anisotropic_filter, D3DPRASTERCAPS_ANISOTROPY) |
D3DPRASTERCAPS_COLORPERSPECTIVE |
D3DPRASTERCAPS_DITHER |
D3DPRASTERCAPS_DEPTHBIAS |
@ -678,7 +678,7 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
D3DPBLENDCAPS_BOTHSRCALPHA |
D3DPBLENDCAPS_BOTHINVSRCALPHA |
D3DPBLENDCAPS_BLENDFACTOR |
D3DPIPECAP(MAX_DUAL_SOURCE_RENDER_TARGETS,
D3DPIPECAP(max_dual_source_render_targets,
D3DPBLENDCAPS_INVSRCCOLOR2 |
D3DPBLENDCAPS_SRCCOLOR2);
@ -707,25 +707,25 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE |
D3DPTEXTURECAPS_CUBEMAP |
D3DPTEXTURECAPS_VOLUMEMAP |
D3DNPIPECAP(NPOT_TEXTURES, D3DPTEXTURECAPS_POW2) |
D3DNPIPECAP(NPOT_TEXTURES, D3DPTEXTURECAPS_NONPOW2CONDITIONAL) |
D3DNPIPECAP(NPOT_TEXTURES, D3DPTEXTURECAPS_CUBEMAP_POW2) |
D3DNPIPECAP(NPOT_TEXTURES, D3DPTEXTURECAPS_VOLUMEMAP_POW2) |
D3DPIPECAP(MAX_TEXTURE_2D_SIZE, D3DPTEXTURECAPS_MIPMAP) |
D3DPIPECAP(MAX_TEXTURE_3D_LEVELS, D3DPTEXTURECAPS_MIPVOLUMEMAP) |
D3DPIPECAP(MAX_TEXTURE_CUBE_LEVELS, D3DPTEXTURECAPS_MIPCUBEMAP);
D3DNPIPECAP(npot_textures, D3DPTEXTURECAPS_POW2) |
D3DNPIPECAP(npot_textures, D3DPTEXTURECAPS_NONPOW2CONDITIONAL) |
D3DNPIPECAP(npot_textures, D3DPTEXTURECAPS_CUBEMAP_POW2) |
D3DNPIPECAP(npot_textures, D3DPTEXTURECAPS_VOLUMEMAP_POW2) |
D3DPIPECAP(max_texture_2d_size, D3DPTEXTURECAPS_MIPMAP) |
D3DPIPECAP(max_texture_3d_levels, D3DPTEXTURECAPS_MIPVOLUMEMAP) |
D3DPIPECAP(max_texture_cube_levels, D3DPTEXTURECAPS_MIPCUBEMAP);
pCaps->TextureFilterCaps =
D3DPTFILTERCAPS_MINFPOINT |
D3DPTFILTERCAPS_MINFLINEAR |
D3DPIPECAP(ANISOTROPIC_FILTER, D3DPTFILTERCAPS_MINFANISOTROPIC) |
D3DPIPECAP(anisotropic_filter, D3DPTFILTERCAPS_MINFANISOTROPIC) |
/*D3DPTFILTERCAPS_MINFPYRAMIDALQUAD |*/
/*D3DPTFILTERCAPS_MINFGAUSSIANQUAD |*/
D3DPTFILTERCAPS_MIPFPOINT |
D3DPTFILTERCAPS_MIPFLINEAR |
D3DPTFILTERCAPS_MAGFPOINT |
D3DPTFILTERCAPS_MAGFLINEAR |
D3DPIPECAP(ANISOTROPIC_FILTER, D3DPTFILTERCAPS_MAGFANISOTROPIC) |
D3DPIPECAP(anisotropic_filter, D3DPTFILTERCAPS_MAGFANISOTROPIC) |
/*D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD |*/
/*D3DPTFILTERCAPS_MAGFGAUSSIANQUAD*/0;
@ -738,7 +738,7 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
D3DPTADDRESSCAPS_WRAP |
D3DPTADDRESSCAPS_MIRROR |
D3DPTADDRESSCAPS_CLAMP |
D3DPIPECAP(TEXTURE_MIRROR_CLAMP, D3DPTADDRESSCAPS_MIRRORONCE);
D3DPIPECAP(texture_mirror_clamp, D3DPTADDRESSCAPS_MIRRORONCE);
pCaps->VolumeTextureAddressCaps = pCaps->TextureAddressCaps;

View file

@ -151,7 +151,7 @@ NineDevice9_SetDefaultState( struct NineDevice9 *This, bool is_reset )
This, (IDirect3DSurface9 *)This->swapchains[0]->zsbuf);
}
#define GET_PCAP(n) pScreen->get_param(pScreen, PIPE_CAP_##n)
#define GET_PCAP(n) pScreen->caps.n
HRESULT
NineDevice9_ctor( struct NineDevice9 *This,
struct NineUnknownParams *pParams,
@ -330,7 +330,7 @@ NineDevice9_ctor( struct NineDevice9 *This,
/* We rely on u_upload_mgr using persistent coherent buffers (which don't
* require flush to work in multi-pipe_context scenario) for vertex and
* index buffers */
if (!GET_PCAP(BUFFER_MAP_PERSISTENT_COHERENT))
if (!GET_PCAP(buffer_map_persistent_coherent))
This->csmt_active = false;
if (This->csmt_active) {
@ -557,16 +557,16 @@ NineDevice9_ctor( struct NineDevice9 *This,
This->driver_caps.user_sw_vbufs = This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_VERTEX_BUFFERS);
This->vertex_uploader = This->csmt_active ? This->pipe_secondary->stream_uploader : This->context.pipe->stream_uploader;
This->driver_caps.window_space_position_support = GET_PCAP(VS_WINDOW_SPACE_POSITION);
This->driver_caps.disabling_depth_clipping_support = GET_PCAP(DEPTH_CLIP_DISABLE);
This->driver_caps.window_space_position_support = GET_PCAP(vs_window_space_position);
This->driver_caps.disabling_depth_clipping_support = GET_PCAP(depth_clip_disable);
This->driver_caps.vs_integer = pScreen->get_shader_param(pScreen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_INTEGERS);
This->driver_caps.ps_integer = pScreen->get_shader_param(pScreen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_INTEGERS);
This->driver_caps.offset_units_unscaled = GET_PCAP(POLYGON_OFFSET_UNITS_UNSCALED);
This->driver_caps.alpha_test_emulation = !GET_PCAP(ALPHA_TEST);
This->driver_caps.offset_units_unscaled = GET_PCAP(polygon_offset_units_unscaled);
This->driver_caps.alpha_test_emulation = !GET_PCAP(alpha_test);
/* Always write pointsize output when the driver doesn't support point_size_per_vertex = 0.
* TODO: Only generate pointsize for draw calls that need it */
This->driver_caps.always_output_pointsize = !GET_PCAP(POINT_SIZE_FIXED);
This->driver_caps.emulate_ucp = !(GET_PCAP(CLIP_PLANES) == 1 || GET_PCAP(CLIP_PLANES) >= 8);
This->driver_caps.always_output_pointsize = !GET_PCAP(point_size_fixed);
This->driver_caps.emulate_ucp = !(GET_PCAP(clip_planes) == 1 || GET_PCAP(clip_planes) >= 8);
This->driver_caps.shader_emulate_features = pCTX->force_emulation;
if (pCTX->force_emulation) {

View file

@ -3590,8 +3590,7 @@ sm1_parse_instruction(struct shader_translator *tx)
TOKEN_JUMP(tx);
}
#define GET_CAP(n) screen->get_param( \
screen, PIPE_CAP_##n)
#define GET_CAP(n) screen->caps.n
#define GET_SHADER_CAP(n) screen->get_shader_param( \
screen, info->type, PIPE_SHADER_CAP_##n)
@ -3663,14 +3662,14 @@ tx_ctor(struct shader_translator *tx, struct pipe_screen *screen, struct nine_sh
tx->native_integers = GET_SHADER_CAP(INTEGERS);
tx->inline_subroutines = !GET_SHADER_CAP(SUBROUTINES);
tx->want_texcoord = GET_CAP(TGSI_TEXCOORD);
tx->shift_wpos = !GET_CAP(FS_COORD_PIXEL_CENTER_INTEGER);
tx->want_texcoord = GET_CAP(tgsi_texcoord);
tx->shift_wpos = !GET_CAP(fs_coord_pixel_center_integer);
tx->texcoord_sn = tx->want_texcoord ?
TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC;
tx->wpos_is_sysval = GET_CAP(FS_POSITION_IS_SYSVAL);
tx->face_is_sysval_integer = GET_CAP(FS_FACE_IS_INTEGER_SYSVAL);
tx->no_vs_window_space = !GET_CAP(VS_WINDOW_SPACE_POSITION);
tx->mul_zero_wins = GET_CAP(LEGACY_MATH_RULES);
tx->wpos_is_sysval = GET_CAP(fs_position_is_sysval);
tx->face_is_sysval_integer = GET_CAP(fs_face_is_integer_sysval);
tx->no_vs_window_space = !GET_CAP(vs_window_space_position);
tx->mul_zero_wins = GET_CAP(legacy_math_rules);
if (info->emulate_features) {
tx->shift_wpos = true;