metal: nogame and error screens work.

- implement love.graphics.setColor
- implement default textures
- hacky implementation of default uniform data
- use texture swizzles to set up LA8 (text) texture data
- shader reflection work
This commit is contained in:
Alex Szpakowski
2020-06-13 20:29:23 -03:00
parent 6cd4b3e3f7
commit 9d2dca5740
15 changed files with 324 additions and 55 deletions
+14 -3
View File
@@ -30,6 +30,7 @@
#import <Metal/MTLRenderPipeline.h>
#include <unordered_map>
#include <map>
#include <string>
namespace love
@@ -39,6 +40,9 @@ namespace graphics
namespace metal
{
static const int DEFAULT_VERTEX_BUFFER_BINDING = 1;
static const int VERTEX_BUFFER_BINDING_START = 2;
class Shader final : public love::graphics::Shader
{
public:
@@ -69,9 +73,9 @@ public:
// Implements Shader.
void attach() override;
std::string getWarnings() const override { return ""; }
int getVertexAttributeIndex(const std::string &name) override { return -1; }
const UniformInfo *getUniformInfo(const std::string &name) const override { return nullptr; }
const UniformInfo *getUniformInfo(BuiltinUniform builtin) const override { return nullptr; }
int getVertexAttributeIndex(const std::string &name) override;
const UniformInfo *getUniformInfo(const std::string &name) const override;
const UniformInfo *getUniformInfo(BuiltinUniform builtin) const override;
void updateUniform(const UniformInfo *info, int count) override {}
void sendTextures(const UniformInfo *info, love::graphics::Texture **textures, int count) override {}
bool hasUniform(const std::string &name) const override { return false; }
@@ -80,6 +84,8 @@ public:
id<MTLRenderPipelineState> getCachedRenderPipeline(const RenderPipelineKey &key);
static int getUniformBufferBinding();
private:
struct RenderPipelineHasher
@@ -92,6 +98,11 @@ private:
id<MTLFunction> functions[ShaderStage::STAGE_MAX_ENUM];
UniformInfo *builtinUniformInfo[BUILTIN_MAX_ENUM];
std::map<std::string, UniformInfo> uniforms;
std::map<std::string, int> attributes;
std::unordered_map<RenderPipelineKey, const void *, RenderPipelineHasher> cachedRenderPipelines;
}; // Metal