Fix inclusive language presubmit

The current presubmit has the filter inverted so it would only attempt
to match the filtered files. The file name also has to be converted to
`LocalPath` otherwise it's attempting to compare a python object to a
string and always fails to match.

Bug: dawn:1339
Change-Id: Ie7712dee60f6b9df2cb78c9feab11769f7ea1f02
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87080
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair
2022-04-19 22:25:45 +00:00
committed by Dawn LUCI CQ
parent 6a3373e419
commit fb5a492787
88 changed files with 574 additions and 534 deletions

View File

@@ -99,8 +99,8 @@ namespace dawn::native::opengl {
SetToggle(Toggle::DisableDepthStencilRead, !supportsDepthStencilRead);
SetToggle(Toggle::DisableSampleVariables, !supportsSampleVariables);
SetToggle(Toggle::FlushBeforeClientWaitSync, gl.GetVersion().IsES());
// For OpenGL ES, we must use dummy fragment shader for vertex-only render pipeline.
SetToggle(Toggle::UseDummyFragmentInVertexOnlyPipeline, gl.GetVersion().IsES());
// For OpenGL ES, we must use a placeholder fragment shader for vertex-only render pipeline.
SetToggle(Toggle::UsePlaceholderFragmentInVertexOnlyPipeline, gl.GetVersion().IsES());
}
const GLFormat& Device::GetGLFormat(const Format& format) {

View File

@@ -87,26 +87,26 @@ namespace dawn::native::opengl {
// Create an OpenGL shader for each stage and gather the list of combined samplers.
PerStage<CombinedSamplerInfo> combinedSamplers;
bool needsDummySampler = false;
bool needsPlaceholderSampler = false;
std::vector<GLuint> glShaders;
for (SingleShaderStage stage : IterateStages(activeStages)) {
const ShaderModule* module = ToBackend(stages[stage].module.Get());
std::string glsl;
DAWN_TRY_ASSIGN(glsl, module->TranslateToGLSL(stages[stage].entryPoint.c_str(), stage,
&combinedSamplers[stage], layout,
&needsDummySampler));
&needsPlaceholderSampler));
GLuint shader;
DAWN_TRY_ASSIGN(shader, CreateShader(gl, GLShaderType(stage), glsl.c_str()));
gl.AttachShader(mProgram, shader);
glShaders.push_back(shader);
}
if (needsDummySampler) {
if (needsPlaceholderSampler) {
SamplerDescriptor desc = {};
ASSERT(desc.minFilter == wgpu::FilterMode::Nearest);
ASSERT(desc.magFilter == wgpu::FilterMode::Nearest);
ASSERT(desc.mipmapFilter == wgpu::FilterMode::Nearest);
mDummySampler =
mPlaceholderSampler =
ToBackend(layout->GetDevice()->GetOrCreateSampler(&desc).AcquireSuccess());
}
@@ -164,8 +164,8 @@ namespace dawn::native::opengl {
wgpu::TextureSampleType::Float;
}
{
if (combined.useDummySampler) {
mDummySamplerUnits.push_back(textureUnit);
if (combined.usePlaceholderSampler) {
mPlaceholderSamplerUnits.push_back(textureUnit);
} else {
const BindGroupLayoutBase* bgl =
layout->GetBindGroupLayout(combined.samplerLocation.group);
@@ -209,9 +209,9 @@ namespace dawn::native::opengl {
void PipelineGL::ApplyNow(const OpenGLFunctions& gl) {
gl.UseProgram(mProgram);
for (GLuint unit : mDummySamplerUnits) {
ASSERT(mDummySampler.Get() != nullptr);
gl.BindSampler(unit, mDummySampler->GetNonFilteringHandle());
for (GLuint unit : mPlaceholderSamplerUnits) {
ASSERT(mPlaceholderSampler.Get() != nullptr);
gl.BindSampler(unit, mPlaceholderSampler->GetNonFilteringHandle());
}
}

View File

@@ -58,10 +58,10 @@ namespace dawn::native::opengl {
GLuint mProgram;
std::vector<std::vector<SamplerUnit>> mUnitsForSamplers;
std::vector<std::vector<GLuint>> mUnitsForTextures;
std::vector<GLuint> mDummySamplerUnits;
std::vector<GLuint> mPlaceholderSamplerUnits;
// TODO(enga): This could live on the Device, or elsewhere, but currently it makes Device
// destruction complex as it requires the sampler to be destroyed before the sampler cache.
Ref<Sampler> mDummySampler;
Ref<Sampler> mPlaceholderSampler;
};
} // namespace dawn::native::opengl

View File

@@ -39,15 +39,15 @@ namespace dawn::native::opengl {
}
bool operator<(const CombinedSampler& a, const CombinedSampler& b) {
return std::tie(a.useDummySampler, a.samplerLocation, a.textureLocation) <
std::tie(b.useDummySampler, a.samplerLocation, b.textureLocation);
return std::tie(a.usePlaceholderSampler, a.samplerLocation, a.textureLocation) <
std::tie(b.usePlaceholderSampler, a.samplerLocation, b.textureLocation);
}
std::string CombinedSampler::GetName() const {
std::ostringstream o;
o << "dawn_combined";
if (useDummySampler) {
o << "_dummy_sampler";
if (usePlaceholderSampler) {
o << "_placeholder_sampler";
} else {
o << "_" << static_cast<uint32_t>(samplerLocation.group) << "_"
<< static_cast<uint32_t>(samplerLocation.binding);
@@ -82,7 +82,7 @@ namespace dawn::native::opengl {
SingleShaderStage stage,
CombinedSamplerInfo* combinedSamplers,
const PipelineLayout* layout,
bool* needsDummySampler) const {
bool* needsPlaceholderSampler) const {
TRACE_EVENT0(GetDevice()->GetPlatform(), General, "TranslateToGLSL");
tint::transform::Manager transformManager;
tint::transform::DataMap transformInputs;
@@ -111,7 +111,7 @@ namespace dawn::native::opengl {
// of the original texture and sampler, and generates a unique name. The
// corresponding uniforms will be retrieved by these generated names
// in PipelineGL. Any texture-only references will have
// "useDummySampler" set to true, and only the texture binding point
// "usePlaceholderSampler" set to true, and only the texture binding point
// will be used in naming them. In addition, Dawn will bind a
// non-filtering sampler for them (see PipelineGL).
auto uses = inspector.GetSamplerTextureUses(entryPointName, placeholderBindingPoint);
@@ -120,10 +120,10 @@ namespace dawn::native::opengl {
CombinedSampler* info = &combinedSamplers->back();
if (use.sampler_binding_point == placeholderBindingPoint) {
info->useDummySampler = true;
*needsDummySampler = true;
info->usePlaceholderSampler = true;
*needsPlaceholderSampler = true;
} else {
info->useDummySampler = false;
info->usePlaceholderSampler = false;
}
info->samplerLocation.group = BindGroupIndex(use.sampler_binding_point.group);
info->samplerLocation.binding = BindingNumber(use.sampler_binding_point.binding);
@@ -131,7 +131,7 @@ namespace dawn::native::opengl {
info->textureLocation.binding = BindingNumber(use.texture_binding_point.binding);
tintOptions.binding_map[use] = info->GetName();
}
if (*needsDummySampler) {
if (*needsPlaceholderSampler) {
tintOptions.placeholder_binding_point = placeholderBindingPoint;
}

View File

@@ -36,8 +36,9 @@ namespace dawn::native::opengl {
BindingLocation samplerLocation;
BindingLocation textureLocation;
// OpenGL requires a sampler with texelFetch. If this is true, the developer did not provide
// one and Dawn should bind a dummy non-filtering sampler. |samplerLocation| is unused.
bool useDummySampler;
// one and Dawn should bind a placeholder non-filtering sampler. |samplerLocation| is
// unused.
bool usePlaceholderSampler;
std::string GetName() const;
};
bool operator<(const CombinedSampler& a, const CombinedSampler& b);
@@ -57,7 +58,7 @@ namespace dawn::native::opengl {
SingleShaderStage stage,
CombinedSamplerInfo* combinedSamplers,
const PipelineLayout* layout,
bool* needsDummySampler) const;
bool* needsPlaceholderSampler) const;
private:
ShaderModule(Device* device, const ShaderModuleDescriptor* descriptor);