Add newline to end of Metal's Globals struct definition.
Also fixes some additional style mishaps in class method names. Change-Id: I49e7ac1aa91d84fef5fbc636552f040a2cb58c78 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341466 Commit-Queue: Brian Osman <brianosman@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
03f9e2a3b7
commit
83f3b8d4ad
@ -1715,7 +1715,7 @@ void MetalCodeGenerator::writeGlobalStruct() {
|
||||
class : public GlobalStructVisitor {
|
||||
public:
|
||||
void visitInterfaceBlock(const InterfaceBlock& block, const String& blockName) override {
|
||||
this->AddElement();
|
||||
this->addElement();
|
||||
fCodeGen->write(" constant ");
|
||||
fCodeGen->write(block.typeName());
|
||||
fCodeGen->write("* ");
|
||||
@ -1723,7 +1723,7 @@ void MetalCodeGenerator::writeGlobalStruct() {
|
||||
fCodeGen->write(";\n");
|
||||
}
|
||||
void visitTexture(const Type& type, const String& name) override {
|
||||
this->AddElement();
|
||||
this->addElement();
|
||||
fCodeGen->write(" ");
|
||||
fCodeGen->writeBaseType(type);
|
||||
fCodeGen->write(" ");
|
||||
@ -1732,13 +1732,13 @@ void MetalCodeGenerator::writeGlobalStruct() {
|
||||
fCodeGen->write(";\n");
|
||||
}
|
||||
void visitSampler(const Type&, const String& name) override {
|
||||
this->AddElement();
|
||||
this->addElement();
|
||||
fCodeGen->write(" sampler ");
|
||||
fCodeGen->writeName(name);
|
||||
fCodeGen->write(";\n");
|
||||
}
|
||||
void visitVariable(const Variable& var, const Expression* value) override {
|
||||
this->AddElement();
|
||||
this->addElement();
|
||||
fCodeGen->write(" ");
|
||||
fCodeGen->writeBaseType(var.type());
|
||||
fCodeGen->write(" ");
|
||||
@ -1746,15 +1746,15 @@ void MetalCodeGenerator::writeGlobalStruct() {
|
||||
fCodeGen->writeArrayDimensions(var.type());
|
||||
fCodeGen->write(";\n");
|
||||
}
|
||||
void AddElement() {
|
||||
void addElement() {
|
||||
if (fFirst) {
|
||||
fCodeGen->write("struct Globals {\n");
|
||||
fFirst = false;
|
||||
}
|
||||
}
|
||||
void Finish() {
|
||||
void finish() {
|
||||
if (!fFirst) {
|
||||
fCodeGen->write("};");
|
||||
fCodeGen->writeLine("};");
|
||||
fFirst = true;
|
||||
}
|
||||
}
|
||||
@ -1765,7 +1765,7 @@ void MetalCodeGenerator::writeGlobalStruct() {
|
||||
|
||||
visitor.fCodeGen = this;
|
||||
this->visitGlobalStruct(&visitor);
|
||||
visitor.Finish();
|
||||
visitor.finish();
|
||||
}
|
||||
|
||||
void MetalCodeGenerator::writeGlobalInit() {
|
||||
@ -1773,27 +1773,27 @@ void MetalCodeGenerator::writeGlobalInit() {
|
||||
public:
|
||||
void visitInterfaceBlock(const InterfaceBlock& blockType,
|
||||
const String& blockName) override {
|
||||
this->AddElement();
|
||||
this->addElement();
|
||||
fCodeGen->write("&");
|
||||
fCodeGen->writeName(blockName);
|
||||
}
|
||||
void visitTexture(const Type&, const String& name) override {
|
||||
this->AddElement();
|
||||
this->addElement();
|
||||
fCodeGen->writeName(name);
|
||||
}
|
||||
void visitSampler(const Type&, const String& name) override {
|
||||
this->AddElement();
|
||||
this->addElement();
|
||||
fCodeGen->writeName(name);
|
||||
}
|
||||
void visitVariable(const Variable& var, const Expression* value) override {
|
||||
this->AddElement();
|
||||
this->addElement();
|
||||
if (value) {
|
||||
fCodeGen->writeVarInitializer(var, *value);
|
||||
} else {
|
||||
fCodeGen->write("{}");
|
||||
}
|
||||
}
|
||||
void AddElement() {
|
||||
void addElement() {
|
||||
if (fFirst) {
|
||||
fCodeGen->write(" Globals globalStruct{");
|
||||
fFirst = false;
|
||||
@ -1801,7 +1801,7 @@ void MetalCodeGenerator::writeGlobalInit() {
|
||||
fCodeGen->write(", ");
|
||||
}
|
||||
}
|
||||
void Finish() {
|
||||
void finish() {
|
||||
if (!fFirst) {
|
||||
fCodeGen->writeLine("};");
|
||||
fCodeGen->writeLine(" thread Globals* _globals = &globalStruct;");
|
||||
@ -1814,7 +1814,7 @@ void MetalCodeGenerator::writeGlobalInit() {
|
||||
|
||||
visitor.fCodeGen = this;
|
||||
this->visitGlobalStruct(&visitor);
|
||||
visitor.Finish();
|
||||
visitor.finish();
|
||||
}
|
||||
|
||||
void MetalCodeGenerator::writeProgramElement(const ProgramElement& e) {
|
||||
|
@ -15,6 +15,7 @@ struct Globals {
|
||||
|
||||
|
||||
|
||||
|
||||
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
Globals globalStruct{{}, 123, {}, float4(4.0, 5.0, 6.0, 7.0)};
|
||||
thread Globals* _globals = &globalStruct;
|
||||
|
@ -13,6 +13,7 @@ struct Globals {
|
||||
sampler texBSmplr;
|
||||
};
|
||||
|
||||
|
||||
fragment Outputs fragmentMain(Inputs _in [[stage_in]], texture2d<float> texA[[texture(1)]], sampler texASmplr[[sampler(1)]], texture2d<float> texB[[texture(0)]], sampler texBSmplr[[sampler(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
Globals globalStruct{texA, texASmplr, texB, texBSmplr};
|
||||
thread Globals* _globals = &globalStruct;
|
||||
|
@ -14,6 +14,7 @@ struct Globals {
|
||||
sampler sSmplr;
|
||||
};
|
||||
|
||||
|
||||
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], texture2d<float> s[[texture(0)]], sampler sSmplr[[sampler(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
Globals globalStruct{s, sSmplr};
|
||||
thread Globals* _globals = &globalStruct;
|
||||
|
@ -23,6 +23,7 @@ struct Globals {
|
||||
sampler uTextureSampler_0_Stage1Smplr;
|
||||
};
|
||||
|
||||
|
||||
float4 MatrixEffect_Stage1_c0_c0(thread Globals* _globals, float4 _input, float2 _coords) {
|
||||
float4 _0_TextureEffect_Stage1_c0_c0_c0;
|
||||
float2 _1_coords = (_globals->_anonInterface0->umatrix_Stage1_c0_c0 * float3(_coords, 1.0)).xy;
|
||||
|
@ -14,7 +14,8 @@ struct testBlock {
|
||||
};
|
||||
struct Globals {
|
||||
constant testBlock* _anonInterface0;
|
||||
};fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant testBlock& _anonInterface0 [[buffer(789)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
};
|
||||
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant testBlock& _anonInterface0 [[buffer(789)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
Globals globalStruct{&_anonInterface0};
|
||||
thread Globals* _globals = &globalStruct;
|
||||
(void)_globals;
|
||||
|
@ -11,7 +11,8 @@ struct testBlock {
|
||||
} test[2];
|
||||
struct Globals {
|
||||
constant testBlock* test;
|
||||
};fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant testBlock& test [[buffer(123)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
};
|
||||
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant testBlock& test [[buffer(123)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
Globals globalStruct{&test};
|
||||
thread Globals* _globals = &globalStruct;
|
||||
(void)_globals;
|
||||
|
@ -11,7 +11,8 @@ struct testBlock {
|
||||
} test;
|
||||
struct Globals {
|
||||
constant testBlock* test;
|
||||
};fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant testBlock& test [[buffer(456)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
};
|
||||
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant testBlock& test [[buffer(456)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
Globals globalStruct{&test};
|
||||
thread Globals* _globals = &globalStruct;
|
||||
(void)_globals;
|
||||
|
@ -77,6 +77,7 @@ struct Globals {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
|
@ -13,6 +13,7 @@ struct Globals {
|
||||
sampler test2DRectSmplr;
|
||||
};
|
||||
|
||||
|
||||
fragment Outputs fragmentMain(Inputs _in [[stage_in]], texture2d<float> test2D[[texture(0)]], sampler test2DSmplr[[sampler(0)]], texture2d<float> test2DRect[[texture(1)]], sampler test2DRectSmplr[[sampler(1)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
Globals globalStruct{test2D, test2DSmplr, test2DRect, test2DRectSmplr};
|
||||
thread Globals* _globals = &globalStruct;
|
||||
|
@ -20,6 +20,7 @@ struct Globals {
|
||||
B b1;
|
||||
};
|
||||
|
||||
|
||||
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
Globals globalStruct{{}, {}};
|
||||
thread Globals* _globals = &globalStruct;
|
||||
|
@ -10,6 +10,7 @@ struct Globals {
|
||||
texture2d<float> tex;
|
||||
sampler texSmplr;
|
||||
};
|
||||
|
||||
fragment Outputs fragmentMain(Inputs _in [[stage_in]], texture2d<float> tex[[texture(0)]], sampler texSmplr[[sampler(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
Globals globalStruct{tex, texSmplr};
|
||||
thread Globals* _globals = &globalStruct;
|
||||
|
@ -21,6 +21,7 @@ struct Globals {
|
||||
|
||||
|
||||
|
||||
|
||||
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
Globals globalStruct{float2(1.0), float2(1.0, 2.0), float2(1.0), float3(float2(1.0), 1.0), int2(1), int2(float2(1.0, 2.0)), float2(int2(1, 2))};
|
||||
thread Globals* _globals = &globalStruct;
|
||||
|
Loading…
Reference in New Issue
Block a user