mirror of
https://github.com/godotengine/godot-angle-static.git
synced 2026-01-06 02:09:55 +03:00
Compute packed varyings in ProgramD3D only.
Instead of storing varying information in the shader, use a temporary set when linking a D3D program. This also means we won't have to modify information in the Shader object when linking a D3D program. This completes the refactoring for PackedVaryings. BUG=angleproject:1123 Change-Id: I241610e87f7d14f3e18b0d8bd84f1a3509c05dfd Reviewed-on: https://chromium-review.googlesource.com/295193 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
@@ -69,7 +69,11 @@ GLuint CompileShaderFromFile(GLenum type, const std::string &sourcePath)
|
||||
return CompileShader(type, source);
|
||||
}
|
||||
|
||||
GLuint CompileProgram(const std::string &vsSource, const std::string &fsSource)
|
||||
GLuint CompileProgramWithTransformFeedback(
|
||||
const std::string &vsSource,
|
||||
const std::string &fsSource,
|
||||
const std::vector<std::string> &transformFeedbackVaryings,
|
||||
GLenum bufferMode)
|
||||
{
|
||||
GLuint program = glCreateProgram();
|
||||
|
||||
@@ -90,6 +94,19 @@ GLuint CompileProgram(const std::string &vsSource, const std::string &fsSource)
|
||||
glAttachShader(program, fs);
|
||||
glDeleteShader(fs);
|
||||
|
||||
if (transformFeedbackVaryings.size() > 0)
|
||||
{
|
||||
std::vector<const char *> constCharTFVaryings;
|
||||
|
||||
for (const std::string &transformFeedbackVarying : transformFeedbackVaryings)
|
||||
{
|
||||
constCharTFVaryings.push_back(transformFeedbackVarying.c_str());
|
||||
}
|
||||
|
||||
glTransformFeedbackVaryings(program, static_cast<GLsizei>(transformFeedbackVaryings.size()),
|
||||
&constCharTFVaryings[0], bufferMode);
|
||||
}
|
||||
|
||||
glLinkProgram(program);
|
||||
|
||||
GLint linkStatus;
|
||||
@@ -112,6 +129,12 @@ GLuint CompileProgram(const std::string &vsSource, const std::string &fsSource)
|
||||
return program;
|
||||
}
|
||||
|
||||
GLuint CompileProgram(const std::string &vsSource, const std::string &fsSource)
|
||||
{
|
||||
std::vector<std::string> emptyVector;
|
||||
return CompileProgramWithTransformFeedback(vsSource, fsSource, emptyVector, GL_NONE);
|
||||
}
|
||||
|
||||
GLuint CompileProgramFromFiles(const std::string &vsPath, const std::string &fsPath)
|
||||
{
|
||||
std::string vsSource = ReadFileToString(vsPath);
|
||||
|
||||
Reference in New Issue
Block a user