diff --git a/src/gallium/drivers/d3d12/d3d12_context.cpp b/src/gallium/drivers/d3d12/d3d12_context.cpp index ed4f2bafb31..27aad18ae31 100644 --- a/src/gallium/drivers/d3d12/d3d12_context.cpp +++ b/src/gallium/drivers/d3d12/d3d12_context.cpp @@ -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; diff --git a/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp b/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp index 501ee851a22..2663abee864 100644 --- a/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp +++ b/src/gallium/drivers/d3d12/d3d12_pipeline_state.cpp @@ -21,12 +21,21 @@ * IN THE SOFTWARE. */ +#ifdef _GAMING_XBOX +#ifdef _GAMING_XBOX_SCARLETT +#include +#else +#include +#endif +#endif #include "d3d12_pipeline_state.h" #include "d3d12_compiler.h" #include "d3d12_context.h" #include "d3d12_screen.h" +#ifndef _GAMING_XBOX #include +#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; diff --git a/src/gallium/drivers/d3d12/d3d12_pipeline_state.h b/src/gallium/drivers/d3d12/d3d12_pipeline_state.h index fcfc98aa187..5fb15b54da3 100644 --- a/src/gallium/drivers/d3d12/d3d12_pipeline_state.h +++ b/src/gallium/drivers/d3d12/d3d12_pipeline_state.h @@ -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; }; diff --git a/src/gallium/drivers/d3d12/d3d12_screen.cpp b/src/gallium/drivers/d3d12/d3d12_screen.cpp index f4dbd856e1f..e26be20b90b 100644 --- a/src/gallium/drivers/d3d12/d3d12_screen.cpp +++ b/src/gallium/drivers/d3d12/d3d12_screen.cpp @@ -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, diff --git a/src/gallium/drivers/d3d12/d3d12_screen.h b/src/gallium/drivers/d3d12/d3d12_screen.h index 9f05ff72104..bf70e879a82 100644 --- a/src/gallium/drivers/d3d12/d3d12_screen.h +++ b/src/gallium/drivers/d3d12/d3d12_screen.h @@ -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;