blob: dd933c579fd4fd76c8f3865a7cf1eb418cad9dea [file] [log] [blame]
Jamie Madill9e54b5a2016-05-25 12:57:39 -04001//
2// Copyright 2016 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6// ProgramVk.h:
7// Defines the class interface for ProgramVk, implementing ProgramImpl.
8//
9
10#ifndef LIBANGLE_RENDERER_VULKAN_PROGRAMVK_H_
11#define LIBANGLE_RENDERER_VULKAN_PROGRAMVK_H_
12
13#include "libANGLE/renderer/ProgramImpl.h"
Jamie Madill8ecf7f92017-01-13 17:29:52 -050014#include "libANGLE/renderer/vulkan/renderervk_utils.h"
Jamie Madill9e54b5a2016-05-25 12:57:39 -040015
16namespace rx
17{
18
19class ProgramVk : public ProgramImpl
20{
21 public:
22 ProgramVk(const gl::ProgramState &state);
23 ~ProgramVk() override;
Jamie Madill5deea722017-02-16 10:44:46 -050024 void destroy(const ContextImpl *contextImpl) override;
Jamie Madill9e54b5a2016-05-25 12:57:39 -040025
Jamie Madilla7d12dc2016-12-13 15:08:19 -050026 LinkResult load(const ContextImpl *contextImpl,
27 gl::InfoLog &infoLog,
28 gl::BinaryInputStream *stream) override;
Jamie Madill9e54b5a2016-05-25 12:57:39 -040029 gl::Error save(gl::BinaryOutputStream *stream) override;
30 void setBinaryRetrievableHint(bool retrievable) override;
31
Jamie Madill8ecf7f92017-01-13 17:29:52 -050032 LinkResult link(ContextImpl *contextImpl,
Jamie Madill192745a2016-12-22 15:58:21 -050033 const gl::VaryingPacking &packing,
34 gl::InfoLog &infoLog) override;
Jamie Madill9e54b5a2016-05-25 12:57:39 -040035 GLboolean validate(const gl::Caps &caps, gl::InfoLog *infoLog) override;
36
37 void setUniform1fv(GLint location, GLsizei count, const GLfloat *v) override;
38 void setUniform2fv(GLint location, GLsizei count, const GLfloat *v) override;
39 void setUniform3fv(GLint location, GLsizei count, const GLfloat *v) override;
40 void setUniform4fv(GLint location, GLsizei count, const GLfloat *v) override;
41 void setUniform1iv(GLint location, GLsizei count, const GLint *v) override;
42 void setUniform2iv(GLint location, GLsizei count, const GLint *v) override;
43 void setUniform3iv(GLint location, GLsizei count, const GLint *v) override;
44 void setUniform4iv(GLint location, GLsizei count, const GLint *v) override;
45 void setUniform1uiv(GLint location, GLsizei count, const GLuint *v) override;
46 void setUniform2uiv(GLint location, GLsizei count, const GLuint *v) override;
47 void setUniform3uiv(GLint location, GLsizei count, const GLuint *v) override;
48 void setUniform4uiv(GLint location, GLsizei count, const GLuint *v) override;
49 void setUniformMatrix2fv(GLint location,
50 GLsizei count,
51 GLboolean transpose,
52 const GLfloat *value) override;
53 void setUniformMatrix3fv(GLint location,
54 GLsizei count,
55 GLboolean transpose,
56 const GLfloat *value) override;
57 void setUniformMatrix4fv(GLint location,
58 GLsizei count,
59 GLboolean transpose,
60 const GLfloat *value) override;
61 void setUniformMatrix2x3fv(GLint location,
62 GLsizei count,
63 GLboolean transpose,
64 const GLfloat *value) override;
65 void setUniformMatrix3x2fv(GLint location,
66 GLsizei count,
67 GLboolean transpose,
68 const GLfloat *value) override;
69 void setUniformMatrix2x4fv(GLint location,
70 GLsizei count,
71 GLboolean transpose,
72 const GLfloat *value) override;
73 void setUniformMatrix4x2fv(GLint location,
74 GLsizei count,
75 GLboolean transpose,
76 const GLfloat *value) override;
77 void setUniformMatrix3x4fv(GLint location,
78 GLsizei count,
79 GLboolean transpose,
80 const GLfloat *value) override;
81 void setUniformMatrix4x3fv(GLint location,
82 GLsizei count,
83 GLboolean transpose,
84 const GLfloat *value) override;
85
86 // TODO: synchronize in syncState when dirty bits exist.
87 void setUniformBlockBinding(GLuint uniformBlockIndex, GLuint uniformBlockBinding) override;
88
89 // May only be called after a successful link operation.
90 // Return false for inactive blocks.
91 bool getUniformBlockSize(const std::string &blockName, size_t *sizeOut) const override;
92
93 // May only be called after a successful link operation.
94 // Returns false for inactive members.
95 bool getUniformBlockMemberInfo(const std::string &memberUniformName,
96 sh::BlockMemberInfo *memberInfoOut) const override;
Sami Väisänen46eaa942016-06-29 10:26:37 +030097
98 void setPathFragmentInputGen(const std::string &inputName,
99 GLenum genMode,
100 GLint components,
101 const GLfloat *coeffs) override;
Jamie Madill8ecf7f92017-01-13 17:29:52 -0500102
103 const vk::ShaderModule &getLinkedVertexModule() const;
104 const vk::ShaderModule &getLinkedFragmentModule() const;
Jamie Madilldf68a6f2017-01-13 17:29:53 -0500105 gl::ErrorOrResult<vk::PipelineLayout *> getPipelineLayout(VkDevice device);
Jamie Madill8ecf7f92017-01-13 17:29:52 -0500106
107 private:
108 vk::ShaderModule mLinkedVertexModule;
109 vk::ShaderModule mLinkedFragmentModule;
Jamie Madilldf68a6f2017-01-13 17:29:53 -0500110 vk::PipelineLayout mPipelineLayout;
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400111};
112
113} // namespace rx
114
115#endif // LIBANGLE_RENDERER_VULKAN_PROGRAMVK_H_