From 8a4938f82b05b86c8f0ed010210eb6d1847c04c9 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 28 Feb 2016 18:15:00 +0100 Subject: OPENGL: Move pipeline code to pipelines/. --- backends/graphics/opengl/pipelines/shader.h | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 backends/graphics/opengl/pipelines/shader.h (limited to 'backends/graphics/opengl/pipelines/shader.h') diff --git a/backends/graphics/opengl/pipelines/shader.h b/backends/graphics/opengl/pipelines/shader.h new file mode 100644 index 0000000000..96e15803f0 --- /dev/null +++ b/backends/graphics/opengl/pipelines/shader.h @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef BACKENDS_GRAPHICS_OPENGL_PIPELINES_SHADER_H +#define BACKENDS_GRAPHICS_OPENGL_PIPELINES_SHADER_H + +#include "backends/graphics/opengl/pipelines/pipeline.h" + +namespace OpenGL { + +#if !USE_FORCED_GLES +class ShaderPipeline : public Pipeline { +public: + ShaderPipeline(); + + virtual void activate(); + + virtual Shader *setShader(Shader *shader); + + virtual void setColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a); + + virtual void drawTexture(const GLTexture &texture, const GLfloat *coordinates); + + virtual void setProjectionMatrix(const GLfloat *projectionMatrix); + +private: + Shader *_activeShader; +}; +#endif // !USE_FORCED_GLES + +} // End of namespace OpenGL + +#endif -- cgit v1.2.3 From 26f106497a863b84c502d122b5ba749176b2c426 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 28 Feb 2016 23:58:04 +0100 Subject: OPENGL: Implement CLUT8 look up as Pipeline. --- backends/graphics/opengl/pipelines/shader.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'backends/graphics/opengl/pipelines/shader.h') diff --git a/backends/graphics/opengl/pipelines/shader.h b/backends/graphics/opengl/pipelines/shader.h index 96e15803f0..a5b94e89f5 100644 --- a/backends/graphics/opengl/pipelines/shader.h +++ b/backends/graphics/opengl/pipelines/shader.h @@ -32,8 +32,6 @@ class ShaderPipeline : public Pipeline { public: ShaderPipeline(); - virtual void activate(); - virtual Shader *setShader(Shader *shader); virtual void setColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a); @@ -42,7 +40,9 @@ public: virtual void setProjectionMatrix(const GLfloat *projectionMatrix); -private: +protected: + virtual void activateInternal(); + Shader *_activeShader; }; #endif // !USE_FORCED_GLES -- cgit v1.2.3 From 3f9852eb202b55b93f6e3121ce473951bff033cd Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 29 Feb 2016 00:04:33 +0100 Subject: OPENGL: Make shader pipelines use fixed shaders. --- backends/graphics/opengl/pipelines/shader.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'backends/graphics/opengl/pipelines/shader.h') diff --git a/backends/graphics/opengl/pipelines/shader.h b/backends/graphics/opengl/pipelines/shader.h index a5b94e89f5..52046f8dd5 100644 --- a/backends/graphics/opengl/pipelines/shader.h +++ b/backends/graphics/opengl/pipelines/shader.h @@ -28,11 +28,11 @@ namespace OpenGL { #if !USE_FORCED_GLES +class Shader; + class ShaderPipeline : public Pipeline { public: - ShaderPipeline(); - - virtual Shader *setShader(Shader *shader); + ShaderPipeline(Shader *shader); virtual void setColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a); @@ -43,7 +43,7 @@ public: protected: virtual void activateInternal(); - Shader *_activeShader; + Shader *const _activeShader; }; #endif // !USE_FORCED_GLES -- cgit v1.2.3 From baca885cfce10acaa7a9892133aaa5b82c7183f7 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 2 Mar 2016 15:16:05 +0100 Subject: OPENGL: Let Shader store the uniform state. --- backends/graphics/opengl/pipelines/shader.h | 1 + 1 file changed, 1 insertion(+) (limited to 'backends/graphics/opengl/pipelines/shader.h') diff --git a/backends/graphics/opengl/pipelines/shader.h b/backends/graphics/opengl/pipelines/shader.h index 52046f8dd5..8e82bd7a31 100644 --- a/backends/graphics/opengl/pipelines/shader.h +++ b/backends/graphics/opengl/pipelines/shader.h @@ -42,6 +42,7 @@ public: protected: virtual void activateInternal(); + virtual void deactivateInternal(); Shader *const _activeShader; }; -- cgit v1.2.3 From 39100b613272523c2e36be213cc827857a08f824 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 4 Mar 2016 00:14:22 +0100 Subject: OPENGL: Do not hardcode any uniform/attribute handling in Shader. --- backends/graphics/opengl/pipelines/shader.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'backends/graphics/opengl/pipelines/shader.h') diff --git a/backends/graphics/opengl/pipelines/shader.h b/backends/graphics/opengl/pipelines/shader.h index 8e82bd7a31..95167ee03f 100644 --- a/backends/graphics/opengl/pipelines/shader.h +++ b/backends/graphics/opengl/pipelines/shader.h @@ -44,6 +44,10 @@ protected: virtual void activateInternal(); virtual void deactivateInternal(); + GLint _vertexAttribLocation; + GLint _texCoordAttribLocation; + GLint _colorAttribLocation; + Shader *const _activeShader; }; #endif // !USE_FORCED_GLES -- cgit v1.2.3