Add compute ShaderStage;

This commit is contained in:
bjorn
2021-06-04 22:05:43 -06:00
committed by bjorn
parent a1c79c45d8
commit 085ba2cb6e
11 changed files with 67 additions and 26 deletions
+2 -2
View File
@@ -155,9 +155,9 @@ love::graphics::ShaderStage *Graphics::newShaderStageInternal(ShaderStageType st
return new ShaderStage(this, stage, source, gles, cachekey);
}
love::graphics::Shader *Graphics::newShaderInternal(love::graphics::ShaderStage *vertex, love::graphics::ShaderStage *pixel)
love::graphics::Shader *Graphics::newShaderInternal(StrongRef<love::graphics::ShaderStage> stages[SHADERSTAGE_MAX_ENUM])
{
return new Shader(vertex, pixel);
return new Shader(stages);
}
love::graphics::Buffer *Graphics::newBuffer(const Buffer::Settings &settings, const std::vector<Buffer::DataDeclaration> &format, const void *data, size_t size, size_t arraylength)
+1 -1
View File
@@ -137,7 +137,7 @@ private:
};
love::graphics::ShaderStage *newShaderStageInternal(ShaderStageType stage, const std::string &cachekey, const std::string &source, bool gles) override;
love::graphics::Shader *newShaderInternal(love::graphics::ShaderStage *vertex, love::graphics::ShaderStage *pixel) override;
love::graphics::Shader *newShaderInternal(StrongRef<love::graphics::ShaderStage> stages[SHADERSTAGE_MAX_ENUM]) override;
love::graphics::StreamBuffer *newStreamBuffer(BufferUsage type, size_t size) override;
void setRenderTargetsInternal(const RenderTargets &rts, int w, int h, int pixelw, int pixelh, bool hasSRGBtexture) override;
void initCapabilities() override;
+2 -2
View File
@@ -42,8 +42,8 @@ static bool isBuffer(Shader::UniformType utype)
return utype == Shader::UNIFORM_TEXELBUFFER || utype == Shader::UNIFORM_STORAGEBUFFER;
}
Shader::Shader(love::graphics::ShaderStage *vertex, love::graphics::ShaderStage *pixel)
: love::graphics::Shader(vertex, pixel)
Shader::Shader(StrongRef<love::graphics::ShaderStage> stages[SHADERSTAGE_MAX_ENUM])
: love::graphics::Shader(stages)
, program(0)
, builtinUniforms()
, builtinUniformInfo()
+1 -1
View File
@@ -43,7 +43,7 @@ class Shader final : public love::graphics::Shader, public Volatile
{
public:
Shader(love::graphics::ShaderStage *vertex, love::graphics::ShaderStage *pixel);
Shader(StrongRef<love::graphics::ShaderStage> stages[SHADERSTAGE_MAX_ENUM]);
virtual ~Shader();
// Implements Volatile
@@ -53,6 +53,8 @@ bool ShaderStage::loadVolatile()
glstage = GL_VERTEX_SHADER;
else if (stage == SHADERSTAGE_PIXEL)
glstage = GL_FRAGMENT_SHADER;
else if (stage == SHADERSTAGE_COMPUTE)
glstage = GL_COMPUTE_SHADER;
else
throw love::Exception("%s shader stage is not handled in OpenGL backend code.", typestr);