Remove (unused) geometry shader support
Bug: skia:8451 skia:10827 Change-Id: I5b38a1d72cd4558f8e2a92aaf9b12f05efce0923 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442683 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Chris Dalton <csmartdalton@google.com> Reviewed-by: John Stiles <johnstiles@google.com>
This commit is contained in:
parent
8d13084535
commit
99ddd2a98d
5
BUILD.gn
5
BUILD.gn
@ -667,7 +667,6 @@ if (skia_compile_sksl_tests) {
|
||||
copy("sksl_pre_includes") {
|
||||
sources = [
|
||||
"src/sksl/sksl_frag.sksl",
|
||||
"src/sksl/sksl_geom.sksl",
|
||||
"src/sksl/sksl_gpu.sksl",
|
||||
"src/sksl/sksl_public.sksl",
|
||||
"src/sksl/sksl_rt_blend.sksl",
|
||||
@ -755,11 +754,9 @@ if (skia_compile_sksl_tests) {
|
||||
sources += [ src ]
|
||||
|
||||
foreach(outExtension, invoker.outExtensions) {
|
||||
# SPIR-V uses separate extensions for .vert and .geom shaders.
|
||||
# SPIR-V uses separate extensions for .vert shaders.
|
||||
if (ext == "vert" && outExtension == ".asm.frag") {
|
||||
outExtension = ".asm.vert"
|
||||
} else if (ext == "geom" && outExtension == ".asm.frag") {
|
||||
outExtension = ".asm.geom"
|
||||
}
|
||||
outputs +=
|
||||
[ target_out_dir + "/" +
|
||||
|
@ -46,7 +46,7 @@ def makeEmptyFile(path):
|
||||
pass
|
||||
|
||||
def extensionForSpirvAsm(ext):
|
||||
return ext if (ext == '.frag' or ext == '.vert' or ext == '.geom') else '.frag'
|
||||
return ext if (ext == '.frag' or ext == '.vert') else '.frag'
|
||||
|
||||
if settings != "--settings" and settings != "--nosettings":
|
||||
sys.exit("### Expected --settings or --nosettings, got " + settings)
|
||||
|
@ -70,7 +70,6 @@ sksl_error_tests = [
|
||||
"/sksl/errors/InvalidToken.sksl",
|
||||
"/sksl/errors/InvalidUnary.sksl",
|
||||
"/sksl/errors/LayoutInFunctions.sksl",
|
||||
"/sksl/errors/LayoutMultiplePrimitiveTypes.sksl",
|
||||
"/sksl/errors/LayoutRepeatedQualifiers.sksl",
|
||||
"/sksl/errors/MatrixToVectorCast3x3.sksl",
|
||||
"/sksl/errors/MatrixToVectorCastBoolean.sksl",
|
||||
@ -321,11 +320,6 @@ sksl_shared_tests = [
|
||||
"/sksl/shared/Functions.sksl",
|
||||
"/sksl/shared/GaussianBlur.sksl",
|
||||
"/sksl/shared/GeometricIntrinsics.sksl",
|
||||
"/sksl/shared/Geometry.geom",
|
||||
"/sksl/shared/GeometryExtension.geom",
|
||||
"/sksl/shared/GeometryGSInvocations.geom",
|
||||
"/sksl/shared/GeometryNoGSInvocations.geom",
|
||||
"/sksl/shared/GeometryNoGSInvocationsReorder.geom",
|
||||
"/sksl/shared/HelloWorld.sksl",
|
||||
"/sksl/shared/Hex.sksl",
|
||||
"/sksl/shared/HexUnsigned.sksl",
|
||||
@ -341,7 +335,6 @@ sksl_shared_tests = [
|
||||
"/sksl/shared/NegatedVectorLiteral.sksl",
|
||||
"/sksl/shared/NoFragCoordsPos.vert",
|
||||
"/sksl/shared/NoFragCoordsPosRT.vert",
|
||||
"/sksl/shared/NormalizationGeo.geom",
|
||||
"/sksl/shared/NormalizationVert.vert",
|
||||
"/sksl/shared/NumberCasts.sksl",
|
||||
"/sksl/shared/NumberConversions.sksl",
|
||||
|
@ -302,11 +302,6 @@ struct SK_API GrContextOptions {
|
||||
*/
|
||||
bool fSuppressFramebufferFetch = false;
|
||||
|
||||
/**
|
||||
* If true, the caps will never support geometry shaders.
|
||||
*/
|
||||
bool fSuppressGeometryShaders = false;
|
||||
|
||||
/**
|
||||
* If greater than zero and less than the actual hardware limit, overrides the maximum number of
|
||||
* tessellation segments supported by the caps.
|
||||
|
@ -121,7 +121,6 @@ struct GrMockOptions {
|
||||
ConfigOptions fCompressedOptions[SkImage::kCompressionTypeCount];
|
||||
|
||||
// GrShaderCaps options.
|
||||
bool fGeometryShaderSupport = false;
|
||||
bool fIntegerSupport = false;
|
||||
bool fFlatInterpolationSupport = false;
|
||||
int fMaxVertexSamplers = 0;
|
||||
|
@ -354,7 +354,6 @@ enum class GrTextureType {
|
||||
|
||||
enum GrShaderType {
|
||||
kVertex_GrShaderType,
|
||||
kGeometry_GrShaderType,
|
||||
kFragment_GrShaderType,
|
||||
|
||||
kLastkFragment_GrShaderType = kFragment_GrShaderType
|
||||
@ -366,8 +365,7 @@ enum GrShaderFlags {
|
||||
kVertex_GrShaderFlag = 1 << 0,
|
||||
kTessControl_GrShaderFlag = 1 << 1,
|
||||
kTessEvaluation_GrShaderFlag = 1 << 2,
|
||||
kGeometry_GrShaderFlag = 1 << 3,
|
||||
kFragment_GrShaderFlag = 1 << 4
|
||||
kFragment_GrShaderFlag = 1 << 3
|
||||
};
|
||||
GR_MAKE_BITFIELD_OPS(GrShaderFlags)
|
||||
|
||||
|
@ -32,24 +32,10 @@ struct Layout {
|
||||
kSet_Flag = 1 << 8,
|
||||
kBuiltin_Flag = 1 << 9,
|
||||
kInputAttachmentIndex_Flag = 1 << 10,
|
||||
kPrimitive_Flag = 1 << 11,
|
||||
kMaxVertices_Flag = 1 << 12,
|
||||
kInvocations_Flag = 1 << 13,
|
||||
};
|
||||
|
||||
enum Primitive {
|
||||
kUnspecified_Primitive = -1,
|
||||
kPoints_Primitive,
|
||||
kLines_Primitive,
|
||||
kLineStrip_Primitive,
|
||||
kLinesAdjacency_Primitive,
|
||||
kTriangles_Primitive,
|
||||
kTriangleStrip_Primitive,
|
||||
kTrianglesAdjacency_Primitive
|
||||
};
|
||||
|
||||
Layout(int flags, int location, int offset, int binding, int index, int set, int builtin,
|
||||
int inputAttachmentIndex, Primitive primitive, int maxVertices, int invocations)
|
||||
int inputAttachmentIndex)
|
||||
: fFlags(flags)
|
||||
, fLocation(location)
|
||||
, fOffset(offset)
|
||||
@ -57,10 +43,7 @@ struct Layout {
|
||||
, fIndex(index)
|
||||
, fSet(set)
|
||||
, fBuiltin(builtin)
|
||||
, fInputAttachmentIndex(inputAttachmentIndex)
|
||||
, fPrimitive(primitive)
|
||||
, fMaxVertices(maxVertices)
|
||||
, fInvocations(invocations) {}
|
||||
, fInputAttachmentIndex(inputAttachmentIndex) {}
|
||||
|
||||
Layout()
|
||||
: fFlags(0)
|
||||
@ -70,10 +53,7 @@ struct Layout {
|
||||
, fIndex(-1)
|
||||
, fSet(-1)
|
||||
, fBuiltin(-1)
|
||||
, fInputAttachmentIndex(-1)
|
||||
, fPrimitive(kUnspecified_Primitive)
|
||||
, fMaxVertices(-1)
|
||||
, fInvocations(-1) {}
|
||||
, fInputAttachmentIndex(-1) {}
|
||||
|
||||
static Layout builtin(int builtin) {
|
||||
Layout result;
|
||||
@ -123,37 +103,6 @@ struct Layout {
|
||||
if (fFlags & kSRGBUnpremul_Flag) {
|
||||
result += separator() + "srgb_unpremul";
|
||||
}
|
||||
switch (fPrimitive) {
|
||||
case kPoints_Primitive:
|
||||
result += separator() + "points";
|
||||
break;
|
||||
case kLines_Primitive:
|
||||
result += separator() + "lines";
|
||||
break;
|
||||
case kLineStrip_Primitive:
|
||||
result += separator() + "line_strip";
|
||||
break;
|
||||
case kLinesAdjacency_Primitive:
|
||||
result += separator() + "lines_adjacency";
|
||||
break;
|
||||
case kTriangles_Primitive:
|
||||
result += separator() + "triangles";
|
||||
break;
|
||||
case kTriangleStrip_Primitive:
|
||||
result += separator() + "triangle_strip";
|
||||
break;
|
||||
case kTrianglesAdjacency_Primitive:
|
||||
result += separator() + "triangles_adjacency";
|
||||
break;
|
||||
case kUnspecified_Primitive:
|
||||
break;
|
||||
}
|
||||
if (fMaxVertices >= 0) {
|
||||
result += separator() + "max_vertices = " + to_string(fMaxVertices);
|
||||
}
|
||||
if (fInvocations >= 0) {
|
||||
result += separator() + "invocations = " + to_string(fInvocations);
|
||||
}
|
||||
if (result.size() > 0) {
|
||||
result = "layout (" + result + ")";
|
||||
}
|
||||
@ -168,10 +117,7 @@ struct Layout {
|
||||
fIndex == other.fIndex &&
|
||||
fSet == other.fSet &&
|
||||
fBuiltin == other.fBuiltin &&
|
||||
fInputAttachmentIndex == other.fInputAttachmentIndex &&
|
||||
fPrimitive == other.fPrimitive &&
|
||||
fMaxVertices == other.fMaxVertices &&
|
||||
fInvocations == other.fInvocations;
|
||||
fInputAttachmentIndex == other.fInputAttachmentIndex;
|
||||
}
|
||||
|
||||
bool operator!=(const Layout& other) const {
|
||||
@ -190,9 +136,6 @@ struct Layout {
|
||||
// input_attachment_index comes from Vulkan/SPIR-V to connect a shader variable to the a
|
||||
// corresponding attachment on the subpass in which the shader is being used.
|
||||
int fInputAttachmentIndex;
|
||||
Primitive fPrimitive;
|
||||
int fMaxVertices;
|
||||
int fInvocations;
|
||||
};
|
||||
|
||||
} // namespace SkSL
|
||||
|
@ -18,7 +18,6 @@ namespace SkSL {
|
||||
enum class ProgramKind : int8_t {
|
||||
kFragment,
|
||||
kVertex,
|
||||
kGeometry,
|
||||
kRuntimeColorFilter, // Runtime effect only suitable as SkColorFilter
|
||||
kRuntimeShader, // " " " " " SkShader
|
||||
kRuntimeBlender, // " " " " " SkBlender
|
||||
|
@ -9,9 +9,7 @@ layout (
|
||||
index = 1,
|
||||
set = 1,
|
||||
builtin = 1,
|
||||
input_attachment_index = 1,
|
||||
max_vertices = 1,
|
||||
invocations = 1)
|
||||
input_attachment_index = 1)
|
||||
void on_return() {}
|
||||
|
||||
void on_param(
|
||||
@ -26,6 +24,4 @@ layout (
|
||||
index = 1,
|
||||
set = 1,
|
||||
builtin = 1,
|
||||
input_attachment_index = 1,
|
||||
max_vertices = 1,
|
||||
invocations = 1) float x) {}
|
||||
input_attachment_index = 1) float x) {}
|
||||
|
@ -1,8 +0,0 @@
|
||||
layout (
|
||||
points,
|
||||
lines,
|
||||
line_strip,
|
||||
lines_adjacency,
|
||||
triangles,
|
||||
triangle_strip
|
||||
) in;
|
@ -10,8 +10,6 @@ layout (
|
||||
set = 1,
|
||||
builtin = 1,
|
||||
input_attachment_index = 1,
|
||||
max_vertices = 1,
|
||||
invocations = 1,
|
||||
|
||||
origin_upper_left,
|
||||
push_constant,
|
||||
@ -23,7 +21,5 @@ layout (
|
||||
index = 2,
|
||||
set = 2,
|
||||
builtin = 2,
|
||||
input_attachment_index = 2,
|
||||
max_vertices = 2,
|
||||
invocations = 2
|
||||
input_attachment_index = 2
|
||||
) float x;
|
||||
|
@ -1,13 +0,0 @@
|
||||
/*#pragma settings GeometryShaderSupport*/
|
||||
|
||||
layout(points) in;
|
||||
layout(invocations = 2) in;
|
||||
layout(line_strip, max_vertices = 2) out;
|
||||
|
||||
void main() {
|
||||
sk_Position = sk_in[0].sk_Position + float4(-0.5, 0, 0, sk_InvocationID);
|
||||
EmitVertex();
|
||||
sk_Position = sk_in[0].sk_Position + float4(0.5, 0, 0, sk_InvocationID);
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
/*#pragma settings GeometryShaderExtensionString*/
|
||||
|
||||
layout(points, invocations = 2) in;
|
||||
layout(invocations = 3) in;
|
||||
layout(line_strip, max_vertices = 2) out;
|
||||
|
||||
void main() {
|
||||
sk_Position = sk_in[0].sk_Position + float4(-0.5, 0, 0, sk_InvocationID);
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
/*#pragma settings GSInvocationsExtensionString*/
|
||||
|
||||
layout(points, invocations = 2) in;
|
||||
layout(invocations = 3) in;
|
||||
layout(line_strip, max_vertices = 2) out;
|
||||
|
||||
void main() {
|
||||
sk_Position = sk_in[0].sk_Position + float4(-0.5, 0, 0, sk_InvocationID);
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
/*#pragma settings NoGSInvocationsSupport*/
|
||||
|
||||
layout(points) in;
|
||||
layout(invocations = 2) in;
|
||||
layout(line_strip, max_vertices = 2) out;
|
||||
|
||||
void test() {
|
||||
sk_Position = sk_in[0].sk_Position + float4(0.5, 0, 0, sk_InvocationID);
|
||||
EmitVertex();
|
||||
}
|
||||
|
||||
void main() {
|
||||
test();
|
||||
sk_Position = sk_in[0].sk_Position + float4(-0.5, 0, 0, sk_InvocationID);
|
||||
EmitVertex();
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*#pragma settings NoGSInvocationsSupport*/
|
||||
|
||||
layout(points) in;
|
||||
|
||||
// Subtle error: Declaring max_vertices before invocations causes us not to
|
||||
// apply the workaround fixup to max_vertices. It *should* be 4 (2*2) in the
|
||||
// GLSL, but is currently only 2. (skbug.com/10827)
|
||||
layout(line_strip, max_vertices = 2) out;
|
||||
layout(invocations = 2) in;
|
||||
|
||||
void test() {
|
||||
sk_Position = sk_in[0].sk_Position + float4(0.5, 0, 0, sk_InvocationID);
|
||||
EmitVertex();
|
||||
}
|
||||
|
||||
void main() {
|
||||
test();
|
||||
sk_Position = sk_in[0].sk_Position + float4(-0.5, 0, 0, sk_InvocationID);
|
||||
EmitVertex();
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
/*#pragma settings GeometryShaderSupport*/
|
||||
|
||||
uniform float4 sk_RTAdjust;
|
||||
layout(points) in;
|
||||
layout(invocations = 2) in;
|
||||
layout(line_strip, max_vertices = 2) out;
|
||||
|
||||
void main() {
|
||||
sk_Position = sk_in[0].sk_Position + float4(-0.5, 0, 0, sk_InvocationID);
|
||||
EmitVertex();
|
||||
sk_Position = sk_in[0].sk_Position + float4(0.5, 0, 0, sk_InvocationID);
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
@ -69,7 +69,7 @@ ProgramImpl::FPCoordsMap ProgramImpl::emitCode(EmitArgs& args, const GrPipeline&
|
||||
|
||||
GrShaderVar positionVar = gpArgs.fPositionVar;
|
||||
// skia:12198
|
||||
if (args.fGeomProc.willUseGeoShader() || args.fGeomProc.willUseTessellationShaders()) {
|
||||
if (args.fGeomProc.willUseTessellationShaders()) {
|
||||
positionVar = {};
|
||||
}
|
||||
FPCoordsMap transformMap = this->collectTransforms(args.fVertBuilder,
|
||||
@ -86,38 +86,13 @@ ProgramImpl::FPCoordsMap ProgramImpl::emitCode(EmitArgs& args, const GrPipeline&
|
||||
}
|
||||
|
||||
GrGLSLVertexBuilder* vBuilder = args.fVertBuilder;
|
||||
if (!args.fGeomProc.willUseGeoShader()) {
|
||||
// Emit the vertex position to the hardware in the normalized window coordinates it expects.
|
||||
SkASSERT(kFloat2_GrSLType == gpArgs.fPositionVar.getType() ||
|
||||
kFloat3_GrSLType == gpArgs.fPositionVar.getType());
|
||||
vBuilder->emitNormalizedSkPosition(gpArgs.fPositionVar.c_str(),
|
||||
gpArgs.fPositionVar.getType());
|
||||
if (kFloat2_GrSLType == gpArgs.fPositionVar.getType()) {
|
||||
args.fVaryingHandler->setNoPerspective();
|
||||
}
|
||||
} else {
|
||||
// Since we have a geometry shader, leave the vertex position in Skia device space for now.
|
||||
// The geometry Shader will operate in device space, and then convert the final positions to
|
||||
// normalized hardware window coordinates under the hood, once everything else has finished.
|
||||
// The subclass must call setNoPerspective on the varying handler, if applicable.
|
||||
vBuilder->codeAppendf("sk_Position = float4(%s", gpArgs.fPositionVar.c_str());
|
||||
switch (gpArgs.fPositionVar.getType()) {
|
||||
case kFloat_GrSLType:
|
||||
vBuilder->codeAppend(", 0");
|
||||
[[fallthrough]];
|
||||
case kFloat2_GrSLType:
|
||||
vBuilder->codeAppend(", 0");
|
||||
[[fallthrough]];
|
||||
case kFloat3_GrSLType:
|
||||
vBuilder->codeAppend(", 1");
|
||||
[[fallthrough]];
|
||||
case kFloat4_GrSLType:
|
||||
vBuilder->codeAppend(");");
|
||||
break;
|
||||
default:
|
||||
SK_ABORT("Invalid position var type");
|
||||
break;
|
||||
}
|
||||
// Emit the vertex position to the hardware in the normalized window coordinates it expects.
|
||||
SkASSERT(kFloat2_GrSLType == gpArgs.fPositionVar.getType() ||
|
||||
kFloat3_GrSLType == gpArgs.fPositionVar.getType());
|
||||
vBuilder->emitNormalizedSkPosition(gpArgs.fPositionVar.c_str(),
|
||||
gpArgs.fPositionVar.getType());
|
||||
if (kFloat2_GrSLType == gpArgs.fPositionVar.getType()) {
|
||||
args.fVaryingHandler->setNoPerspective();
|
||||
}
|
||||
return transformMap;
|
||||
}
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <unordered_map>
|
||||
|
||||
class GrGLSLFPFragmentBuilder;
|
||||
class GrGLSLGeometryBuilder;
|
||||
class GrGLSLVaryingHandler;
|
||||
class GrGLSLUniformHandler;
|
||||
class GrGLSLVertexBuilder;
|
||||
@ -186,10 +185,6 @@ public:
|
||||
return fShaders & (kTessControl_GrShaderFlag | kTessEvaluation_GrShaderFlag);
|
||||
}
|
||||
|
||||
bool willUseGeoShader() const {
|
||||
return fShaders & kGeometry_GrShaderFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes a key for the transforms owned by an FP based on the shader code that will be
|
||||
* emitted by the primitive processor to implement them.
|
||||
@ -249,7 +244,6 @@ protected:
|
||||
void setWillUseTessellationShaders() {
|
||||
fShaders |= kTessControl_GrShaderFlag | kTessEvaluation_GrShaderFlag;
|
||||
}
|
||||
void setWillUseGeoShader() { fShaders |= kGeometry_GrShaderFlag; }
|
||||
void setTextureSamplerCnt(int cnt) {
|
||||
SkASSERT(cnt >= 0);
|
||||
fTextureSamplerCnt = cnt;
|
||||
@ -296,7 +290,6 @@ public:
|
||||
|
||||
struct EmitArgs {
|
||||
EmitArgs(GrGLSLVertexBuilder* vertBuilder,
|
||||
GrGLSLGeometryBuilder* geomBuilder,
|
||||
GrGLSLFPFragmentBuilder* fragBuilder,
|
||||
GrGLSLVaryingHandler* varyingHandler,
|
||||
GrGLSLUniformHandler* uniformHandler,
|
||||
@ -306,7 +299,6 @@ public:
|
||||
const char* outputCoverage,
|
||||
const SamplerHandle* texSamplers)
|
||||
: fVertBuilder(vertBuilder)
|
||||
, fGeomBuilder(geomBuilder)
|
||||
, fFragBuilder(fragBuilder)
|
||||
, fVaryingHandler(varyingHandler)
|
||||
, fUniformHandler(uniformHandler)
|
||||
@ -316,7 +308,6 @@ public:
|
||||
, fOutputCoverage(outputCoverage)
|
||||
, fTexSamplers(texSamplers) {}
|
||||
GrGLSLVertexBuilder* fVertBuilder;
|
||||
GrGLSLGeometryBuilder* fGeomBuilder;
|
||||
GrGLSLFPFragmentBuilder* fFragBuilder;
|
||||
GrGLSLVaryingHandler* fVaryingHandler;
|
||||
GrGLSLUniformHandler* fUniformHandler;
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
namespace GrPersistentCacheUtils {
|
||||
|
||||
static constexpr int kCurrentVersion = 7;
|
||||
static constexpr int kCurrentVersion = 8;
|
||||
|
||||
int GetCurrentVersion() {
|
||||
// The persistent cache stores a copy of the SkSL::Program::Inputs struct. If you alter the
|
||||
|
@ -109,8 +109,6 @@ static void finalize_helper(GrSPIRVVaryingHandler::VarArray& vars) {
|
||||
void GrSPIRVVaryingHandler::onFinalize() {
|
||||
finalize_helper(fVertexInputs);
|
||||
finalize_helper(fVertexOutputs);
|
||||
finalize_helper(fGeomInputs);
|
||||
finalize_helper(fGeomOutputs);
|
||||
finalize_helper(fFragInputs);
|
||||
finalize_helper(fFragOutputs);
|
||||
}
|
||||
|
@ -16,8 +16,6 @@
|
||||
GrShaderCaps::GrShaderCaps(const GrContextOptions& options) {
|
||||
fGLSLGeneration = k330_GrGLSLGeneration;
|
||||
fShaderDerivativeSupport = false;
|
||||
fGeometryShaderSupport = false;
|
||||
fGSInvocationsSupport = false;
|
||||
fDstReadInShaderSupport = false;
|
||||
fDualSourceBlendingSupport = false;
|
||||
fIntegerSupport = false;
|
||||
@ -70,8 +68,6 @@ GrShaderCaps::GrShaderCaps(const GrContextOptions& options) {
|
||||
|
||||
fVersionDeclString = nullptr;
|
||||
fShaderDerivativeExtensionString = nullptr;
|
||||
fGeometryShaderExtensionString = nullptr;
|
||||
fGSInvocationsExtensionString = nullptr;
|
||||
fSecondaryOutputExtensionString = nullptr;
|
||||
fExternalTextureExtensionString = nullptr;
|
||||
fSecondExternalTextureExtensionString = nullptr;
|
||||
@ -90,8 +86,6 @@ void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const {
|
||||
writer->beginObject();
|
||||
|
||||
writer->appendBool("Shader Derivative Support", fShaderDerivativeSupport);
|
||||
writer->appendBool("Geometry Shader Support", fGeometryShaderSupport);
|
||||
writer->appendBool("Geometry Shader Invocations Support", fGSInvocationsSupport);
|
||||
writer->appendBool("Dst Read In Shader Support", fDstReadInShaderSupport);
|
||||
writer->appendBool("Dual Source Blending Support", fDualSourceBlendingSupport);
|
||||
writer->appendBool("Integer Support", fIntegerSupport);
|
||||
@ -202,9 +196,6 @@ void GrShaderCaps::applyOptionsOverrides(const GrContextOptions& options) {
|
||||
if (options.fSuppressFramebufferFetch) {
|
||||
fFBFetchSupport = false;
|
||||
}
|
||||
if (options.fSuppressGeometryShaders) {
|
||||
fGeometryShaderSupport = false;
|
||||
}
|
||||
if (options.fMaxTessellationSegmentsOverride > 0) {
|
||||
fMaxTessellationSegments = std::min(options.fMaxTessellationSegmentsOverride,
|
||||
fMaxTessellationSegments);
|
||||
|
@ -42,8 +42,6 @@ public:
|
||||
bool supportsDistanceFieldText() const { return fShaderDerivativeSupport; }
|
||||
|
||||
bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; }
|
||||
bool geometryShaderSupport() const { return fGeometryShaderSupport; }
|
||||
bool gsInvocationsSupport() const { return fGSInvocationsSupport; }
|
||||
bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; }
|
||||
bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; }
|
||||
bool nonsquareMatrixSupport() const { return fNonsquareMatrixSupport; }
|
||||
@ -224,22 +222,6 @@ public:
|
||||
return fShaderDerivativeExtensionString;
|
||||
}
|
||||
|
||||
// Returns the string of an extension that must be enabled in the shader to support geometry
|
||||
// shaders. If nullptr is returned then no extension needs to be enabled. Before calling this
|
||||
// function, the caller must verify that geometryShaderSupport exists.
|
||||
const char* geometryShaderExtensionString() const {
|
||||
SkASSERT(this->geometryShaderSupport());
|
||||
return fGeometryShaderExtensionString;
|
||||
}
|
||||
|
||||
// Returns the string of an extension that must be enabled in the shader to support
|
||||
// geometry shader invocations. If nullptr is returned then no extension needs to be enabled.
|
||||
// Before calling this function, the caller must verify that gsInvocationsSupport exists.
|
||||
const char* gsInvocationsExtensionString() const {
|
||||
SkASSERT(this->gsInvocationsSupport());
|
||||
return fGSInvocationsExtensionString;
|
||||
}
|
||||
|
||||
// This returns the name of an extension that must be enabled in the shader, if such a thing is
|
||||
// required in order to use a secondary output in the shader. This returns a nullptr if no such
|
||||
// extension is required. However, the return value of this function does not say whether dual
|
||||
@ -290,8 +272,6 @@ private:
|
||||
GrGLSLGeneration fGLSLGeneration;
|
||||
|
||||
bool fShaderDerivativeSupport : 1;
|
||||
bool fGeometryShaderSupport : 1;
|
||||
bool fGSInvocationsSupport : 1;
|
||||
bool fDstReadInShaderSupport : 1;
|
||||
bool fDualSourceBlendingSupport : 1;
|
||||
bool fIntegerSupport : 1;
|
||||
@ -351,8 +331,6 @@ private:
|
||||
const char* fVersionDeclString;
|
||||
|
||||
const char* fShaderDerivativeExtensionString;
|
||||
const char* fGeometryShaderExtensionString;
|
||||
const char* fGSInvocationsExtensionString;
|
||||
const char* fSecondaryOutputExtensionString;
|
||||
const char* fExternalTextureExtensionString;
|
||||
const char* fSecondExternalTextureExtensionString;
|
||||
|
@ -228,7 +228,6 @@ void PrintShaderBanner(SkSL::ProgramKind programKind) {
|
||||
const char* typeName = "Unknown";
|
||||
switch (programKind) {
|
||||
case SkSL::ProgramKind::kVertex: typeName = "Vertex"; break;
|
||||
case SkSL::ProgramKind::kGeometry: typeName = "Geometry"; break;
|
||||
case SkSL::ProgramKind::kFragment: typeName = "Fragment"; break;
|
||||
default: break;
|
||||
}
|
||||
|
@ -229,8 +229,6 @@ void GrD3DCaps::initShaderCaps(int vendorID, const D3D12_FEATURE_DATA_D3D12_OPTI
|
||||
|
||||
shaderCaps->fShaderDerivativeSupport = true;
|
||||
|
||||
shaderCaps->fGeometryShaderSupport = shaderCaps->fGSInvocationsSupport = true;
|
||||
|
||||
shaderCaps->fDualSourceBlendingSupport = true;
|
||||
|
||||
shaderCaps->fIntegerSupport = true;
|
||||
|
@ -86,9 +86,6 @@ static gr_cp<ID3DBlob> GrCompileHLSLShader(GrD3DGpu* gpu,
|
||||
case SkSL::ProgramKind::kVertex:
|
||||
compileTarget = "vs_5_1";
|
||||
break;
|
||||
case SkSL::ProgramKind::kGeometry:
|
||||
compileTarget = "gs_5_1";
|
||||
break;
|
||||
case SkSL::ProgramKind::kFragment:
|
||||
compileTarget = "ps_5_1";
|
||||
break;
|
||||
@ -133,9 +130,7 @@ bool GrD3DPipelineStateBuilder::loadHLSLFromCache(SkReadBuffer* reader, gr_cp<ID
|
||||
};
|
||||
|
||||
return compile(SkSL::ProgramKind::kVertex, kVertex_GrShaderType) &&
|
||||
compile(SkSL::ProgramKind::kFragment, kFragment_GrShaderType) &&
|
||||
(hlsl[kGeometry_GrShaderType].empty() ||
|
||||
compile(SkSL::ProgramKind::kGeometry, kGeometry_GrShaderType));
|
||||
compile(SkSL::ProgramKind::kFragment, kFragment_GrShaderType);
|
||||
}
|
||||
|
||||
gr_cp<ID3DBlob> GrD3DPipelineStateBuilder::compileD3DProgram(
|
||||
@ -501,7 +496,7 @@ static D3D12_PRIMITIVE_TOPOLOGY_TYPE gr_primitive_type_to_d3d(GrPrimitiveType pr
|
||||
|
||||
gr_cp<ID3D12PipelineState> create_pipeline_state(
|
||||
GrD3DGpu* gpu, const GrProgramInfo& programInfo, const sk_sp<GrD3DRootSignature>& rootSig,
|
||||
gr_cp<ID3DBlob> vertexShader, gr_cp<ID3DBlob> geometryShader, gr_cp<ID3DBlob> pixelShader,
|
||||
gr_cp<ID3DBlob> vertexShader, gr_cp<ID3DBlob> pixelShader,
|
||||
DXGI_FORMAT renderTargetFormat, DXGI_FORMAT depthStencilFormat,
|
||||
unsigned int sampleQualityPattern) {
|
||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {};
|
||||
@ -513,11 +508,6 @@ gr_cp<ID3D12PipelineState> create_pipeline_state(
|
||||
psoDesc.PS = { reinterpret_cast<UINT8*>(pixelShader->GetBufferPointer()),
|
||||
pixelShader->GetBufferSize() };
|
||||
|
||||
if (geometryShader.get()) {
|
||||
psoDesc.GS = { reinterpret_cast<UINT8*>(geometryShader->GetBufferPointer()),
|
||||
geometryShader->GetBufferSize() };
|
||||
}
|
||||
|
||||
psoDesc.StreamOutput = { nullptr, 0, nullptr, 0, 0 };
|
||||
|
||||
fill_in_blend_state(programInfo.pipeline(), &psoDesc.BlendState);
|
||||
@ -605,7 +595,6 @@ std::unique_ptr<GrD3DPipelineState> GrD3DPipelineStateBuilder::finalize() {
|
||||
SkSL::Program::Inputs inputs[kGrShaderTypeCount];
|
||||
SkSL::String* sksl[kGrShaderTypeCount] = {
|
||||
&fVS.fCompilerString,
|
||||
&fGS.fCompilerString,
|
||||
&fFS.fCompilerString,
|
||||
};
|
||||
SkSL::String cached_sksl[kGrShaderTypeCount];
|
||||
@ -631,12 +620,6 @@ std::unique_ptr<GrD3DPipelineState> GrD3DPipelineStateBuilder::finalize() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (geomProc.willUseGeoShader()) {
|
||||
if (!compile(SkSL::ProgramKind::kGeometry, kGeometry_GrShaderType)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (persistentCache && !cached) {
|
||||
const bool cacheSkSL = fGpu->getContext()->priv().options().fShaderCacheStrategy ==
|
||||
GrContextOptions::ShaderCacheStrategy::kSkSL;
|
||||
@ -665,7 +648,7 @@ std::unique_ptr<GrD3DPipelineState> GrD3DPipelineStateBuilder::finalize() {
|
||||
const GrD3DRenderTarget* rt = static_cast<const GrD3DRenderTarget*>(fRenderTarget);
|
||||
gr_cp<ID3D12PipelineState> pipelineState = create_pipeline_state(
|
||||
fGpu, fProgramInfo, rootSig, std::move(shaders[kVertex_GrShaderType]),
|
||||
std::move(shaders[kGeometry_GrShaderType]), std::move(shaders[kFragment_GrShaderType]),
|
||||
std::move(shaders[kFragment_GrShaderType]),
|
||||
rt->dxgiFormat(), rt->stencilDxgiFormat(), rt->sampleQualityPattern());
|
||||
sk_sp<GrD3DPipeline> pipeline = GrD3DPipeline::Make(std::move(pipelineState));
|
||||
|
||||
|
@ -364,18 +364,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
|
||||
|
||||
shaderCaps->fShaderDerivativeSupport = true;
|
||||
|
||||
// we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS
|
||||
shaderCaps->fGeometryShaderSupport = version >= GR_GL_VER(3, 2) &&
|
||||
ctxInfo.glslGeneration() >= k150_GrGLSLGeneration;
|
||||
if (shaderCaps->fGeometryShaderSupport) {
|
||||
if (ctxInfo.glslGeneration() >= k400_GrGLSLGeneration) {
|
||||
shaderCaps->fGSInvocationsSupport = true;
|
||||
} else if (ctxInfo.hasExtension("GL_ARB_gpu_shader5")) {
|
||||
shaderCaps->fGSInvocationsSupport = true;
|
||||
shaderCaps->fGSInvocationsExtensionString = "GL_ARB_gpu_shader5";
|
||||
}
|
||||
}
|
||||
|
||||
shaderCaps->fIntegerSupport = version >= GR_GL_VER(3, 0) &&
|
||||
ctxInfo.glslGeneration() >= k130_GrGLSLGeneration;
|
||||
|
||||
@ -387,22 +375,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
|
||||
shaderCaps->fShaderDerivativeSupport = version >= GR_GL_VER(3, 0) ||
|
||||
ctxInfo.hasExtension("GL_OES_standard_derivatives");
|
||||
|
||||
// Mali and early Adreno both have support for geometry shaders, but they appear to be
|
||||
// implemented in software. In practice with ccpr, they were slower than the backup impl
|
||||
// that only uses vertex shaders.
|
||||
if (ctxInfo.vendor() != GrGLVendor::kARM &&
|
||||
ctxInfo.renderer() != GrGLRenderer::kAdreno3xx &&
|
||||
ctxInfo.renderer() != GrGLRenderer::kAdreno4xx_other) {
|
||||
|
||||
if (version >= GR_GL_VER(3,2)) {
|
||||
shaderCaps->fGeometryShaderSupport = true;
|
||||
} else if (ctxInfo.hasExtension("GL_EXT_geometry_shader")) {
|
||||
shaderCaps->fGeometryShaderSupport = true;
|
||||
shaderCaps->fGeometryShaderExtensionString = "GL_EXT_geometry_shader";
|
||||
}
|
||||
shaderCaps->fGSInvocationsSupport = shaderCaps->fGeometryShaderSupport;
|
||||
}
|
||||
|
||||
shaderCaps->fIntegerSupport = version >= GR_GL_VER(3, 0) &&
|
||||
ctxInfo.glslGeneration() >= k330_GrGLSLGeneration; // We use this value for GLSL ES 3.0.
|
||||
shaderCaps->fNonsquareMatrixSupport = ctxInfo.glslGeneration() >= k330_GrGLSLGeneration;
|
||||
@ -3547,23 +3519,6 @@ void GrGLCaps::applyDriverCorrectnessWorkarounds(const GrGLContextInfo& ctxInfo,
|
||||
fClearTextureSupport = false;
|
||||
}
|
||||
|
||||
#ifdef SK_BUILD_FOR_MAC
|
||||
// Radeon MacBooks hit a crash in glReadPixels() when using geometry shaders.
|
||||
// http://skbug.com/8097
|
||||
if (ctxInfo.vendor() == GrGLVendor::kATI) {
|
||||
shaderCaps->fGeometryShaderSupport = false;
|
||||
}
|
||||
// On at least some MacBooks, GLSL 4.0 geometry shaders break if we use invocations.
|
||||
shaderCaps->fGSInvocationsSupport = false;
|
||||
#endif
|
||||
|
||||
// Qualcomm driver @103.0 has been observed to crash compiling ccpr geometry
|
||||
// shaders. @127.0 is the earliest verified driver to not crash.
|
||||
if (ctxInfo.driver() == GrGLDriver::kQualcomm &&
|
||||
ctxInfo.driverVersion() < GR_GL_DRIVER_VER(127, 0, 0)) {
|
||||
shaderCaps->fGeometryShaderSupport = false;
|
||||
}
|
||||
|
||||
// glBlitFramebuffer seems to produce incorrect results on QC, Mali400, and Tegra3 but
|
||||
// glCopyTexSubImage2D works (even though there is no extension that specifically allows it).
|
||||
if (ctxInfo.vendor() == GrGLVendor::kQualcomm ||
|
||||
|
@ -545,7 +545,6 @@
|
||||
/* Shaders */
|
||||
#define GR_GL_FRAGMENT_SHADER 0x8B30
|
||||
#define GR_GL_VERTEX_SHADER 0x8B31
|
||||
#define GR_GL_GEOMETRY_SHADER 0x8DD9
|
||||
#define GR_GL_TESS_CONTROL_SHADER 0x8E88
|
||||
#define GR_GL_TESS_EVALUATION_SHADER 0x8E87
|
||||
#define GR_GL_MAX_VERTEX_ATTRIBS 0x8869
|
||||
|
@ -246,7 +246,6 @@ sk_sp<GrGLProgram> GrGLProgramBuilder::finalize(const GrGLPrecompiledProgram* pr
|
||||
SkSL::String glsl[kGrShaderTypeCount];
|
||||
SkSL::String* sksl[kGrShaderTypeCount] = {
|
||||
&fVS.fCompilerString,
|
||||
&fGS.fCompilerString,
|
||||
&fFS.fCompilerString,
|
||||
};
|
||||
SkSL::String cached_sksl[kGrShaderTypeCount];
|
||||
@ -413,31 +412,6 @@ sk_sp<GrGLProgram> GrGLProgramBuilder::finalize(const GrGLPrecompiledProgram* pr
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Geometry Shader
|
||||
*/
|
||||
if (geomProc.willUseGeoShader()) {
|
||||
if (glsl[kGeometry_GrShaderType].empty()) {
|
||||
// Don't have cached GLSL, need to compile SkSL->GLSL
|
||||
std::unique_ptr<SkSL::Program> gs;
|
||||
gs = GrSkSLtoGLSL(this->gpu(),
|
||||
SkSL::ProgramKind::kGeometry,
|
||||
*sksl[kGeometry_GrShaderType],
|
||||
settings,
|
||||
&glsl[kGeometry_GrShaderType],
|
||||
errorHandler);
|
||||
if (!gs) {
|
||||
cleanup_program(fGpu, programID, shadersToDelete);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
if (!this->compileAndAttachShaders(glsl[kGeometry_GrShaderType], programID,
|
||||
GR_GL_GEOMETRY_SHADER, &shadersToDelete,
|
||||
errorHandler)) {
|
||||
cleanup_program(fGpu, programID, shadersToDelete);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
this->bindProgramResourceLocations(programID);
|
||||
|
||||
{
|
||||
@ -499,16 +473,10 @@ bool GrGLProgramBuilder::checkLinkStatus(GrGLuint programID,
|
||||
SkSL::String allShaders;
|
||||
if (sksl) {
|
||||
allShaders.appendf("// Vertex SKSL\n%s\n", sksl[kVertex_GrShaderType]->c_str());
|
||||
if (!sksl[kGeometry_GrShaderType]->empty()) {
|
||||
allShaders.appendf("// Geometry SKSL\n%s\n", sksl[kGeometry_GrShaderType]->c_str());
|
||||
}
|
||||
allShaders.appendf("// Fragment SKSL\n%s\n", sksl[kFragment_GrShaderType]->c_str());
|
||||
}
|
||||
if (glsl) {
|
||||
allShaders.appendf("// Vertex GLSL\n%s\n", glsl[kVertex_GrShaderType].c_str());
|
||||
if (!glsl[kGeometry_GrShaderType].empty()) {
|
||||
allShaders.appendf("// Geometry GLSL\n%s\n", glsl[kGeometry_GrShaderType].c_str());
|
||||
}
|
||||
allShaders.appendf("// Fragment GLSL\n%s\n", glsl[kFragment_GrShaderType].c_str());
|
||||
}
|
||||
GrGLint infoLen = GR_GL_INIT_ZERO;
|
||||
@ -601,11 +569,7 @@ bool GrGLProgramBuilder::PrecompileProgram(GrDirectContext* dContext,
|
||||
GR_GL_FRAGMENT_SHADER) ||
|
||||
!compileShader(SkSL::ProgramKind::kVertex,
|
||||
shaders[kVertex_GrShaderType],
|
||||
GR_GL_VERTEX_SHADER) ||
|
||||
(!shaders[kGeometry_GrShaderType].empty() &&
|
||||
!compileShader(SkSL::ProgramKind::kGeometry,
|
||||
shaders[kGeometry_GrShaderType],
|
||||
GR_GL_GEOMETRY_SHADER))) {
|
||||
GR_GL_VERTEX_SHADER)) {
|
||||
cleanup_program(glGpu, programID, shadersToDelete);
|
||||
return false;
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ const int GrGLSLProgramBuilder::kVarsPerBlock = 8;
|
||||
GrGLSLProgramBuilder::GrGLSLProgramBuilder(const GrProgramDesc& desc,
|
||||
const GrProgramInfo& programInfo)
|
||||
: fVS(this)
|
||||
, fGS(this)
|
||||
, fFS(this)
|
||||
, fDesc(desc)
|
||||
, fProgramInfo(programInfo)
|
||||
@ -41,10 +40,6 @@ void GrGLSLProgramBuilder::addFeature(GrShaderFlags shaders,
|
||||
if (shaders & kVertex_GrShaderFlag) {
|
||||
fVS.addFeature(featureBit, extensionName);
|
||||
}
|
||||
if (shaders & kGeometry_GrShaderFlag) {
|
||||
SkASSERT(this->geometryProcessor().willUseGeoShader());
|
||||
fGS.addFeature(featureBit, extensionName);
|
||||
}
|
||||
if (shaders & kFragment_GrShaderFlag) {
|
||||
fFS.addFeature(featureBit, extensionName);
|
||||
}
|
||||
@ -84,9 +79,7 @@ bool GrGLSLProgramBuilder::emitAndInstallPrimProc(SkString* outputColor, SkStrin
|
||||
|
||||
SkASSERT(!fUniformHandles.fRTAdjustmentUni.isValid());
|
||||
GrShaderFlags rtAdjustVisibility;
|
||||
if (geomProc.willUseGeoShader()) {
|
||||
rtAdjustVisibility = kGeometry_GrShaderFlag;
|
||||
} else if (geomProc.willUseTessellationShaders()) {
|
||||
if (geomProc.willUseTessellationShaders()) {
|
||||
rtAdjustVisibility = kTessEvaluation_GrShaderFlag;
|
||||
} else {
|
||||
rtAdjustVisibility = kVertex_GrShaderFlag;
|
||||
@ -115,7 +108,6 @@ bool GrGLSLProgramBuilder::emitAndInstallPrimProc(SkString* outputColor, SkStrin
|
||||
}
|
||||
|
||||
GrGeometryProcessor::ProgramImpl::EmitArgs args(&fVS,
|
||||
geomProc.willUseGeoShader() ? &fGS : nullptr,
|
||||
&fFS,
|
||||
this->varyingHandler(),
|
||||
this->uniformHandler(),
|
||||
@ -493,9 +485,5 @@ bool GrGLSLProgramBuilder::fragmentProcessorHasCoordsParam(const GrFragmentProce
|
||||
void GrGLSLProgramBuilder::finalizeShaders() {
|
||||
this->varyingHandler()->finalize();
|
||||
fVS.finalize(kVertex_GrShaderFlag);
|
||||
if (this->geometryProcessor().willUseGeoShader()) {
|
||||
SkASSERT(this->shaderCaps()->geometryShaderSupport());
|
||||
fGS.finalize(kGeometry_GrShaderFlag);
|
||||
}
|
||||
fFS.finalize(kFragment_GrShaderFlag);
|
||||
}
|
||||
|
@ -96,7 +96,6 @@ public:
|
||||
static const int kVarsPerBlock;
|
||||
|
||||
GrGLSLVertexBuilder fVS;
|
||||
GrGLSLGeometryBuilder fGS;
|
||||
GrGLSLFragmentShaderBuilder fFS;
|
||||
|
||||
const GrProgramDesc& fDesc;
|
||||
|
@ -13,7 +13,6 @@ void GrGLSLVaryingHandler::addPassThroughAttribute(const GrShaderVar& vsVar,
|
||||
const char* output,
|
||||
Interpolation interpolation) {
|
||||
SkASSERT(vsVar.getType() != kVoid_GrSLType);
|
||||
SkASSERT(!fProgramBuilder->geometryProcessor().willUseGeoShader());
|
||||
GrGLSLVarying v(vsVar.getType());
|
||||
this->addVarying(vsVar.c_str(), &v, interpolation);
|
||||
fProgramBuilder->fVS.codeAppendf("%s = %s;", v.vsOut(), vsVar.c_str());
|
||||
@ -40,7 +39,6 @@ static bool use_flat_interpolation(GrGLSLVaryingHandler::Interpolation interpola
|
||||
void GrGLSLVaryingHandler::addVarying(const char* name, GrGLSLVarying* varying,
|
||||
Interpolation interpolation) {
|
||||
SkASSERT(GrSLTypeIsFloatType(varying->type()) || Interpolation::kMustBeFlat == interpolation);
|
||||
bool willUseGeoShader = fProgramBuilder->geometryProcessor().willUseGeoShader();
|
||||
VaryingInfo& v = fVaryings.push_back();
|
||||
|
||||
SkASSERT(varying);
|
||||
@ -53,14 +51,8 @@ void GrGLSLVaryingHandler::addVarying(const char* name, GrGLSLVarying* varying,
|
||||
varying->fVsOut = v.fVsOut.c_str();
|
||||
v.fVisibility |= kVertex_GrShaderFlag;
|
||||
}
|
||||
if (willUseGeoShader) {
|
||||
v.fGsOut = fProgramBuilder->nameVariable('g', name);
|
||||
varying->fGsIn = v.fVsOut.c_str();
|
||||
varying->fGsOut = v.fGsOut.c_str();
|
||||
v.fVisibility |= kGeometry_GrShaderFlag;
|
||||
}
|
||||
if (varying->isInFragmentShader()) {
|
||||
varying->fFsIn = (willUseGeoShader ? v.fGsOut : v.fVsOut).c_str();
|
||||
varying->fFsIn = v.fVsOut.c_str();
|
||||
v.fVisibility |= kFragment_GrShaderFlag;
|
||||
}
|
||||
}
|
||||
@ -93,9 +85,6 @@ void GrGLSLVaryingHandler::setNoPerspective() {
|
||||
if (const char* extension = caps.noperspectiveInterpolationExtensionString()) {
|
||||
int bit = 1 << GrGLSLShaderBuilder::kNoPerspectiveInterpolation_GLSLPrivateFeature;
|
||||
fProgramBuilder->fVS.addFeature(bit, extension);
|
||||
if (fProgramBuilder->geometryProcessor().willUseGeoShader()) {
|
||||
fProgramBuilder->fGS.addFeature(bit, extension);
|
||||
}
|
||||
fProgramBuilder->fFS.addFeature(bit, extension);
|
||||
}
|
||||
fDefaultInterpolationModifier = "noperspective";
|
||||
@ -107,18 +96,9 @@ void GrGLSLVaryingHandler::finalize() {
|
||||
if (v.fVisibility & kVertex_GrShaderFlag) {
|
||||
fVertexOutputs.emplace_back(v.fVsOut, v.fType, GrShaderVar::TypeModifier::Out,
|
||||
GrShaderVar::kNonArray, SkString(), SkString(modifier));
|
||||
if (v.fVisibility & kGeometry_GrShaderFlag) {
|
||||
fGeomInputs.emplace_back(v.fVsOut, v.fType, GrShaderVar::TypeModifier::In,
|
||||
GrShaderVar::kUnsizedArray, SkString(), SkString(modifier));
|
||||
}
|
||||
}
|
||||
if (v.fVisibility & kFragment_GrShaderFlag) {
|
||||
const char* fsIn = v.fVsOut.c_str();
|
||||
if (v.fVisibility & kGeometry_GrShaderFlag) {
|
||||
fGeomOutputs.emplace_back(v.fGsOut, v.fType, GrShaderVar::TypeModifier::Out,
|
||||
GrShaderVar::kNonArray, SkString(), SkString(modifier));
|
||||
fsIn = v.fGsOut.c_str();
|
||||
}
|
||||
fFragInputs.emplace_back(SkString(fsIn), v.fType, GrShaderVar::TypeModifier::In,
|
||||
GrShaderVar::kNonArray, SkString(), SkString(modifier));
|
||||
}
|
||||
@ -138,11 +118,6 @@ void GrGLSLVaryingHandler::getVertexDecls(SkString* inputDecls, SkString* output
|
||||
this->appendDecls(fVertexOutputs, outputDecls);
|
||||
}
|
||||
|
||||
void GrGLSLVaryingHandler::getGeomDecls(SkString* inputDecls, SkString* outputDecls) const {
|
||||
this->appendDecls(fGeomInputs, inputDecls);
|
||||
this->appendDecls(fGeomOutputs, outputDecls);
|
||||
}
|
||||
|
||||
void GrGLSLVaryingHandler::getFragDecls(SkString* inputDecls, SkString* outputDecls) const {
|
||||
// We should not have any outputs in the fragment shader when using version 1.10
|
||||
SkASSERT(k110_GrGLSLGeneration != fProgramBuilder->shaderCaps()->generation() ||
|
||||
|
@ -62,8 +62,6 @@ public:
|
||||
bool isInFragmentShader() const { return Scope::kVertToGeo != fScope; }
|
||||
|
||||
const char* vsOut() const { SkASSERT(this->isInVertexShader()); return fVsOut; }
|
||||
const char* gsIn() const { return fGsIn; }
|
||||
const char* gsOut() const { return fGsOut; }
|
||||
const char* fsIn() const { SkASSERT(this->isInFragmentShader()); return fFsIn; }
|
||||
|
||||
GrShaderVar vsOutVar() const {
|
||||
@ -80,8 +78,6 @@ private:
|
||||
GrSLType fType = kVoid_GrSLType;
|
||||
Scope fScope = Scope::kVertToFrag;
|
||||
const char* fVsOut = nullptr;
|
||||
const char* fGsIn = nullptr;
|
||||
const char* fGsOut = nullptr;
|
||||
const char* fFsIn = nullptr;
|
||||
|
||||
friend class GrGLSLVaryingHandler;
|
||||
@ -95,8 +91,6 @@ public:
|
||||
: fVaryings(kVaryingsPerBlock)
|
||||
, fVertexInputs(kVaryingsPerBlock)
|
||||
, fVertexOutputs(kVaryingsPerBlock)
|
||||
, fGeomInputs(kVaryingsPerBlock)
|
||||
, fGeomOutputs(kVaryingsPerBlock)
|
||||
, fFragInputs(kVaryingsPerBlock)
|
||||
, fFragOutputs(kVaryingsPerBlock)
|
||||
, fProgramBuilder(program)
|
||||
@ -132,8 +126,7 @@ public:
|
||||
/**
|
||||
* The GP can use these calls to pass a vertex shader variable directly to 'output' in the
|
||||
* fragment shader. Though this adds code to vertex and fragment stages, 'output' is expected to
|
||||
* be defined in the fragment shader before the call is made. This cannot be used with a
|
||||
* geometry shader.
|
||||
* be defined in the fragment shader before the call is made.
|
||||
* TODO it might be nicer behavior to have a flag to declare output inside these calls
|
||||
*/
|
||||
void addPassThroughAttribute(const GrShaderVar& vsVar,
|
||||
@ -147,7 +140,6 @@ public:
|
||||
void finalize();
|
||||
|
||||
void getVertexDecls(SkString* inputDecls, SkString* outputDecls) const;
|
||||
void getGeomDecls(SkString* inputDecls, SkString* outputDecls) const;
|
||||
void getFragDecls(SkString* inputDecls, SkString* outputDecls) const;
|
||||
|
||||
protected:
|
||||
@ -155,7 +147,6 @@ protected:
|
||||
GrSLType fType;
|
||||
bool fIsFlat;
|
||||
SkString fVsOut;
|
||||
SkString fGsOut;
|
||||
GrShaderFlags fVisibility;
|
||||
};
|
||||
|
||||
@ -165,8 +156,6 @@ protected:
|
||||
VaryingList fVaryings;
|
||||
VarArray fVertexInputs;
|
||||
VarArray fVertexOutputs;
|
||||
VarArray fGeomInputs;
|
||||
VarArray fGeomOutputs;
|
||||
VarArray fFragInputs;
|
||||
VarArray fFragOutputs;
|
||||
|
||||
|
@ -39,49 +39,3 @@ void GrGLSLVertexBuilder::onFinalize() {
|
||||
}
|
||||
fProgramBuilder->varyingHandler()->getVertexDecls(&this->inputs(), &this->outputs());
|
||||
}
|
||||
|
||||
static const char* input_type_name(GrGLSLGeometryBuilder::InputType in) {
|
||||
using InputType = GrGLSLGeometryBuilder::InputType;
|
||||
switch (in) {
|
||||
case InputType::kPoints: return "points";
|
||||
case InputType::kLines: return "lines";
|
||||
case InputType::kTriangles: return "triangles";
|
||||
}
|
||||
SK_ABORT("invalid input type");
|
||||
}
|
||||
|
||||
static const char* output_type_name(GrGLSLGeometryBuilder::OutputType out) {
|
||||
using OutputType = GrGLSLGeometryBuilder::OutputType;
|
||||
switch (out) {
|
||||
case OutputType::kPoints: return "points";
|
||||
case OutputType::kLineStrip: return "line_strip";
|
||||
case OutputType::kTriangleStrip: return "triangle_strip";
|
||||
}
|
||||
SK_ABORT("invalid output type");
|
||||
}
|
||||
|
||||
void GrGLSLGeometryBuilder::configure(InputType inputType, OutputType outputType, int maxVertices,
|
||||
int numInvocations) {
|
||||
SkASSERT(!this->isConfigured());
|
||||
fNumInvocations = numInvocations;
|
||||
this->addLayoutQualifier(input_type_name(inputType), kIn_InterfaceQualifier);
|
||||
this->addLayoutQualifier(SkStringPrintf("invocations = %i", numInvocations).c_str(),
|
||||
kIn_InterfaceQualifier);
|
||||
this->addLayoutQualifier(output_type_name(outputType), kOut_InterfaceQualifier);
|
||||
this->addLayoutQualifier(SkStringPrintf("max_vertices = %i", maxVertices).c_str(),
|
||||
kOut_InterfaceQualifier);
|
||||
}
|
||||
|
||||
void GrGLSLGeometryBuilder::emitVertex(SkString* out, const char* devPos, GrSLType devPosType) {
|
||||
this->emitNormalizedSkPosition(out, devPos, devPosType);
|
||||
out->append("EmitVertex();");
|
||||
}
|
||||
|
||||
void GrGLSLGeometryBuilder::endPrimitive() {
|
||||
this->codeAppend("EndPrimitive();");
|
||||
}
|
||||
|
||||
void GrGLSLGeometryBuilder::onFinalize() {
|
||||
SkASSERT(this->isConfigured());
|
||||
fProgramBuilder->varyingHandler()->getGeomDecls(&this->inputs(), &this->outputs());
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
#include "src/gpu/glsl/GrGLSLShaderBuilder.h"
|
||||
|
||||
/**
|
||||
* Base class for vertex and geometry shader builders. This is the stage that computes input
|
||||
* geometry for the rasterizer.
|
||||
* Base class for vertex shader builder. This is the stage that computes input geometry for the
|
||||
* rasterizer.
|
||||
*/
|
||||
class GrGLSLVertexGeoBuilder : public GrGLSLShaderBuilder {
|
||||
public:
|
||||
@ -55,42 +55,4 @@ private:
|
||||
using INHERITED = GrGLSLVertexGeoBuilder;
|
||||
};
|
||||
|
||||
|
||||
class GrGLSLGeometryBuilder : public GrGLSLVertexGeoBuilder {
|
||||
public:
|
||||
GrGLSLGeometryBuilder(GrGLSLProgramBuilder* program) : INHERITED(program) {}
|
||||
|
||||
enum class InputType {
|
||||
kPoints,
|
||||
kLines,
|
||||
kTriangles,
|
||||
};
|
||||
|
||||
enum class OutputType {
|
||||
kPoints,
|
||||
kLineStrip,
|
||||
kTriangleStrip
|
||||
};
|
||||
|
||||
void configure(InputType, OutputType, int maxVertices, int numInvocations = 1);
|
||||
bool isConfigured() const { return fNumInvocations; }
|
||||
|
||||
void emitVertex(const char* devPos, GrSLType devPosType = GrSLType::kFloat2_GrSLType) {
|
||||
this->emitVertex(&this->code(), devPos, devPosType);
|
||||
}
|
||||
void emitVertex(SkString* out, const char* devPos,
|
||||
GrSLType devPosType = GrSLType::kFloat2_GrSLType);
|
||||
|
||||
void endPrimitive();
|
||||
|
||||
private:
|
||||
void onFinalize() override;
|
||||
|
||||
int fNumInvocations = 0;
|
||||
|
||||
friend class GrGLProgramBuilder;
|
||||
|
||||
using INHERITED = GrGLSLVertexGeoBuilder;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -29,7 +29,6 @@ public:
|
||||
fSampleLocationsSupport = true;
|
||||
|
||||
fShaderCaps.reset(new GrShaderCaps(contextOptions));
|
||||
fShaderCaps->fGeometryShaderSupport = options.fGeometryShaderSupport;
|
||||
fShaderCaps->fIntegerSupport = options.fIntegerSupport;
|
||||
fShaderCaps->fFlatInterpolationSupport = options.fFlatInterpolationSupport;
|
||||
fShaderCaps->fMaxFragmentSamplers = options.fMaxFragmentSamplers;
|
||||
|
@ -543,7 +543,6 @@ void GrMtlCaps::initShaderCaps() {
|
||||
shaderCaps->fPreferFlatInterpolation = true;
|
||||
|
||||
shaderCaps->fShaderDerivativeSupport = true;
|
||||
shaderCaps->fGeometryShaderSupport = false;
|
||||
|
||||
if (@available(macOS 10.12, iOS 11.0, *)) {
|
||||
shaderCaps->fDualSourceBlendingSupport = true;
|
||||
|
@ -486,9 +486,6 @@ GrMtlPipelineState* GrMtlPipelineStateBuilder::finalize(
|
||||
const GrMtlPrecompiledLibraries* precompiledLibs) {
|
||||
TRACE_EVENT0("skia.shaders", TRACE_FUNC);
|
||||
|
||||
// Geometry shaders are not supported
|
||||
SkASSERT(!this->geometryProcessor().willUseGeoShader());
|
||||
|
||||
// Set up for cache if needed
|
||||
std::unique_ptr<SkBinaryWriteBuffer> writer;
|
||||
|
||||
|
@ -39,8 +39,6 @@ static void finalize_helper(GrMtlVaryingHandler::VarArray& vars) {
|
||||
void GrMtlVaryingHandler::onFinalize() {
|
||||
finalize_helper(fVertexInputs);
|
||||
finalize_helper(fVertexOutputs);
|
||||
finalize_helper(fGeomInputs);
|
||||
finalize_helper(fGeomOutputs);
|
||||
finalize_helper(fFragInputs);
|
||||
finalize_helper(fFragOutputs);
|
||||
}
|
||||
|
@ -699,10 +699,6 @@ void GrVkCaps::initShaderCaps(const VkPhysicalDeviceProperties& properties,
|
||||
// RelaxedPrecision. Rewriting the multiply as a sum of vector*scalar fixes this. (skia:11769)
|
||||
shaderCaps->fRewriteMatrixVectorMultiply = (kARM_VkVendor == properties.vendorID);
|
||||
|
||||
// FIXME: http://skbug.com/7733: Disable geometry shaders until Intel/Radeon GMs draw correctly.
|
||||
// shaderCaps->fGeometryShaderSupport =
|
||||
// shaderCaps->fGSInvocationsSupport = features.features.geometryShader;
|
||||
|
||||
shaderCaps->fDualSourceBlendingSupport = features.features.dualSrcBlend;
|
||||
|
||||
shaderCaps->fIntegerSupport = true;
|
||||
@ -1912,9 +1908,6 @@ GrInternalSurfaceFlags GrVkCaps::getExtraSurfaceFlagsForDeferredRT() const {
|
||||
|
||||
VkShaderStageFlags GrVkCaps::getPushConstantStageFlags() const {
|
||||
VkShaderStageFlags stageFlags = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||
if (this->shaderCaps()->geometryShaderSupport()) {
|
||||
stageFlags |= VK_SHADER_STAGE_GEOMETRY_BIT;
|
||||
}
|
||||
return stageFlags;
|
||||
}
|
||||
|
||||
|
@ -19,9 +19,6 @@
|
||||
GrVkDescriptorSetManager* GrVkDescriptorSetManager::CreateUniformManager(GrVkGpu* gpu) {
|
||||
SkSTArray<1, uint32_t> visibilities;
|
||||
uint32_t stages = kVertex_GrShaderFlag | kFragment_GrShaderFlag;
|
||||
if (gpu->vkCaps().shaderCaps()->geometryShaderSupport()) {
|
||||
stages |= kGeometry_GrShaderFlag;
|
||||
}
|
||||
visibilities.push_back(stages);
|
||||
SkTArray<const GrVkSampler*> samplers;
|
||||
return Create(gpu, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, visibilities, samplers);
|
||||
@ -58,9 +55,6 @@ VkShaderStageFlags visibility_to_vk_stage_flags(uint32_t visibility) {
|
||||
if (visibility & kVertex_GrShaderFlag) {
|
||||
flags |= VK_SHADER_STAGE_VERTEX_BIT;
|
||||
}
|
||||
if (visibility & kGeometry_GrShaderFlag) {
|
||||
flags |= VK_SHADER_STAGE_GEOMETRY_BIT;
|
||||
}
|
||||
if (visibility & kFragment_GrShaderFlag) {
|
||||
flags |= VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||
}
|
||||
|
@ -130,15 +130,6 @@ int GrVkPipelineStateBuilder::loadShadersFromCache(SkReadBuffer* cached,
|
||||
shaders[kFragment_GrShaderType],
|
||||
inputs[kFragment_GrShaderType]);
|
||||
|
||||
if (!shaders[kGeometry_GrShaderType].empty()) {
|
||||
success = success && this->installVkShaderModule(VK_SHADER_STAGE_GEOMETRY_BIT,
|
||||
fGS,
|
||||
&outShaderModules[kGeometry_GrShaderType],
|
||||
&outStageInfo[2],
|
||||
shaders[kGeometry_GrShaderType],
|
||||
inputs[kGeometry_GrShaderType]);
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
for (int i = 0; i < kGrShaderTypeCount; ++i) {
|
||||
if (outShaderModules[i]) {
|
||||
@ -148,7 +139,7 @@ int GrVkPipelineStateBuilder::loadShadersFromCache(SkReadBuffer* cached,
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return shaders[kGeometry_GrShaderType].empty() ? 2 : 3;
|
||||
return 2;
|
||||
}
|
||||
|
||||
void GrVkPipelineStateBuilder::storeShadersInCache(const SkSL::String shaders[],
|
||||
@ -177,7 +168,6 @@ GrVkPipelineState* GrVkPipelineStateBuilder::finalize(const GrProgramDesc& desc,
|
||||
|
||||
VkDescriptorSetLayout dsLayout[GrVkUniformHandler::kDescSetCount];
|
||||
VkShaderModule shaderModules[kGrShaderTypeCount] = { VK_NULL_HANDLE,
|
||||
VK_NULL_HANDLE,
|
||||
VK_NULL_HANDLE };
|
||||
|
||||
GrVkResourceProvider& resourceProvider = fGpu->resourceProvider();
|
||||
@ -239,7 +229,6 @@ GrVkPipelineState* GrVkPipelineStateBuilder::finalize(const GrProgramDesc& desc,
|
||||
|
||||
SkSL::String* sksl[kGrShaderTypeCount] = {
|
||||
&fVS.fCompilerString,
|
||||
&fGS.fCompilerString,
|
||||
&fFS.fCompilerString,
|
||||
};
|
||||
SkSL::String cached_sksl[kGrShaderTypeCount];
|
||||
@ -268,17 +257,6 @@ GrVkPipelineState* GrVkPipelineStateBuilder::finalize(const GrProgramDesc& desc,
|
||||
&shaders[kFragment_GrShaderType],
|
||||
&inputs[kFragment_GrShaderType]);
|
||||
|
||||
if (this->geometryProcessor().willUseGeoShader()) {
|
||||
success = success && this->createVkShaderModule(VK_SHADER_STAGE_GEOMETRY_BIT,
|
||||
*sksl[kGeometry_GrShaderType],
|
||||
&shaderModules[kGeometry_GrShaderType],
|
||||
&shaderStageInfo[2],
|
||||
settings,
|
||||
&shaders[kGeometry_GrShaderType],
|
||||
&inputs[kGeometry_GrShaderType]);
|
||||
++numShaderStages;
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
for (int i = 0; i < kGrShaderTypeCount; ++i) {
|
||||
if (shaderModules[i]) {
|
||||
|
@ -79,9 +79,6 @@ SkSL::ProgramKind vk_shader_stage_to_skiasl_kind(VkShaderStageFlagBits stage) {
|
||||
if (VK_SHADER_STAGE_VERTEX_BIT == stage) {
|
||||
return SkSL::ProgramKind::kVertex;
|
||||
}
|
||||
if (VK_SHADER_STAGE_GEOMETRY_BIT == stage) {
|
||||
return SkSL::ProgramKind::kGeometry;
|
||||
}
|
||||
SkASSERT(VK_SHADER_STAGE_FRAGMENT_BIT == stage);
|
||||
return SkSL::ProgramKind::kFragment;
|
||||
}
|
||||
|
@ -106,8 +106,6 @@ static void finalize_helper(GrVkVaryingHandler::VarArray& vars) {
|
||||
void GrVkVaryingHandler::onFinalize() {
|
||||
finalize_helper(fVertexInputs);
|
||||
finalize_helper(fVertexOutputs);
|
||||
finalize_helper(fGeomInputs);
|
||||
finalize_helper(fGeomOutputs);
|
||||
finalize_helper(fFragInputs);
|
||||
finalize_helper(fFragOutputs);
|
||||
}
|
||||
|
@ -59,7 +59,6 @@
|
||||
|
||||
// At runtime, we load the dehydrated sksl data files. The data is a (pointer, size) pair.
|
||||
#include "src/sksl/generated/sksl_frag.dehydrated.sksl"
|
||||
#include "src/sksl/generated/sksl_geom.dehydrated.sksl"
|
||||
#include "src/sksl/generated/sksl_gpu.dehydrated.sksl"
|
||||
#include "src/sksl/generated/sksl_public.dehydrated.sksl"
|
||||
#include "src/sksl/generated/sksl_rt_blend.dehydrated.sksl"
|
||||
@ -242,14 +241,6 @@ const ParsedModule& Compiler::loadVertexModule() {
|
||||
return fVertexModule;
|
||||
}
|
||||
|
||||
const ParsedModule& Compiler::loadGeometryModule() {
|
||||
if (!fGeometryModule.fSymbols) {
|
||||
fGeometryModule = this->parseModule(ProgramKind::kGeometry, MODULE_DATA(geom),
|
||||
this->loadGPUModule());
|
||||
}
|
||||
return fGeometryModule;
|
||||
}
|
||||
|
||||
const ParsedModule& Compiler::loadPublicModule() {
|
||||
if (!fPublicModule.fSymbols) {
|
||||
fPublicModule = this->parseModule(ProgramKind::kGeneric, MODULE_DATA(public), fRootModule);
|
||||
@ -308,7 +299,6 @@ const ParsedModule& Compiler::moduleForProgramKind(ProgramKind kind) {
|
||||
switch (kind) {
|
||||
case ProgramKind::kVertex: return this->loadVertexModule(); break;
|
||||
case ProgramKind::kFragment: return this->loadFragmentModule(); break;
|
||||
case ProgramKind::kGeometry: return this->loadGeometryModule(); break;
|
||||
case ProgramKind::kRuntimeColorFilter: return this->loadRuntimeColorFilterModule(); break;
|
||||
case ProgramKind::kRuntimeShader: return this->loadRuntimeShaderModule(); break;
|
||||
case ProgramKind::kRuntimeBlender: return this->loadRuntimeBlenderModule(); break;
|
||||
|
@ -24,8 +24,6 @@
|
||||
#endif
|
||||
|
||||
#define SK_FRAGCOLOR_BUILTIN 10001
|
||||
#define SK_IN_BUILTIN 10002
|
||||
#define SK_OUT_BUILTIN 10007
|
||||
#define SK_LASTFRAGCOLOR_BUILTIN 10008
|
||||
#define SK_MAIN_COORDS_BUILTIN 10009
|
||||
#define SK_INPUT_COLOR_BUILTIN 10010
|
||||
@ -34,7 +32,6 @@
|
||||
#define SK_CLOCKWISE_BUILTIN 17
|
||||
#define SK_VERTEXID_BUILTIN 42
|
||||
#define SK_INSTANCEID_BUILTIN 43
|
||||
#define SK_INVOCATIONID_BUILTIN 8
|
||||
#define SK_POSITION_BUILTIN 0
|
||||
|
||||
class SkBitSet;
|
||||
@ -222,7 +219,6 @@ private:
|
||||
const ParsedModule& loadGPUModule();
|
||||
const ParsedModule& loadFragmentModule();
|
||||
const ParsedModule& loadVertexModule();
|
||||
const ParsedModule& loadGeometryModule();
|
||||
const ParsedModule& loadPublicModule();
|
||||
const ParsedModule& loadRuntimeColorFilterModule();
|
||||
const ParsedModule& loadRuntimeShaderModule();
|
||||
@ -261,7 +257,6 @@ private:
|
||||
ParsedModule fGPUModule; // [Private] + GPU intrinsics, helper functions
|
||||
ParsedModule fVertexModule; // [GPU] + Vertex stage decls
|
||||
ParsedModule fFragmentModule; // [GPU] + Fragment stage decls
|
||||
ParsedModule fGeometryModule; // [GPU] + Geometry stage decls
|
||||
|
||||
ParsedModule fPublicModule; // [Root] + Public features
|
||||
ParsedModule fRuntimeColorFilterModule; // [Public] + Runtime shader decls
|
||||
|
@ -92,15 +92,6 @@ void DSLParser::InitLayoutMap() {
|
||||
TOKEN(ORIGIN_UPPER_LEFT, "origin_upper_left");
|
||||
TOKEN(BLEND_SUPPORT_ALL_EQUATIONS, "blend_support_all_equations");
|
||||
TOKEN(PUSH_CONSTANT, "push_constant");
|
||||
TOKEN(POINTS, "points");
|
||||
TOKEN(LINES, "lines");
|
||||
TOKEN(LINE_STRIP, "line_strip");
|
||||
TOKEN(LINES_ADJACENCY, "lines_adjacency");
|
||||
TOKEN(TRIANGLES, "triangles");
|
||||
TOKEN(TRIANGLE_STRIP, "triangle_strip");
|
||||
TOKEN(TRIANGLES_ADJACENCY, "triangles_adjacency");
|
||||
TOKEN(MAX_VERTICES, "max_vertices");
|
||||
TOKEN(INVOCATIONS, "invocations");
|
||||
TOKEN(SRGB_UNPREMUL, "srgb_unpremul");
|
||||
#undef TOKEN
|
||||
}
|
||||
|
@ -44,15 +44,6 @@ public:
|
||||
EARLY_FRAGMENT_TESTS,
|
||||
BLEND_SUPPORT_ALL_EQUATIONS,
|
||||
PUSH_CONSTANT,
|
||||
POINTS,
|
||||
LINES,
|
||||
LINE_STRIP,
|
||||
LINES_ADJACENCY,
|
||||
TRIANGLES,
|
||||
TRIANGLE_STRIP,
|
||||
TRIANGLES_ADJACENCY,
|
||||
MAX_VERTICES,
|
||||
INVOCATIONS,
|
||||
MARKER,
|
||||
WHEN,
|
||||
KEY,
|
||||
|
@ -97,9 +97,6 @@ void Dehydrator::write(Layout l) {
|
||||
this->writeS8(l.fSet);
|
||||
this->writeS16(l.fBuiltin);
|
||||
this->writeS8(l.fInputAttachmentIndex);
|
||||
this->writeS8(l.fPrimitive);
|
||||
this->writeS8(l.fMaxVertices);
|
||||
this->writeS8(l.fInvocations);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,8 +125,7 @@ bool IRGenerator::detectVarDeclarationWithoutScope(const Statement& stmt) {
|
||||
|
||||
std::unique_ptr<Extension> IRGenerator::convertExtension(int offset, skstd::string_view name) {
|
||||
if (this->programKind() != ProgramKind::kFragment &&
|
||||
this->programKind() != ProgramKind::kVertex &&
|
||||
this->programKind() != ProgramKind::kGeometry) {
|
||||
this->programKind() != ProgramKind::kVertex) {
|
||||
this->errorReporter().error(offset, "extensions are not allowed here");
|
||||
return nullptr;
|
||||
}
|
||||
@ -163,23 +162,7 @@ std::unique_ptr<Statement> IRGenerator::convertStatement(const ASTNode& statemen
|
||||
return nullptr;
|
||||
default:
|
||||
// it's an expression
|
||||
std::unique_ptr<Statement> result = this->convertExpressionStatement(statement);
|
||||
if (fRTAdjust && this->programKind() == ProgramKind::kGeometry) {
|
||||
SkASSERT(result->is<ExpressionStatement>());
|
||||
Expression& expr = *result->as<ExpressionStatement>().expression();
|
||||
if (expr.is<FunctionCall>()) {
|
||||
FunctionCall& fc = expr.as<FunctionCall>();
|
||||
if (fc.function().isBuiltin() && fc.function().name() == "EmitVertex") {
|
||||
StatementArray statements;
|
||||
statements.reserve_back(2);
|
||||
statements.push_back(getNormalizeSkPositionCode());
|
||||
statements.push_back(std::move(result));
|
||||
return Block::Make(statement.fOffset, std::move(statements),
|
||||
fSymbolTable, /*isScope=*/true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return this->convertExpressionStatement(statement);
|
||||
}
|
||||
}
|
||||
|
||||
@ -412,32 +395,13 @@ StatementArray IRGenerator::convertVarDeclarations(const ASTNode& decls,
|
||||
|
||||
std::unique_ptr<ModifiersDeclaration> IRGenerator::convertModifiersDeclaration(const ASTNode& m) {
|
||||
if (this->programKind() != ProgramKind::kFragment &&
|
||||
this->programKind() != ProgramKind::kVertex &&
|
||||
this->programKind() != ProgramKind::kGeometry) {
|
||||
this->programKind() != ProgramKind::kVertex) {
|
||||
this->errorReporter().error(m.fOffset, "layout qualifiers are not allowed here");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SkASSERT(m.fKind == ASTNode::Kind::kModifiers);
|
||||
Modifiers modifiers = m.getModifiers();
|
||||
if (modifiers.fLayout.fInvocations != -1) {
|
||||
if (this->programKind() != ProgramKind::kGeometry) {
|
||||
this->errorReporter().error(m.fOffset,
|
||||
"'invocations' is only legal in geometry shaders");
|
||||
return nullptr;
|
||||
}
|
||||
fInvocations = modifiers.fLayout.fInvocations;
|
||||
if (!this->caps().gsInvocationsSupport()) {
|
||||
modifiers.fLayout.fInvocations = -1;
|
||||
if (modifiers.fLayout.description() == "") {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (modifiers.fLayout.fMaxVertices != -1 && fInvocations > 0 &&
|
||||
!this->caps().gsInvocationsSupport()) {
|
||||
modifiers.fLayout.fMaxVertices *= fInvocations;
|
||||
}
|
||||
return std::make_unique<ModifiersDeclaration>(this->modifiersPool().add(modifiers));
|
||||
}
|
||||
|
||||
@ -630,39 +594,6 @@ std::unique_ptr<Statement> IRGenerator::convertDiscard(const ASTNode& d) {
|
||||
return DiscardStatement::Make(d.fOffset);
|
||||
}
|
||||
|
||||
std::unique_ptr<Block> IRGenerator::applyInvocationIDWorkaround(std::unique_ptr<Block> main) {
|
||||
Layout invokeLayout;
|
||||
Modifiers invokeModifiers(invokeLayout, Modifiers::kHasSideEffects_Flag);
|
||||
const FunctionDeclaration* invokeDecl = fSymbolTable->add(std::make_unique<FunctionDeclaration>(
|
||||
/*offset=*/-1,
|
||||
this->modifiersPool().add(invokeModifiers),
|
||||
"_invoke",
|
||||
std::vector<const Variable*>(),
|
||||
fContext.fTypes.fVoid.get(),
|
||||
fIsBuiltinCode));
|
||||
IntrinsicSet referencedIntrinsics;
|
||||
main = this->finalizeFunction(*invokeDecl, std::move(main), &referencedIntrinsics);
|
||||
auto invokeDef = std::make_unique<FunctionDefinition>(/*offset=*/-1, invokeDecl,
|
||||
fIsBuiltinCode, std::move(main),
|
||||
std::move(referencedIntrinsics));
|
||||
invokeDecl->setDefinition(invokeDef.get());
|
||||
fProgramElements->push_back(std::move(invokeDef));
|
||||
|
||||
using namespace SkSL::dsl;
|
||||
DSLGlobalVar loopIdx("sk_InvocationID");
|
||||
std::unique_ptr<Expression> endPrimitive = this->convertIdentifier(/*offset=*/-1,
|
||||
"EndPrimitive");
|
||||
SkASSERT(endPrimitive);
|
||||
|
||||
std::unique_ptr<Statement> block = DSLBlock(
|
||||
For(loopIdx = 0, loopIdx < fInvocations, loopIdx++, DSLBlock(
|
||||
DSLFunction(invokeDecl)(),
|
||||
DSLExpression(std::move(endPrimitive))({})
|
||||
))
|
||||
).release();
|
||||
return std::unique_ptr<Block>(&block.release()->as<Block>());
|
||||
}
|
||||
|
||||
std::unique_ptr<Statement> IRGenerator::getNormalizeSkPositionCode() {
|
||||
using namespace SkSL::dsl;
|
||||
using SkSL::dsl::Swizzle; // disambiguate from SkSL::Swizzle
|
||||
@ -743,9 +674,6 @@ void IRGenerator::CheckModifiers(const Context& context,
|
||||
{ Layout::kSet_Flag, "set"},
|
||||
{ Layout::kBuiltin_Flag, "builtin"},
|
||||
{ Layout::kInputAttachmentIndex_Flag, "input_attachment_index"},
|
||||
{ Layout::kPrimitive_Flag, "primitive-type"},
|
||||
{ Layout::kMaxVertices_Flag, "max_vertices"},
|
||||
{ Layout::kInvocations_Flag, "invocations"},
|
||||
};
|
||||
|
||||
int layoutFlags = modifiers.fLayout.fFlags;
|
||||
@ -765,11 +693,6 @@ std::unique_ptr<Block> IRGenerator::finalizeFunction(const FunctionDeclaration&
|
||||
std::unique_ptr<Block> body,
|
||||
IntrinsicSet* referencedIntrinsics) {
|
||||
bool isMain = funcDecl.isMain();
|
||||
bool needInvocationIDWorkaround = fInvocations != -1 && isMain &&
|
||||
!this->caps().gsInvocationsSupport();
|
||||
if (needInvocationIDWorkaround) {
|
||||
body = this->applyInvocationIDWorkaround(std::move(body));
|
||||
}
|
||||
if (ProgramKind::kVertex == this->programKind() && isMain && fRTAdjust) {
|
||||
body->children().push_back(this->getNormalizeSkPositionCode());
|
||||
}
|
||||
@ -880,8 +803,7 @@ std::unique_ptr<StructDefinition> IRGenerator::convertStructDefinition(const AST
|
||||
|
||||
std::unique_ptr<SkSL::InterfaceBlock> IRGenerator::convertInterfaceBlock(const ASTNode& intf) {
|
||||
if (this->programKind() != ProgramKind::kFragment &&
|
||||
this->programKind() != ProgramKind::kVertex &&
|
||||
this->programKind() != ProgramKind::kGeometry) {
|
||||
this->programKind() != ProgramKind::kVertex) {
|
||||
this->errorReporter().error(intf.fOffset, "interface block is not allowed here");
|
||||
return nullptr;
|
||||
}
|
||||
@ -1464,30 +1386,11 @@ void IRGenerator::start(const ParsedModule& base,
|
||||
fIsBuiltinCode = isBuiltinCode;
|
||||
|
||||
fInputs = {};
|
||||
fInvocations = -1;
|
||||
fRTAdjust = nullptr;
|
||||
fRTAdjustInterfaceBlock = nullptr;
|
||||
fDefinedStructs.clear();
|
||||
this->pushSymbolTable();
|
||||
|
||||
if (this->programKind() == ProgramKind::kGeometry && !fIsBuiltinCode) {
|
||||
// Declare sk_InvocationID programmatically. With invocations support, it's an 'in' builtin.
|
||||
// If we're applying the workaround, then it's a plain global.
|
||||
bool workaround = !this->caps().gsInvocationsSupport();
|
||||
Modifiers m;
|
||||
if (!workaround) {
|
||||
m.fFlags = Modifiers::kIn_Flag;
|
||||
m.fLayout.fBuiltin = SK_INVOCATIONID_BUILTIN;
|
||||
}
|
||||
auto var = std::make_unique<Variable>(/*offset=*/-1, this->modifiersPool().add(m),
|
||||
"sk_InvocationID", fContext.fTypes.fInt.get(),
|
||||
/*builtin=*/false, Variable::Storage::kGlobal);
|
||||
auto decl = VarDeclaration::Make(fContext, var.get(), fContext.fTypes.fInt.get(),
|
||||
/*arraySize=*/0, /*value=*/nullptr);
|
||||
fSymbolTable->add(std::move(var));
|
||||
fProgramElements->push_back(std::make_unique<GlobalVarDeclaration>(std::move(decl)));
|
||||
}
|
||||
|
||||
if (this->settings().fExternalFunctions) {
|
||||
// Add any external values to the new symbol table, so they're only visible to this Program.
|
||||
for (const std::unique_ptr<ExternalFunction>& ef : *this->settings().fExternalFunctions) {
|
||||
|
@ -221,7 +221,6 @@ private:
|
||||
std::unique_ptr<Statement> convertVarDeclarationStatement(const ASTNode& s);
|
||||
std::unique_ptr<Statement> convertWhile(const ASTNode& w);
|
||||
void convertGlobalVarDeclarations(const ASTNode& decl);
|
||||
std::unique_ptr<Block> applyInvocationIDWorkaround(std::unique_ptr<Block> main);
|
||||
// returns a statement which converts sk_Position from device to normalized coordinates
|
||||
std::unique_ptr<Statement> getNormalizeSkPositionCode();
|
||||
|
||||
@ -262,7 +261,6 @@ private:
|
||||
std::shared_ptr<SymbolTable> fSymbolTable = nullptr;
|
||||
// Symbols which have definitions in the include files.
|
||||
IRIntrinsicMap* fIntrinsics = nullptr;
|
||||
int fInvocations;
|
||||
std::unordered_set<const Type*> fDefinedStructs;
|
||||
std::vector<std::unique_ptr<ProgramElement>>* fProgramElements = nullptr;
|
||||
std::vector<const ProgramElement*>* fSharedElements = nullptr;
|
||||
|
@ -33,8 +33,6 @@
|
||||
SKSL_INTRINSIC(dFdy) \
|
||||
SKSL_INTRINSIC(distance) \
|
||||
SKSL_INTRINSIC(dot) \
|
||||
SKSL_INTRINSIC(EmitVertex) \
|
||||
SKSL_INTRINSIC(EndPrimitive) \
|
||||
SKSL_INTRINSIC(equal) \
|
||||
SKSL_INTRINSIC(exp2) \
|
||||
SKSL_INTRINSIC(exp) \
|
||||
|
@ -139,18 +139,6 @@ static bool detect_shader_settings(const SkSL::String& text,
|
||||
static auto s_emulateAbsIntCaps = Factory::EmulateAbsIntFunction();
|
||||
*caps = s_emulateAbsIntCaps.get();
|
||||
}
|
||||
if (settingsText.consumeSuffix(" GeometryShaderExtensionString")) {
|
||||
static auto s_geometryExtCaps = Factory::GeometryShaderExtensionString();
|
||||
*caps = s_geometryExtCaps.get();
|
||||
}
|
||||
if (settingsText.consumeSuffix(" GeometryShaderSupport")) {
|
||||
static auto s_geometryShaderCaps = Factory::GeometryShaderSupport();
|
||||
*caps = s_geometryShaderCaps.get();
|
||||
}
|
||||
if (settingsText.consumeSuffix(" GSInvocationsExtensionString")) {
|
||||
static auto s_gsInvocationCaps = Factory::GSInvocationsExtensionString();
|
||||
*caps = s_gsInvocationCaps.get();
|
||||
}
|
||||
if (settingsText.consumeSuffix(" IncompleteShortIntPrecision")) {
|
||||
static auto s_incompleteShortIntCaps = Factory::IncompleteShortIntPrecision();
|
||||
*caps = s_incompleteShortIntCaps.get();
|
||||
@ -168,10 +156,6 @@ static bool detect_shader_settings(const SkSL::String& text,
|
||||
Factory::MustForceNegatedLdexpParamToMultiply();
|
||||
*caps = s_negativeLdexpCaps.get();
|
||||
}
|
||||
if (settingsText.consumeSuffix(" NoGSInvocationsSupport")) {
|
||||
static auto s_noGSInvocations = Factory::NoGSInvocationsSupport();
|
||||
*caps = s_noGSInvocations.get();
|
||||
}
|
||||
if (settingsText.consumeSuffix(" RemovePowWithConstantExponent")) {
|
||||
static auto s_powCaps = Factory::RemovePowWithConstantExponent();
|
||||
*caps = s_powCaps.get();
|
||||
@ -281,8 +265,6 @@ ResultCode processCommand(std::vector<SkSL::String>& args) {
|
||||
kind = SkSL::ProgramKind::kVertex;
|
||||
} else if (inputPath.ends_with(".frag") || inputPath.ends_with(".sksl")) {
|
||||
kind = SkSL::ProgramKind::kFragment;
|
||||
} else if (inputPath.ends_with(".geom")) {
|
||||
kind = SkSL::ProgramKind::kGeometry;
|
||||
} else if (inputPath.ends_with(".rtb")) {
|
||||
kind = SkSL::ProgramKind::kRuntimeBlender;
|
||||
} else if (inputPath.ends_with(".rtcf")) {
|
||||
@ -290,7 +272,7 @@ ResultCode processCommand(std::vector<SkSL::String>& args) {
|
||||
} else if (inputPath.ends_with(".rts")) {
|
||||
kind = SkSL::ProgramKind::kRuntimeShader;
|
||||
} else {
|
||||
printf("input filename must end in '.vert', '.frag', '.geom', '.rtb', '.rtcf', "
|
||||
printf("input filename must end in '.vert', '.frag', '.rtb', '.rtcf', "
|
||||
"'.rts', or '.sksl'\n");
|
||||
return ResultCode::kInputError;
|
||||
}
|
||||
@ -354,8 +336,7 @@ ResultCode processCommand(std::vector<SkSL::String>& args) {
|
||||
[](SkSL::Compiler& compiler, SkSL::Program& program, SkSL::OutputStream& out) {
|
||||
return compiler.toSPIRV(program, out);
|
||||
});
|
||||
} else if (outputPath.ends_with(".asm.frag") || outputPath.ends_with(".asm.vert") ||
|
||||
outputPath.ends_with(".asm.geom")) {
|
||||
} else if (outputPath.ends_with(".asm.frag") || outputPath.ends_with(".asm.vert")) {
|
||||
return compileProgram(
|
||||
[](SkSL::Compiler& compiler, SkSL::Program& program, SkSL::OutputStream& out) {
|
||||
// Compile program to SPIR-V assembly in a string-stream.
|
||||
@ -489,7 +470,7 @@ ResultCode processCommand(std::vector<SkSL::String>& args) {
|
||||
}
|
||||
} else {
|
||||
printf("expected output path to end with one of: .glsl, .metal, .spirv, .asm.frag, .skvm, "
|
||||
".stage, .asm.vert, .asm.geom, .cpp, .h (got '%s')\n", outputPath.c_str());
|
||||
".stage, .asm.vert (got '%s')\n", outputPath.c_str());
|
||||
return ResultCode::kConfigurationError;
|
||||
}
|
||||
return ResultCode::kSuccess;
|
||||
|
@ -100,15 +100,6 @@ void Parser::InitLayoutMap() {
|
||||
TOKEN(ORIGIN_UPPER_LEFT, "origin_upper_left");
|
||||
TOKEN(BLEND_SUPPORT_ALL_EQUATIONS, "blend_support_all_equations");
|
||||
TOKEN(PUSH_CONSTANT, "push_constant");
|
||||
TOKEN(POINTS, "points");
|
||||
TOKEN(LINES, "lines");
|
||||
TOKEN(LINE_STRIP, "line_strip");
|
||||
TOKEN(LINES_ADJACENCY, "lines_adjacency");
|
||||
TOKEN(TRIANGLES, "triangles");
|
||||
TOKEN(TRIANGLE_STRIP, "triangle_strip");
|
||||
TOKEN(TRIANGLES_ADJACENCY, "triangles_adjacency");
|
||||
TOKEN(MAX_VERTICES, "max_vertices");
|
||||
TOKEN(INVOCATIONS, "invocations");
|
||||
TOKEN(SRGB_UNPREMUL, "srgb_unpremul");
|
||||
#undef TOKEN
|
||||
}
|
||||
@ -684,13 +675,10 @@ Layout Parser::layout() {
|
||||
int set = -1;
|
||||
int builtin = -1;
|
||||
int inputAttachmentIndex = -1;
|
||||
Layout::Primitive primitive = Layout::kUnspecified_Primitive;
|
||||
int maxVertices = -1;
|
||||
int invocations = -1;
|
||||
if (this->checkNext(Token::Kind::TK_LAYOUT)) {
|
||||
if (!this->expect(Token::Kind::TK_LPAREN, "'('")) {
|
||||
return Layout(flags, location, offset, binding, index, set, builtin,
|
||||
inputAttachmentIndex, primitive, maxVertices, invocations);
|
||||
return Layout(
|
||||
flags, location, offset, binding, index, set, builtin, inputAttachmentIndex);
|
||||
}
|
||||
for (;;) {
|
||||
Token t = this->nextToken();
|
||||
@ -701,13 +689,6 @@ Layout Parser::layout() {
|
||||
}
|
||||
flags |= f;
|
||||
};
|
||||
auto setPrimitive = [&](Layout::Primitive p) {
|
||||
if (flags & Layout::kPrimitive_Flag) {
|
||||
this->error(t, "only one primitive-type layout qualifier is allowed");
|
||||
}
|
||||
flags |= Layout::kPrimitive_Flag;
|
||||
primitive = p;
|
||||
};
|
||||
|
||||
auto found = layoutTokens->find(text);
|
||||
if (found != layoutTokens->end()) {
|
||||
@ -752,35 +733,6 @@ Layout Parser::layout() {
|
||||
setFlag(Layout::kInputAttachmentIndex_Flag);
|
||||
inputAttachmentIndex = this->layoutInt();
|
||||
break;
|
||||
case LayoutToken::POINTS:
|
||||
setPrimitive(Layout::kPoints_Primitive);
|
||||
break;
|
||||
case LayoutToken::LINES:
|
||||
setPrimitive(Layout::kLines_Primitive);
|
||||
break;
|
||||
case LayoutToken::LINE_STRIP:
|
||||
setPrimitive(Layout::kLineStrip_Primitive);
|
||||
break;
|
||||
case LayoutToken::LINES_ADJACENCY:
|
||||
setPrimitive(Layout::kLinesAdjacency_Primitive);
|
||||
break;
|
||||
case LayoutToken::TRIANGLES:
|
||||
setPrimitive(Layout::kTriangles_Primitive);
|
||||
break;
|
||||
case LayoutToken::TRIANGLE_STRIP:
|
||||
setPrimitive(Layout::kTriangleStrip_Primitive);
|
||||
break;
|
||||
case LayoutToken::TRIANGLES_ADJACENCY:
|
||||
setPrimitive(Layout::kTrianglesAdjacency_Primitive);
|
||||
break;
|
||||
case LayoutToken::MAX_VERTICES:
|
||||
setFlag(Layout::kMaxVertices_Flag);
|
||||
maxVertices = this->layoutInt();
|
||||
break;
|
||||
case LayoutToken::INVOCATIONS:
|
||||
setFlag(Layout::kInvocations_Flag);
|
||||
invocations = this->layoutInt();
|
||||
break;
|
||||
default:
|
||||
this->error(t, "'" + text + "' is not a valid layout qualifier");
|
||||
break;
|
||||
@ -796,8 +748,7 @@ Layout Parser::layout() {
|
||||
}
|
||||
}
|
||||
}
|
||||
return Layout(flags, location, offset, binding, index, set, builtin, inputAttachmentIndex,
|
||||
primitive, maxVertices, invocations);
|
||||
return Layout(flags, location, offset, binding, index, set, builtin, inputAttachmentIndex);
|
||||
}
|
||||
|
||||
/* layout? (UNIFORM | CONST | IN | OUT | INOUT | FLAT | NOPERSPECTIVE | INLINE)* */
|
||||
|
@ -40,15 +40,6 @@ public:
|
||||
ORIGIN_UPPER_LEFT,
|
||||
BLEND_SUPPORT_ALL_EQUATIONS,
|
||||
PUSH_CONSTANT,
|
||||
POINTS,
|
||||
LINES,
|
||||
LINE_STRIP,
|
||||
LINES_ADJACENCY,
|
||||
TRIANGLES,
|
||||
TRIANGLE_STRIP,
|
||||
TRIANGLES_ADJACENCY,
|
||||
MAX_VERTICES,
|
||||
INVOCATIONS,
|
||||
SRGB_UNPREMUL,
|
||||
};
|
||||
|
||||
|
@ -107,12 +107,8 @@ Layout Rehydrator::layout() {
|
||||
int set = this->readS8();
|
||||
int builtin = this->readS16();
|
||||
int inputAttachmentIndex = this->readS8();
|
||||
int primitive = this->readS8();
|
||||
int maxVertices = this->readS8();
|
||||
int invocations = this->readS8();
|
||||
return Layout(flags, location, offset, binding, index, set, builtin,
|
||||
inputAttachmentIndex, (Layout::Primitive)primitive, maxVertices,
|
||||
invocations);
|
||||
return Layout(
|
||||
flags, location, offset, binding, index, set, builtin, inputAttachmentIndex);
|
||||
}
|
||||
default:
|
||||
SkASSERT(false);
|
||||
|
@ -99,8 +99,7 @@ public:
|
||||
// int32 value
|
||||
kIntLiteral_Command,
|
||||
// int32 flags, int8 location, int8 offset, int8 binding, int8 index, int8 set,
|
||||
// int16 builtin, int8 inputAttachmentIndex, int8 format, int8 primitive, int8 maxVertices,
|
||||
// int8 invocations, String marker, String when, int8 key, int8 ctype
|
||||
// int16 builtin, int8 inputAttachmentIndex
|
||||
kLayout_Command,
|
||||
// Layout layout, uint8 flags
|
||||
kModifiers8Bit_Command,
|
||||
|
@ -75,11 +75,6 @@ public:
|
||||
return fMustForceNegatedLdexpParamToMultiply;
|
||||
}
|
||||
|
||||
bool fGeometryShaderSupport = true;
|
||||
bool geometryShaderSupport() const {
|
||||
return fGeometryShaderSupport;
|
||||
}
|
||||
|
||||
bool fShaderDerivativeSupport = true;
|
||||
bool shaderDerivativeSupport() const {
|
||||
return fShaderDerivativeSupport;
|
||||
@ -212,16 +207,6 @@ public:
|
||||
return fFragCoordConventionsExtensionString;
|
||||
}
|
||||
|
||||
const char* fGeometryShaderExtensionString = nullptr;
|
||||
const char* geometryShaderExtensionString() const {
|
||||
return fGeometryShaderExtensionString;
|
||||
}
|
||||
|
||||
const char* fGSInvocationsExtensionString = nullptr;
|
||||
const char* gsInvocationsExtensionString() const {
|
||||
return fGSInvocationsExtensionString;
|
||||
}
|
||||
|
||||
const char* fExternalTextureExtensionString = nullptr;
|
||||
const char* externalTextureExtensionString() const {
|
||||
return fExternalTextureExtensionString;
|
||||
@ -237,11 +222,6 @@ public:
|
||||
return fVersionDeclString;
|
||||
}
|
||||
|
||||
bool fGSInvocationsSupport = true;
|
||||
bool gsInvocationsSupport() const {
|
||||
return fGSInvocationsSupport;
|
||||
}
|
||||
|
||||
bool fCanUseFractForNegativeValues = true;
|
||||
bool canUseFractForNegativeValues() const {
|
||||
return fCanUseFractForNegativeValues;
|
||||
@ -366,32 +346,6 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
static ShaderCapsPointer GeometryShaderExtensionString() {
|
||||
ShaderCapsPointer result = MakeShaderCaps();
|
||||
result->fVersionDeclString = "#version 310es";
|
||||
result->fGeometryShaderSupport = true;
|
||||
result->fGeometryShaderExtensionString = "GL_EXT_geometry_shader";
|
||||
result->fGSInvocationsSupport = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
static ShaderCapsPointer GeometryShaderSupport() {
|
||||
ShaderCapsPointer result = MakeShaderCaps();
|
||||
result->fVersionDeclString = "#version 400";
|
||||
result->fGeometryShaderSupport = true;
|
||||
result->fGSInvocationsSupport = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
static ShaderCapsPointer GSInvocationsExtensionString() {
|
||||
ShaderCapsPointer result = MakeShaderCaps();
|
||||
result->fVersionDeclString = "#version 400";
|
||||
result->fGeometryShaderSupport = true;
|
||||
result->fGSInvocationsSupport = true;
|
||||
result->fGSInvocationsExtensionString = "GL_ARB_gpu_shader5";
|
||||
return result;
|
||||
}
|
||||
|
||||
static ShaderCapsPointer IncompleteShortIntPrecision() {
|
||||
ShaderCapsPointer result = MakeShaderCaps();
|
||||
result->fVersionDeclString = "#version 310es";
|
||||
@ -420,14 +374,6 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
static ShaderCapsPointer NoGSInvocationsSupport() {
|
||||
ShaderCapsPointer result = MakeShaderCaps();
|
||||
result->fVersionDeclString = "#version 400";
|
||||
result->fGeometryShaderSupport = true;
|
||||
result->fGSInvocationsSupport = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
static ShaderCapsPointer RemovePowWithConstantExponent() {
|
||||
ShaderCapsPointer result = MakeShaderCaps();
|
||||
result->fVersionDeclString = "#version 400";
|
||||
|
@ -784,12 +784,6 @@ void GLSLCodeGenerator::writeVariableReference(const VariableReference& ref) {
|
||||
case SK_INSTANCEID_BUILTIN:
|
||||
this->write("gl_InstanceID");
|
||||
break;
|
||||
case SK_IN_BUILTIN:
|
||||
this->write("gl_in");
|
||||
break;
|
||||
case SK_INVOCATIONID_BUILTIN:
|
||||
this->write("gl_InvocationID");
|
||||
break;
|
||||
case SK_LASTFRAGCOLOR_BUILTIN:
|
||||
this->write(this->caps().fbFetchColorName());
|
||||
break;
|
||||
@ -1448,12 +1442,6 @@ void GLSLCodeGenerator::writeProgramElement(const ProgramElement& e) {
|
||||
break;
|
||||
case ProgramElement::Kind::kModifiers: {
|
||||
const Modifiers& modifiers = e.as<ModifiersDeclaration>().modifiers();
|
||||
if (!fFoundGSInvocations && modifiers.fLayout.fInvocations >= 0) {
|
||||
if (this->caps().gsInvocationsExtensionString()) {
|
||||
this->writeExtension(this->caps().gsInvocationsExtensionString());
|
||||
}
|
||||
fFoundGSInvocations = true;
|
||||
}
|
||||
this->writeModifiers(modifiers, true);
|
||||
this->writeLine(";");
|
||||
break;
|
||||
@ -1478,10 +1466,6 @@ void GLSLCodeGenerator::writeInputVars() {
|
||||
|
||||
bool GLSLCodeGenerator::generateCode() {
|
||||
this->writeHeader();
|
||||
if (fProgram.fConfig->fKind == ProgramKind::kGeometry &&
|
||||
this->caps().geometryShaderExtensionString()) {
|
||||
this->writeExtension(this->caps().geometryShaderExtensionString());
|
||||
}
|
||||
OutputStream* rawOut = fOut;
|
||||
StringStream body;
|
||||
fOut = &body;
|
||||
|
@ -189,7 +189,6 @@ protected:
|
||||
bool fFoundDerivatives = false;
|
||||
bool fFoundExternalSamplerDecl = false;
|
||||
bool fFoundRectSamplerDecl = false;
|
||||
bool fFoundGSInvocations = false;
|
||||
bool fSetupClockwise = false;
|
||||
bool fSetupFragPosition = false;
|
||||
bool fSetupFragCoordWorkaround = false;
|
||||
|
@ -171,8 +171,6 @@ void SPIRVCodeGenerator::setupIntrinsics() {
|
||||
SpvOpSGreaterThanEqual,
|
||||
SpvOpUGreaterThanEqual,
|
||||
SpvOpUndef);
|
||||
fIntrinsicMap[k_EmitVertex_IntrinsicKind] = ALL_SPIRV(EmitVertex);
|
||||
fIntrinsicMap[k_EndPrimitive_IntrinsicKind] = ALL_SPIRV(EndPrimitive);
|
||||
// interpolateAt* not yet supported...
|
||||
}
|
||||
|
||||
@ -399,12 +397,7 @@ void SPIRVCodeGenerator::writeCapabilities(OutputStream& out) {
|
||||
this->writeInstruction(SpvOpCapability, (SpvId) i, out);
|
||||
}
|
||||
}
|
||||
if (fProgram.fConfig->fKind == ProgramKind::kGeometry) {
|
||||
this->writeInstruction(SpvOpCapability, SpvCapabilityGeometry, out);
|
||||
}
|
||||
else {
|
||||
this->writeInstruction(SpvOpCapability, SpvCapabilityShader, out);
|
||||
}
|
||||
this->writeInstruction(SpvOpCapability, SpvCapabilityShader, out);
|
||||
}
|
||||
|
||||
SpvId SPIRVCodeGenerator::nextId(const Type* type) {
|
||||
@ -1999,13 +1992,7 @@ std::unique_ptr<SPIRVCodeGenerator::LValue> SPIRVCodeGenerator::getLValue(const
|
||||
/*isMemoryObjectPointer=*/true,
|
||||
this->getType(type), precision);
|
||||
}
|
||||
SpvId typeId;
|
||||
if (var.modifiers().fLayout.fBuiltin == SK_IN_BUILTIN) {
|
||||
typeId = this->getType(*Type::MakeArrayType("sk_in", var.type().componentType(),
|
||||
fSkInCount));
|
||||
} else {
|
||||
typeId = this->getType(type, this->memoryLayoutForVariable(var));
|
||||
}
|
||||
SpvId typeId = this->getType(type, this->memoryLayoutForVariable(var));
|
||||
auto entry = fVariableMap.find(&var);
|
||||
SkASSERTF(entry != fVariableMap.end(), "%s", expr.description().c_str());
|
||||
return std::make_unique<PointerLValue>(*this, entry->second,
|
||||
@ -2979,8 +2966,7 @@ void SPIRVCodeGenerator::writeLayout(const Layout& layout, SpvId target) {
|
||||
layout.fInputAttachmentIndex, fDecorationBuffer);
|
||||
fCapabilities |= (((uint64_t) 1) << SpvCapabilityInputAttachment);
|
||||
}
|
||||
if (layout.fBuiltin >= 0 && layout.fBuiltin != SK_FRAGCOLOR_BUILTIN &&
|
||||
layout.fBuiltin != SK_IN_BUILTIN && layout.fBuiltin != SK_OUT_BUILTIN) {
|
||||
if (layout.fBuiltin >= 0 && layout.fBuiltin != SK_FRAGCOLOR_BUILTIN) {
|
||||
this->writeInstruction(SpvOpDecorate, target, SpvDecorationBuiltIn, layout.fBuiltin,
|
||||
fDecorationBuffer);
|
||||
}
|
||||
@ -3018,28 +3004,6 @@ MemoryLayout SPIRVCodeGenerator::memoryLayoutForVariable(const Variable& v) cons
|
||||
return pushConstant ? MemoryLayout(MemoryLayout::k430_Standard) : fDefaultLayout;
|
||||
}
|
||||
|
||||
static void update_sk_in_count(const Modifiers& m, int* outSkInCount) {
|
||||
switch (m.fLayout.fPrimitive) {
|
||||
case Layout::kPoints_Primitive:
|
||||
*outSkInCount = 1;
|
||||
break;
|
||||
case Layout::kLines_Primitive:
|
||||
*outSkInCount = 2;
|
||||
break;
|
||||
case Layout::kLinesAdjacency_Primitive:
|
||||
*outSkInCount = 4;
|
||||
break;
|
||||
case Layout::kTriangles_Primitive:
|
||||
*outSkInCount = 3;
|
||||
break;
|
||||
case Layout::kTrianglesAdjacency_Primitive:
|
||||
*outSkInCount = 6;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SpvId SPIRVCodeGenerator::writeInterfaceBlock(const InterfaceBlock& intf, bool appendRTFlip) {
|
||||
MemoryLayout memoryLayout = this->memoryLayoutForVariable(intf.variable());
|
||||
SpvId result = this->nextId(nullptr);
|
||||
@ -3063,10 +3027,7 @@ SpvId SPIRVCodeGenerator::writeInterfaceBlock(const InterfaceBlock& intf, bool a
|
||||
/*index=*/-1,
|
||||
/*set=*/-1,
|
||||
/*builtin=*/-1,
|
||||
/*inputAttachmentIndex=*/-1,
|
||||
Layout::kUnspecified_Primitive,
|
||||
/*maxVertices=*/1,
|
||||
/*invocations=*/-1),
|
||||
/*inputAttachmentIndex=*/-1),
|
||||
/*flags=*/0),
|
||||
SKSL_RTFLIP_NAME,
|
||||
fContext.fTypes.fFloat2.get());
|
||||
@ -3096,20 +3057,8 @@ SpvId SPIRVCodeGenerator::writeInterfaceBlock(const InterfaceBlock& intf, bool a
|
||||
fWroteRTFlip = true;
|
||||
return result;
|
||||
}
|
||||
SpvId typeId;
|
||||
const Modifiers& intfModifiers = intfVar.modifiers();
|
||||
if (intfModifiers.fLayout.fBuiltin == SK_IN_BUILTIN) {
|
||||
for (const ProgramElement* e : fProgram.elements()) {
|
||||
if (e->is<ModifiersDeclaration>()) {
|
||||
const Modifiers& m = e->as<ModifiersDeclaration>().modifiers();
|
||||
update_sk_in_count(m, &fSkInCount);
|
||||
}
|
||||
}
|
||||
typeId = this->getType(*Type::MakeArrayType("sk_in", type.componentType(), fSkInCount),
|
||||
memoryLayout);
|
||||
} else {
|
||||
typeId = this->getType(type, memoryLayout);
|
||||
}
|
||||
SpvId typeId = this->getType(type, memoryLayout);
|
||||
if (intfModifiers.fLayout.fBuiltin == -1) {
|
||||
this->writeInstruction(SpvOpDecorate, typeId, SpvDecorationBlock, fDecorationBuffer);
|
||||
}
|
||||
@ -3170,14 +3119,7 @@ void SPIRVCodeGenerator::writeGlobalVar(ProgramKind kind, const VarDeclaration&
|
||||
}
|
||||
SpvId id = this->nextId(&type);
|
||||
fVariableMap[&var] = id;
|
||||
SpvId typeId;
|
||||
if (var.modifiers().fLayout.fBuiltin == SK_IN_BUILTIN) {
|
||||
typeId = this->getPointerType(
|
||||
*Type::MakeArrayType("sk_in", type.componentType(), fSkInCount),
|
||||
storageClass);
|
||||
} else {
|
||||
typeId = this->getPointerType(type, storageClass);
|
||||
}
|
||||
SpvId typeId = this->getPointerType(type, storageClass);
|
||||
this->writeInstruction(SpvOpVariable, typeId, id, storageClass, fConstantBuffer);
|
||||
this->writeInstruction(SpvOpName, id, var.name(), fNameBuffer);
|
||||
if (varDecl.value()) {
|
||||
@ -3407,72 +3349,6 @@ void SPIRVCodeGenerator::writeReturnStatement(const ReturnStatement& r, OutputSt
|
||||
}
|
||||
}
|
||||
|
||||
void SPIRVCodeGenerator::writeGeometryShaderExecutionMode(SpvId entryPoint, OutputStream& out) {
|
||||
SkASSERT(fProgram.fConfig->fKind == ProgramKind::kGeometry);
|
||||
int invocations = 1;
|
||||
for (const ProgramElement* e : fProgram.elements()) {
|
||||
if (e->is<ModifiersDeclaration>()) {
|
||||
const Modifiers& m = e->as<ModifiersDeclaration>().modifiers();
|
||||
if (m.fFlags & Modifiers::kIn_Flag) {
|
||||
if (m.fLayout.fInvocations != -1) {
|
||||
invocations = m.fLayout.fInvocations;
|
||||
}
|
||||
SpvId input;
|
||||
switch (m.fLayout.fPrimitive) {
|
||||
case Layout::kPoints_Primitive:
|
||||
input = SpvExecutionModeInputPoints;
|
||||
break;
|
||||
case Layout::kLines_Primitive:
|
||||
input = SpvExecutionModeInputLines;
|
||||
break;
|
||||
case Layout::kLinesAdjacency_Primitive:
|
||||
input = SpvExecutionModeInputLinesAdjacency;
|
||||
break;
|
||||
case Layout::kTriangles_Primitive:
|
||||
input = SpvExecutionModeTriangles;
|
||||
break;
|
||||
case Layout::kTrianglesAdjacency_Primitive:
|
||||
input = SpvExecutionModeInputTrianglesAdjacency;
|
||||
break;
|
||||
default:
|
||||
input = 0;
|
||||
break;
|
||||
}
|
||||
update_sk_in_count(m, &fSkInCount);
|
||||
if (input) {
|
||||
this->writeInstruction(SpvOpExecutionMode, entryPoint, input, out);
|
||||
}
|
||||
} else if (m.fFlags & Modifiers::kOut_Flag) {
|
||||
SpvId output;
|
||||
switch (m.fLayout.fPrimitive) {
|
||||
case Layout::kPoints_Primitive:
|
||||
output = SpvExecutionModeOutputPoints;
|
||||
break;
|
||||
case Layout::kLineStrip_Primitive:
|
||||
output = SpvExecutionModeOutputLineStrip;
|
||||
break;
|
||||
case Layout::kTriangleStrip_Primitive:
|
||||
output = SpvExecutionModeOutputTriangleStrip;
|
||||
break;
|
||||
default:
|
||||
output = 0;
|
||||
break;
|
||||
}
|
||||
if (output) {
|
||||
this->writeInstruction(SpvOpExecutionMode, entryPoint, output, out);
|
||||
}
|
||||
if (m.fLayout.fMaxVertices != -1) {
|
||||
this->writeInstruction(SpvOpExecutionMode, entryPoint,
|
||||
SpvExecutionModeOutputVertices, m.fLayout.fMaxVertices,
|
||||
out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this->writeInstruction(SpvOpExecutionMode, entryPoint, SpvExecutionModeInvocations,
|
||||
invocations, out);
|
||||
}
|
||||
|
||||
// Given any function, returns the top-level symbol table (OUTSIDE of the function's scope).
|
||||
static std::shared_ptr<SymbolTable> get_top_level_symbol_table(const FunctionDeclaration& anyFunc) {
|
||||
return anyFunc.definition()->body()->as<Block>().symbolTable()->fParent;
|
||||
@ -3603,10 +3479,7 @@ void SPIRVCodeGenerator::addRTFlipUniform(int offset) {
|
||||
/*index=*/-1,
|
||||
/*set=*/-1,
|
||||
/*builtin=*/-1,
|
||||
/*inputAttachmentIndex=*/-1,
|
||||
Layout::kUnspecified_Primitive,
|
||||
/*maxVertices=*/1,
|
||||
/*invocations=*/-1),
|
||||
/*inputAttachmentIndex=*/-1),
|
||||
/*flags=*/0),
|
||||
SKSL_RTFLIP_NAME,
|
||||
fContext.fTypes.fFloat2.get());
|
||||
@ -3633,10 +3506,7 @@ void SPIRVCodeGenerator::addRTFlipUniform(int offset) {
|
||||
/*index=*/-1,
|
||||
set,
|
||||
/*builtin=*/-1,
|
||||
/*inputAttachmentIndex=*/-1,
|
||||
Layout::kUnspecified_Primitive,
|
||||
/*maxVertices=*/-1,
|
||||
/*invocations=*/-1),
|
||||
/*inputAttachmentIndex=*/-1),
|
||||
Modifiers::kUniform_Flag);
|
||||
modsPtr = fProgram.fModifiers->add(modifiers);
|
||||
}
|
||||
@ -3745,9 +3615,6 @@ void SPIRVCodeGenerator::writeInstructions(const Program& program, OutputStream&
|
||||
case ProgramKind::kFragment:
|
||||
this->writeWord(SpvExecutionModelFragment, out);
|
||||
break;
|
||||
case ProgramKind::kGeometry:
|
||||
this->writeWord(SpvExecutionModelGeometry, out);
|
||||
break;
|
||||
default:
|
||||
SK_ABORT("cannot write this kind of program to SPIR-V\n");
|
||||
}
|
||||
@ -3757,9 +3624,6 @@ void SPIRVCodeGenerator::writeInstructions(const Program& program, OutputStream&
|
||||
for (int var : interfaceVars) {
|
||||
this->writeWord(var, out);
|
||||
}
|
||||
if (program.fConfig->fKind == ProgramKind::kGeometry) {
|
||||
this->writeGeometryShaderExecutionMode(entryPoint, out);
|
||||
}
|
||||
if (program.fConfig->fKind == ProgramKind::kFragment) {
|
||||
this->writeInstruction(SpvOpExecutionMode,
|
||||
fFunctionMap[main],
|
||||
|
@ -440,8 +440,6 @@ private:
|
||||
int32_t word5, int32_t word6, int32_t word7, int32_t word8,
|
||||
OutputStream& out);
|
||||
|
||||
void writeGeometryShaderExecutionMode(SpvId entryPoint, OutputStream& out);
|
||||
|
||||
bool isDead(const Variable& var) const;
|
||||
|
||||
MemoryLayout memoryLayoutForVariable(const Variable&) const;
|
||||
|
@ -115,9 +115,7 @@ DSLGlobalVar::DSLGlobalVar(const char* name)
|
||||
const SkSL::Modifiers* modifiers = DSLWriter::Context().fModifiersPool->add(
|
||||
SkSL::Modifiers(SkSL::Layout(/*flags=*/0, /*location=*/-1, /*offset=*/-1,
|
||||
/*binding=*/-1, /*index=*/-1, /*set=*/-1,
|
||||
SK_MAIN_COORDS_BUILTIN, /*inputAttachmentIndex=*/-1,
|
||||
Layout::kUnspecified_Primitive, /*maxVertices=*/1,
|
||||
/*invocations=*/-1),
|
||||
SK_MAIN_COORDS_BUILTIN, /*inputAttachmentIndex=*/-1),
|
||||
SkSL::Modifiers::kNo_Flag));
|
||||
|
||||
fVar = DSLWriter::SymbolTable()->takeOwnershipOfIRNode(std::make_unique<SkSL::Variable>(
|
||||
|
@ -10,23 +10,23 @@ static uint8_t SKSL_INCLUDE_sksl_frag[] = {99,0,
|
||||
48,5,0,
|
||||
52,1,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,15,0,255,255,255,255,2,2,0,
|
||||
35,0,2,0,0,255,255,255,255,255,15,0,255,2,2,0,
|
||||
49,2,0,15,0,0,
|
||||
52,3,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,17,0,255,255,255,255,2,22,0,
|
||||
35,0,2,0,0,255,255,255,255,255,17,0,255,2,22,0,
|
||||
49,4,0,35,0,0,
|
||||
52,5,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,15,39,255,255,255,255,4,40,0,
|
||||
35,0,2,0,0,255,255,255,255,255,15,39,255,4,40,0,
|
||||
49,6,0,65,0,0,
|
||||
52,7,0,
|
||||
36,
|
||||
35,144,2,0,0,0,255,255,0,255,17,39,255,255,255,255,4,71,0,
|
||||
35,144,2,0,0,0,255,255,0,255,17,39,255,4,71,0,
|
||||
46,6,0,0,
|
||||
52,8,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,24,39,255,255,255,255,0,84,0,
|
||||
35,0,2,0,0,255,255,255,255,255,24,39,255,0,84,0,
|
||||
46,6,0,0,5,0,
|
||||
2,0,
|
||||
1,0,
|
||||
|
@ -1,77 +0,0 @@
|
||||
static uint8_t SKSL_INCLUDE_sksl_geom[] = {134,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,
|
||||
12,115,107,95,80,111,105,110,116,83,105,122,101,
|
||||
5,102,108,111,97,116,
|
||||
5,115,107,95,105,110,
|
||||
6,115,116,114,101,97,109,
|
||||
3,105,110,116,
|
||||
16,69,109,105,116,83,116,114,101,97,109,86,101,114,116,101,120,
|
||||
4,118,111,105,100,
|
||||
18,69,110,100,83,116,114,101,97,109,80,114,105,109,105,116,105,118,101,
|
||||
10,69,109,105,116,86,101,114,116,101,120,
|
||||
12,69,110,100,80,114,105,109,105,116,105,118,101,
|
||||
0,
|
||||
48,12,0,
|
||||
43,1,0,2,0,2,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,0,0,255,255,255,255,0,15,0,
|
||||
49,2,0,27,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,1,0,255,255,255,255,0,34,0,
|
||||
49,3,0,47,0,
|
||||
52,4,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,18,39,255,255,255,255,2,53,0,
|
||||
0,5,0,
|
||||
46,1,0,255,0,
|
||||
43,6,0,2,0,2,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,0,0,255,255,255,255,0,15,0,
|
||||
46,2,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,1,0,255,255,255,255,0,34,0,
|
||||
46,3,0,
|
||||
52,7,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,23,39,255,255,255,255,4,2,0,
|
||||
46,6,0,0,
|
||||
23,7,0,0,
|
||||
23,7,0,1,
|
||||
52,8,0,
|
||||
17,59,0,
|
||||
49,9,0,66,0,3,
|
||||
29,10,0,
|
||||
36,
|
||||
16,64,70,0,1,8,0,
|
||||
49,11,0,87,0,
|
||||
52,12,0,
|
||||
17,59,0,
|
||||
46,9,0,3,
|
||||
29,13,0,
|
||||
36,
|
||||
16,64,92,0,1,12,0,
|
||||
46,11,0,
|
||||
29,14,0,
|
||||
36,
|
||||
16,64,111,0,0,
|
||||
46,11,0,
|
||||
29,15,0,
|
||||
36,
|
||||
16,64,122,0,0,
|
||||
46,11,0,7,0,
|
||||
7,0,
|
||||
10,0,
|
||||
11,0,
|
||||
9,0,
|
||||
5,0,
|
||||
4,0,
|
||||
1,0,
|
||||
20,
|
||||
33,
|
||||
46,4,0,2,0,53,0,255,
|
||||
33,
|
||||
46,7,0,2,0,135,0,0,
|
||||
21,};
|
||||
static constexpr size_t SKSL_INCLUDE_sksl_geom_LENGTH = sizeof(SKSL_INCLUDE_sksl_geom);
|
@ -20,7 +20,7 @@ static uint8_t SKSL_INCLUDE_sksl_rt_shader[] = {113,0,
|
||||
48,23,0,
|
||||
52,1,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,15,0,255,255,255,255,0,2,0,
|
||||
35,0,2,0,0,255,255,255,255,255,15,0,255,0,2,0,
|
||||
49,2,0,15,0,0,
|
||||
52,3,0,
|
||||
17,22,0,
|
||||
|
@ -11,10 +11,10 @@ static uint8_t SKSL_INCLUDE_sksl_vert[] = {82,0,
|
||||
48,6,0,
|
||||
43,1,0,2,0,2,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,0,0,255,255,255,255,0,15,0,
|
||||
35,0,2,0,0,255,255,255,255,255,0,0,255,0,15,0,
|
||||
49,2,0,27,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,1,0,255,255,255,255,0,34,0,
|
||||
35,0,2,0,0,255,255,255,255,255,1,0,255,0,34,0,
|
||||
49,3,0,47,0,
|
||||
52,4,0,
|
||||
36,
|
||||
@ -24,11 +24,11 @@ static uint8_t SKSL_INCLUDE_sksl_vert[] = {82,0,
|
||||
23,4,0,1,
|
||||
52,5,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,42,0,255,255,255,255,2,53,0,
|
||||
35,0,2,0,0,255,255,255,255,255,42,0,255,2,53,0,
|
||||
49,6,0,65,0,0,
|
||||
52,7,0,
|
||||
36,
|
||||
35,0,2,0,0,255,255,255,255,255,43,0,255,255,255,255,2,69,0,
|
||||
35,0,2,0,0,255,255,255,255,255,43,0,255,2,69,0,
|
||||
46,6,0,0,4,0,
|
||||
5,0,
|
||||
3,0,
|
||||
|
@ -203,7 +203,6 @@ static bool check_main_signature(const Context& context, int offset, const Type&
|
||||
break;
|
||||
}
|
||||
case ProgramKind::kVertex:
|
||||
case ProgramKind::kGeometry:
|
||||
if (parameters.size()) {
|
||||
errors.error(offset, "shader 'main' must have zero parameters");
|
||||
return false;
|
||||
|
@ -1,19 +0,0 @@
|
||||
// defines built-in interfaces supported by SkiaSL geometry shaders
|
||||
|
||||
layout(builtin=10002) in sk_PerVertex {
|
||||
layout(builtin=0) float4 sk_Position;
|
||||
layout(builtin=1) float sk_PointSize;
|
||||
} sk_in[];
|
||||
|
||||
layout(builtin=10007) out sk_PerVertex {
|
||||
layout(builtin=0) float4 sk_Position;
|
||||
layout(builtin=1) float sk_PointSize;
|
||||
};
|
||||
|
||||
// sk_InvocationID exists, but is declared programmatically (to support a workaround)
|
||||
// layout(builtin=8) in int sk_InvocationID;
|
||||
|
||||
sk_has_side_effects void EmitStreamVertex(int stream);
|
||||
sk_has_side_effects void EndStreamPrimitive(int stream);
|
||||
sk_has_side_effects void EmitVertex();
|
||||
sk_has_side_effects void EndPrimitive();
|
@ -1,29 +1,25 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: 15: layout qualifier 'origin_upper_left' is not permitted here
|
||||
error: 15: layout qualifier 'push_constant' is not permitted here
|
||||
error: 15: layout qualifier 'blend_support_all_equations' is not permitted here
|
||||
error: 15: layout qualifier 'srgb_unpremul' is not permitted here
|
||||
error: 15: layout qualifier 'location' is not permitted here
|
||||
error: 15: layout qualifier 'offset' is not permitted here
|
||||
error: 15: layout qualifier 'binding' is not permitted here
|
||||
error: 15: layout qualifier 'index' is not permitted here
|
||||
error: 15: layout qualifier 'set' is not permitted here
|
||||
error: 15: layout qualifier 'builtin' is not permitted here
|
||||
error: 15: layout qualifier 'input_attachment_index' is not permitted here
|
||||
error: 15: layout qualifier 'max_vertices' is not permitted here
|
||||
error: 15: layout qualifier 'invocations' is not permitted here
|
||||
error: 31: layout qualifier 'origin_upper_left' is not permitted here
|
||||
error: 31: layout qualifier 'push_constant' is not permitted here
|
||||
error: 31: layout qualifier 'blend_support_all_equations' is not permitted here
|
||||
error: 31: layout qualifier 'srgb_unpremul' is not permitted here
|
||||
error: 31: layout qualifier 'location' is not permitted here
|
||||
error: 31: layout qualifier 'offset' is not permitted here
|
||||
error: 31: layout qualifier 'binding' is not permitted here
|
||||
error: 31: layout qualifier 'index' is not permitted here
|
||||
error: 31: layout qualifier 'set' is not permitted here
|
||||
error: 31: layout qualifier 'builtin' is not permitted here
|
||||
error: 31: layout qualifier 'input_attachment_index' is not permitted here
|
||||
error: 31: layout qualifier 'max_vertices' is not permitted here
|
||||
error: 31: layout qualifier 'invocations' is not permitted here
|
||||
26 errors
|
||||
error: 13: layout qualifier 'origin_upper_left' is not permitted here
|
||||
error: 13: layout qualifier 'push_constant' is not permitted here
|
||||
error: 13: layout qualifier 'blend_support_all_equations' is not permitted here
|
||||
error: 13: layout qualifier 'srgb_unpremul' is not permitted here
|
||||
error: 13: layout qualifier 'location' is not permitted here
|
||||
error: 13: layout qualifier 'offset' is not permitted here
|
||||
error: 13: layout qualifier 'binding' is not permitted here
|
||||
error: 13: layout qualifier 'index' is not permitted here
|
||||
error: 13: layout qualifier 'set' is not permitted here
|
||||
error: 13: layout qualifier 'builtin' is not permitted here
|
||||
error: 13: layout qualifier 'input_attachment_index' is not permitted here
|
||||
error: 27: layout qualifier 'origin_upper_left' is not permitted here
|
||||
error: 27: layout qualifier 'push_constant' is not permitted here
|
||||
error: 27: layout qualifier 'blend_support_all_equations' is not permitted here
|
||||
error: 27: layout qualifier 'srgb_unpremul' is not permitted here
|
||||
error: 27: layout qualifier 'location' is not permitted here
|
||||
error: 27: layout qualifier 'offset' is not permitted here
|
||||
error: 27: layout qualifier 'binding' is not permitted here
|
||||
error: 27: layout qualifier 'index' is not permitted here
|
||||
error: 27: layout qualifier 'set' is not permitted here
|
||||
error: 27: layout qualifier 'builtin' is not permitted here
|
||||
error: 27: layout qualifier 'input_attachment_index' is not permitted here
|
||||
22 errors
|
||||
|
@ -1,8 +0,0 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: 3: only one primitive-type layout qualifier is allowed
|
||||
error: 4: only one primitive-type layout qualifier is allowed
|
||||
error: 5: only one primitive-type layout qualifier is allowed
|
||||
error: 6: only one primitive-type layout qualifier is allowed
|
||||
error: 7: only one primitive-type layout qualifier is allowed
|
||||
5 errors
|
@ -1,16 +1,14 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: 16: layout qualifier 'origin_upper_left' appears more than once
|
||||
error: 17: layout qualifier 'push_constant' appears more than once
|
||||
error: 18: layout qualifier 'blend_support_all_equations' appears more than once
|
||||
error: 19: layout qualifier 'srgb_unpremul' appears more than once
|
||||
error: 20: layout qualifier 'location' appears more than once
|
||||
error: 21: layout qualifier 'offset' appears more than once
|
||||
error: 22: layout qualifier 'binding' appears more than once
|
||||
error: 23: layout qualifier 'index' appears more than once
|
||||
error: 24: layout qualifier 'set' appears more than once
|
||||
error: 25: layout qualifier 'builtin' appears more than once
|
||||
error: 26: layout qualifier 'input_attachment_index' appears more than once
|
||||
error: 27: layout qualifier 'max_vertices' appears more than once
|
||||
error: 28: layout qualifier 'invocations' appears more than once
|
||||
13 errors
|
||||
error: 14: layout qualifier 'origin_upper_left' appears more than once
|
||||
error: 15: layout qualifier 'push_constant' appears more than once
|
||||
error: 16: layout qualifier 'blend_support_all_equations' appears more than once
|
||||
error: 17: layout qualifier 'srgb_unpremul' appears more than once
|
||||
error: 18: layout qualifier 'location' appears more than once
|
||||
error: 19: layout qualifier 'offset' appears more than once
|
||||
error: 20: layout qualifier 'binding' appears more than once
|
||||
error: 21: layout qualifier 'index' appears more than once
|
||||
error: 22: layout qualifier 'set' appears more than once
|
||||
error: 23: layout qualifier 'builtin' appears more than once
|
||||
error: 24: layout qualifier 'input_attachment_index' appears more than once
|
||||
11 errors
|
||||
|
@ -1,60 +0,0 @@
|
||||
OpCapability Geometry
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Geometry %main "main" %3 %8 %sk_InvocationID
|
||||
OpExecutionMode %main InputPoints
|
||||
OpExecutionMode %main OutputLineStrip
|
||||
OpExecutionMode %main OutputVertices 2
|
||||
OpExecutionMode %main Invocations 2
|
||||
OpName %sk_PerVertex "sk_PerVertex"
|
||||
OpMemberName %sk_PerVertex 0 "sk_Position"
|
||||
OpMemberName %sk_PerVertex 1 "sk_PointSize"
|
||||
OpName %sk_InvocationID "sk_InvocationID"
|
||||
OpName %main "main"
|
||||
OpMemberDecorate %sk_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %sk_PerVertex 1 BuiltIn PointSize
|
||||
OpDecorate %_arr_sk_PerVertex_int_1 ArrayStride 32
|
||||
OpDecorate %sk_InvocationID BuiltIn InvocationId
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%sk_PerVertex = OpTypeStruct %v4float %float
|
||||
%_ptr_Output_sk_PerVertex = OpTypePointer Output %sk_PerVertex
|
||||
%3 = OpVariable %_ptr_Output_sk_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%_arr_sk_PerVertex_int_1 = OpTypeArray %sk_PerVertex %int_1
|
||||
%_ptr_Input__arr_sk_PerVertex_int_1 = OpTypePointer Input %_arr_sk_PerVertex_int_1
|
||||
%8 = OpVariable %_ptr_Input__arr_sk_PerVertex_int_1 Input
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%sk_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%float_n0_5 = OpConstant %float -0.5
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%main = OpFunction %void None %16
|
||||
%17 = OpLabel
|
||||
%19 = OpAccessChain %_ptr_Input_v4float %8 %int_0 %int_0
|
||||
%21 = OpLoad %v4float %19
|
||||
%24 = OpLoad %int %sk_InvocationID
|
||||
%25 = OpConvertSToF %float %24
|
||||
%26 = OpCompositeConstruct %v4float %float_n0_5 %float_0 %float_0 %25
|
||||
%27 = OpFAdd %v4float %21 %26
|
||||
%28 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
OpStore %28 %27
|
||||
OpEmitVertex
|
||||
%31 = OpAccessChain %_ptr_Input_v4float %8 %int_0 %int_0
|
||||
%32 = OpLoad %v4float %31
|
||||
%34 = OpLoad %int %sk_InvocationID
|
||||
%35 = OpConvertSToF %float %34
|
||||
%36 = OpCompositeConstruct %v4float %float_0_5 %float_0 %float_0 %35
|
||||
%37 = OpFAdd %v4float %32 %36
|
||||
%38 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
OpStore %38 %37
|
||||
OpEmitVertex
|
||||
OpEndPrimitive
|
||||
OpReturn
|
||||
OpFunctionEnd
|
@ -1,11 +0,0 @@
|
||||
#version 400
|
||||
layout (points) in ;
|
||||
layout (invocations = 2) in ;
|
||||
layout (line_strip, max_vertices = 2) out ;
|
||||
void main() {
|
||||
gl_Position = gl_in[0].gl_Position + vec4(-0.5, 0.0, 0.0, float(gl_InvocationID));
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[0].gl_Position + vec4(0.5, 0.0, 0.0, float(gl_InvocationID));
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: unsupported kind of program
|
||||
1 error
|
@ -1,50 +0,0 @@
|
||||
OpCapability Geometry
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Geometry %main "main" %3 %8 %sk_InvocationID
|
||||
OpExecutionMode %main InputPoints
|
||||
OpExecutionMode %main OutputLineStrip
|
||||
OpExecutionMode %main OutputVertices 2
|
||||
OpExecutionMode %main Invocations 3
|
||||
OpName %sk_PerVertex "sk_PerVertex"
|
||||
OpMemberName %sk_PerVertex 0 "sk_Position"
|
||||
OpMemberName %sk_PerVertex 1 "sk_PointSize"
|
||||
OpName %sk_InvocationID "sk_InvocationID"
|
||||
OpName %main "main"
|
||||
OpMemberDecorate %sk_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %sk_PerVertex 1 BuiltIn PointSize
|
||||
OpDecorate %_arr_sk_PerVertex_int_1 ArrayStride 32
|
||||
OpDecorate %sk_InvocationID BuiltIn InvocationId
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%sk_PerVertex = OpTypeStruct %v4float %float
|
||||
%_ptr_Output_sk_PerVertex = OpTypePointer Output %sk_PerVertex
|
||||
%3 = OpVariable %_ptr_Output_sk_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%_arr_sk_PerVertex_int_1 = OpTypeArray %sk_PerVertex %int_1
|
||||
%_ptr_Input__arr_sk_PerVertex_int_1 = OpTypePointer Input %_arr_sk_PerVertex_int_1
|
||||
%8 = OpVariable %_ptr_Input__arr_sk_PerVertex_int_1 Input
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%sk_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%float_n0_5 = OpConstant %float -0.5
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %16
|
||||
%17 = OpLabel
|
||||
%19 = OpAccessChain %_ptr_Input_v4float %8 %int_0 %int_0
|
||||
%21 = OpLoad %v4float %19
|
||||
%24 = OpLoad %int %sk_InvocationID
|
||||
%25 = OpConvertSToF %float %24
|
||||
%26 = OpCompositeConstruct %v4float %float_n0_5 %float_0 %float_0 %25
|
||||
%27 = OpFAdd %v4float %21 %26
|
||||
%28 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
OpStore %28 %27
|
||||
OpEmitVertex
|
||||
OpEndPrimitive
|
||||
OpReturn
|
||||
OpFunctionEnd
|
@ -1,10 +0,0 @@
|
||||
#version 310es
|
||||
#extension GL_EXT_geometry_shader : require
|
||||
layout (points, invocations = 2) in ;
|
||||
layout (invocations = 3) in ;
|
||||
layout (line_strip, max_vertices = 2) out ;
|
||||
void main() {
|
||||
gl_Position = gl_in[0].gl_Position + vec4(-0.5, 0.0, 0.0, float(gl_InvocationID));
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: unsupported kind of program
|
||||
1 error
|
@ -1,50 +0,0 @@
|
||||
OpCapability Geometry
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Geometry %main "main" %3 %8 %sk_InvocationID
|
||||
OpExecutionMode %main InputPoints
|
||||
OpExecutionMode %main OutputLineStrip
|
||||
OpExecutionMode %main OutputVertices 2
|
||||
OpExecutionMode %main Invocations 3
|
||||
OpName %sk_PerVertex "sk_PerVertex"
|
||||
OpMemberName %sk_PerVertex 0 "sk_Position"
|
||||
OpMemberName %sk_PerVertex 1 "sk_PointSize"
|
||||
OpName %sk_InvocationID "sk_InvocationID"
|
||||
OpName %main "main"
|
||||
OpMemberDecorate %sk_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %sk_PerVertex 1 BuiltIn PointSize
|
||||
OpDecorate %_arr_sk_PerVertex_int_1 ArrayStride 32
|
||||
OpDecorate %sk_InvocationID BuiltIn InvocationId
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%sk_PerVertex = OpTypeStruct %v4float %float
|
||||
%_ptr_Output_sk_PerVertex = OpTypePointer Output %sk_PerVertex
|
||||
%3 = OpVariable %_ptr_Output_sk_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%_arr_sk_PerVertex_int_1 = OpTypeArray %sk_PerVertex %int_1
|
||||
%_ptr_Input__arr_sk_PerVertex_int_1 = OpTypePointer Input %_arr_sk_PerVertex_int_1
|
||||
%8 = OpVariable %_ptr_Input__arr_sk_PerVertex_int_1 Input
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%sk_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%float_n0_5 = OpConstant %float -0.5
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%main = OpFunction %void None %16
|
||||
%17 = OpLabel
|
||||
%19 = OpAccessChain %_ptr_Input_v4float %8 %int_0 %int_0
|
||||
%21 = OpLoad %v4float %19
|
||||
%24 = OpLoad %int %sk_InvocationID
|
||||
%25 = OpConvertSToF %float %24
|
||||
%26 = OpCompositeConstruct %v4float %float_n0_5 %float_0 %float_0 %25
|
||||
%27 = OpFAdd %v4float %21 %26
|
||||
%28 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
OpStore %28 %27
|
||||
OpEmitVertex
|
||||
OpEndPrimitive
|
||||
OpReturn
|
||||
OpFunctionEnd
|
@ -1,10 +0,0 @@
|
||||
#version 400
|
||||
#extension GL_ARB_gpu_shader5 : require
|
||||
layout (points, invocations = 2) in ;
|
||||
layout (invocations = 3) in ;
|
||||
layout (line_strip, max_vertices = 2) out ;
|
||||
void main() {
|
||||
gl_Position = gl_in[0].gl_Position + vec4(-0.5, 0.0, 0.0, float(gl_InvocationID));
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: unsupported kind of program
|
||||
1 error
|
@ -1,79 +0,0 @@
|
||||
OpCapability Geometry
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Geometry %main "main" %3 %8
|
||||
OpExecutionMode %main InputPoints
|
||||
OpExecutionMode %main OutputLineStrip
|
||||
OpExecutionMode %main OutputVertices 4
|
||||
OpExecutionMode %main Invocations 1
|
||||
OpName %sk_PerVertex "sk_PerVertex"
|
||||
OpMemberName %sk_PerVertex 0 "sk_Position"
|
||||
OpMemberName %sk_PerVertex 1 "sk_PointSize"
|
||||
OpName %sk_InvocationID "sk_InvocationID"
|
||||
OpName %main "main"
|
||||
OpMemberDecorate %sk_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %sk_PerVertex 1 BuiltIn PointSize
|
||||
OpDecorate %_arr_sk_PerVertex_int_1 ArrayStride 32
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%sk_PerVertex = OpTypeStruct %v4float %float
|
||||
%_ptr_Output_sk_PerVertex = OpTypePointer Output %sk_PerVertex
|
||||
%3 = OpVariable %_ptr_Output_sk_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%_arr_sk_PerVertex_int_1 = OpTypeArray %sk_PerVertex %int_1
|
||||
%_ptr_Input__arr_sk_PerVertex_int_1 = OpTypePointer Input %_arr_sk_PerVertex_int_1
|
||||
%8 = OpVariable %_ptr_Input__arr_sk_PerVertex_int_1 Input
|
||||
%_ptr_Private_int = OpTypePointer Private %int
|
||||
%sk_InvocationID = OpVariable %_ptr_Private_int Private
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_2 = OpConstant %int 2
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_n0_5 = OpConstant %float -0.5
|
||||
%false = OpConstantFalse %bool
|
||||
%main = OpFunction %void None %16
|
||||
%17 = OpLabel
|
||||
OpStore %sk_InvocationID %int_0
|
||||
OpBranch %19
|
||||
%19 = OpLabel
|
||||
OpLoopMerge %23 %22 None
|
||||
OpBranch %20
|
||||
%20 = OpLabel
|
||||
%24 = OpLoad %int %sk_InvocationID
|
||||
%26 = OpSLessThan %bool %24 %int_2
|
||||
OpBranchConditional %26 %21 %23
|
||||
%21 = OpLabel
|
||||
%28 = OpAccessChain %_ptr_Input_v4float %8 %int_0 %int_0
|
||||
%30 = OpLoad %v4float %28
|
||||
%33 = OpLoad %int %sk_InvocationID
|
||||
%34 = OpConvertSToF %float %33
|
||||
%35 = OpCompositeConstruct %v4float %float_0_5 %float_0 %float_0 %34
|
||||
%36 = OpFAdd %v4float %30 %35
|
||||
%37 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
OpStore %37 %36
|
||||
OpEmitVertex
|
||||
%40 = OpAccessChain %_ptr_Input_v4float %8 %int_0 %int_0
|
||||
%41 = OpLoad %v4float %40
|
||||
%43 = OpLoad %int %sk_InvocationID
|
||||
%44 = OpConvertSToF %float %43
|
||||
%45 = OpCompositeConstruct %v4float %float_n0_5 %float_0 %float_0 %44
|
||||
%46 = OpFAdd %v4float %41 %45
|
||||
%47 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
OpStore %47 %46
|
||||
OpEmitVertex
|
||||
OpEndPrimitive
|
||||
OpBranch %22
|
||||
%22 = OpLabel
|
||||
%51 = OpLoad %int %sk_InvocationID
|
||||
%52 = OpIAdd %int %51 %int_1
|
||||
OpStore %sk_InvocationID %52
|
||||
OpBranch %19
|
||||
%23 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
@ -1,14 +0,0 @@
|
||||
#version 400
|
||||
int sk_InvocationID;
|
||||
layout (points) in ;
|
||||
layout (line_strip, max_vertices = 4) out ;
|
||||
void main() {
|
||||
for (sk_InvocationID = 0;sk_InvocationID < 2; sk_InvocationID++) {
|
||||
gl_Position = gl_in[0].gl_Position + vec4(0.5, 0.0, 0.0, float(sk_InvocationID));
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[0].gl_Position + vec4(-0.5, 0.0, 0.0, float(sk_InvocationID));
|
||||
EmitVertex();
|
||||
false;
|
||||
EndPrimitive();
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: unsupported kind of program
|
||||
1 error
|
@ -1,79 +0,0 @@
|
||||
OpCapability Geometry
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Geometry %main "main" %3 %8
|
||||
OpExecutionMode %main InputPoints
|
||||
OpExecutionMode %main OutputLineStrip
|
||||
OpExecutionMode %main OutputVertices 2
|
||||
OpExecutionMode %main Invocations 1
|
||||
OpName %sk_PerVertex "sk_PerVertex"
|
||||
OpMemberName %sk_PerVertex 0 "sk_Position"
|
||||
OpMemberName %sk_PerVertex 1 "sk_PointSize"
|
||||
OpName %sk_InvocationID "sk_InvocationID"
|
||||
OpName %main "main"
|
||||
OpMemberDecorate %sk_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %sk_PerVertex 1 BuiltIn PointSize
|
||||
OpDecorate %_arr_sk_PerVertex_int_1 ArrayStride 32
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%sk_PerVertex = OpTypeStruct %v4float %float
|
||||
%_ptr_Output_sk_PerVertex = OpTypePointer Output %sk_PerVertex
|
||||
%3 = OpVariable %_ptr_Output_sk_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%_arr_sk_PerVertex_int_1 = OpTypeArray %sk_PerVertex %int_1
|
||||
%_ptr_Input__arr_sk_PerVertex_int_1 = OpTypePointer Input %_arr_sk_PerVertex_int_1
|
||||
%8 = OpVariable %_ptr_Input__arr_sk_PerVertex_int_1 Input
|
||||
%_ptr_Private_int = OpTypePointer Private %int
|
||||
%sk_InvocationID = OpVariable %_ptr_Private_int Private
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_2 = OpConstant %int 2
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%float_n0_5 = OpConstant %float -0.5
|
||||
%false = OpConstantFalse %bool
|
||||
%main = OpFunction %void None %16
|
||||
%17 = OpLabel
|
||||
OpStore %sk_InvocationID %int_0
|
||||
OpBranch %19
|
||||
%19 = OpLabel
|
||||
OpLoopMerge %23 %22 None
|
||||
OpBranch %20
|
||||
%20 = OpLabel
|
||||
%24 = OpLoad %int %sk_InvocationID
|
||||
%26 = OpSLessThan %bool %24 %int_2
|
||||
OpBranchConditional %26 %21 %23
|
||||
%21 = OpLabel
|
||||
%28 = OpAccessChain %_ptr_Input_v4float %8 %int_0 %int_0
|
||||
%30 = OpLoad %v4float %28
|
||||
%33 = OpLoad %int %sk_InvocationID
|
||||
%34 = OpConvertSToF %float %33
|
||||
%35 = OpCompositeConstruct %v4float %float_0_5 %float_0 %float_0 %34
|
||||
%36 = OpFAdd %v4float %30 %35
|
||||
%37 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
OpStore %37 %36
|
||||
OpEmitVertex
|
||||
%40 = OpAccessChain %_ptr_Input_v4float %8 %int_0 %int_0
|
||||
%41 = OpLoad %v4float %40
|
||||
%43 = OpLoad %int %sk_InvocationID
|
||||
%44 = OpConvertSToF %float %43
|
||||
%45 = OpCompositeConstruct %v4float %float_n0_5 %float_0 %float_0 %44
|
||||
%46 = OpFAdd %v4float %41 %45
|
||||
%47 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
OpStore %47 %46
|
||||
OpEmitVertex
|
||||
OpEndPrimitive
|
||||
OpBranch %22
|
||||
%22 = OpLabel
|
||||
%51 = OpLoad %int %sk_InvocationID
|
||||
%52 = OpIAdd %int %51 %int_1
|
||||
OpStore %sk_InvocationID %52
|
||||
OpBranch %19
|
||||
%23 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
@ -1,14 +0,0 @@
|
||||
#version 400
|
||||
int sk_InvocationID;
|
||||
layout (points) in ;
|
||||
layout (line_strip, max_vertices = 2) out ;
|
||||
void main() {
|
||||
for (sk_InvocationID = 0;sk_InvocationID < 2; sk_InvocationID++) {
|
||||
gl_Position = gl_in[0].gl_Position + vec4(0.5, 0.0, 0.0, float(sk_InvocationID));
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[0].gl_Position + vec4(-0.5, 0.0, 0.0, float(sk_InvocationID));
|
||||
EmitVertex();
|
||||
false;
|
||||
EndPrimitive();
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: unsupported kind of program
|
||||
1 error
|
@ -1,117 +0,0 @@
|
||||
OpCapability Geometry
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Geometry %main "main" %3 %8 %sk_InvocationID
|
||||
OpExecutionMode %main InputPoints
|
||||
OpExecutionMode %main OutputLineStrip
|
||||
OpExecutionMode %main OutputVertices 2
|
||||
OpExecutionMode %main Invocations 2
|
||||
OpName %sk_PerVertex "sk_PerVertex"
|
||||
OpMemberName %sk_PerVertex 0 "sk_Position"
|
||||
OpMemberName %sk_PerVertex 1 "sk_PointSize"
|
||||
OpName %sk_InvocationID "sk_InvocationID"
|
||||
OpName %_UniformBuffer "_UniformBuffer"
|
||||
OpMemberName %_UniformBuffer 0 "sk_RTAdjust"
|
||||
OpName %main "main"
|
||||
OpMemberDecorate %sk_PerVertex 0 BuiltIn Position
|
||||
OpMemberDecorate %sk_PerVertex 1 BuiltIn PointSize
|
||||
OpDecorate %_arr_sk_PerVertex_int_1 ArrayStride 32
|
||||
OpDecorate %sk_InvocationID BuiltIn InvocationId
|
||||
OpMemberDecorate %_UniformBuffer 0 Offset 0
|
||||
OpDecorate %_UniformBuffer Block
|
||||
OpDecorate %15 Binding 0
|
||||
OpDecorate %15 DescriptorSet 0
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%sk_PerVertex = OpTypeStruct %v4float %float
|
||||
%_ptr_Output_sk_PerVertex = OpTypePointer Output %sk_PerVertex
|
||||
%3 = OpVariable %_ptr_Output_sk_PerVertex Output
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%_arr_sk_PerVertex_int_1 = OpTypeArray %sk_PerVertex %int_1
|
||||
%_ptr_Input__arr_sk_PerVertex_int_1 = OpTypePointer Input %_arr_sk_PerVertex_int_1
|
||||
%8 = OpVariable %_ptr_Input__arr_sk_PerVertex_int_1 Input
|
||||
%_ptr_Input_int = OpTypePointer Input %int
|
||||
%sk_InvocationID = OpVariable %_ptr_Input_int Input
|
||||
%_UniformBuffer = OpTypeStruct %v4float
|
||||
%_ptr_Uniform__UniformBuffer = OpTypePointer Uniform %_UniformBuffer
|
||||
%15 = OpVariable %_ptr_Uniform__UniformBuffer Uniform
|
||||
%void = OpTypeVoid
|
||||
%19 = OpTypeFunction %void
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%float_n0_5 = OpConstant %float -0.5
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%main = OpFunction %void None %19
|
||||
%20 = OpLabel
|
||||
%22 = OpAccessChain %_ptr_Input_v4float %8 %int_0 %int_0
|
||||
%24 = OpLoad %v4float %22
|
||||
%27 = OpLoad %int %sk_InvocationID
|
||||
%28 = OpConvertSToF %float %27
|
||||
%29 = OpCompositeConstruct %v4float %float_n0_5 %float_0 %float_0 %28
|
||||
%30 = OpFAdd %v4float %24 %29
|
||||
%31 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
OpStore %31 %30
|
||||
%33 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
%34 = OpLoad %v4float %33
|
||||
%35 = OpVectorShuffle %v2float %34 %34 0 1
|
||||
%37 = OpAccessChain %_ptr_Uniform_v4float %15 %int_0
|
||||
%39 = OpLoad %v4float %37
|
||||
%40 = OpVectorShuffle %v2float %39 %39 0 2
|
||||
%41 = OpFMul %v2float %35 %40
|
||||
%42 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
%43 = OpLoad %v4float %42
|
||||
%44 = OpVectorShuffle %v2float %43 %43 3 3
|
||||
%45 = OpAccessChain %_ptr_Uniform_v4float %15 %int_0
|
||||
%46 = OpLoad %v4float %45
|
||||
%47 = OpVectorShuffle %v2float %46 %46 1 3
|
||||
%48 = OpFMul %v2float %44 %47
|
||||
%49 = OpFAdd %v2float %41 %48
|
||||
%50 = OpCompositeExtract %float %49 0
|
||||
%51 = OpCompositeExtract %float %49 1
|
||||
%52 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
%53 = OpLoad %v4float %52
|
||||
%54 = OpCompositeExtract %float %53 3
|
||||
%55 = OpCompositeConstruct %v4float %50 %51 %float_0 %54
|
||||
%56 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
OpStore %56 %55
|
||||
OpEmitVertex
|
||||
%58 = OpAccessChain %_ptr_Input_v4float %8 %int_0 %int_0
|
||||
%59 = OpLoad %v4float %58
|
||||
%61 = OpLoad %int %sk_InvocationID
|
||||
%62 = OpConvertSToF %float %61
|
||||
%63 = OpCompositeConstruct %v4float %float_0_5 %float_0 %float_0 %62
|
||||
%64 = OpFAdd %v4float %59 %63
|
||||
%65 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
OpStore %65 %64
|
||||
%66 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
%67 = OpLoad %v4float %66
|
||||
%68 = OpVectorShuffle %v2float %67 %67 0 1
|
||||
%69 = OpAccessChain %_ptr_Uniform_v4float %15 %int_0
|
||||
%70 = OpLoad %v4float %69
|
||||
%71 = OpVectorShuffle %v2float %70 %70 0 2
|
||||
%72 = OpFMul %v2float %68 %71
|
||||
%73 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
%74 = OpLoad %v4float %73
|
||||
%75 = OpVectorShuffle %v2float %74 %74 3 3
|
||||
%76 = OpAccessChain %_ptr_Uniform_v4float %15 %int_0
|
||||
%77 = OpLoad %v4float %76
|
||||
%78 = OpVectorShuffle %v2float %77 %77 1 3
|
||||
%79 = OpFMul %v2float %75 %78
|
||||
%80 = OpFAdd %v2float %72 %79
|
||||
%81 = OpCompositeExtract %float %80 0
|
||||
%82 = OpCompositeExtract %float %80 1
|
||||
%83 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
%84 = OpLoad %v4float %83
|
||||
%85 = OpCompositeExtract %float %84 3
|
||||
%86 = OpCompositeConstruct %v4float %81 %82 %float_0 %85
|
||||
%87 = OpAccessChain %_ptr_Output_v4float %3 %int_0
|
||||
OpStore %87 %86
|
||||
OpEmitVertex
|
||||
OpEndPrimitive
|
||||
OpReturn
|
||||
OpFunctionEnd
|
@ -1,18 +0,0 @@
|
||||
#version 400
|
||||
uniform vec4 sk_RTAdjust;
|
||||
layout (points) in ;
|
||||
layout (invocations = 2) in ;
|
||||
layout (line_strip, max_vertices = 2) out ;
|
||||
void main() {
|
||||
gl_Position = gl_in[0].gl_Position + vec4(-0.5, 0.0, 0.0, float(gl_InvocationID));
|
||||
{
|
||||
gl_Position = vec4(gl_Position.xy * sk_RTAdjust.xz + gl_Position.ww * sk_RTAdjust.yw, 0.0, gl_Position.w);
|
||||
EmitVertex();
|
||||
}
|
||||
gl_Position = gl_in[0].gl_Position + vec4(0.5, 0.0, 0.0, float(gl_InvocationID));
|
||||
{
|
||||
gl_Position = vec4(gl_Position.xy * sk_RTAdjust.xz + gl_Position.ww * sk_RTAdjust.yw, 0.0, gl_Position.w);
|
||||
EmitVertex();
|
||||
}
|
||||
EndPrimitive();
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: unsupported kind of program
|
||||
1 error
|
@ -19,7 +19,6 @@ static DEFINE_bool(cachePathMasks, true,
|
||||
static DEFINE_bool(allPathsVolatile, false,
|
||||
"Causes all GPU paths to be processed as if 'setIsVolatile' had been called.");
|
||||
|
||||
static DEFINE_bool(gs, true, "Enables support for geometry shaders (if hw allows).");
|
||||
static DEFINE_bool(hwtess, false, "Enables support for tessellation shaders (if hw allows.).");
|
||||
|
||||
static DEFINE_int(maxTessellationSegments, 0,
|
||||
@ -104,7 +103,6 @@ void SetCtxOptionsFromCommonFlags(GrContextOptions* ctxOptions) {
|
||||
ctxOptions->fExecutor = gGpuExecutor.get();
|
||||
ctxOptions->fAllowPathMaskCaching = FLAGS_cachePathMasks;
|
||||
ctxOptions->fAllPathsVolatile = FLAGS_allPathsVolatile;
|
||||
ctxOptions->fSuppressGeometryShaders = !FLAGS_gs;
|
||||
ctxOptions->fEnableExperimentalHardwareTessellation = FLAGS_hwtess;
|
||||
ctxOptions->fMaxTessellationSegmentsOverride = FLAGS_maxTessellationSegments;
|
||||
ctxOptions->fAlwaysPreferHardwareTessellation = FLAGS_alwaysHwTess;
|
||||
|
Loading…
Reference in New Issue
Block a user