d3d12: Fix Xbox GDK build errors

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23154>
This commit is contained in:
Caleb Cornett
2023-05-23 21:10:03 -04:00
committed by Marge Bot
parent 39a9ebde37
commit 2e0eeb3706
5 changed files with 39 additions and 7 deletions
+14 -4
View File
@@ -62,6 +62,12 @@
#include "dxil_validator.h"
#endif
#ifdef _GAMING_XBOX
typedef D3D12_DEPTH_STENCILOP_DESC d3d12_depth_stencil_op_desc_type;
#else
typedef D3D12_DEPTH_STENCILOP_DESC1 d3d12_depth_stencil_op_desc_type;
#endif
static void
d3d12_context_destroy(struct pipe_context *pctx)
{
@@ -428,16 +434,18 @@ stencil_op(enum pipe_stencil_op op)
unreachable("unexpected op");
}
static D3D12_DEPTH_STENCILOP_DESC1
static d3d12_depth_stencil_op_desc_type
stencil_op_state(const struct pipe_stencil_state *src)
{
D3D12_DEPTH_STENCILOP_DESC1 ret;
d3d12_depth_stencil_op_desc_type ret;
ret.StencilFailOp = stencil_op((pipe_stencil_op) src->fail_op);
ret.StencilPassOp = stencil_op((pipe_stencil_op) src->zpass_op);
ret.StencilDepthFailOp = stencil_op((pipe_stencil_op) src->zfail_op);
ret.StencilFunc = compare_op((pipe_compare_func) src->func);
#ifndef _GAMING_XBOX
ret.StencilReadMask = src->valuemask;
ret.StencilWriteMask = src->writemask;
#endif
return ret;
}
@@ -469,15 +477,17 @@ d3d12_create_depth_stencil_alpha_state(struct pipe_context *pctx,
}
if (depth_stencil_alpha->stencil[1].enabled) {
struct d3d12_screen* screen = d3d12_screen(pctx->screen);
dsa->backface_enabled = true;
dsa->desc.BackFace = stencil_op_state(depth_stencil_alpha->stencil + 1);
#ifndef _GAMING_XBOX
struct d3d12_screen *screen = d3d12_screen(pctx->screen);
if (!screen->opts14.IndependentFrontAndBackStencilRefMaskSupported) {
dsa->desc.BackFace.StencilReadMask = dsa->desc.FrontFace.StencilReadMask;
dsa->desc.BackFace.StencilWriteMask = dsa->desc.FrontFace.StencilWriteMask;
}
#endif
}
else {
dsa->desc.BackFace = dsa->desc.FrontFace;
@@ -21,12 +21,21 @@
* IN THE SOFTWARE.
*/
#ifdef _GAMING_XBOX
#ifdef _GAMING_XBOX_SCARLETT
#include <d3dx12_xs.h>
#else
#include <d3dx12_x.h>
#endif
#endif
#include "d3d12_pipeline_state.h"
#include "d3d12_compiler.h"
#include "d3d12_context.h"
#include "d3d12_screen.h"
#ifndef _GAMING_XBOX
#include <directx/d3dx12_pipeline_state_stream.h>
#endif
#include "util/hash_table.h"
#include "util/set.h"
@@ -278,7 +287,7 @@ create_gfx_pipeline_state(struct d3d12_context *ctx)
if (state->has_float_rtv)
blend_state.RenderTarget[0].LogicOpEnable = FALSE;
(D3D12_DEPTH_STENCIL_DESC2&)pso_desc.DepthStencilState = state->zsa->desc;
(d3d12_depth_stencil_desc_type&)pso_desc.DepthStencilState = state->zsa->desc;
pso_desc.SampleMask = state->sample_mask;
D3D12_RASTERIZER_DESC& rast = (D3D12_RASTERIZER_DESC&)pso_desc.RasterizerState;
@@ -316,11 +325,14 @@ create_gfx_pipeline_state(struct d3d12_context *ctx)
rast.ForcedSampleCount = 1;
pso_desc.DSVFormat = DXGI_FORMAT_UNKNOWN;
}
} else if (state->samples > 1 &&
}
#ifndef _GAMING_XBOX
else if (state->samples > 1 &&
!(screen->opts19.SupportedSampleCountsWithNoOutputs & (1 << state->samples))) {
samples.Count = 1;
rast.ForcedSampleCount = state->samples;
}
#endif
samples.Quality = 0;
pso_desc.NodeMask = 0;
@@ -28,6 +28,12 @@
#include "d3d12_common.h"
#ifdef _GAMING_XBOX
typedef D3D12_DEPTH_STENCIL_DESC1 d3d12_depth_stencil_desc_type;
#else
typedef D3D12_DEPTH_STENCIL_DESC2 d3d12_depth_stencil_desc_type;
#endif
struct d3d12_context;
struct d3d12_root_signature;
@@ -52,7 +58,7 @@ struct d3d12_blend_state {
};
struct d3d12_depth_stencil_alpha_state {
D3D12_DEPTH_STENCIL_DESC2 desc;
d3d12_depth_stencil_desc_type desc;
bool backface_enabled;
};
@@ -1475,7 +1475,9 @@ d3d12_init_screen(struct d3d12_screen *screen, IUnknown *adapter)
return false;
}
screen->dev->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS14, &screen->opts14, sizeof(screen->opts14));
#ifndef _GAMING_XBOX
screen->dev->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS19, &screen->opts19, sizeof(screen->opts19));
#endif
screen->architecture.NodeIndex = 0;
if (FAILED(screen->dev->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE,
+2
View File
@@ -117,7 +117,9 @@ struct d3d12_screen {
D3D12_FEATURE_DATA_D3D12_OPTIONS3 opts3;
D3D12_FEATURE_DATA_D3D12_OPTIONS4 opts4;
D3D12_FEATURE_DATA_D3D12_OPTIONS14 opts14;
#ifndef _GAMING_XBOX
D3D12_FEATURE_DATA_D3D12_OPTIONS19 opts19;
#endif
nir_shader_compiler_options nir_options;