Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cmake build issues and gcc hang #91

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions contrib/glslopt/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
#include <stdlib.h>
#include "glsl_optimizer.h"

extern "C" void
_mesa_error_no_memory(const char *caller)
{
fprintf(stderr, "Mesa error: out of memory in %s", caller);
}

static glslopt_ctx* gContext = 0;

static int printhelp(const char* msg)
Expand Down
5 changes: 5 additions & 0 deletions src/glsl/opt_array_splitting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ ir_array_reference_visitor::get_split_list(exec_list *instructions,

/* Trim out variables we found that we can't split. */
foreach_in_list_safe(variable_entry, entry, &variable_list) {
#ifdef __GNUC__
// without this memory fence (or something like it),
// gcc will optimize out this loop. See issue #44
__asm__("":::"memory");
#endif
if (debug) {
printf("array %s@%p: decl %d, split %d\n",
entry->var->name, (void *) entry->var, entry->declaration,
Expand Down
5 changes: 1 addition & 4 deletions src/glsl/standalone_scaffolding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ _mesa_shader_debug(struct gl_context *, GLenum, GLuint *id,
}

extern "C" void
_mesa_error_no_memory(const char *caller)
{
}

_mesa_error_no_memory(const char *caller);

struct gl_shader *
_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type)
Expand Down
9 changes: 9 additions & 0 deletions tests/glsl_optimizer_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <time.h>
#include "../src/glsl/glsl_optimizer.h"

extern "C" void
_mesa_error_no_memory(const char *caller)
{
fprintf(stderr, "Mesa error: out of memory in %s", caller);
}


#define GL_GLEXT_PROTOTYPES 1

#if __linux__
Expand Down