@@ -2450,57 +2450,87 @@ typedef struct ShadingRateMode ShadingRateMode;
24502450DILIGENT_TYPED_ENUM (SHADING_RATE_CAP_FLAGS , Uint16 )
24512451{
24522452 /// No shading rate capabilities.
2453- SHADING_RATE_CAP_FLAG_NONE = 0 ,
2453+ SHADING_RATE_CAP_FLAG_NONE = 0 ,
24542454
24552455 /// Shading rate can be specified for the whole draw call using IDeviceContext::SetShadingRate().
2456- SHADING_RATE_CAP_FLAG_PER_DRAW = 1u << 0 ,
2456+ SHADING_RATE_CAP_FLAG_PER_DRAW = 1u << 0 ,
24572457
24582458 /// Shading rate can be specified in the vertex shader for each primitive and combined with the base rate.
24592459 /// Use IDeviceContext::SetShadingRate() to set base rate and per-primitive combiner.
2460- SHADING_RATE_CAP_FLAG_PER_PRIMITIVE = 1u << 1 ,
2460+ SHADING_RATE_CAP_FLAG_PER_PRIMITIVE = 1u << 1 ,
24612461
24622462 /// Shading rate is specified by a texture, each texel defines a shading rate for the tile.
24632463 /// Supported tile size is specified in ShadingRateProperties::MinTileSize/MaxTileSize.
24642464 /// Use IDeviceContext::SetShadingRate() to set the base rate and texture combiner.
24652465 /// Use IDeviceContext::SetRenderTargetsExt() to set the shading rate texture.
2466- SHADING_RATE_CAP_FLAG_TEXTURE_BASED = 1u << 2 ,
2466+ SHADING_RATE_CAP_FLAG_TEXTURE_BASED = 1u << 2 ,
24672467
24682468 /// Allows to set zero bits in GraphicsPipelineDesc::SampleMask
24692469 /// with the enabled variable rate shading.
2470- SHADING_RATE_CAP_FLAG_SAMPLE_MASK = 1u << 3 ,
2470+ SHADING_RATE_CAP_FLAG_SAMPLE_MASK = 1u << 3 ,
24712471
24722472 /// Allows to get or set SampleMask in the shader with enabled variable rate shading.
24732473 /// HLSL: SV_Coverage, GLSL: gl_SampleMaskIn, gl_SampleMask.
2474- SHADING_RATE_CAP_FLAG_SHADER_SAMPLE_MASK = 1u << 4 ,
2474+ SHADING_RATE_CAP_FLAG_SHADER_SAMPLE_MASK = 1u << 4 ,
24752475
24762476 /// Allows to write depth and stencil from the pixel shader.
2477- SHADING_RATE_CAP_FLAG_SHADER_DEPTH_STENCIL_WRITE = 1u << 5 ,
2477+ SHADING_RATE_CAP_FLAG_SHADER_DEPTH_STENCIL_WRITE = 1u << 5 ,
24782478
24792479 /// Allows to use per primitive shading rate when multiple viewports are used.
24802480 SHADING_RATE_CAP_FLAG_PER_PRIMITIVE_WITH_MULTIPLE_VIEWPORTS = 1u << 6 ,
24812481
24822482 /// Shading rate attachment for render pass must be the same for all subpasses.
24832483 /// See SubpassDesc::pShadingRateAttachment.
2484- SHADING_RATE_CAP_FLAG_SAME_TEXTURE_FOR_WHOLE_RENDERPASS = 1u << 7 ,
2484+ SHADING_RATE_CAP_FLAG_SAME_TEXTURE_FOR_WHOLE_RENDERPASS = 1u << 7 ,
24852485
24862486 /// Allows to use texture 2D array for shading rate.
2487- SHADING_RATE_CAP_FLAG_TEXTURE_ARRAY = 1u << 8 ,
2487+ SHADING_RATE_CAP_FLAG_TEXTURE_ARRAY = 1u << 8 ,
24882488
24892489 /// Allows to read current shading rate in the pixel shader.
24902490 /// HLSL: in SV_ShadingRate, GLSL: gl_ShadingRate.
2491- SHADING_RATE_CAP_FLAG_SHADING_RATE_SHADER_INPUT = 1u << 9 ,
2492-
2493- /// Indicates that VRS texture is accessed on the GPU side.
2494- /// If the flag is not set, the texture content is accessed
2495- /// on the CPU side when render pass begins.
2496- SHADING_RATE_CAP_FLAG_TEXTURE_DEVICE_ACCESS = 1u << 10 ,
2491+ SHADING_RATE_CAP_FLAG_SHADING_RATE_SHADER_INPUT = 1u << 9 ,
24972492
24982493 /// Indicates that driver may generate additional fragment shader invocations
24992494 /// in order to make transitions between fragment areas with different shading rates more smooth.
2500- SHADING_RATE_CAP_FLAG_ADDITIONAL_INVOCATIONS = 1u << 11 ,
2495+ SHADING_RATE_CAP_FLAG_ADDITIONAL_INVOCATIONS = 1u << 10 ,
2496+
2497+ /// Indicates that there are no additional requirements for render targets
2498+ /// that are used in texture-based VRS rendering.
2499+ SHADING_RATE_CAP_FLAG_NON_SUBSAMPLED_RENDER_TARGET = 1u << 11 ,
2500+
2501+ /// Indicates that render targets that are used in texture-based VRS rendering
2502+ /// must be created with MISC_TEXTURE_FLAG_SUBSAMPLED flag.
2503+ /// Intermediate targets must be scaled to the final resolution in a separate pass.
2504+ /// Intermediate targets can only be sampled with an immutable sampler created with SAMPLER_FLAG_SUBSAMPLED flag.
2505+ /// If supported, rendering to the subsampled render targets may be more optimal.
2506+ ///
2507+ /// \note Both NON_SUBSAMPLED and SUBSAMPLED modes may be supported by a device.
2508+ SHADING_RATE_CAP_FLAG_SUBSAMPLED_RENDER_TARGET = 1u << 12
25012509};
25022510DEFINE_FLAG_ENUM_OPERATORS (SHADING_RATE_CAP_FLAGS );
25032511
2512+ /// Defines how the shading rate texture is accessed
2513+ DILIGENT_TYPED_ENUM (SHADING_RATE_TEXTURE_ACCESS , Uint8 )
2514+ {
2515+ /// Shading rate texture access type is unknown
2516+ SHADING_RATE_TEXTURE_ACCESS_UNKNOWN = 0 ,
2517+
2518+ /// Shading rate texture is accessed by the GPU when command buffer is executed.
2519+ SHADING_RATE_TEXTURE_ACCESS_ON_GPU ,
2520+
2521+ /// Shading rate texture is accessed by the CPU when command buffer is submitted
2522+ /// for execution. An application is not allowed to modify the texture until the command
2523+ /// buffer is executed by the GPU. Feneces or other synchronization methods must be used
2524+ /// to control the access to the texture.
2525+ SHADING_RATE_TEXTURE_ACCESS_ON_SUBMIT ,
2526+
2527+ /// Shading rate texture is accessed by the CPU when SetRenderTargetsEx or BeginRenderPass
2528+ /// command is executed. An application is not allowed to modify the texture until the
2529+ /// command buffer is executed by GPU. Feneces or other synchronization methods must be used
2530+ /// to control the access to the texture.
2531+ SHADING_RATE_TEXTURE_ACCESS_ON_SET_RTV
2532+ };
2533+
25042534/// Shading rate properties
25052535struct ShadingRateProperties
25062536{
@@ -2509,7 +2539,7 @@ struct ShadingRateProperties
25092539 ShadingRateMode ShadingRates [DILIGENT_MAX_SHADING_RATES ] DEFAULT_INITIALIZER ({});
25102540
25112541 /// The number of valid elements in ShadingRates array.
2512- Uint32 NumShadingRates DEFAULT_INITIALIZER (0 );
2542+ Uint8 NumShadingRates DEFAULT_INITIALIZER (0 );
25132543
25142544 /// Shading rate capability flags, see Diligent::SHADING_RATE_CAP_FLAGS.
25152545 SHADING_RATE_CAP_FLAGS CapFlags DEFAULT_INITIALIZER (SHADING_RATE_CAP_FLAG_NONE );
@@ -2520,13 +2550,22 @@ struct ShadingRateProperties
25202550 /// Indicates which shading rate texture format is used by this device (see Diligent::SHADING_RATE_FORMAT).
25212551 SHADING_RATE_FORMAT Format DEFAULT_INITIALIZER (SHADING_RATE_FORMAT_UNKNOWN );
25222552
2553+ /// Shading rate texture access type (see Diligent::SHADING_RATE_TEXTURE_ACCESS).
2554+ SHADING_RATE_TEXTURE_ACCESS ShadingRateTextureAccess DEFAULT_INITIALIZER (SHADING_RATE_TEXTURE_ACCESS_UNKNOWN );
2555+
2556+ /// Indicates which bind flags are allowed for shading rate texture.
2557+ BIND_FLAGS BindFlags DEFAULT_INITIALIZER (BIND_NONE );
2558+
25232559 /// Minimal supported tile size.
25242560 /// Shading rate texture size must be less than or equal to (framebuffer_size / MinTileSize).
25252561 Uint32 MinTileSize [2 ] DEFAULT_INITIALIZER ({});
25262562
25272563 /// Maximum supported tile size.
25282564 /// Shading rate texture size must be greater than or equal to (framebuffer_size / MaxTileSize).
25292565 Uint32 MaxTileSize [2 ] DEFAULT_INITIALIZER ({});
2566+
2567+ /// Maximum size of the texture array created with MISC_TEXTURE_FLAG_SUBSAMPLED flag.
2568+ Uint32 MaxSabsampledArraySlices DEFAULT_INITIALIZER (0 );
25302569};
25312570typedef struct ShadingRateProperties ShadingRateProperties ;
25322571
0 commit comments