Revert "OpenGL: delete shaders and pipelines when they are not used any longer"
This reverts commit a57c1db878e2f8a7eb352c8f253db5488cdca6f6.
It produces a GL_INVALID_VALUE in ColorStateTest.ColorWriteMask
BUG=dawn:529
Change-Id: I3511057daf24baaf895b86cbda2a3a21e58d77fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65384
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn_native/opengl/ComputePipelineGL.cpp b/src/dawn_native/opengl/ComputePipelineGL.cpp
index e51e217..fb33344 100644
--- a/src/dawn_native/opengl/ComputePipelineGL.cpp
+++ b/src/dawn_native/opengl/ComputePipelineGL.cpp
@@ -27,10 +27,6 @@
return pipeline;
}
- ComputePipeline::~ComputePipeline() {
- DeleteProgram(ToBackend(GetDevice())->gl);
- }
-
MaybeError ComputePipeline::Initialize() {
DAWN_TRY(
InitializeBase(ToBackend(GetDevice())->gl, ToBackend(GetLayout()), GetAllStages()));
diff --git a/src/dawn_native/opengl/ComputePipelineGL.h b/src/dawn_native/opengl/ComputePipelineGL.h
index dd5c0b3..8e77440 100644
--- a/src/dawn_native/opengl/ComputePipelineGL.h
+++ b/src/dawn_native/opengl/ComputePipelineGL.h
@@ -35,7 +35,7 @@
private:
using ComputePipelineBase::ComputePipelineBase;
- ~ComputePipeline() override;
+ ~ComputePipeline() override = default;
MaybeError Initialize() override;
};
diff --git a/src/dawn_native/opengl/PipelineGL.cpp b/src/dawn_native/opengl/PipelineGL.cpp
index 83b0e81..8ec9d61 100644
--- a/src/dawn_native/opengl/PipelineGL.cpp
+++ b/src/dawn_native/opengl/PipelineGL.cpp
@@ -87,7 +87,6 @@
// Create an OpenGL shader for each stage and gather the list of combined samplers.
PerStage<CombinedSamplerInfo> combinedSamplers;
bool needsDummySampler = false;
- std::vector<GLuint> glShaders;
for (SingleShaderStage stage : IterateStages(activeStages)) {
const ShaderModule* module = ToBackend(stages[stage].module.Get());
std::string glsl;
@@ -97,7 +96,6 @@
GLuint shader;
DAWN_TRY_ASSIGN(shader, CreateShader(gl, GLShaderType(stage), glsl.c_str()));
gl.AttachShader(mProgram, shader);
- glShaders.push_back(shader);
}
if (needsDummySampler) {
@@ -180,19 +178,9 @@
textureUnit++;
}
-
- for (GLuint glShader : glShaders) {
- gl.DetachShader(mProgram, glShader);
- gl.DeleteShader(glShader);
- }
-
return {};
}
- void PipelineGL::DeleteProgram(const OpenGLFunctions& gl) {
- gl.DeleteProgram(mProgram);
- }
-
const std::vector<PipelineGL::SamplerUnit>& PipelineGL::GetTextureUnitsForSampler(
GLuint index) const {
ASSERT(index < mUnitsForSamplers.size());
diff --git a/src/dawn_native/opengl/PipelineGL.h b/src/dawn_native/opengl/PipelineGL.h
index be6c1dd..e210606 100644
--- a/src/dawn_native/opengl/PipelineGL.h
+++ b/src/dawn_native/opengl/PipelineGL.h
@@ -47,12 +47,12 @@
const std::vector<GLuint>& GetTextureUnitsForTextureView(GLuint index) const;
GLuint GetProgramHandle() const;
- protected:
void ApplyNow(const OpenGLFunctions& gl);
+
+ protected:
MaybeError InitializeBase(const OpenGLFunctions& gl,
const PipelineLayout* layout,
const PerStage<ProgrammableStage>& stages);
- void DeleteProgram(const OpenGLFunctions& gl);
private:
GLuint mProgram;
diff --git a/src/dawn_native/opengl/RenderPipelineGL.cpp b/src/dawn_native/opengl/RenderPipelineGL.cpp
index 1b4b5ce..b6a5a4f 100644
--- a/src/dawn_native/opengl/RenderPipelineGL.cpp
+++ b/src/dawn_native/opengl/RenderPipelineGL.cpp
@@ -238,7 +238,6 @@
const OpenGLFunctions& gl = ToBackend(GetDevice())->gl;
gl.DeleteVertexArrays(1, &mVertexArrayObject);
gl.BindVertexArray(0);
- DeleteProgram(gl);
}
GLenum RenderPipeline::GetGLPrimitiveTopology() const {