-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable optimizations for ESSL 1.0 code #7358
Conversation
Please add a release note line to NEW_RELEASE_NOTES.md. If this PR does not warrant a release note, add the 'internal' label to this PR. |
b370128
to
0d0ef80
Compare
@@ -14977,7 +14977,11 @@ string CompilerGLSL::flags_to_qualifiers_glsl(const SPIRType &type, const Bitset | |||
{ | |||
auto &execution = get_entry_point(); | |||
|
|||
if (flags.get(DecorationRelaxedPrecision)) | |||
if (type.basetype == SPIRType::UInt && is_legacy()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these changes submitted to spirv-cross upstream? Otherwise, we'll lose these patches when building inside of G3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Submitted an upstream PR, but I'm not sure they'll like it since it doesn't fix the root of the problem.
@@ -460,19 +491,22 @@ io::sstream& CodeGenerator::generateOutput(io::sstream& out, ShaderStage type, | |||
const char* materialTypeString = getOutputTypeName(materialOutputType); | |||
const char* typeString = getOutputTypeName(outputType); | |||
|
|||
bool generate_essl3_code = mTargetLanguage == TargetLanguage::SPIRV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why can't we generate essl1 with target lang spirv?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I described it a bit above in a comment elsewhere in this file:
// During compilation and optimization, __VERSION__ reflects the shader language version of the
// intermediate code, not the version of the final code. spirv-cross automatically adapts
// certain language features (e.g. fragment output) but leaves others untouched (e.g. sampler
// functions, bit shift operations). Client code may have to make decisions based on this
// information, so define a FILAMENT_EFFECTIVE_VERSION constant.
Since the intermediate code is always ESSL 3.0 even if it eventually becomes ESSL 1.0, we have to sometimes generate ESSL 3.0 stuff like this.
0d0ef80
to
d2aac29
Compare
d2aac29
to
a6f1206
Compare
a6f1206
to
85f145e
Compare
e4fd636
to
29eb09a
Compare
Since #7358 is blocked by an upstream spirv-cross issue, we can at least do a bit of preprocessor optimization for ESSL 1.0 code in the meantime and introduce the FILAMENT_EFFECTIVE_VERSION preprocessor definitions.
Since #7358 is blocked by an upstream spirv-cross issue, we can at least do a bit of preprocessor optimization for ESSL 1.0 code in the meantime and introduce the FILAMENT_EFFECTIVE_VERSION preprocessor definitions.
Since #7358 is blocked by an upstream spirv-cross issue, we can at least do a bit of preprocessor optimization for ESSL 1.0 code in the meantime and introduce the FILAMENT_EFFECTIVE_VERSION preprocessor definitions.
a9a6915
to
d064a67
Compare
The CL introducing the ESSL 1.0 chunk in materials inadvertently disabled optimizations for said code. This commit reintroduces those optimizations and fixes associated bugs which manifested. In particular, spirv-cross was generating uints for bools; this has been fixed with a hack. Additionally, spirv-cross is now compiled with exceptions enabled so that matc can gracefully fail and show the code which failed to compile rather than abruptly aborting.
d064a67
to
dedaba3
Compare
Since #7358 is blocked by an upstream spirv-cross issue, we can at least do a bit of preprocessor optimization for ESSL 1.0 code in the meantime and introduce the FILAMENT_EFFECTIVE_VERSION preprocessor definitions.
Since google#7358 is blocked by an upstream spirv-cross issue, we can at least do a bit of preprocessor optimization for ESSL 1.0 code in the meantime and introduce the FILAMENT_EFFECTIVE_VERSION preprocessor definitions.
The CL introducing the ESSL 1.0 chunk in materials inadvertently disabled optimizations for said code. This commit reintroduces those optimizations and fixes associated bugs which manifested. In particular, spirv-cross was generating uints for bools; this has been fixed with a hack. Additionally, spirv-cross is now compiled with exceptions enabled so that matc can gracefully fail and show the code which failed to compile rather than abruptly aborting.
Upstream issue for spirv-cross.
Upstream PR for spirv-cross.