Added support for dehydrating / rehydrating FunctionPrototypes
Change-Id: I075301319a6a0caedd8cb501502fa5db7fa7185b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/500442 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
parent
b920095295
commit
0cfc76a0dd
@ -35,6 +35,7 @@
|
||||
#include "src/sksl/ir/SkSLFunctionCall.h"
|
||||
#include "src/sksl/ir/SkSLFunctionDeclaration.h"
|
||||
#include "src/sksl/ir/SkSLFunctionDefinition.h"
|
||||
#include "src/sksl/ir/SkSLFunctionPrototype.h"
|
||||
#include "src/sksl/ir/SkSLIfStatement.h"
|
||||
#include "src/sksl/ir/SkSLIndexExpression.h"
|
||||
#include "src/sksl/ir/SkSLInlineMarker.h"
|
||||
@ -562,9 +563,11 @@ void Dehydrator::write(const ProgramElement& e) {
|
||||
break;
|
||||
}
|
||||
case ProgramElement::Kind::kFunctionPrototype: {
|
||||
// We don't need to emit function prototypes into the dehydrated data, because we don't
|
||||
// ever need to re-emit the intrinsics files as raw GLSL/Metal. As long as the symbols
|
||||
// exist in the symbol table, we're in good shape.
|
||||
const FunctionPrototype& f = e.as<FunctionPrototype>();
|
||||
if (!f.isBuiltin()) {
|
||||
this->writeCommand(Rehydrator::kFunctionPrototype_Command);
|
||||
this->writeU16(this->symbolId(&f.declaration()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ProgramElement::Kind::kInterfaceBlock: {
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "src/sksl/ir/SkSLFunctionCall.h"
|
||||
#include "src/sksl/ir/SkSLFunctionDeclaration.h"
|
||||
#include "src/sksl/ir/SkSLFunctionDefinition.h"
|
||||
#include "src/sksl/ir/SkSLFunctionPrototype.h"
|
||||
#include "src/sksl/ir/SkSLIfStatement.h"
|
||||
#include "src/sksl/ir/SkSLIndexExpression.h"
|
||||
#include "src/sksl/ir/SkSLInlineMarker.h"
|
||||
@ -278,6 +279,13 @@ std::unique_ptr<ProgramElement> Rehydrator::element() {
|
||||
decl->setDefinition(result.get());
|
||||
return std::move(result);
|
||||
}
|
||||
case Rehydrator::kFunctionPrototype_Command: {
|
||||
const FunctionDeclaration* decl = this->symbolRef<FunctionDeclaration>(
|
||||
Symbol::Kind::kFunctionDeclaration);
|
||||
// since we skip over builtin prototypes when dehydrating, we know that this
|
||||
// builtin=false
|
||||
return std::make_unique<FunctionPrototype>(/*line=*/-1, decl, /*builtin=*/false);
|
||||
}
|
||||
case Rehydrator::kInterfaceBlock_Command: {
|
||||
const Symbol* var = this->symbol();
|
||||
SkASSERT(var && var->is<Variable>());
|
||||
|
@ -32,7 +32,7 @@ class Type;
|
||||
*/
|
||||
class Rehydrator {
|
||||
public:
|
||||
static constexpr uint16_t kVersion = 3;
|
||||
static constexpr uint16_t kVersion = 4;
|
||||
|
||||
enum Command {
|
||||
// uint16 id, Type componentType, uint8 count
|
||||
@ -84,6 +84,8 @@ public:
|
||||
// uint16 id, Modifiers modifiers, String name, uint8 parameterCount, uint16[] parameterIds,
|
||||
// Type returnType
|
||||
kFunctionDeclaration_Command,
|
||||
// uint16 declaration
|
||||
kFunctionPrototype_Command,
|
||||
// bool isStatic, Expression test, Statement ifTrue, Statement ifFalse
|
||||
kIf_Command,
|
||||
// Expression base, Expression index
|
||||
|
@ -1,4 +1,4 @@
|
||||
static uint8_t SKSL_INCLUDE_sksl_frag[] = {3,0,96,0,
|
||||
static uint8_t SKSL_INCLUDE_sksl_frag[] = {4,0,96,0,
|
||||
12,115,107,95,70,114,97,103,67,111,111,114,100,
|
||||
6,102,108,111,97,116,52,
|
||||
12,115,107,95,67,108,111,99,107,119,105,115,101,
|
||||
@ -7,52 +7,52 @@ static uint8_t SKSL_INCLUDE_sksl_frag[] = {3,0,96,0,
|
||||
5,104,97,108,102,52,
|
||||
16,115,107,95,76,97,115,116,70,114,97,103,67,111,108,111,114,
|
||||
21,115,107,95,83,101,99,111,110,100,97,114,121,70,114,97,103,67,111,108,111,114,
|
||||
47,1,5,0,
|
||||
51,1,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,255,255,15,0,255,16,2,0,
|
||||
48,2,0,15,0,0,
|
||||
51,3,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,255,255,17,0,255,16,22,0,
|
||||
48,4,0,35,0,0,
|
||||
51,5,0,
|
||||
36,
|
||||
35,144,2,0,0,0,255,255,255,255,0,255,17,39,255,32,40,0,
|
||||
48,6,0,53,0,0,
|
||||
51,7,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,255,255,24,39,255,0,59,0,
|
||||
46,6,0,0,
|
||||
51,8,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,255,255,28,39,255,32,76,0,
|
||||
46,6,0,0,5,0,
|
||||
48,1,5,0,
|
||||
52,1,0,
|
||||
37,
|
||||
36,0,2,0,0,255,255,255,255,255,255,255,15,0,255,16,2,0,
|
||||
49,2,0,15,0,0,
|
||||
52,3,0,
|
||||
37,
|
||||
36,0,2,0,0,255,255,255,255,255,255,255,17,0,255,16,22,0,
|
||||
49,4,0,35,0,0,
|
||||
52,5,0,
|
||||
37,
|
||||
36,144,2,0,0,0,255,255,255,255,0,255,17,39,255,32,40,0,
|
||||
49,6,0,53,0,0,
|
||||
52,7,0,
|
||||
37,
|
||||
36,0,2,0,0,255,255,255,255,255,255,255,24,39,255,0,59,0,
|
||||
47,6,0,0,
|
||||
52,8,0,
|
||||
37,
|
||||
36,0,2,0,0,255,255,255,255,255,255,255,28,39,255,32,76,0,
|
||||
47,6,0,0,5,0,
|
||||
1,0,
|
||||
2,0,
|
||||
0,0,
|
||||
3,0,
|
||||
4,0,
|
||||
20,
|
||||
53,
|
||||
52,1,0,
|
||||
46,2,0,0,
|
||||
55,
|
||||
53,
|
||||
52,3,0,
|
||||
46,4,0,0,
|
||||
55,
|
||||
53,
|
||||
52,5,0,
|
||||
46,6,0,0,
|
||||
55,
|
||||
53,
|
||||
52,7,0,
|
||||
46,6,0,0,
|
||||
55,
|
||||
53,
|
||||
52,8,0,
|
||||
46,6,0,0,
|
||||
55,
|
||||
54,
|
||||
53,1,0,
|
||||
47,2,0,0,
|
||||
56,
|
||||
54,
|
||||
53,3,0,
|
||||
47,4,0,0,
|
||||
56,
|
||||
54,
|
||||
53,5,0,
|
||||
47,6,0,0,
|
||||
56,
|
||||
54,
|
||||
53,7,0,
|
||||
47,6,0,0,
|
||||
56,
|
||||
54,
|
||||
53,8,0,
|
||||
47,6,0,0,
|
||||
56,
|
||||
21,};
|
||||
static constexpr size_t SKSL_INCLUDE_sksl_frag_LENGTH = sizeof(SKSL_INCLUDE_sksl_frag);
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,16 +1,16 @@
|
||||
static uint8_t SKSL_INCLUDE_sksl_rt_shader[] = {3,0,20,0,
|
||||
static uint8_t SKSL_INCLUDE_sksl_rt_shader[] = {4,0,20,0,
|
||||
12,115,107,95,70,114,97,103,67,111,111,114,100,
|
||||
6,102,108,111,97,116,52,
|
||||
47,1,1,0,
|
||||
51,1,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,255,255,15,0,255,0,2,0,
|
||||
48,2,0,15,0,0,1,0,
|
||||
48,1,1,0,
|
||||
52,1,0,
|
||||
37,
|
||||
36,0,2,0,0,255,255,255,255,255,255,255,15,0,255,0,2,0,
|
||||
49,2,0,15,0,0,1,0,
|
||||
0,0,
|
||||
20,
|
||||
53,
|
||||
52,1,0,
|
||||
46,2,0,0,
|
||||
55,
|
||||
54,
|
||||
53,1,0,
|
||||
47,2,0,0,
|
||||
56,
|
||||
21,};
|
||||
static constexpr size_t SKSL_INCLUDE_sksl_rt_shader_LENGTH = sizeof(SKSL_INCLUDE_sksl_rt_shader);
|
||||
|
@ -1,4 +1,4 @@
|
||||
static uint8_t SKSL_INCLUDE_sksl_vert[] = {3,0,82,0,
|
||||
static uint8_t SKSL_INCLUDE_sksl_vert[] = {4,0,82,0,
|
||||
12,115,107,95,80,101,114,86,101,114,116,101,120,
|
||||
11,115,107,95,80,111,115,105,116,105,111,110,
|
||||
6,102,108,111,97,116,52,
|
||||
@ -8,42 +8,42 @@ static uint8_t SKSL_INCLUDE_sksl_vert[] = {3,0,82,0,
|
||||
3,105,110,116,
|
||||
13,115,107,95,73,110,115,116,97,110,99,101,73,68,
|
||||
0,
|
||||
47,1,6,0,
|
||||
43,1,0,2,0,2,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,255,255,0,0,255,0,15,0,
|
||||
48,2,0,27,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,255,255,1,0,255,0,34,0,
|
||||
48,3,0,47,0,1,
|
||||
51,4,0,
|
||||
36,
|
||||
48,1,6,0,
|
||||
44,1,0,2,0,2,
|
||||
37,
|
||||
36,0,2,0,0,255,255,255,255,255,255,255,0,0,255,0,15,0,
|
||||
49,2,0,27,0,
|
||||
37,
|
||||
36,0,2,0,0,255,255,255,255,255,255,255,1,0,255,0,34,0,
|
||||
49,3,0,47,0,1,
|
||||
52,4,0,
|
||||
37,
|
||||
16,32,2,0,
|
||||
46,1,0,0,
|
||||
47,1,0,0,
|
||||
23,4,0,0,
|
||||
23,4,0,1,
|
||||
51,5,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,255,255,42,0,255,16,53,0,
|
||||
48,6,0,65,0,0,
|
||||
51,7,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,255,255,43,0,255,16,69,0,
|
||||
46,6,0,0,4,0,
|
||||
52,5,0,
|
||||
37,
|
||||
36,0,2,0,0,255,255,255,255,255,255,255,42,0,255,16,53,0,
|
||||
49,6,0,65,0,0,
|
||||
52,7,0,
|
||||
37,
|
||||
36,0,2,0,0,255,255,255,255,255,255,255,43,0,255,16,69,0,
|
||||
47,6,0,0,4,0,
|
||||
5,0,
|
||||
3,0,
|
||||
2,0,
|
||||
4,0,
|
||||
20,
|
||||
33,
|
||||
46,4,0,2,0,83,0,0,
|
||||
53,
|
||||
52,5,0,
|
||||
46,6,0,0,
|
||||
55,
|
||||
53,
|
||||
52,7,0,
|
||||
46,6,0,0,
|
||||
55,
|
||||
34,
|
||||
47,4,0,2,0,83,0,0,
|
||||
54,
|
||||
53,5,0,
|
||||
47,6,0,0,
|
||||
56,
|
||||
54,
|
||||
53,7,0,
|
||||
47,6,0,0,
|
||||
56,
|
||||
21,};
|
||||
static constexpr size_t SKSL_INCLUDE_sksl_vert_LENGTH = sizeof(SKSL_INCLUDE_sksl_vert);
|
||||
|
Loading…
Reference in New Issue
Block a user