Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
65116e9
mesa: remove _mesa_ prefix from some static functions
Feb 7, 2014
4609545
mesa: trivial clean-ups in errors.c
Feb 7, 2014
d271538
mesa: allocate gl_debug_state on demand
Feb 7, 2014
068fc27
mesa: make ARB_debug_output functions an alias of
tarceri Mar 8, 2014
b5c6997
mesa: add missing DebugMessageControl types
tarceri Mar 8, 2014
622da81
mesa: Release gl_debug_state when destroying context.
Mar 11, 2014
dd4cd4f
mesa: s/FREE/free/ in _mesa_free_errors_data()
Apr 10, 2014
4997856
mesa: refactor _mesa_get_debug_state
olvaffe Apr 22, 2014
abb86c0
mesa: refactor debug output should_log
olvaffe Apr 22, 2014
23f5f4f
mesa: refactor debug output set_message_state
olvaffe Apr 22, 2014
3d08da8
mesa: refactor debug out log_msg
olvaffe Apr 22, 2014
459dc2e
mesa: refactor debug output get_msg
olvaffe Apr 22, 2014
967102f
mesa: refactor debug output control_messages
olvaffe Apr 22, 2014
7e84d1e
mesa: refactor _mesa_PushDebugGroup
olvaffe Apr 22, 2014
6223519
mesa: refactor _mesa_PopDebugGroup and _mesa_free_errors_data
olvaffe Apr 22, 2014
51b1604
mesa: eliminate debug output get_msg
olvaffe Apr 22, 2014
6381568
mesa: eliminate debug output control_app_messages
olvaffe Apr 22, 2014
7375118
mesa: eliminate debug output should_log
olvaffe Apr 22, 2014
650a0f7
mesa: eliminate debug output message_insert
olvaffe Apr 22, 2014
c856912
mesa: use accessors for struct gl_debug_state
olvaffe Apr 22, 2014
e8c17e3
mesa: clean up debug message log
olvaffe Apr 23, 2014
945621a
mesa: clean up debug groups
olvaffe Apr 23, 2014
4409b5f
mesa: clean up debug output namespace handling
olvaffe Apr 23, 2014
3fee90c
mesa: delay copying of debug groups
olvaffe Apr 23, 2014
5c58190
mesa: overhaul debug namespace support
olvaffe Apr 24, 2014
9a1e292
mesa: protect the debug state with a mutex
olvaffe Apr 22, 2014
68c8deb
glsl: make static constant variables "static const"
olvaffe Apr 16, 2014
a7699ff
glsl: protect locale_t with a mutex
olvaffe Apr 16, 2014
975897a
glsl: protect anonymous struct id with a mutex
olvaffe Apr 16, 2014
4f6dbab
glsl: protect glsl_type with a mutex
olvaffe Mar 27, 2014
94bb07d
glsl: add a generic thread pool data structure
olvaffe Apr 20, 2014
34c993d
mesa: add support for threaded glCompileShader
Mar 26, 2014
4299cdb
i965: add drirc option multithread_glsl_compiler
olvaffe Apr 20, 2014
1ba4e70
Revert "glx: Fix a regression in the new XCB code"
keith-packard Dec 24, 2013
4c9a2eb
Revert "glx: Replace DRI2SwapBuffers() custom protocol with XCB."
keith-packard Dec 24, 2013
8a2ade4
Revert "glx: Replace DRI2SwapInterval custom protocol with XCB."
keith-packard Dec 24, 2013
53b31fb
Revert "glx: Replace DRI2GetMSC custom protocol with XCB."
keith-packard Dec 24, 2013
6bc30d0
Revert "glx: Replace DRI2WaitForMSC custom protocol with XCB."
keith-packard Dec 24, 2013
01c11d6
Revert "glx: Replace DRI2WaitForSBC custom protocol with XCB."
keith-packard Dec 24, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/glsl/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ TESTS = glcpp/tests/glcpp-test \
tests/general-ir-test \
tests/optimization-test \
tests/ralloc-test \
tests/threadpool-test \
tests/sampler-types-test \
tests/uniform-initializer-test

Expand All @@ -48,6 +49,7 @@ check_PROGRAMS = \
glsl_test \
tests/general-ir-test \
tests/ralloc-test \
tests/threadpool-test \
tests/sampler-types-test \
tests/uniform-initializer-test

Expand Down Expand Up @@ -92,6 +94,14 @@ tests_ralloc_test_LDADD = \
$(top_builddir)/src/gtest/libgtest.la \
$(PTHREAD_LIBS)

tests_threadpool_test_SOURCES = \
tests/threadpool_test.cpp \
$(top_builddir)/src/glsl/threadpool.c
tests_threadpool_test_CFLAGS = $(PTHREAD_CFLAGS)
tests_threadpool_test_LDADD = \
$(top_builddir)/src/gtest/libgtest.la \
$(PTHREAD_LIBS)

tests_sampler_types_test_SOURCES = \
$(top_srcdir)/src/mesa/program/prog_hash_table.c\
$(top_srcdir)/src/mesa/program/symbol_table.c \
Expand All @@ -115,7 +125,7 @@ glcpp_glcpp_LDADD = \
libglcpp.la \
-lm

libglsl_la_LIBADD = libglcpp.la
libglsl_la_LIBADD = libglcpp.la $(PTHREAD_LIBS)
libglsl_la_SOURCES = \
glsl_lexer.cpp \
glsl_parser.cpp \
Expand Down
3 changes: 2 additions & 1 deletion src/glsl/Makefile.sources
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ LIBGLSL_FILES = \
$(GLSL_SRCDIR)/opt_tree_grafting.cpp \
$(GLSL_SRCDIR)/opt_vectorize.cpp \
$(GLSL_SRCDIR)/s_expression.cpp \
$(GLSL_SRCDIR)/strtod.c
$(GLSL_SRCDIR)/strtod.c \
$(GLSL_SRCDIR)/threadpool.c

# glsl_compiler

Expand Down
2 changes: 1 addition & 1 deletion src/glsl/builtin_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ const static struct builtin_type_versions {
T(atomic_uint, 420, 999)
};

const glsl_type *const deprecated_types[] = {
static const glsl_type *const deprecated_types[] = {
glsl_type::struct_gl_PointParameters_type,
glsl_type::struct_gl_MaterialParameters_type,
glsl_type::struct_gl_LightSourceParameters_type,
Expand Down
63 changes: 32 additions & 31 deletions src/glsl/builtin_variables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@
#include "program/prog_statevars.h"
#include "program/prog_instruction.h"

static struct gl_builtin_uniform_element gl_NumSamples_elements[] = {
static const struct gl_builtin_uniform_element gl_NumSamples_elements[] = {
{NULL, {STATE_NUM_SAMPLES, 0, 0}, SWIZZLE_XXXX}
};

static struct gl_builtin_uniform_element gl_DepthRange_elements[] = {
static const struct gl_builtin_uniform_element gl_DepthRange_elements[] = {
{"near", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_XXXX},
{"far", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_YYYY},
{"diff", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_ZZZZ},
};

static struct gl_builtin_uniform_element gl_ClipPlane_elements[] = {
static const struct gl_builtin_uniform_element gl_ClipPlane_elements[] = {
{NULL, {STATE_CLIPPLANE, 0, 0}, SWIZZLE_XYZW}
};

static struct gl_builtin_uniform_element gl_Point_elements[] = {
static const struct gl_builtin_uniform_element gl_Point_elements[] = {
{"size", {STATE_POINT_SIZE}, SWIZZLE_XXXX},
{"sizeMin", {STATE_POINT_SIZE}, SWIZZLE_YYYY},
{"sizeMax", {STATE_POINT_SIZE}, SWIZZLE_ZZZZ},
Expand All @@ -54,23 +54,23 @@ static struct gl_builtin_uniform_element gl_Point_elements[] = {
{"distanceQuadraticAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_ZZZZ},
};

static struct gl_builtin_uniform_element gl_FrontMaterial_elements[] = {
static const struct gl_builtin_uniform_element gl_FrontMaterial_elements[] = {
{"emission", {STATE_MATERIAL, 0, STATE_EMISSION}, SWIZZLE_XYZW},
{"ambient", {STATE_MATERIAL, 0, STATE_AMBIENT}, SWIZZLE_XYZW},
{"diffuse", {STATE_MATERIAL, 0, STATE_DIFFUSE}, SWIZZLE_XYZW},
{"specular", {STATE_MATERIAL, 0, STATE_SPECULAR}, SWIZZLE_XYZW},
{"shininess", {STATE_MATERIAL, 0, STATE_SHININESS}, SWIZZLE_XXXX},
};

static struct gl_builtin_uniform_element gl_BackMaterial_elements[] = {
static const struct gl_builtin_uniform_element gl_BackMaterial_elements[] = {
{"emission", {STATE_MATERIAL, 1, STATE_EMISSION}, SWIZZLE_XYZW},
{"ambient", {STATE_MATERIAL, 1, STATE_AMBIENT}, SWIZZLE_XYZW},
{"diffuse", {STATE_MATERIAL, 1, STATE_DIFFUSE}, SWIZZLE_XYZW},
{"specular", {STATE_MATERIAL, 1, STATE_SPECULAR}, SWIZZLE_XYZW},
{"shininess", {STATE_MATERIAL, 1, STATE_SHININESS}, SWIZZLE_XXXX},
};

static struct gl_builtin_uniform_element gl_LightSource_elements[] = {
static const struct gl_builtin_uniform_element gl_LightSource_elements[] = {
{"ambient", {STATE_LIGHT, 0, STATE_AMBIENT}, SWIZZLE_XYZW},
{"diffuse", {STATE_LIGHT, 0, STATE_DIFFUSE}, SWIZZLE_XYZW},
{"specular", {STATE_LIGHT, 0, STATE_SPECULAR}, SWIZZLE_XYZW},
Expand All @@ -89,100 +89,100 @@ static struct gl_builtin_uniform_element gl_LightSource_elements[] = {
{"quadraticAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_ZZZZ},
};

static struct gl_builtin_uniform_element gl_LightModel_elements[] = {
static const struct gl_builtin_uniform_element gl_LightModel_elements[] = {
{"ambient", {STATE_LIGHTMODEL_AMBIENT, 0}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_FrontLightModelProduct_elements[] = {
static const struct gl_builtin_uniform_element gl_FrontLightModelProduct_elements[] = {
{"sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 0}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_BackLightModelProduct_elements[] = {
static const struct gl_builtin_uniform_element gl_BackLightModelProduct_elements[] = {
{"sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 1}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_FrontLightProduct_elements[] = {
static const struct gl_builtin_uniform_element gl_FrontLightProduct_elements[] = {
{"ambient", {STATE_LIGHTPROD, 0, 0, STATE_AMBIENT}, SWIZZLE_XYZW},
{"diffuse", {STATE_LIGHTPROD, 0, 0, STATE_DIFFUSE}, SWIZZLE_XYZW},
{"specular", {STATE_LIGHTPROD, 0, 0, STATE_SPECULAR}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_BackLightProduct_elements[] = {
static const struct gl_builtin_uniform_element gl_BackLightProduct_elements[] = {
{"ambient", {STATE_LIGHTPROD, 0, 1, STATE_AMBIENT}, SWIZZLE_XYZW},
{"diffuse", {STATE_LIGHTPROD, 0, 1, STATE_DIFFUSE}, SWIZZLE_XYZW},
{"specular", {STATE_LIGHTPROD, 0, 1, STATE_SPECULAR}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_TextureEnvColor_elements[] = {
static const struct gl_builtin_uniform_element gl_TextureEnvColor_elements[] = {
{NULL, {STATE_TEXENV_COLOR, 0}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_EyePlaneS_elements[] = {
static const struct gl_builtin_uniform_element gl_EyePlaneS_elements[] = {
{NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_S}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_EyePlaneT_elements[] = {
static const struct gl_builtin_uniform_element gl_EyePlaneT_elements[] = {
{NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_T}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_EyePlaneR_elements[] = {
static const struct gl_builtin_uniform_element gl_EyePlaneR_elements[] = {
{NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_R}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_EyePlaneQ_elements[] = {
static const struct gl_builtin_uniform_element gl_EyePlaneQ_elements[] = {
{NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_Q}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_ObjectPlaneS_elements[] = {
static const struct gl_builtin_uniform_element gl_ObjectPlaneS_elements[] = {
{NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_S}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_ObjectPlaneT_elements[] = {
static const struct gl_builtin_uniform_element gl_ObjectPlaneT_elements[] = {
{NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_T}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_ObjectPlaneR_elements[] = {
static const struct gl_builtin_uniform_element gl_ObjectPlaneR_elements[] = {
{NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_R}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_ObjectPlaneQ_elements[] = {
static const struct gl_builtin_uniform_element gl_ObjectPlaneQ_elements[] = {
{NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_Q}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_Fog_elements[] = {
static const struct gl_builtin_uniform_element gl_Fog_elements[] = {
{"color", {STATE_FOG_COLOR}, SWIZZLE_XYZW},
{"density", {STATE_FOG_PARAMS}, SWIZZLE_XXXX},
{"start", {STATE_FOG_PARAMS}, SWIZZLE_YYYY},
{"end", {STATE_FOG_PARAMS}, SWIZZLE_ZZZZ},
{"scale", {STATE_FOG_PARAMS}, SWIZZLE_WWWW},
};

static struct gl_builtin_uniform_element gl_NormalScale_elements[] = {
static const struct gl_builtin_uniform_element gl_NormalScale_elements[] = {
{NULL, {STATE_NORMAL_SCALE}, SWIZZLE_XXXX},
};

static struct gl_builtin_uniform_element gl_BumpRotMatrix0MESA_elements[] = {
static const struct gl_builtin_uniform_element gl_BumpRotMatrix0MESA_elements[] = {
{NULL, {STATE_INTERNAL, STATE_ROT_MATRIX_0}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_BumpRotMatrix1MESA_elements[] = {
static const struct gl_builtin_uniform_element gl_BumpRotMatrix1MESA_elements[] = {
{NULL, {STATE_INTERNAL, STATE_ROT_MATRIX_1}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_FogParamsOptimizedMESA_elements[] = {
static const struct gl_builtin_uniform_element gl_FogParamsOptimizedMESA_elements[] = {
{NULL, {STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_CurrentAttribVertMESA_elements[] = {
static const struct gl_builtin_uniform_element gl_CurrentAttribVertMESA_elements[] = {
{NULL, {STATE_INTERNAL, STATE_CURRENT_ATTRIB, 0}, SWIZZLE_XYZW},
};

static struct gl_builtin_uniform_element gl_CurrentAttribFragMESA_elements[] = {
static const struct gl_builtin_uniform_element gl_CurrentAttribFragMESA_elements[] = {
{NULL, {STATE_INTERNAL, STATE_CURRENT_ATTRIB_MAYBE_VP_CLAMPED, 0}, SWIZZLE_XYZW},
};

#define MATRIX(name, statevar, modifier) \
static struct gl_builtin_uniform_element name ## _elements[] = { \
static const struct gl_builtin_uniform_element name ## _elements[] = { \
{ NULL, { statevar, 0, 0, 0, modifier}, SWIZZLE_XYZW }, \
{ NULL, { statevar, 0, 1, 1, modifier}, SWIZZLE_XYZW }, \
{ NULL, { statevar, 0, 2, 2, modifier}, SWIZZLE_XYZW }, \
Expand Down Expand Up @@ -225,7 +225,7 @@ MATRIX(gl_TextureMatrixTranspose,
MATRIX(gl_TextureMatrixInverseTranspose,
STATE_TEXTURE_MATRIX, STATE_MATRIX_INVERSE);

static struct gl_builtin_uniform_element gl_NormalMatrix_elements[] = {
static const struct gl_builtin_uniform_element gl_NormalMatrix_elements[] = {
{ NULL, { STATE_MODELVIEW_MATRIX, 0, 0, 0, STATE_MATRIX_INVERSE},
MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_Z) },
{ NULL, { STATE_MODELVIEW_MATRIX, 0, 1, 1, STATE_MATRIX_INVERSE},
Expand Down Expand Up @@ -496,7 +496,8 @@ builtin_variable_generator::add_uniform(const glsl_type *type,

for (unsigned a = 0; a < array_count; a++) {
for (unsigned j = 0; j < statevar->num_elements; j++) {
struct gl_builtin_uniform_element *element = &statevar->elements[j];
const struct gl_builtin_uniform_element *element =
&statevar->elements[j];

memcpy(slots->tokens, element->tokens, sizeof(element->tokens));
if (type->is_array()) {
Expand Down
1 change: 1 addition & 0 deletions src/glsl/glsl_lexer.ll
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ classify_identifier(struct _mesa_glsl_parse_state *state, const char *name)
void
_mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state, const char *string)
{
glsl_initialize_strtod();
yylex_init_extra(state, & state->scanner);
yy_scan_string(string, state->scanner);
}
Expand Down
2 changes: 1 addition & 1 deletion src/glsl/glsl_parser.yy
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ layout_qualifier_id:

/* Layout qualifiers for GLSL 1.50 geometry shaders. */
if (!$$.flags.i) {
struct {
static const struct {
const char *s;
GLenum e;
} map[] = {
Expand Down
18 changes: 14 additions & 4 deletions src/glsl/glsl_parser_extras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ extern "C" {
#include "glsl_parser.h"
#include "ir_optimization.h"
#include "loop_analysis.h"
#include "threadpool.h"

/**
* Format a short human-readable description of the given GLSL version.
Expand All @@ -49,7 +50,7 @@ glsl_compute_version_string(void *mem_ctx, bool is_es, unsigned version)
}


static unsigned known_desktop_glsl_versions[] =
static const unsigned known_desktop_glsl_versions[] =
{ 110, 120, 130, 140, 150, 330, 400, 410, 420, 430, 440 };


Expand Down Expand Up @@ -628,7 +629,7 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
if (extension && extension->compatible_with_state(state)) {
extension->set_flags(state, behavior);
} else {
static const char *const fmt = "extension `%s' unsupported in %s shader";
static const char fmt[] = "extension `%s' unsupported in %s shader";

if (behavior == extension_require) {
_mesa_glsl_error(name_locp, state, fmt,
Expand Down Expand Up @@ -1321,9 +1322,15 @@ ast_struct_specifier::ast_struct_specifier(const char *identifier,
ast_declarator_list *declarator_list)
{
if (identifier == NULL) {
static mtx_t mutex = _MTX_INITIALIZER_NP;
static unsigned anon_count = 1;
identifier = ralloc_asprintf(this, "#anon_struct_%04x", anon_count);
anon_count++;
unsigned count;

mtx_lock(&mutex);
count = anon_count++;
mtx_unlock(&mutex);

identifier = ralloc_asprintf(this, "#anon_struct_%04x", count);
}
name = identifier;
this->declarations.push_degenerate_list_at_head(&declarator_list->link);
Expand Down Expand Up @@ -1553,6 +1560,8 @@ extern "C" {
void
_mesa_destroy_shader_compiler(void)
{
_mesa_glsl_destroy_threadpool();

_mesa_destroy_shader_compiler_caches();

_mesa_glsl_release_types();
Expand All @@ -1566,6 +1575,7 @@ _mesa_destroy_shader_compiler(void)
void
_mesa_destroy_shader_compiler_caches(void)
{
_mesa_glsl_wait_threadpool();
_mesa_glsl_release_builtin_functions();
}

Expand Down
Loading