Hash :
f355e2b3
Author :
Date :
2025-04-15T18:58:25
Vulkan: Remove preferDriverUniformOverSpecConst This was practically true for every vendor on Android (where rotation matters). For Qualcomm, it was also true due to a bug in version checking and didn't seem to be causing any concerns. Where pre-rotation is supported, it is better to enable this feature to avoid excessive pipeline creation. This change removes the feature and makes sure ANGLE always uses uniforms for rotation instead of spec consts. While technically this may have an adverse effect on platforms that never need pre-rotation, the ability is retained for all vendors since pre-rotation is finding its way into more platforms and would likely eventually be needed everywhere anyway. Bug: angleproject:42265878 Bug: angleproject:42262166 Change-Id: I4b64c04da46db08cfdd44b60789b66d93d8e8b17 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6459025 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: mohan maiya <m.maiya@samsung.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
//
// Copyright 2020 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// SpecializationConst.cpp: Add code to generate AST node for various specialization constants.
//
#include "compiler/translator/tree_util/SpecializationConstant.h"
#include "common/PackedEnums.h"
#include "common/angleutils.h"
#include "compiler/translator/StaticType.h"
#include "compiler/translator/SymbolTable.h"
#include "compiler/translator/tree_util/IntermNode_util.h"
namespace sh
{
namespace
{
// Specialization constant names
constexpr ImmutableString kDitherSpecConstVarName = ImmutableString("ANGLEDither");
const TType *MakeSpecConst(const TType &type, vk::SpecializationConstantId id)
{
// Create a new type with the EvqSpecConst qualifier
TType *specConstType = new TType(type);
specConstType->setQualifier(EvqSpecConst);
// Set the constant_id of the spec const
TLayoutQualifier layoutQualifier = TLayoutQualifier::Create();
layoutQualifier.location = static_cast<int>(id);
specConstType->setLayoutQualifier(layoutQualifier);
return specConstType;
}
} // anonymous namespace
SpecConst::SpecConst(TSymbolTable *symbolTable,
GLenum shaderType)
: mSymbolTable(symbolTable),
mDitherVar(nullptr)
{
if (shaderType == GL_FRAGMENT_SHADER || shaderType == GL_COMPUTE_SHADER)
{
return;
}
}
SpecConst::~SpecConst() {}
void SpecConst::declareSpecConsts(TIntermBlock *root)
{
// Add specialization constant declarations. The default value of the specialization
// constant is irrelevant, as it will be set when creating the pipeline.
// Only emit specialized const declaration if it has been referenced.
if (mDitherVar != nullptr)
{
TIntermDeclaration *decl = new TIntermDeclaration();
decl->appendDeclarator(new TIntermBinary(EOpInitialize, getDither(), CreateUIntNode(0)));
root->insertStatement(0, decl);
}
}
TIntermTyped *SpecConst::getDither()
{
if (mDitherVar == nullptr)
{
const TType *type = MakeSpecConst(*StaticType::GetBasic<EbtUInt, EbpHigh>(),
vk::SpecializationConstantId::Dither);
mDitherVar =
new TVariable(mSymbolTable, kDitherSpecConstVarName, type, SymbolType::AngleInternal);
mUsageBits.set(vk::SpecConstUsage::Dither);
}
return new TIntermSymbol(mDitherVar);
}
} // namespace sh