From 9592aa0bda4f53294670198c105d87f7b9cdd5fe Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Wed, 4 Dec 2024 10:58:25 +0100 Subject: [PATCH] clutter/tests: Remove interactive tests using gdk-pixbuf As those tests are not really useful, see previous commit. Removing them allows us to get rid of gdk-pixbuf in this code path and so, allowing to completely remove it once the MetaBackground API is refactored. Part-of: --- src/tests/clutter/interactive/light0.png | Bin 1559 -> 0 bytes src/tests/clutter/interactive/meson.build | 4 - src/tests/clutter/interactive/redhand.png | Bin 8250 -> 0 bytes .../clutter/interactive/redhand_alpha.png | Bin 2360 -> 0 bytes .../interactive/test-cogl-multitexture.c | 239 ------------ .../clutter/interactive/test-cogl-offscreen.c | 304 --------------- .../interactive/test-cogl-shader-glsl.c | 359 ------------------ .../clutter/interactive/test-cogl-tex-tile.c | 180 --------- src/tests/clutter/test-utils.h | 126 ------ 9 files changed, 1212 deletions(-) delete mode 100644 src/tests/clutter/interactive/light0.png delete mode 100644 src/tests/clutter/interactive/redhand.png delete mode 100644 src/tests/clutter/interactive/redhand_alpha.png delete mode 100644 src/tests/clutter/interactive/test-cogl-multitexture.c delete mode 100644 src/tests/clutter/interactive/test-cogl-offscreen.c delete mode 100644 src/tests/clutter/interactive/test-cogl-shader-glsl.c delete mode 100644 src/tests/clutter/interactive/test-cogl-tex-tile.c delete mode 100644 src/tests/clutter/test-utils.h diff --git a/src/tests/clutter/interactive/light0.png b/src/tests/clutter/interactive/light0.png deleted file mode 100644 index 52c64e81a1a922cc3370499100d415eac2fe2ec2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1559 zcmY+Ec~sI_6vshxNmR1j7u-!7EFCvAR6r0d6?bt-b19eHEd?VNT+lpjIqqp$N~1NB znoBVfWrUNZHihNbWR?v!>13#7hA=;CI;VN(zIV_4eD8br-hW=Hw-;VPPE!s90x7t= zVSNEV3T&RNBybv!6W#!>!`s6jhjLJHL8@XMRdG&gcxN>?w7MrwgMioccGL86*YZ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}p;&&?eA%(xpemn(OO26>&#fO6-c~Ws#K#*CY6r2*R za&@^pfGuGir~!Z@00`&-0Oz(H0K{u`eLyflwF^`LR2-o4w$kqa>NlXWmA(a(fDD_h z2fqg@-zwa{Z4+n-c|zpC!=eNF4wnZ!pxOl5K&FU1IPohO$JhkgLwLkBxOX(K4+WG3 zfa4c{iVo;q)^+?E_yel<_o@c~KmY({aD+?(_fcD2@_WBbSr*}ghqK;&{=aFNg7WP2 SQ_U*3zD9SP7q%O7nEEf@=F&R= diff --git a/src/tests/clutter/interactive/meson.build b/src/tests/clutter/interactive/meson.build index eb0089637..d9132e533 100644 --- a/src/tests/clutter/interactive/meson.build +++ b/src/tests/clutter/interactive/meson.build @@ -15,9 +15,6 @@ clutter_tests_interactive_link_args = [ clutter_tests_interactive_test_sources = [ 'test-events.c', 'test-grab.c', - 'test-cogl-shader-glsl.c', - 'test-cogl-tex-tile.c', - 'test-cogl-offscreen.c', 'test-animation.c', 'test-binding-pool.c', 'test-text.c', @@ -55,7 +52,6 @@ executable('test-interactive', link_args: clutter_tests_interactive_link_args, dependencies: [ libmutter_test_dep, - gdk_pixbuf_dep, ], install: false, ) diff --git a/src/tests/clutter/interactive/redhand.png b/src/tests/clutter/interactive/redhand.png deleted file mode 100644 index c07d8acd33d54996512f6e2b6ca4d17b5ffc4f20..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8250 zcmZ`;Wmr_v)*gE3p#+8+Lb^c&q=pb2x^?Iv#L#Gna z;9~}DGo8|sclaT%M4lM0sJI~^@yle1Nun*Qtas*mx9*&F^7#69TJZ3qQ-xoJo%DX| znaMt;`2V;vDHOLbxeD%3@fWQ(yl9B0{<|x|zEzBir7;y0eIx5!CM!yB=ABC^n0Zqi zULG=FeZ+x^fuZI}U%)~*L0t=1xN;I9lps7>s{tfzeLxhvh7rStBEoj>Xy*5;3&sCx z4C0EZ2}Qzg*pggWz|2@mv*DQiw{83&9ld&Dk*Q5sh^U0i+KJ$MwOg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!io7UZbnkI;smuHr9=B+_w`b%|XPCw%6_#L_1P_pa>UO+kCF zVpflgl)>-WW>h_F2elCUtf&~Q1F4JBw6Z>Wo^sDMvre64onZNX8c>y&z6ZWFmj7Zv z4uv?pr`f^`BL+*5T<(eZg*?tTCcQNg5Fwbkc0Oz6rwCVpC=w!!`Slib*R>!R!QMAw zk67_C8m9I#TvSu68Juqer~II2N*aol@-LA8 E2il-`3jhEB diff --git a/src/tests/clutter/interactive/redhand_alpha.png b/src/tests/clutter/interactive/redhand_alpha.png deleted file mode 100644 index 42a93c3a4405853d89acc80521bdb25313edb74b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2360 zcmV-83CH${P)7Pc1`wip<;85y=38n+u8w;UX}9UZtIAGjbOxgsLDBO}8=K)NL*!$Cp$?d`)t zLjC*u#6v^6CMLTkCjS2Z`Rwe(MMcC$M*jZ(yC)~bM@Rqv|HVj1`0DDrC@98BNybY{ zyD2HgOia8gD){N?$4^hlP*A)pE67q(6_XXbEG)e+FupM{zA`euGc&(5G`}@9zcx0& zH#fjIIKewR!8|;|Jw3ucKEgjg!$CpBLqo(wM8ri!#70KNM@Pj-NXAJ?$x~CwR8+}T zRmxUY%2-&+Sy{_kTFYBo%UoQ{U0uvxUd>-$&0t{7VPVZ;V$Ne@&ShoKW@gW4XU}M8 z&uMAUX=%`EYS3$I(QItdZEewRZqaXV(r|FnadFaea?^Bl({**!c6QWvchq=z)p>c< zdV1A+d)9n>)_r}}ety<}f7gG1*MWi9f`ZtCgV=ejkkdWMwk=&A!-IJ5ul$70-mEM(=-jEqpspP7vbtw@yu9kZzU#lg>%hS4!NKgp!tBGt?Zw6I#>VZ( z$L`3;?#apS%F6D`%kRw0@6FBd&d%`9&+yRD@X^un($ewN)biEU^48Y!*Vpsd*z?)h z^xNC?+}!lt-Syty_21w1;NbP);r8O<_T%ICGp>{QUm?{r~>{|NsAyf;RsE z001m>QchC<00000000000000002m@ACowucL_|tVS7T#laC&@#h>4=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Ft!8>x)kUA%;|dt$uvRxTSh<(Vsw|A^PXeaN@%W1Dq90>F`uh-37E#zHcEp zXqAhHx2$+;?#u=6uHAV8jxa+S5GZ|!qqQX&fws-o0v zjCfwIaS&p5#M?-y2c($gZ6rq^M}w!4`~o@ZJe6#Q91$-ev=L(55F5fPSr0L)y_M8L zjMxxn$rebl-dhMYK#0lFA^eiww?c%ju_5dd%7qBJ5JpM0><~uDzFwk37$r1Mb_kd?2uC+=hl4b_EkX!B;}66^ zTD31AU?s!}VWiONOa!Q0*TE>!+ccvGg7Gc!LKr1ZOxepwv`XT4uu>ccH&-v2{py&^ zXNLQ2RL;^JMEVdG5~odTNe^L=-oYTfgF$)+gY*st=^YH>I~c@wFv!nfke|UIKZ7YL eBP`3ZEbBk%iTT(2=KcQw0000 -#include -#include - -#include -#include -#include - -#include -#include - -#include "clutter/test-utils.h" -#include "tests/clutter-test-utils.h" - -typedef struct _TestMultiLayerPipelineState -{ - ClutterActor *group; - CoglTexture *alpha_tex; - CoglTexture *redhand_tex; - gfloat *tex_coords; - - ClutterTimeline *timeline; - - CoglPipeline *pipeline0; - graphene_matrix_t tex_matrix0; - graphene_matrix_t rot_matrix0; - CoglTexture *light_tex0; - - CoglPipeline *pipeline1; - graphene_matrix_t tex_matrix1; - graphene_matrix_t rot_matrix1; - CoglTexture *light_tex1; - -} TestMultiLayerPipelineState; - -int -test_cogl_multitexture_main (int argc, char *argv[]); - -const char * -test_cogl_multitexture_describe (void); - -static void -frame_cb (ClutterTimeline *timeline, - int frame_no, - gpointer data) -{ - TestMultiLayerPipelineState *state = data; - - graphene_matrix_multiply (&state->rot_matrix0, - &state->tex_matrix0, - &state->tex_matrix0); - cogl_pipeline_set_layer_matrix (state->pipeline0, 2, &state->tex_matrix0); - - graphene_matrix_multiply (&state->rot_matrix1, - &state->tex_matrix1, - &state->tex_matrix1); - cogl_pipeline_set_layer_matrix (state->pipeline1, 2, &state->tex_matrix1); -} - -static void -pipeline_rectangle_paint (ClutterActor *actor, - ClutterPaintContext *paint_context, - gpointer data) -{ - TestMultiLayerPipelineState *state = data; - CoglFramebuffer *framebuffer = - clutter_paint_context_get_framebuffer (paint_context); - - cogl_framebuffer_push_matrix (framebuffer); - - cogl_framebuffer_translate (framebuffer, 150, 15, 0); - - cogl_framebuffer_draw_multitextured_rectangle (framebuffer, - COGL_FRAMEBUFFER (state->pipeline0), - 0, 0, 200, 213, - state->tex_coords, - 12); - cogl_framebuffer_translate (framebuffer, -300, -30, 0); - cogl_framebuffer_draw_multitextured_rectangle (framebuffer, - COGL_FRAMEBUFFER (state->pipeline1), - 0, 0, 200, 213, - state->tex_coords, - 12); - - cogl_framebuffer_pop_matrix (framebuffer); -} - -static void -animation_completed_cb (ClutterAnimation *animation, - TestMultiLayerPipelineState *state) -{ - static gboolean go_back = FALSE; - gdouble new_rotation_y; - - if (go_back) - new_rotation_y = 30; - else - new_rotation_y = -30; - go_back = !go_back; - - clutter_actor_animate_with_timeline (state->group, - CLUTTER_LINEAR, - state->timeline, - "rotation-angle-y", new_rotation_y, - "signal-after::completed", - animation_completed_cb, state, - NULL); - - -} - -G_MODULE_EXPORT int -test_cogl_multitexture_main (int argc, char *argv[]) -{ - GError *error = NULL; - ClutterActor *stage; - CoglColor stage_color = { 0x61, 0x56, 0x56, 0xff }; - g_autofree TestMultiLayerPipelineState *state = g_new0 (TestMultiLayerPipelineState, 1); - gfloat stage_w, stage_h; - gchar **files; - gfloat tex_coords[] = - { - /* tx1 ty1 tx2 ty2 */ - 0, 0, 1, 1, - 0, 0, 1, 1, - 0, 0, 1, 1 - }; - CoglContext *ctx; - - clutter_test_init (&argc, &argv); - - stage = clutter_test_get_stage (); - clutter_actor_get_size (stage, &stage_w, &stage_h); - - clutter_actor_set_background_color (CLUTTER_ACTOR (stage), &stage_color); - - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_test_quit), NULL); - - /* We create a non-descript actor that we know doesn't have a - * default paint handler, so that we can easily control - * painting in a paint signal handler, without having to - * sub-class anything etc. */ - state->group = clutter_actor_new (); - clutter_actor_set_position (state->group, stage_w / 2, stage_h / 2); - g_signal_connect (state->group, "paint", - G_CALLBACK (pipeline_rectangle_paint), state); - - files = g_new (gchar*, 4); - files[0] = g_build_filename (TESTS_DATADIR, "redhand_alpha.png", NULL); - files[1] = g_build_filename (TESTS_DATADIR, "redhand.png", NULL); - files[2] = g_build_filename (TESTS_DATADIR, "light0.png", NULL); - files[3] = NULL; - - ctx = clutter_backend_get_cogl_context (clutter_test_get_backend ()); - state->alpha_tex = clutter_test_texture_2d_new_from_file (ctx, files[0], &error); - if (!state->alpha_tex) - g_critical ("Failed to load redhand_alpha.png: %s", error->message); - - state->redhand_tex = clutter_test_texture_2d_new_from_file (ctx, files[1], &error); - if (!state->redhand_tex) - g_critical ("Failed to load redhand.png: %s", error->message); - - state->light_tex0 = clutter_test_texture_2d_new_from_file (ctx, files[2], &error); - if (!state->light_tex0) - g_critical ("Failed to load light0.png: %s", error->message); - - state->light_tex1 = clutter_test_texture_2d_new_from_file (ctx, files[2], &error); - if (!state->light_tex1) - g_critical ("Failed to load light0.png: %s", error->message); - - g_strfreev (files); - - state->pipeline0 = cogl_pipeline_new (); - cogl_pipeline_set_layer (state->pipeline0, 0, state->alpha_tex); - cogl_pipeline_set_layer (state->pipeline0, 1, state->redhand_tex); - cogl_pipeline_set_layer (state->pipeline0, 2, state->light_tex0); - - state->pipeline1 = cogl_pipeline_new (); - cogl_pipeline_set_layer (state->pipeline1, 0, state->alpha_tex); - cogl_pipeline_set_layer (state->pipeline1, 1, state->redhand_tex); - cogl_pipeline_set_layer (state->pipeline1, 2, state->light_tex1); - - state->tex_coords = tex_coords; - - graphene_matrix_init_identity (&state->tex_matrix0); - graphene_matrix_init_identity (&state->tex_matrix1); - graphene_matrix_init_identity (&state->rot_matrix0); - graphene_matrix_init_identity (&state->rot_matrix1); - - graohene_matrix_translate (&state->rot_matrix0, - &GRAPHENE_POINT3D_INIT (-0.5, -0.5, 0)); - graohene_matrix_rotate (&state->rot_matrix0, 10.0, graphene_vec3_z_axis ()); - graphene_matrix_translate (&state->rot_matrix0, - &GRAPHENE_POINT3D_INIT (0.5, 0.5, 0)); - - graphene_matrix_translate (&state->rot_matrix1, - &GRAPHENE_POINT3D_INIT (-0.5, -0.5, 0)); - graohene_matrix_rotate (&state->rot_matrix1, -10.0, graphene_vec3_z_axis ()); - graphene_matrix_translate (&state->rot_matrix1, - &GRAPHENE_POINT3D_INIT (0.5, 0.5, 0)); - - clutter_actor_set_translation (data->parent_container, -86.f, -125.f, 0.f); - clutter_actor_add_child (stage, state->group); - - state->timeline = clutter_timeline_new_for_actor (stage, 2812); - - g_signal_connect (state->timeline, "new-frame", G_CALLBACK (frame_cb), state); - - clutter_actor_animate_with_timeline (state->group, - CLUTTER_LINEAR, - state->timeline, - "rotation-angle-y", 30.0, - "signal-after::completed", - animation_completed_cb, state, - NULL); - - /* start the timeline and thus the animations */ - clutter_timeline_start (state->timeline); - - clutter_actor_show (stage); - - clutter_test_main (); - - g_object_unref (state->pipeline1); - g_object_unref (state->pipeline0); - g_object_unref (state->alpha_tex); - g_object_unref (state->redhand_tex); - g_object_unref (state->light_tex0); - g_object_unref (state->light_tex1); - g_free (state); - - return 0; -} - -G_MODULE_EXPORT const char * -test_cogl_multitexture_describe (void) -{ - return "Multi-texturing support in Cogl."; -} diff --git a/src/tests/clutter/interactive/test-cogl-offscreen.c b/src/tests/clutter/interactive/test-cogl-offscreen.c deleted file mode 100644 index fb21521a4..000000000 --- a/src/tests/clutter/interactive/test-cogl-offscreen.c +++ /dev/null @@ -1,304 +0,0 @@ -#include -#include -#include -#include -#include - -#include "clutter/test-utils.h" -#include "tests/clutter-test-utils.h" - -/* Coglbox declaration - *--------------------------------------------------*/ - -G_BEGIN_DECLS - -#define TEST_TYPE_COGLBOX test_coglbox_get_type() - -static -G_DECLARE_FINAL_TYPE (TestCoglbox, test_coglbox, TEST, COGLBOX, ClutterActor) - -struct _TestCoglbox -{ - ClutterActor parent; - - CoglTexture *texhand_id; - CoglTexture *texture_id; - CoglFramebuffer *framebuffer; -}; - -G_DEFINE_TYPE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR); - -int -test_cogl_offscreen_main (int argc, char *argv[]); - -const char * -test_cogl_offscreen_describe (void); - -G_END_DECLS - -/* Coglbox implementation - *--------------------------------------------------*/ - -static void -test_coglbox_paint (ClutterActor *self, - ClutterPaintContext *paint_context) -{ - TestCoglbox *coglbox = TEST_COGLBOX (self); - CoglFramebuffer *framebuffer = - clutter_paint_context_get_framebuffer (paint_context); - CoglContext *ctx = cogl_framebuffer_get_context (framebuffer); - gfloat texcoords[4] = { 0, 0, 1, 1 }; - CoglPipeline *pipeline; - CoglColor color; - - pipeline = cogl_pipeline_new (ctx); - cogl_color_init_from_4f (&color, 0.4f, 0.4f, 221.0f / 255.0f, 1.0f); - cogl_pipeline_set_color (pipeline, &color); - cogl_framebuffer_draw_rectangle (framebuffer, pipeline, 0, 0, 400, 400); - g_object_unref (pipeline); - - pipeline = cogl_pipeline_new (ctx); - cogl_pipeline_set_layer_texture (pipeline, 0, coglbox->texhand_id); - cogl_framebuffer_draw_textured_rectangle (framebuffer, pipeline, - 0, 0, - 400, 400, - 0, 0, - 6, 6); - g_object_unref (pipeline); - - pipeline = cogl_pipeline_new (ctx); - - cogl_color_init_from_4f (&color, 1.0f, 0.0f, 0.0f, 1.0f); - cogl_pipeline_set_color (pipeline, &color); - cogl_framebuffer_draw_rectangle (coglbox->framebuffer, pipeline, - 20, 20, 20 + 100, 20 + 100); - - cogl_color_init_from_4f (&color, 0.0f, 1.0f, 0.0f, 1.0f); - cogl_pipeline_set_color (pipeline, &color); - cogl_framebuffer_draw_rectangle (coglbox->framebuffer, pipeline, - 80, 80, 80 + 100, 80 + 100); - g_object_unref (pipeline); - - pipeline = cogl_pipeline_new (ctx); - cogl_color_init_from_4f (&color, - 136.0f / 255.0f, 136.0f / 255.0f, - 136.0f / 255.0f, 136.0f / 255.0f); - cogl_pipeline_set_color (pipeline, &color); - cogl_pipeline_set_layer_texture (pipeline, 0, coglbox->texture_id); - cogl_framebuffer_draw_textured_rectangle (framebuffer, pipeline, - 100, 100, - 300, 300, - texcoords[0], - texcoords[1], - texcoords[2], - texcoords[3]); - g_object_unref (pipeline); -} - -static void -test_coglbox_dispose (GObject *object) -{ - TestCoglbox *coglbox = TEST_COGLBOX (object); - - g_object_unref (coglbox->texture_id); - g_object_unref (coglbox->framebuffer); - - G_OBJECT_CLASS (test_coglbox_parent_class)->dispose (object); -} - -/* A newly created Cogl framebuffer will be initialized with a - * viewport covering the size of the viewport i.e. equavalent to: - * - * calling cogl_framebuffer_set_viewport ( - * fb, - * 0, 0, - * cogl_framebuffer_get_viewport_width (fb), - * cogl_framebuffer_get_viewport_width (fb)); - * - * The projection matrix will be an identity matrix. - * - * The modelview matrix will be an identity matrix, and this will - * create a coordinate system - like OpenGL - with the viewport - * being mapped to a unit cube with the origin (0, 0, 0) in the - * center, x, y and z ranging from -1 to 1 with (-1, -1) being top - * left and (1, 1) bottom right. - * - * This sets up a Clutter like coordinate system for a Cogl - * framebuffer - */ -static void -setup_viewport (CoglFramebuffer *framebuffer, - unsigned int width, - unsigned int height, - float fovy, - float aspect, - float z_near, - float z_far) -{ - float z_camera; - graphene_matrix_t projection_matrix; - graphene_matrix_t mv_matrix; - - cogl_framebuffer_set_viewport (framebuffer, 0, 0, width, height); - - /* For Ortho projection. - * _cogl_matrix_stack_ortho (projection_stack, 0, width, 0, height, -1, 1); - */ - - cogl_framebuffer_perspective (framebuffer, fovy, aspect, z_near, z_far); - - /* - * In theory, we can compute the camera distance from screen as: - * - * 0.5 * tan (FOV) - * - * However, it's better to compute the z_camera from our projection - * matrix so that we get a 1:1 mapping at the screen distance. Consider - * the upper-left corner of the screen. It has object coordinates - * (0,0,0), so by the transform below, ends up with eye coordinate - * - * x_eye = x_object / width - 0.5 = - 0.5 - * y_eye = (height - y_object) / width - 0.5 = 0.5 - * z_eye = z_object / width - z_camera = - z_camera - * - * From cogl_perspective(), we know that the projection matrix has - * the form: - * - * (x, 0, 0, 0) - * (0, y, 0, 0) - * (0, 0, c, d) - * (0, 0, -1, 0) - * - * Applied to the above, we get clip coordinates of - * - * x_clip = x * (- 0.5) - * y_clip = y * 0.5 - * w_clip = - 1 * (- z_camera) = z_camera - * - * Dividing through by w to get normalized device coordinates, we - * have, x_nd = x * 0.5 / z_camera, y_nd = - y * 0.5 / z_camera. - * The upper left corner of the screen has normalized device coordinates, - * (-1, 1), so to have the correct 1:1 mapping, we have to have: - * - * z_camera = 0.5 * x = 0.5 * y - * - * If x != y, then we have a non-uniform aspect ration, and a 1:1 mapping - * doesn't make sense. - */ - - cogl_framebuffer_get_projection_matrix (framebuffer, &projection_matrix); - z_camera = 0.5f * graphene_matrix_get_value (&projection_matrix, 0, 0); - - graphene_matrix_init_translate (&mv_matrix, - &GRAPHENE_POINT3D_INIT (0.0f, - -1.0f * height, - 0.0f)); - graphene_matrix_scale (&mv_matrix, 1.0f / width, -1.0f / height, 1.0f / width); - graphene_matrix_translate (&mv_matrix, - &GRAPHENE_POINT3D_INIT (-0.5f, -0.5f, -z_camera)); - cogl_framebuffer_set_modelview_matrix (framebuffer, &mv_matrix); -} - -static void -test_coglbox_map (ClutterActor *actor) -{ - TestCoglbox *coglbox = TEST_COGLBOX (actor); - ClutterActor *stage; - ClutterPerspective perspective; - float stage_width; - float stage_height; - GError *error = NULL; - - CLUTTER_ACTOR_CLASS (test_coglbox_parent_class)->map (actor); - - printf ("Creating offscreen\n"); - coglbox->framebuffer = - COGL_FRAMEBUFFER (cogl_offscreen_new_with_texture (coglbox->texture_id)); - if (!cogl_framebuffer_allocate (coglbox->framebuffer, &error)) - g_error ("Failed to allocate framebuffer: %s", error->message); - - stage = clutter_actor_get_stage (actor); - clutter_stage_get_perspective (CLUTTER_STAGE (stage), &perspective); - clutter_actor_get_size (stage, &stage_width, &stage_height); - - setup_viewport (coglbox->framebuffer, - (int) stage_width, - (int) stage_height, - perspective.fovy, - perspective.aspect, - perspective.z_near, - perspective.z_far); - - if (!coglbox->framebuffer) - printf ("Failed creating offscreen to texture!\n"); -} - -static void -test_coglbox_init (TestCoglbox *self) -{ - g_autoptr (GError) error = NULL; - CoglContext *ctx = - clutter_backend_get_cogl_context (clutter_test_get_backend ()); - gchar *file; - - printf ("Loading redhand.png\n"); - file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL); - self->texhand_id = clutter_test_texture_2d_new_from_file (ctx, file, &error); - if (error) - g_warning ("Error loading redhand.png: %s", error->message); - g_free (file); - - printf ("Creating texture with size\n"); - self->texture_id = cogl_texture_2d_new_with_size (ctx, 200, 200); - - if (self->texture_id == NULL) - printf ("Failed creating texture with size!\n"); -} - -static void -test_coglbox_class_init (TestCoglboxClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); - - gobject_class->dispose = test_coglbox_dispose; - - actor_class->map = test_coglbox_map; - actor_class->paint = test_coglbox_paint; -} - -static ClutterActor* -test_coglbox_new (void) -{ - return g_object_new (TEST_TYPE_COGLBOX, NULL); -} - -G_MODULE_EXPORT int -test_cogl_offscreen_main (int argc, char *argv[]) -{ - ClutterActor *stage; - ClutterActor *coglbox; - - clutter_test_init (&argc, &argv); - - /* Stage */ - stage = clutter_test_get_stage (); - clutter_actor_set_size (stage, 400, 400); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_test_quit), NULL); - - /* Cogl Box */ - coglbox = test_coglbox_new (); - clutter_actor_add_child (stage, coglbox); - - clutter_actor_show (stage); - - clutter_test_main (); - - return 0; -} - -G_MODULE_EXPORT const char * -test_cogl_offscreen_describe (void) -{ - return "Offscreen buffer support in Cogl."; -} diff --git a/src/tests/clutter/interactive/test-cogl-shader-glsl.c b/src/tests/clutter/interactive/test-cogl-shader-glsl.c deleted file mode 100644 index bb1810269..000000000 --- a/src/tests/clutter/interactive/test-cogl-shader-glsl.c +++ /dev/null @@ -1,359 +0,0 @@ -#define COGL_DISABLE_DEPRECATION_WARNINGS - -#include - -#include -#include -#include -#include - -#include "clutter/test-utils.h" -#include "tests/clutter-test-utils.h" - -typedef struct -{ - const char *name; - const char *source; -} ShaderSource; - -int -test_cogl_shader_glsl_main (int argc, char *argv[]); - -/* a couple of boilerplate defines that are common amongst all the - * sample shaders - */ - -/* FRAGMENT_SHADER_BEGIN: generate boilerplate with a local vec4 color already - * initialized, from a sampler2D in a variable tex. - */ -#define FRAGMENT_SHADER_VARS \ - "uniform sampler2D tex;" \ - "uniform float x_step, y_step;" - -#define FRAGMENT_SHADER_BEGIN \ - "void main (){" \ - " vec4 color = texture2D (tex, vec2(cogl_tex_coord_in[0]));" - -/* FRAGMENT_SHADER_END: apply the changed color to the output buffer correctly - * blended with the gl specified color (makes the opacity of actors work - * correctly). - */ -#define FRAGMENT_SHADER_END \ - " cogl_color_out = color;" \ - " cogl_color_out = cogl_color_out * cogl_color_in;" \ - "}" - -static ShaderSource shaders[]= - { - {"brightness-contrast", - FRAGMENT_SHADER_VARS - "uniform float brightness, contrast;" - FRAGMENT_SHADER_BEGIN - " color.rgb /= color.a;" - " color.rgb = (color.rgb - vec3(0.5, 0.5, 0.5)) * contrast + " - "vec3 (brightness + 0.5, brightness + 0.5, brightness + 0.5);" - " color.rgb *= color.a;" - FRAGMENT_SHADER_END - }, - - {"box-blur", - FRAGMENT_SHADER_VARS - - "vec4 get_rgba_rel(sampler2D tex, float dx, float dy)" - "{" - " return texture2D (tex, cogl_tex_coord_in[0].st " - " + vec2(dx, dy) * 2.0);" - "}" - - FRAGMENT_SHADER_BEGIN - " float count = 1.0;" - " color += get_rgba_rel (tex, -x_step, -y_step); count++;" - " color += get_rgba_rel (tex, -x_step, 0.0); count++;" - " color += get_rgba_rel (tex, -x_step, y_step); count++;" - " color += get_rgba_rel (tex, 0.0, -y_step); count++;" - " color += get_rgba_rel (tex, 0.0, 0.0); count++;" - " color += get_rgba_rel (tex, 0.0, y_step); count++;" - " color += get_rgba_rel (tex, x_step, -y_step); count++;" - " color += get_rgba_rel (tex, x_step, 0.0); count++;" - " color += get_rgba_rel (tex, x_step, y_step); count++;" - " color = color / count;" - FRAGMENT_SHADER_END - }, - - {"invert", - FRAGMENT_SHADER_VARS - FRAGMENT_SHADER_BEGIN - " color.rgb /= color.a;" - " color.rgb = vec3(1.0, 1.0, 1.0) - color.rgb;\n" - " color.rgb *= color.a;" - FRAGMENT_SHADER_END - }, - - {"brightness-contrast", - FRAGMENT_SHADER_VARS - "uniform float brightness;" - "uniform float contrast;" - FRAGMENT_SHADER_BEGIN - " color.rgb /= color.a;" - " color.r = (color.r - 0.5) * contrast + brightness + 0.5;" - " color.g = (color.g - 0.5) * contrast + brightness + 0.5;" - " color.b = (color.b - 0.5) * contrast + brightness + 0.5;" - " color.rgb *= color.a;" - FRAGMENT_SHADER_END - }, - - {"gray", - FRAGMENT_SHADER_VARS - FRAGMENT_SHADER_BEGIN - " float avg = (color.r + color.g + color.b) / 3.0;" - " color.r = avg;" - " color.g = avg;" - " color.b = avg;" - FRAGMENT_SHADER_END - }, - - {"combined-mirror", - FRAGMENT_SHADER_VARS - FRAGMENT_SHADER_BEGIN - " vec4 colorB = texture2D (tex, vec2(cogl_tex_coord_in[0].ts));" - " float avg = (color.r + color.g + color.b) / 3.0;" - " color.r = avg;" - " color.g = avg;" - " color.b = avg;" - " color = (color + colorB)/2.0;" - FRAGMENT_SHADER_END - }, - - {"edge-detect", - FRAGMENT_SHADER_VARS - "float get_avg_rel(sampler2D texB, float dx, float dy)" - "{" - " vec4 colorB = texture2D (texB, cogl_tex_coord_in[0].st + vec2(dx, dy));" - " return (colorB.r + colorB.g + colorB.b) / 3.0;" - "}" - FRAGMENT_SHADER_BEGIN - " mat3 sobel_h = mat3( 1.0, 2.0, 1.0," - " 0.0, 0.0, 0.0," - " -1.0, -2.0, -1.0);" - " mat3 sobel_v = mat3( 1.0, 0.0, -1.0," - " 2.0, 0.0, -2.0," - " 1.0, 0.0, -1.0);" - " mat3 map = mat3( get_avg_rel(tex, -x_step, -y_step)," - " get_avg_rel(tex, -x_step, 0.0)," - " get_avg_rel(tex, -x_step, y_step)," - " get_avg_rel(tex, 0.0, -y_step)," - " get_avg_rel(tex, 0.0, 0.0)," - " get_avg_rel(tex, 0.0, y_step)," - " get_avg_rel(tex, x_step, -y_step)," - " get_avg_rel(tex, x_step, 0.0)," - " get_avg_rel(tex, x_step, y_step) );" - " mat3 gh = sobel_h * map;" - " mat3 gv = map * sobel_v;" - " float avgh = (gh[0][0] + gh[0][1] + gh[0][2] +" - " gh[1][0] + gh[1][1] + gh[1][2] +" - " gh[2][0] + gh[2][1] + gh[2][2]) / 18.0 + 0.5;" - " float avgv = (gv[0][0] + gv[0][1] + gv[0][2] +" - " gv[1][0] + gv[1][1] + gv[1][2] +" - " gv[2][0] + gv[2][1] + gv[2][2]) / 18.0 + 0.5;" - " float avg = (avgh + avgv) / 2.0;" - " color.r = avg * color.r;" - " color.g = avg * color.g;" - " color.b = avg * color.b;" - FRAGMENT_SHADER_END - } -}; - -static CoglTexture *redhand; -static CoglPipeline *pipeline; -static unsigned int timeout_id = 0; -static int shader_no = 0; - -static void -on_paint (ClutterActor *actor, - ClutterPaintContext *paint_context) -{ - CoglFramebuffer *framebuffer = - clutter_paint_context_get_framebuffer (paint_context); - float stage_width = clutter_actor_get_width (actor); - float stage_height = clutter_actor_get_height (actor); - float image_width = cogl_texture_get_width (redhand); - float image_height = cogl_texture_get_height (redhand); - - cogl_framebuffer_draw_rectangle (framebuffer, pipeline, - stage_width / 2.0f - image_width / 2.0f, - stage_height / 2.0f - image_height / 2.0f, - stage_width / 2.0f + image_width / 2.0f, - stage_height / 2.0f + image_height / 2.0f); -} - -static void -set_shader_num (int new_no) -{ - CoglShader *shader; - CoglProgram *program; - CoglPipeline *shader_pipeline; - CoglContext *ctx = - clutter_backend_get_cogl_context (clutter_test_get_backend ()); - int image_width = cogl_texture_get_width (redhand); - int image_height = cogl_texture_get_height (redhand); - int uniform_no; - - g_print ("setting shaders[%i] named '%s'\n", - new_no, - shaders[new_no].name); - - shader_pipeline = cogl_pipeline_new (ctx); - - shader = cogl_shader_new (COGL_SHADER_TYPE_FRAGMENT); - cogl_shader_source (shader, shaders[new_no].source); - - program = cogl_program_new (); - cogl_program_attach_shader (program, shader); - g_object_unref (shader); - cogl_program_link (program); - - uniform_no = cogl_program_get_uniform_location (program, "tex"); - cogl_program_set_uniform_1i (program, uniform_no, 0); - uniform_no = cogl_program_get_uniform_location (program, "radius"); - cogl_program_set_uniform_1f (program, uniform_no, 3.0f); - uniform_no = cogl_program_get_uniform_location (program, "brightness"); - cogl_program_set_uniform_1f (program, uniform_no, 0.4f); - uniform_no = cogl_program_get_uniform_location (program, "contrast"); - cogl_program_set_uniform_1f (program, uniform_no, -1.9f); - - uniform_no = cogl_program_get_uniform_location (program, "x_step"); - cogl_program_set_uniform_1f (program, uniform_no, 1.0f / image_width); - uniform_no = cogl_program_get_uniform_location (program, "y_step"); - cogl_program_set_uniform_1f (program, uniform_no, 1.0f / image_height); - - cogl_pipeline_set_user_program (shader_pipeline, program); - g_object_unref (program); - - shader_no = new_no; -} - -static gboolean -button_release_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer data) -{ - int new_no; - - /* Stop the automatic cycling if the user want to manually control - * which shader to display */ - g_clear_handle_id (&timeout_id, g_source_remove); - - if (clutter_event_get_button (event) == 1) - { - new_no = shader_no - 1; - if (new_no < 0) - new_no = G_N_ELEMENTS (shaders) - 1; - } - else - { - new_no = shader_no + 1; - if (new_no >= G_N_ELEMENTS (shaders)) - new_no = 0; - } - - set_shader_num (new_no); - - return CLUTTER_EVENT_STOP; -} - -static gboolean -key_release_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - guint keysym = clutter_event_get_key_symbol (event); - ClutterModifierType mods = clutter_event_get_state (event); - - if (keysym == CLUTTER_KEY_q || - ((mods & CLUTTER_SHIFT_MASK) && keysym == CLUTTER_KEY_q)) - clutter_test_quit (); - - return CLUTTER_EVENT_STOP; -} - -static gboolean -timeout_cb (gpointer user_data) -{ - shader_no++; - if (shader_no > (G_N_ELEMENTS (shaders) - 1)) - shader_no = 0; - - set_shader_num (shader_no); - - return G_SOURCE_CONTINUE; -} - -static gboolean -idle_cb (gpointer data) -{ - clutter_actor_queue_redraw (data); - - return G_SOURCE_CONTINUE; -} - -static gboolean -destroy_window_cb (ClutterStage *stage, - ClutterEvent *event, - gpointer user_data) -{ - clutter_test_quit (); - - return CLUTTER_EVENT_STOP; -} - -G_MODULE_EXPORT int -test_cogl_shader_glsl_main (int argc, char *argv[]) -{ - ClutterActor *stage; - ClutterActor *actor; - char *file; - GError *error; - CoglColor stage_color = { 0x61, 0x64, 0x8c, 0xff }; - CoglPipeline *shader_pipeline; - CoglContext *ctx = - clutter_backend_get_cogl_context (clutter_test_get_backend ()); - - clutter_test_init (&argc, &argv); - - stage = clutter_test_get_stage (); - actor = g_object_new (CLUTTER_TYPE_TEST_ACTOR, NULL); - clutter_actor_add_child (stage, actor); - - clutter_actor_set_background_color (CLUTTER_ACTOR (stage), &stage_color); - - file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL); - error = NULL; - redhand = clutter_test_texture_2d_new_from_file (ctx, file, &error); - if (redhand == NULL) - g_error ("image load failed: %s", error->message); - - shader_pipeline = cogl_pipeline_new (ctx); - cogl_pipeline_set_layer_texture (shader_pipeline, 0, redhand); - - set_shader_num (0); - g_signal_connect (actor, "paint", G_CALLBACK (on_paint), NULL); - - clutter_actor_set_reactive (stage, TRUE); - g_signal_connect (stage, "button-release-event", - G_CALLBACK (button_release_cb), NULL); - g_signal_connect (stage, "key-release-event", - G_CALLBACK (key_release_cb), NULL); - - g_signal_connect (stage, "delete-event", - G_CALLBACK (destroy_window_cb), NULL); - - timeout_id = g_timeout_add (1000, timeout_cb, NULL); - - g_idle_add (idle_cb, stage); - - clutter_actor_show (stage); - - clutter_test_main (); - - return EXIT_SUCCESS; -} diff --git a/src/tests/clutter/interactive/test-cogl-tex-tile.c b/src/tests/clutter/interactive/test-cogl-tex-tile.c deleted file mode 100644 index d5c2da094..000000000 --- a/src/tests/clutter/interactive/test-cogl-tex-tile.c +++ /dev/null @@ -1,180 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include "clutter/test-utils.h" -#include "tests/clutter-test-utils.h" - -/* Coglbox declaration - *--------------------------------------------------*/ - -G_BEGIN_DECLS - -#define TEST_TYPE_COGLBOX test_coglbox_get_type() - -static -G_DECLARE_FINAL_TYPE (TestCoglbox, test_coglbox, TEST, COGLBOX, ClutterActor) - -struct _TestCoglbox -{ - ClutterActor parent; - - CoglTexture *cogl_tex_id; - float animation_progress; -}; - -G_DEFINE_TYPE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR); - -int -test_cogl_tex_tile_main (int argc, char *argv[]); - -const char * -test_cogl_tex_tile_describe (void); - -G_END_DECLS - -/* Coglbox implementation - *--------------------------------------------------*/ - -static void -test_coglbox_paint (ClutterActor *self, - ClutterPaintContext *paint_context) -{ - TestCoglbox *coglbox = TEST_COGLBOX (self); - CoglFramebuffer *framebuffer = - clutter_paint_context_get_framebuffer (paint_context); - CoglContext *ctx = cogl_framebuffer_get_context (framebuffer); - CoglPipeline *pipeline; - CoglColor color; - gfloat texcoords[4] = { 0.0f, 0.0f, 1.0f, 1.0f }; - gfloat angle; - gfloat frac; - gint t; - - angle = (float) (coglbox->animation_progress * 2 * G_PI); - - frac = ((coglbox->animation_progress <= 0.5f - ? coglbox->animation_progress - : 1.0f - coglbox->animation_progress) + 0.5f) * 2.0f; - - for (t=0; t<4; t+=2) - { - texcoords[t] += cosf (angle); - texcoords[t+1] += sinf (angle); - - texcoords[t] *= frac; - texcoords[t+1] *= frac; - } - - cogl_framebuffer_push_matrix (framebuffer); - - pipeline = cogl_pipeline_new (ctx); - cogl_color_init_from_4f (&color, 0.4f, 0.4f, 221.0f / 255.0f, 1.0f); - cogl_pipeline_set_color (pipeline, &color); - cogl_framebuffer_draw_rectangle (framebuffer, pipeline, 0, 0, 400, 400); - g_object_unref (pipeline); - - cogl_framebuffer_translate (framebuffer, 100, 100, 0); - - pipeline = cogl_pipeline_new (ctx); - cogl_pipeline_set_layer_texture (pipeline, 0, coglbox->cogl_tex_id); - cogl_framebuffer_draw_textured_rectangle (framebuffer, pipeline, - 0, 0, 200, 213, - texcoords[0], texcoords[1], - texcoords[2], texcoords[3]); - g_object_unref (pipeline); - - cogl_framebuffer_pop_matrix (framebuffer); -} - -static void -test_coglbox_dispose (GObject *object) -{ - TestCoglbox *coglbox = TEST_COGLBOX (object); - - g_object_unref (coglbox->cogl_tex_id); - - G_OBJECT_CLASS (test_coglbox_parent_class)->dispose (object); -} - -static void -test_coglbox_init (TestCoglbox *self) -{ - g_autoptr (GError) error = NULL; - CoglContext *ctx = - clutter_backend_get_cogl_context (clutter_test_get_backend ()); - gchar *file; - - file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL); - self->cogl_tex_id = clutter_test_texture_2d_new_from_file (ctx, file, &error); - if (error) - g_warning ("Error loading redhand.png: %s", error->message); - g_free (file); -} - -static void -test_coglbox_class_init (TestCoglboxClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); - - gobject_class->dispose = test_coglbox_dispose; - actor_class->paint = test_coglbox_paint; -} - -static ClutterActor* -test_coglbox_new (void) -{ - return g_object_new (TEST_TYPE_COGLBOX, NULL); -} - -static void -frame_cb (ClutterTimeline *timeline, - int msecs, - gpointer data) -{ - TestCoglbox *coglbox = TEST_COGLBOX (data); - - coglbox->animation_progress = (float) clutter_timeline_get_progress (timeline); - clutter_actor_queue_redraw (CLUTTER_ACTOR (data)); -} - -G_MODULE_EXPORT int -test_cogl_tex_tile_main (int argc, char *argv[]) -{ - ClutterActor *stage; - ClutterActor *coglbox; - ClutterTimeline *timeline; - - clutter_test_init (&argc, &argv); - - /* Stage */ - stage = clutter_test_get_stage (); - clutter_actor_set_size (stage, 400, 400); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_test_quit), NULL); - - /* Cogl Box */ - coglbox = test_coglbox_new (); - clutter_actor_add_child (stage, coglbox); - - /* Timeline for animation */ - timeline = clutter_timeline_new_for_actor (stage, 6000); /* 6 second duration */ - clutter_timeline_set_repeat_count (timeline, -1); - g_signal_connect (timeline, "new-frame", G_CALLBACK (frame_cb), coglbox); - clutter_timeline_start (timeline); - - clutter_actor_show (stage); - - clutter_test_main (); - - return 0; -} - -G_MODULE_EXPORT const char * -test_cogl_tex_tile_describe (void) -{ - return "Texture tiling."; -} diff --git a/src/tests/clutter/test-utils.h b/src/tests/clutter/test-utils.h deleted file mode 100644 index a2c7f04be..000000000 --- a/src/tests/clutter/test-utils.h +++ /dev/null @@ -1,126 +0,0 @@ -#include -#include - -static GQuark pixbuf_key = 0; - -static inline CoglBitmap * -clutter_test_create_bitmap_from_file (CoglContext *ctx, - const char *filename, - GError **error) -{ - pixbuf_key = g_quark_from_static_string ("-cogl-bitmap-pixbuf-key"); - GdkPixbuf *pixbuf; - gboolean has_alpha; - GdkColorspace color_space; - CoglPixelFormat pixel_format; - int width; - int height; - int rowstride; - int bits_per_sample; - int n_channels; - CoglBitmap *bmp; - GError *glib_error = NULL; - - /* Load from file using GdkPixbuf */ - pixbuf = gdk_pixbuf_new_from_file (filename, &glib_error); - if (pixbuf == NULL) - { - g_propagate_error (error, glib_error); - return FALSE; - } - - /* Get pixbuf properties */ - has_alpha = gdk_pixbuf_get_has_alpha (pixbuf); - color_space = gdk_pixbuf_get_colorspace (pixbuf); - width = gdk_pixbuf_get_width (pixbuf); - height = gdk_pixbuf_get_height (pixbuf); - rowstride = gdk_pixbuf_get_rowstride (pixbuf); - bits_per_sample = gdk_pixbuf_get_bits_per_sample (pixbuf); - n_channels = gdk_pixbuf_get_n_channels (pixbuf); - - /* According to current docs this should be true and so - * the translation to cogl pixel format below valid */ - g_assert_cmpint (bits_per_sample, ==, 8); - - if (has_alpha) - g_assert_cmpint (n_channels, ==, 4); - else - g_assert_cmpint (n_channels, ==, 3); - - /* Translate to cogl pixel format */ - switch (color_space) - { - case GDK_COLORSPACE_RGB: - /* The only format supported by GdkPixbuf so far */ - pixel_format = has_alpha ? - COGL_PIXEL_FORMAT_RGBA_8888 : - COGL_PIXEL_FORMAT_RGB_888; - break; - - default: - /* Ouch, spec changed! */ - g_object_unref (pixbuf); - return FALSE; - } - - /* We just use the data directly from the pixbuf so that we don't - have to copy to a separate buffer. Note that Cogl is expected not - to read past the end of bpp*width on the last row even if the - rowstride is much larger so we don't need to worry about - GdkPixbuf's semantics that it may under-allocate the buffer. */ - bmp = cogl_bitmap_new_for_data (ctx, - width, - height, - pixel_format, - rowstride, - gdk_pixbuf_get_pixels (pixbuf)); - - g_object_set_qdata_full (G_OBJECT (bmp), - pixbuf_key, - pixbuf, - g_object_unref); - - return bmp; -} - -static inline CoglTexture * -clutter_test_texture_2d_sliced_new_from_file (CoglContext *ctx, - const char *filename, - GError **error) -{ - CoglBitmap *bmp; - CoglTexture *tex_2ds = NULL; - - g_return_val_if_fail (error == NULL || *error == NULL, NULL); - - bmp = clutter_test_create_bitmap_from_file (ctx, filename, error); - if (bmp == NULL) - return NULL; - - tex_2ds = cogl_texture_2d_sliced_new_from_bitmap (bmp, COGL_TEXTURE_MAX_WASTE); - - g_object_unref (bmp); - - return tex_2ds; -} - -static inline CoglTexture * -clutter_test_texture_2d_new_from_file (CoglContext *ctx, - const char *filename, - GError **error) -{ - CoglBitmap *bmp; - CoglTexture *tex_2d = NULL; - - g_return_val_if_fail (error == NULL || *error == NULL, NULL); - - bmp = clutter_test_create_bitmap_from_file (ctx, filename, error); - if (bmp == NULL) - return NULL; - - tex_2d = cogl_texture_2d_new_from_bitmap (bmp); - - g_object_unref (bmp); - - return tex_2d; -}