This commit is contained in:
ZY4N
2025-03-23 21:11:22 +01:00
parent 510398423a
commit c609d49f0d
49 changed files with 1412 additions and 924 deletions

View File

@@ -25,7 +25,7 @@ shader_program_handle::attribute_support_type shader_program_handle::check_attri
auto curr_attribute_flag = attribute_support_type{ 1 };
for (const auto& attribute : attributes) {
const auto location = glGetAttribLocation(program_id, attribute.name);
const auto location = glGetAttribLocation(id, attribute.name);
if (location == attribute.info.location)
{
attribute_candidates |= curr_attribute_flag;
@@ -36,7 +36,7 @@ shader_program_handle::attribute_support_type shader_program_handle::check_attri
auto supported_attributes = attribute_support_type{};
GLint count;
glGetProgramiv(program_id, GL_ACTIVE_ATTRIBUTES, &count);
glGetProgramiv(id, GL_ACTIVE_ATTRIBUTES, &count);
if (check_error()) ztu::logger::error("GL_err: %", error.message());
for (GLint i{}; i != count and attribute_candidates; ++i)
@@ -46,7 +46,7 @@ shader_program_handle::attribute_support_type shader_program_handle::check_attri
GLsizei name_length;
auto name = std::array<char, 256>{};
glGetActiveAttrib(
program_id, i,
id, i,
name.size(),
&name_length,
&size, &type,
@@ -93,12 +93,12 @@ shader_program_handle::uniform_support_type shader_program_handle::check_uniform
auto curr_uniform_flag = uniform_support_type{ 1 };
for (const auto& uniform : uniforms)
{
const auto location = glGetUniformLocation(program_id, uniform.name);
const auto location = glGetUniformLocation(id, uniform.name);
if (location == uniform.info.location)
{
uniform_candidates |= curr_uniform_flag;
ztu::logger::debug("[%] '%': %.", program_id, uniform.name, location);
ztu::logger::debug("[%] '%': %.", id, uniform.name, location);
}
else
{
@@ -110,7 +110,7 @@ shader_program_handle::uniform_support_type shader_program_handle::check_uniform
auto supported_uniforms = uniform_support_type{};
GLint count;
glGetProgramiv(program_id, GL_ACTIVE_UNIFORMS, &count);
glGetProgramiv(id, GL_ACTIVE_UNIFORMS, &count);
if (check_error()) ztu::logger::error("GL_err: %", error.message());
for (GLint i{}; i != count and uniform_candidates; ++i)
@@ -120,7 +120,7 @@ shader_program_handle::uniform_support_type shader_program_handle::check_uniform
GLsizei name_length;
auto name = std::array<char, 256>{};
glGetActiveUniform(
program_id, i,
id, i,
name.size(),
&name_length,
&size, &type,
@@ -149,4 +149,9 @@ shader_program_handle::uniform_support_type shader_program_handle::check_uniform
return supported_uniforms;
}
bool shader_program_handle::valid() const
{
return id != 0;
}
}