Skip to content
This repository was archived by the owner on Jan 7, 2023. It is now read-only.

Commit 74ae967

Browse files
authored
Merge pull request #138 from kanlihu/mesa
Mesa
2 parents 2f0b3cf + 32ecd3b commit 74ae967

File tree

5 files changed

+53
-5
lines changed

5 files changed

+53
-5
lines changed

Android.common.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ LOCAL_CFLAGS += \
6969
-DHAVE___BUILTIN_CLZLL \
7070
-DHAVE___BUILTIN_UNREACHABLE \
7171
-DHAVE_PTHREAD=1 \
72+
-DGLX_USE_TLS \
7273
-DHAVE_DLADDR \
7374
-DHAVE_DL_ITERATE_PHDR \
7475
-DHAVE_LINUX_FUTEX_H \
@@ -87,6 +88,7 @@ LOCAL_CFLAGS += \
8788
-Wno-enum-conversion
8889

8990
LOCAL_CPPFLAGS += \
91+
-DGLX_USE_TLS \
9092
-D__STDC_CONSTANT_MACROS \
9193
-D__STDC_FORMAT_MACROS \
9294
-D__STDC_LIMIT_MACROS \

src/mapi/Android.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ LOCAL_SRC_FILES := \
4444
u_execmem.c
4545

4646
LOCAL_CFLAGS := \
47+
-DGLX_USE_TLS \
4748
-DMAPI_MODE_GLAPI \
4849
-DMAPI_ABI_HEADER=\"$(abi_header)\"
4950

src/mapi/glapi/glapi.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ _GLAPI_EXPORT extern __thread void * _glapi_tls_Context
9797
_GLAPI_EXPORT extern const struct _glapi_table *_glapi_Dispatch;
9898
_GLAPI_EXPORT extern const void *_glapi_Context;
9999

100-
# define GET_DISPATCH() _glapi_tls_Dispatch
101-
# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _glapi_tls_Context
100+
# define GET_DISPATCH() _glapi_get_dispatch()
101+
# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _glapi_get_context()
102102

103103
#else
104104

src/mesa/drivers/dri/i965/brw_draw.c

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,51 @@ brw_draw_prims(struct gl_context *ctx,
11891189
brw->predicate.state = predicate_state;
11901190
}
11911191

1192+
#define MAX_PATCH_PER_DRAW 2
1193+
1194+
static void
1195+
brw_draw_prims_patch(struct gl_context *ctx,
1196+
const struct _mesa_prim *prims,
1197+
GLuint nr_prims,
1198+
const struct _mesa_index_buffer *ib,
1199+
GLboolean index_bounds_valid,
1200+
GLuint min_index,
1201+
GLuint max_index,
1202+
struct gl_transform_feedback_object *gl_xfb_obj,
1203+
unsigned stream,
1204+
struct gl_buffer_object *indirect) {
1205+
1206+
if (ctx != NULL && nr_prims == 1 && prims != NULL && prims->mode == GL_PATCHES && ib != NULL) {
1207+
struct _mesa_index_buffer ib_loop;
1208+
GLint patch_vertices = ctx->TessCtrlProgram.patch_vertices;
1209+
ib_loop = *ib;
1210+
GLuint count = ib->count;
1211+
unsigned index_size = ib->index_size;
1212+
struct gl_buffer_object *obj = ib->obj;
1213+
void *ptr = ib->ptr;
1214+
GLuint startindx = 0;
1215+
while (count > MAX_PATCH_PER_DRAW * patch_vertices) {
1216+
struct _mesa_index_buffer ib_new;
1217+
struct _mesa_prim prims_new;
1218+
ib_new.index_size = index_size;
1219+
ib_new.obj = obj;
1220+
ib_new.count = patch_vertices * MAX_PATCH_PER_DRAW;
1221+
ib_new.ptr = ptr + startindx * index_size;
1222+
prims_new = *prims;
1223+
prims_new.count = patch_vertices * MAX_PATCH_PER_DRAW;
1224+
brw_draw_prims(ctx, &prims_new, nr_prims,
1225+
&ib_new, index_bounds_valid, min_index, max_index,
1226+
gl_xfb_obj, stream, indirect);
1227+
startindx += MAX_PATCH_PER_DRAW * patch_vertices;
1228+
count -= MAX_PATCH_PER_DRAW * patch_vertices;
1229+
}
1230+
} else {
1231+
brw_draw_prims(ctx, prims, nr_prims,
1232+
ib, index_bounds_valid, min_index, max_index,
1233+
gl_xfb_obj, stream, indirect);
1234+
}
1235+
}
1236+
11921237
void
11931238
brw_draw_indirect_prims(struct gl_context *ctx,
11941239
GLuint mode,
@@ -1230,7 +1275,7 @@ brw_draw_indirect_prims(struct gl_context *ctx,
12301275
brw->draw.draw_params_count_offset = indirect_params_offset;
12311276
}
12321277

1233-
brw_draw_prims(ctx, prim, draw_count,
1278+
brw_draw_prims_patch(ctx, prim, draw_count,
12341279
ib, false, 0, ~0,
12351280
NULL, 0,
12361281
indirect_data);
@@ -1243,7 +1288,7 @@ brw_init_draw_functions(struct dd_function_table *functions)
12431288
{
12441289
/* Register our drawing function:
12451290
*/
1246-
functions->Draw = brw_draw_prims;
1291+
functions->Draw = brw_draw_prims_patch;
12471292
functions->DrawIndirect = brw_draw_indirect_prims;
12481293
}
12491294

src/mesa/main/shaderimage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,11 +588,11 @@ set_image_binding(struct gl_image_unit *u, struct gl_texture_object *texObj,
588588
if (texObj && _mesa_tex_target_is_layered(texObj->Target)) {
589589
u->Layered = layered;
590590
u->Layer = layer;
591-
u->_Layer = (u->Layered ? 0 : u->Layer);
592591
} else {
593592
u->Layered = GL_FALSE;
594593
u->Layer = 0;
595594
}
595+
u->_Layer = (u->Layered ? 0 : u->Layer);
596596

597597
_mesa_reference_texobj(&u->TexObj, texObj);
598598
}

0 commit comments

Comments
 (0)