[Vulkan] 32-bit index fetch without fullDrawIndexUint32
This commit is contained in:
@@ -83,6 +83,9 @@ class SpirvShaderTranslator : public ShaderTranslator {
|
||||
};
|
||||
|
||||
enum : uint32_t {
|
||||
kSysFlag_VertexIndexLoad_Shift,
|
||||
kSysFlag_ComputeOrPrimitiveVertexIndexLoad_Shift,
|
||||
kSysFlag_ComputeOrPrimitiveVertexIndexLoad32Bit_Shift,
|
||||
kSysFlag_XYDividedByW_Shift,
|
||||
kSysFlag_ZDividedByW_Shift,
|
||||
kSysFlag_WNotReciprocal_Shift,
|
||||
@@ -98,6 +101,22 @@ class SpirvShaderTranslator : public ShaderTranslator {
|
||||
|
||||
kSysFlag_Count,
|
||||
|
||||
// For HostVertexShaderType kVertex, if fullDrawIndexUint32 is not
|
||||
// supported (ignored otherwise), whether to fetch the index manually
|
||||
// (32-bit only - 16-bit indices are always fetched via the Vulkan index
|
||||
// buffer).
|
||||
kSysFlag_VertexIndexLoad = 1u << kSysFlag_VertexIndexLoad_Shift,
|
||||
// For HostVertexShaderTypes kMemexportCompute, kPointListAsTriangleStrip,
|
||||
// kRectangleListAsTriangleStrip, whether the vertex index needs to be
|
||||
// loaded from the index buffer (rather than using autogenerated indices),
|
||||
// and whether it's 32-bit. This is separate from kSysFlag_VertexIndexLoad
|
||||
// because the same system constants may be used for the memexporting
|
||||
// compute shader and the vertex shader for the same draw, but
|
||||
// kSysFlag_VertexIndexLoad may be not needed.
|
||||
kSysFlag_ComputeOrPrimitiveVertexIndexLoad =
|
||||
1u << kSysFlag_ComputeOrPrimitiveVertexIndexLoad_Shift,
|
||||
kSysFlag_ComputeOrPrimitiveVertexIndexLoad32Bit =
|
||||
1u << kSysFlag_ComputeOrPrimitiveVertexIndexLoad32Bit_Shift,
|
||||
kSysFlag_XYDividedByW = 1u << kSysFlag_XYDividedByW_Shift,
|
||||
kSysFlag_ZDividedByW = 1u << kSysFlag_ZDividedByW_Shift,
|
||||
kSysFlag_WNotReciprocal = 1u << kSysFlag_WNotReciprocal_Shift,
|
||||
@@ -116,11 +135,14 @@ class SpirvShaderTranslator : public ShaderTranslator {
|
||||
// IF SYSTEM CONSTANTS ARE CHANGED OR ADDED, THE FOLLOWING MUST BE UPDATED:
|
||||
// - SystemConstantIndex enum.
|
||||
// - Structure members in BeginTranslation.
|
||||
//
|
||||
// Using the std140 layout - vec2 must be aligned to 8 bytes, vec3 and vec4 to
|
||||
// 16 bytes.
|
||||
struct SystemConstants {
|
||||
uint32_t flags;
|
||||
uint32_t vertex_index_load_address;
|
||||
xenos::Endian vertex_index_endian;
|
||||
int32_t vertex_base_index;
|
||||
uint32_t padding_vertex_base_index;
|
||||
|
||||
float ndc_scale[3];
|
||||
uint32_t padding_ndc_scale;
|
||||
@@ -216,6 +238,7 @@ class SpirvShaderTranslator : public ShaderTranslator {
|
||||
uint32_t max_storage_buffer_range;
|
||||
bool clip_distance;
|
||||
bool cull_distance;
|
||||
bool full_draw_index_uint32;
|
||||
bool image_view_format_swizzle;
|
||||
bool signed_zero_inf_nan_preserve_float32;
|
||||
bool denorm_flush_to_zero_float32;
|
||||
@@ -576,8 +599,9 @@ class SpirvShaderTranslator : public ShaderTranslator {
|
||||
|
||||
enum SystemConstantIndex : unsigned int {
|
||||
kSystemConstantFlags,
|
||||
kSystemConstantIndexVertexIndexEndian,
|
||||
kSystemConstantIndexVertexBaseIndex,
|
||||
kSystemConstantVertexIndexLoadAddress,
|
||||
kSystemConstantVertexIndexEndian,
|
||||
kSystemConstantVertexBaseIndex,
|
||||
kSystemConstantNdcScale,
|
||||
kSystemConstantNdcOffset,
|
||||
kSystemConstantTextureSwizzledSigns,
|
||||
|
||||
Reference in New Issue
Block a user