[−][src]Crate grr
Bare metal OpenGL 4.5+ wrapper
Overview
grr
aims at providing a modern and clean looking API with focus on
direct state access. The terminology used follows mostly Vulkan and OpenGL.
Initialization
The main entry point for working with the library is a Device
.
A device wraps an OpenGL context which needs to be created and managed externally.
The documentation and examples will all use glutin
for window and context management.
extern crate glutin; extern crate grr; fn main() -> Result<(), Box<std::error::Error>> { let mut events_loop = glutin::EventsLoop::new(); let wb = glutin::WindowBuilder::new() .with_title("Hello grr!") .with_dimensions((1024.0, 768.0).into()); let window = unsafe { glutin::ContextBuilder::new() .with_vsync(true) .with_srgb(true) .with_gl_debug_flag(true) .build_windowed(wb, &events_loop)? .make_current() .unwrap() }; let grr = unsafe { grr::Device::new( |symbol| window.get_proc_address(symbol) as *const _, grr::Debug::Enable { callback: |_, _, _, _, msg| { println!("{:?}", msg); }, flags: grr::DebugReport::all(), }, ) }; Ok(()) }
Modules
The API has multiple concepts which interplay with each other. The main of interacting with the library is via
function calls on a Device
object. The calls often translate directly to one GL call.
All other objects created are opaque handles!
- Resource: Objects with associated memory. Can be a
Buffer
(untyped) or anImage
. - Pipeline: There currently are two sort of pipelines supported: Graphics and Compute
- Framebuffer: Assembles the attachments (
ImageView
orRenderBuffer
) for draw calls - Sampler: Configures image filtering. An
Image
is bound together with aSampler
to a texture unit for access in a shader stage. - Vertex Array: Specifies the vertex attributes and bindings for the input assembler stage. Buffers are bound to a
VertexArray
to declare the memory region to fetch attribute data from.
Structs
Barrier | Memory barrier. |
BlendChannel | |
Buffer | |
BufferImageCopy | |
BufferRange | Buffer Range. |
ColorBlend | |
ColorBlendAttachment | |
DebugReport | Debug report flags. |
DepthStencil | Depth and stencil test and associated options. |
Device | Logical device, representation one or multiple physical devices (hardware or software). |
DeviceFeatures | Additional features supported by the device. |
DeviceLimits | |
DispatchIndirectCmd | Indirect dispatch command structure. |
DrawIndexedIndirectCmd | Indirect (indexed) draw command structure. |
DrawIndirectCmd | Indirect draw command structure. |
Extent | |
Framebuffer | Framebuffer handle. |
GraphicsPipelineDesc | Graphics Pipeline Descriptor. |
HostImageCopy | |
Image | Image resource handle. |
ImageCopy | |
ImageView | Image view handle. |
InputAssembly | Input Assembly Descriptor. |
MappingFlags | Memory mapping flags. |
MemoryFlags | Memory property flags. |
MemoryLayout | Specifies the layout of the host or buffer memory. |
MeshPipelineDesc | |
Multisample | |
Offset | Starting location for copying from or to texture data. |
Pipeline | Graphics or Compute pipeline. |
PipelineFlags | Pipeline link flags. |
Query | |
QueryResultFlags | |
Rasterization | Rasterizer Descriptor. |
Region | |
RegionBarrier | Memory barrier for by-region dependencies. |
Renderbuffer | Renderbuffer handle. |
Sampler | Sampler handle. |
SamplerDesc | Sampler Descriptor. |
Shader | Shader. |
ShaderFlags | Shader compilation flags. |
StencilFace | Stencil operation settings, per-face. |
SubresourceLayers | |
SubresourceRange | Subresource of an image. |
VertexArray | Vertex array handle. |
VertexAttributeDesc | Vertex attribute format and binding. |
VertexBufferView | Buffer representation for vertex attributes |
VertexPipelineDesc | |
Viewport | Viewport transformation. |
Enums
Attachment | Attachment reference. |
AttachmentView | |
BaseFormat | |
BlendFactor | |
BlendOp | |
ClearAttachment | Attachment clearing description. |
Compare | Comparison operator. |
ConditionalMode | |
Constant | Uniform constant. |
CullMode | Polygon culling mode. |
Debug | Device debug control. |
DebugSource | Debug message source. |
DebugType | Debug message type. |
Error | Error return codes |
Filter | Filter options for computing pixels when the texture maps to an area different from one texture element. |
Format | The |
FormatLayout | |
FrontFace | Polygon front face. |
ImageType | Image dimensionality type. |
ImageViewType | Image View type. |
IndexTy | Index size. |
InputRate | Vertex attribute addresssing. |
MsgFilter | Message filter. |
ObjectType | |
PolygonMode | Polygon rendering mode. |
Primitive | Primitve topology. |
QueryType | |
SamplerAddress | Sampler addressing mode. |
ShaderStage | Shader Stages. |
StencilOp | |
VertexFormat | Vertex attribute formats. |
Traits
Object |
Functions
as_u8_slice | View a slice as raw byte slice. |
Type Definitions
DebugCallback | |
Result | A specialized Result type for |