- _end_canary
uint _end_canary;
Undocumented in source.
- _start_canary
uint _start_canary;
Undocumented in source.
- d3d11_shader_resource_view
const(void)* d3d11_shader_resource_view;
Undocumented in source.
- d3d11_texture
const(void)* d3d11_texture;
Undocumented in source.
- data
ImageData data;
Undocumented in source.
- gl_texture_target
uint gl_texture_target;
Undocumented in source.
- gl_textures
uint[2] gl_textures;
Undocumented in source.
- height
int height;
Undocumented in source.
- label
const(char)* label;
Undocumented in source.
- mtl_textures
const(void)*[2] mtl_textures;
Undocumented in source.
- num_mipmaps
int num_mipmaps;
Undocumented in source.
- num_slices
int num_slices;
Undocumented in source.
- pixel_format
PixelFormat pixel_format;
Undocumented in source.
- render_target
bool render_target;
Undocumented in source.
- sample_count
int sample_count;
Undocumented in source.
- type
ImageType type;
Undocumented in source.
- usage
Usage usage;
Undocumented in source.
- wgpu_texture
const(void)* wgpu_texture;
Undocumented in source.
- wgpu_texture_view
const(void)* wgpu_texture_view;
Undocumented in source.
- width
int width;
Undocumented in source.
sg_image_desc
Creation parameters for sg_image objects, used in the sg_make_image() call.
The default configuration is:
.type: SG_IMAGETYPE_2D .render_target: false .width 0 (must be set to >0) .height 0 (must be set to >0) .num_slices 1 (3D textures: depth; array textures: number of layers) .num_mipmaps: 1 .usage: SG_USAGE_IMMUTABLE .pixel_format: SG_PIXELFORMAT_RGBA8 for textures, or sg_desc.environment.defaults.color_format for render targets .sample_count: 1 for textures, or sg_desc.environment.defaults.sample_count for render targets .data an sg_image_data struct to define the initial content .label 0 (optional string label for trace hooks)
Q: Why is the default sample_count for render targets identical with the "default sample count" from sg_desc.environment.defaults.sample_count?
A: So that it matches the default sample count in pipeline objects. Even though it is a bit strange/confusing that offscreen render targets by default get the same sample count as 'default swapchains', but it's better that an offscreen render target created with default parameters matches a pipeline object created with default parameters.
NOTE:
Images with usage SG_USAGE_IMMUTABLE must be fully initialized by providing a valid .data member which points to initialization data.
ADVANCED TOPIC: Injecting native 3D-API textures:
The following struct members allow to inject your own GL, Metal or D3D11 textures into sokol_gfx:
.gl_texturesSG_NUM_INFLIGHT_FRAMES .mtl_texturesSG_NUM_INFLIGHT_FRAMES .d3d11_texture .d3d11_shader_resource_view .wgpu_texture .wgpu_texture_view
For GL, you can also specify the texture target or leave it empty to use the default texture target for the image type (GL_TEXTURE_2D for SG_IMAGETYPE_2D etc)
For D3D11 and WebGPU, either only provide a texture, or both a texture and shader-resource-view / texture-view object. If you want to use access the injected texture in a shader you *must* provide a shader-resource-view.
The same rules apply as for injecting native buffers (see sg_buffer_desc documentation for more details)