Skip to content

Commit 72b6078

Browse files
SiegeLordExSiegeLord
authored andcommitted
Tweaks to the sample/depth patch.
- Adjust formatting of some preprocessor commands - Mark the API as unstable and added since 5.2.1 - Move the documentation around a bit
1 parent b8672bd commit 72b6078

File tree

5 files changed

+53
-33
lines changed

5 files changed

+53
-33
lines changed

docs/src/refman/graphics.txt

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -680,17 +680,20 @@ thread) if they are used with [al_set_target_bitmap]. 0 means no
680680
depth-buffer will be created when drawing into the bitmap, which is the
681681
default.
682682

683-
> *Note:* This is an experimental feature and currently only works for
684-
the OpenGL backend.
683+
Since: 5.2.1
685684

686-
Since: 5.1.14
685+
> *[Unstable API]:* This is an experimental feature and currently only works for
686+
the OpenGL backend.
687687

688688
### API: al_get_new_bitmap_depth
689689

690690
Returns the value currently set with [al_set_new_bitmap_depth] on
691691
the current thread or 0 if none was set.
692692

693-
Since: 5.1.14
693+
Since: 5.2.1
694+
695+
> *[Unstable API]:* This is an experimental feature and currently only works for
696+
the OpenGL backend.
694697

695698
### API: al_set_new_bitmap_samples
696699

@@ -701,9 +704,6 @@ the default. 1 means multi-sampling will be used but only using a single
701704
sample per pixel (so usually there will be no visual difference to not
702705
using multi-sampling at all).
703706

704-
> *Note:* This is an experimental feature and currently only works for
705-
the OpenGL backend.
706-
707707
> *Note:* Some platforms have restrictions on when the multi-sampling
708708
buffer for a bitmap is realized, i.e. down-scaled back to the actual
709709
bitmap dimensions. This may only happen after a call to
@@ -720,14 +720,20 @@ bitmap dimensions. This may only happen after a call to
720720
// CORRECT: at this point, the bitmap contents are updated and
721721
// there will be an anti-aliased line in it.
722722

723-
Since: 5.1.14
723+
Since: 5.2.1
724+
725+
> *[Unstable API]:* This is an experimental feature and currently only works for
726+
the OpenGL backend.
724727

725728
### API: al_get_new_bitmap_samples
726729

727730
Returns the value currently set with [al_set_new_bitmap_samples] on
728731
the current thread or 0 if none was set.
729732

730-
Since: 5.1.14
733+
Since: 5.2.1
734+
735+
> *[Unstable API]:* This is an experimental feature and currently only works for
736+
the OpenGL backend.
731737

732738
## Bitmap properties
733739

@@ -751,6 +757,26 @@ Returns the height of a bitmap in pixels.
751757

752758
Returns the width of a bitmap in pixels.
753759

760+
### API: al_get_bitmap_depth
761+
762+
Return the depthbuffer depth used by this bitmap if it is used with
763+
[al_set_target_bitmap].
764+
765+
Since: 5.2.1
766+
767+
> *[Unstable API]:* This is an experimental feature and currently only works for
768+
the OpenGL backend.
769+
770+
### API: al_get_bitmap_samples
771+
772+
Return the multi-sampling samples used by this bitmap if it is used with
773+
[al_set_target_bitmap].
774+
775+
Since: 5.2.1
776+
777+
> *[Unstable API]:* This is an experimental feature and currently only works for
778+
the OpenGL backend.
779+
754780
### API: al_get_pixel
755781

756782
Get a pixel's color value from the specified bitmap. This operation is slow
@@ -1184,20 +1210,6 @@ associated texture.
11841210

11851211
See also: [al_get_target_bitmap], [al_set_target_backbuffer]
11861212

1187-
### API: al_get_bitmap_depth
1188-
1189-
Return the depthbuffer depth used by this bitmap if it is used with
1190-
[al_set_target_bitmap].
1191-
1192-
Since: 5.1.14
1193-
1194-
### API: al_get_bitmap_samples
1195-
1196-
Return the multi-sampling samples used by this bitmap if it is used with
1197-
[al_set_target_bitmap].
1198-
1199-
Since: 5.1.14
1200-
12011213
### API: al_set_target_backbuffer
12021214

12031215
Same as `al_set_target_bitmap(al_get_backbuffer(display));`

examples/ex_depth_target.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define ALLEGRO_UNSTABLE
12
#include <allegro5/allegro.h>
23
#include <allegro5/allegro_image.h>
34
#include <allegro5/allegro_font.h>

examples/ex_multisample_target.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define ALLEGRO_UNSTABLE
12
#include <allegro5/allegro.h>
23
#include <allegro5/allegro_image.h>
34
#include <allegro5/allegro_font.h>

include/allegro5/bitmap.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,23 @@ AL_FUNC(void, al_set_new_bitmap_flags, (int flags));
3636
AL_FUNC(int, al_get_new_bitmap_format, (void));
3737
AL_FUNC(int, al_get_new_bitmap_flags, (void));
3838
AL_FUNC(void, al_add_new_bitmap_flag, (int flag));
39+
40+
#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC)
3941
AL_FUNC(int, al_get_new_bitmap_depth, (void));
4042
AL_FUNC(void, al_set_new_bitmap_depth, (int depth));
4143
AL_FUNC(int, al_get_new_bitmap_samples, (void));
4244
AL_FUNC(void, al_set_new_bitmap_samples, (int samples));
45+
#endif
4346

4447
AL_FUNC(int, al_get_bitmap_width, (ALLEGRO_BITMAP *bitmap));
4548
AL_FUNC(int, al_get_bitmap_height, (ALLEGRO_BITMAP *bitmap));
4649
AL_FUNC(int, al_get_bitmap_format, (ALLEGRO_BITMAP *bitmap));
4750
AL_FUNC(int, al_get_bitmap_flags, (ALLEGRO_BITMAP *bitmap));
51+
52+
#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC)
4853
AL_FUNC(int, al_get_bitmap_depth, (ALLEGRO_BITMAP *bitmap));
4954
AL_FUNC(int, al_get_bitmap_samples, (ALLEGRO_BITMAP *bitmap));
55+
#endif
5056

5157
AL_FUNC(ALLEGRO_BITMAP*, al_create_bitmap, (int w, int h));
5258
AL_FUNC(void, al_destroy_bitmap, (ALLEGRO_BITMAP *bitmap));

src/opengl/ogl_fbo.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,11 @@ static void attach_depth_buffer(ALLEGRO_FBO_INFO *info)
177177
int samples = al_get_bitmap_samples(info->owner);
178178

179179
bool extension_supported;
180-
#ifdef ALLEGRO_CFG_OPENGLES
181-
extension_supported = display->ogl_extras->extension_list->ALLEGRO_GL_EXT_multisampled_render_to_texture;
182-
#else
183-
extension_supported = display->ogl_extras->extension_list->ALLEGRO_GL_EXT_framebuffer_multisample;
184-
#endif
180+
#ifdef ALLEGRO_CFG_OPENGLES
181+
extension_supported = display->ogl_extras->extension_list->ALLEGRO_GL_EXT_multisampled_render_to_texture;
182+
#else
183+
extension_supported = display->ogl_extras->extension_list->ALLEGRO_GL_EXT_framebuffer_multisample;
184+
#endif
185185

186186
if (samples == 0 || !extension_supported)
187187
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, gldepth, w, h);
@@ -234,9 +234,9 @@ static void attach_multisample_buffer(ALLEGRO_FBO_INFO *info)
234234
if (!display->ogl_extras->extension_list->ALLEGRO_GL_EXT_framebuffer_multisample)
235235
return;
236236

237-
#ifdef ALLEGRO_CFG_OPENGLES
238-
(void)display;
239-
#else
237+
#ifdef ALLEGRO_CFG_OPENGLES
238+
(void)display;
239+
#else
240240

241241
if (info->buffers.multisample_buffer == 0) {
242242
GLuint rb;
@@ -595,7 +595,7 @@ static void use_fbo_for_bitmap(ALLEGRO_DISPLAY *display,
595595
if (!info->buffers.multisample_buffer) {
596596

597597
/* Attach the texture. */
598-
#ifdef ALLEGRO_CFG_OPENGLES
598+
#ifdef ALLEGRO_CFG_OPENGLES
599599
if (ANDROID_PROGRAMMABLE_PIPELINE(al_get_current_display())) {
600600
bool extension_supported = display->ogl_extras->
601601
extension_list->
@@ -614,7 +614,7 @@ static void use_fbo_for_bitmap(ALLEGRO_DISPLAY *display,
614614
#endif
615615
}
616616
else
617-
#endif
617+
#endif
618618
{
619619
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
620620
GL_TEXTURE_2D, ogl_bitmap->texture, 0);

0 commit comments

Comments
 (0)