enum ir_variable_mode mode, int slot);
ir_variable *add_uniform(const glsl_type *type, const char *name);
ir_variable *add_const(const char *name, int value);
+ ir_variable *add_const_ivec3(const char *name, int x, int y, int z);
void add_varying(int slot, const glsl_type *type, const char *name,
const char *name_as_gs_input);
}
+ir_variable *
+builtin_variable_generator::add_const_ivec3(const char *name, int x, int y,
+ int z)
+{
+ ir_variable *const var = add_variable(name, glsl_type::ivec3_type,
+ ir_var_auto, -1);
+ ir_constant_data data;
+ memset(&data, 0, sizeof(data));
+ data.i[0] = x;
+ data.i[1] = y;
+ data.i[2] = z;
+ var->constant_value = new(var) ir_constant(glsl_type::ivec3_type, &data);
+ var->constant_initializer =
+ new(var) ir_constant(glsl_type::ivec3_type, &data);
+ var->data.has_initializer = true;
+ return var;
+}
+
+
void
builtin_variable_generator::generate_constants()
{
add_const("gl_MaxTessControlAtomicCounters", 0);
add_const("gl_MaxTessEvaluationAtomicCounters", 0);
}
+
+ if (state->is_version(430, 0) || state->ARB_compute_shader_enable) {
+ add_const_ivec3("gl_MaxComputeWorkGroupSize",
+ state->Const.MaxComputeWorkGroupSize[0],
+ state->Const.MaxComputeWorkGroupSize[1],
+ state->Const.MaxComputeWorkGroupSize[2]);
+ }
}
this->Const.MaxCombinedAtomicCounters = ctx->Const.MaxCombinedAtomicCounters;
this->Const.MaxAtomicBufferBindings = ctx->Const.MaxAtomicBufferBindings;
+ /* Compute shader constants */
+ for (unsigned i = 0; i < Elements(this->Const.MaxComputeWorkGroupSize); i++)
+ this->Const.MaxComputeWorkGroupSize[i] = ctx->Const.MaxComputeWorkGroupSize[i];
+
this->current_function = NULL;
this->toplevel_ir = NULL;
this->found_return = false;
unsigned MaxFragmentAtomicCounters;
unsigned MaxCombinedAtomicCounters;
unsigned MaxAtomicBufferBindings;
+
+ /* ARB_compute_shader */
+ unsigned MaxComputeWorkGroupSize[3];
} Const;
/**
*/
ctx->Const.GLSLVersion = glsl_version;
ctx->Extensions.ARB_ES3_compatibility = true;
+ ctx->Const.MaxComputeWorkGroupSize[0] = 1024;
+ ctx->Const.MaxComputeWorkGroupSize[1] = 1024;
+ ctx->Const.MaxComputeWorkGroupSize[2] = 64;
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits = 16;
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxUniformComponents = 1024;
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxInputComponents = 0; /* not used */
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents = 32;
ctx->Const.MaxDrawBuffers = 1;
+ ctx->Const.MaxComputeWorkGroupSize[0] = 1024;
+ ctx->Const.MaxComputeWorkGroupSize[1] = 1024;
+ ctx->Const.MaxComputeWorkGroupSize[2] = 64;
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits = 16;
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxUniformComponents = 1024;
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxInputComponents = 0; /* not used */
/* GL_ARB_vertex_attrib_binding */
ctx->Const.MaxVertexAttribRelativeOffset = 2047;
ctx->Const.MaxVertexAttribBindings = MAX_VERTEX_GENERIC_ATTRIBS;
+
+ /* GL_ARB_compute_shader */
+ ctx->Const.MaxComputeWorkGroupSize[0] = 1024;
+ ctx->Const.MaxComputeWorkGroupSize[1] = 1024;
+ ctx->Const.MaxComputeWorkGroupSize[2] = 64;
}
v->value_int = ctx->ImageUnits[index].Format;
return TYPE_INT;
+
+ case GL_MAX_COMPUTE_WORK_GROUP_SIZE:
+ if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_compute_shader)
+ goto invalid_enum;
+ if (index >= 3)
+ goto invalid_value;
+ v->value_int = ctx->Const.MaxComputeWorkGroupSize[index];
+ return TYPE_INT;
}
invalid_enum:
GLuint MaxCombinedImageUnitsAndFragmentOutputs;
GLuint MaxImageSamples;
GLuint MaxCombinedImageUniforms;
+
+ /** GL_ARB_compute_shader */
+ GLuint MaxComputeWorkGroupSize[3]; /* Array of x, y, z dimensions */
};