mirror of
https://github.com/godotengine/godot-angle-static.git
synced 2026-01-03 14:09:33 +03:00
Vulkan: Output SPIR-V ids from compiler
In this change, the shader interface variables are given SPIR-V ids by the compiler before SPIR-V generation. Those ids are made available through the ShaderVariable interface. The transformer does not yet rely on this information. A follow up change will rework the backend's name->info map and the transformer to directly use ids instead of names. Bug: angleproject:7220 Change-Id: Ic0a62681d4bcf3ed171c39c3ecd83e438ea068c8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4600609 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
This commit is contained in:
committed by
Angle LUCI CQ
parent
acdf872299
commit
10380f4ba4
@@ -26,7 +26,7 @@
|
||||
|
||||
// Version number for shader translation API.
|
||||
// It is incremented every time the API changes.
|
||||
#define ANGLE_SH_VERSION 334
|
||||
#define ANGLE_SH_VERSION 335
|
||||
|
||||
enum ShShaderSpec
|
||||
{
|
||||
@@ -1027,10 +1027,15 @@ enum ReservedIds
|
||||
|
||||
// Pre-rotation and Z-correction support
|
||||
kIdTransformPositionFunction,
|
||||
kIdOutputPerVertexVar,
|
||||
|
||||
// Transform feedback support
|
||||
kIdXfbEmulationGetOffsetsFunction,
|
||||
kIdXfbEmulationCaptureFunction,
|
||||
kIdXfbEmulationBufferVarZero,
|
||||
kIdXfbEmulationBufferVarOne,
|
||||
kIdXfbEmulationBufferVarTwo,
|
||||
kIdXfbEmulationBufferVarThree,
|
||||
|
||||
// Multisampling support
|
||||
kIdSampleID,
|
||||
@@ -1039,12 +1044,14 @@ enum ReservedIds
|
||||
// ANGLE internal shader variables, which are not produced as ShaderVariables.
|
||||
// kIdShaderVariablesBegin marks the beginning of these ids. variableId -> info maps in the
|
||||
// backend can use |variableId - kIdShaderVariablesBegin| as key into a flat array.
|
||||
//
|
||||
// Note that for blocks, only the block id is in this section as that is the id used in the
|
||||
// variableId -> info maps.
|
||||
kIdShaderVariablesBegin,
|
||||
|
||||
// gl_PerVertex
|
||||
kIdInputPerVertexBlock = kIdShaderVariablesBegin,
|
||||
kIdOutputPerVertexBlock,
|
||||
kIdOutputPerVertexVar,
|
||||
// The driver and default uniform blocks
|
||||
kIdDriverUniformsBlock,
|
||||
kIdDefaultUniformsBlock,
|
||||
@@ -1055,10 +1062,6 @@ enum ReservedIds
|
||||
kIdXfbEmulationBufferBlockOne,
|
||||
kIdXfbEmulationBufferBlockTwo,
|
||||
kIdXfbEmulationBufferBlockThree,
|
||||
kIdXfbEmulationBufferVarZero,
|
||||
kIdXfbEmulationBufferVarOne,
|
||||
kIdXfbEmulationBufferVarTwo,
|
||||
kIdXfbEmulationBufferVarThree,
|
||||
// Additional varying added to hold untransformed gl_Position for transform feedback capture
|
||||
kIdXfbExtensionPosition,
|
||||
|
||||
|
||||
@@ -240,6 +240,11 @@ struct ShaderVariable
|
||||
// If the variable is a sampler that has ever been statically used with texelFetch
|
||||
bool texelFetchStaticUse;
|
||||
|
||||
// Id of the variable in the shader. Currently used by the SPIR-V output to communicate the
|
||||
// SPIR-V id of the variable. This value is only set for variables that the SPIR-V transformer
|
||||
// needs to know about, i.e. active variables, excluding non-zero array elements etc.
|
||||
uint32_t id;
|
||||
|
||||
protected:
|
||||
bool isSameVariableAtLinkTime(const ShaderVariable &other,
|
||||
bool matchPrecision,
|
||||
@@ -296,6 +301,9 @@ struct InterfaceBlock
|
||||
bool isReadOnly;
|
||||
BlockType blockType;
|
||||
std::vector<ShaderVariable> fields;
|
||||
|
||||
// Id of the interface block in the shader. Similar to |ShaderVariable::id|.
|
||||
uint32_t id;
|
||||
};
|
||||
|
||||
struct WorkGroupSize
|
||||
|
||||
Reference in New Issue
Block a user