coalpy.gpu
<< coalpy >> Compute Abstraction Layer for Python by Kleber A Garcia 2021 (c). coalpy is a compute abstraction layer for python. It brings advanced rendering features focused on compute shaders and an easy interface to create graphical applications, without dealing with graphics APIs complexity. Start by creating a shader, create a window, passing an onRender function, create a command list and start using your GPU!
coalpy.gpu.add_data_path
function
Adds a path to load shader / texture files / shader includes from. Parameters: path (str or Module): If str it will be a path to be used. If a module, it will find the source folder of the module's __init__.py file, and use this source as the path. path priorities are based on the order of how they were added.
coalpy.gpu.begin_collect_markers
function
Call this surrounding all your schedules to define a 'frame'. Once you call end_collect_markers you can extract the results for further processing. gpu.begin_collect_markers() ... gpu.schedule([]) #perform all your schedules marker_data = gpu.end_collect_markers() Parameters: max_query_bytes (int)(optional): default value 56kb. Maximum amount of marker data to obtain.
coalpy.gpu.end_collect_markers
function
Ends marker collection. See gpu.begin_collect_markers Returns: marker_results (see g.MarkerResults)
coalpy.gpu.get_adapters
function
Lists all gpu graphics cards found in the system. Returns: adapters (Array of tuple): Each element in the list is a tuple of type (i : int, name : Str)
coalpy.gpu.get_current_adapter_info
function
Gets the currently active GPU adapter, as a tuple of (i : int, name : Str). Returns: adapter (tuple): Element as tuple of type (i : int, name : str)
coalpy.gpu.get_settings
function
Returns an object containing all the settings loaded for the coalpy.gpu module. Returns: Object (Settings): object containing all the settings loaded for coalpy.gpu of type Settings.
coalpy.gpu.init
function
Initializes the device, if it hasn't been initialized. Call this function to explicitely initialize the device. Only here any configuration changes will be applied. If this function is not called, initialization of the adapter happens upon the first usage (implicitely). Any modifications to the settings (such as graphics API or adapter index) won't be applied until the application restarts.
coalpy.gpu.run
function
Runs window rendering callbacks. This function blocks until all the existing windows are closed. Window objects must be created and referenced prior. Use the Window object to configure / specify callbacks and this function to run all the event loops for windows.
coalpy.gpu.schedule
function
Submits an array of CommandList objects to the GPU to run shader work on. Parameters: command_lists (array of CommandList or a single CommandList object): an array of CommandList objects or a single CommandList object to run in the GPU. CommandList can be resubmitted through more calls of schedule.
coalpy.gpu.Buffer
type
Class that represents a Buffer GPU resource. Constructor: name (str): string to identify the resource with. mem_flags (int): See coalpy.gpu.MemFlags. Default is Gpu_Read and Gpu_Write. type (int): See coalpy.gpu.BufferType. Default is Standard. format (int): Format of buffer. See coalpy.gpu.Format for available formats. This argument is ignored if buffer is Structured or Raw. Default format is RGBA_32_SINT element_count (int): number of elements this buffer will have stride (int): stride count in case of Structured type usage (Bool) : see coalpy.gpu.BufferUsage
coalpy.gpu.Buffer.mappedMemory
function
Returns: Returns a memory view object with the mapped memory. NOTE: only works if the buffer is created with BufferUsage.Upload flag.
coalpy.gpu.CommandList
type
Class that represents a stream of commands. Takes no arguments for constructor. CommandList objects can be uploaded via coalpy.gpu.schedule. CommandList objects can be resubmitted as many times and can be reused to avoid cost.
coalpy.gpu.CommandList.begin_marker
function
Sets a string marker. Must be paired with a call to end_marker. Markers can also be nested. You can use renderdoc / pix to explore the resulting frame's markers. Parameters: name (str): string text of the marker to be used.
coalpy.gpu.CommandList.clear_append_consume_counter
function
Clears the append consume counter of a Buffer that was created with the is_append_consume flag set to true. Parameters: source (Buffer): source Buffer object clear_value (int)(optional): integer value with the clear count. By default is 0.
coalpy.gpu.CommandList.copy_append_consume_counter
function
Copies the counter of an append consume buffer to a destination resource. The destination must be a buffer that holds at least 4 bytes (considering the offset). Parameters: source (Buffer): source Buffer object, must have is_append_consume flag to True. destination (Buffer): Destination buffer to hold value. destination_offset (int)(optional): integer value with the destination's buffer offset, in bytes.
coalpy.gpu.CommandList.copy_resource
function
copy_resource method, copies one resource to another. Both source and destination must be the same type (either Buffer or textures). Parameters: source (Texture or Buffer): an object of type Texture or Buffer. This will be the source resource to copy from. destination (Texture or Buffer): an object of type Texture or Buffer. This will be the destination resource to copy to. source_offset (tuple or int): if texture copy, a tuple with x, y, z offsets and mipLevel must be specified. If Buffer copy, it must be a single integer with the byte offset for the source Buffer. destination_offset (tuple or int): if texture copy, a tuple with x, y, z offsets and mipLevel must be specified. If Buffer copy, it must be a single integer with the byte offset for the destianation Buffer. size (tuple or int): if texture a tuple with the x, y and z size. If Buffer just an int with the proper byte size. Default covers the entire size.
coalpy.gpu.CommandList.dispatch
function
Dispatch method, which executes a compute shader with resources bound. Parameters: x (int)(optional): the number of groups on the x axis. By default is 1. y (int)(optional): the number of groups on the y axis. By default is 1. z (int)(optional): the number of groups on the z axis. By defaul/t shader (Shader): object of type Shader. This will be the compute shader launched on the GPU. name (str)(optional): Debug name of this dispatch to see in render doc / profiling captures. constants (optional): Constant can be, an array of ints and floats, an array.array or any object compatible with the object protocol, or a list of Buffer objects. If a list of Buffer objects, these can be indexed via register(b#) in the shader used, Every other type will always be bound to a constant Buffer on register(b0). samplers (optional): a single Sampler object, or an array of Sampler objects, or a single SamplerTable object, or an array of SamplerTable objects. If a single SamplerTable object is used, the table will be automatically bound to register space 0, and each resource accessed either by bindless dynamic indexing, or a hard register(s#). If an array of SamplerTable is passed, each resource table will be bound using a register space index corresponding to the table index in the array, and the rules to reference each sampler within the table stay the same. If and array of Sampler objects are passed (or a single Sampler object), each sampler object is bound to a single register and always to the default space (0). inputs (optional): a single InResourceTable object, or an array of InResourceTable objects, or a single Texture/Buffer object, or an array of Texture/Buffer objects. If a single object is used, the table will be automatically bound to register space 0, and each resource accessed either by bindless dynamic indexing, or a hard register(t#). If an array of InResourceTable is passed, each resource table will be bound using a register space index corresponding to the table index in the array, and the rules to reference each resource within the table stay the same. If and array of Texture/Buffer objects are passed (or a single Texture/Buffer object), each object is bound to a single register and always to the default space (0). outputs (optional): a single OutResourceTable object, or an array of OutResourceTable objects. Same rules as inputs apply, but we use registers u# to address the UAVs. indirect_args (Buffer)(optional): a single object of type Buffer, which contains the x, y and z groups packed tightly as 3 ints. If this buffer is provided, the x, y and z arguments are ignored.
coalpy.gpu.CommandList.end_marker
function
Finishes the scope of a marker. Must have a corresponding begin_marker.
coalpy.gpu.CommandList.upload_resource
function
upload_resource method. Uploads an python array [], an array.array or any buffer protocol compatible object to a gpu resource. Parameters: source: an array of ints and floats, or an array.array object or any object compatible with the buffer protocol (for example a bytearray). destination (Texture or Buffer): a destination object of type Texture or Buffer. size (tuple): if texture upload, a tuple with the x, y and z size of the box to copy of the source buffer. If a Buffer upload, then this parameter gets ignored. destination_offset (tuple or int): if texture copy, a tuple with x, y, z offsets and mipLevel must be specified. If Buffer copy, it must be a single integer with the byte offset for the destianation Buffer.
coalpy.gpu.ImguiBuilder
type
Imgui builder class. Use this class' methods to build a Dear ImGUI on a specified window. To utilize you need to instantiate a Window object. In its constructor set use_imgui to True (which is by default). On the on_render function, you will receive a RenderArgs object. There will be a ImguiBuilder object in the imgui member that you can now query to construct your user interface. Coalpy does not support creation of a ImguiBuilder object, it will always be passed as an argument on the RenderArgs of the window.
coalpy.gpu.ImguiBuilder.begin
function
Begin method, starts the scope of a ImGUI interface. This method must have a corresponding end at some point denoting denoting the scope of all functions required. Parameters: name (str): Mandatory name of this interface panel. is_open (bool)(optional): Specifies the previous state of this panel. True for open, false otherwise. Update this state with the return value of this function. is_fullscreen (bool)(optional): sets this window to follow the main viewport. flags (int)(optional): See coalpy.gpu.ImGuiWindowFlags for flag definitions Returns: returns a boolean, True if the X for closing this panel was pressed, False otherwise.
coalpy.gpu.ImguiBuilder.begin_combo
function
begins a combo box. Must be paired with an end_combo call. To insert items, use selectable() between begin_combo/end_combo Parameters: label (str): the label name for this comboxbox. preview_value (str): preview string value Returns: If value returned is true, must call end_combo.
function
Starts the scope of a main menu at the top of the window. Use the MainMenu and BeginMenu/EndMenu functions to add / remove components. Must be paired with a end_main_menu_bar method. Returns: if returns true, call end_main_menu_bar. If returns false means its not rendered.
function
Starts a menu item in the menu bar. Must be paird with an end_menu method. Parameters: label (str): name of this menu item. Can recursively have more menu items. Returns: if returns true, call end_menu. If returns false means its not rendered.
coalpy.gpu.ImguiBuilder.begin_tab_bar
function
create and append into a TabBar Parameters: id (str): id of tab bar flags (int)(optional): Flags, see coalpy.gpu.ImGuiTabBarFlags Return: bool
coalpy.gpu.ImguiBuilder.begin_tab_item
function
create a Tab. Returns true if the Tab is selected. Parameters: label (str): label of tab item open (bool): Pass true if its open / selected false otherwise flags (int): see coalpy.gpu.ImGuiTabItemFlags Return: bool
function
Draws a button. Parameters: label (str): the label name for this button. Returns: True if button was pressed, false otherwise.
coalpy.gpu.ImguiBuilder.checkbox
function
Draws a checkbox ui item. Parameters: label (str): the label name for this checkbox. v (bool): The current state of the checkbox Returns: The new bool value that the user set. Feed this value back on v on the next call to see a proper state update.
coalpy.gpu.ImguiBuilder.collapsing_header
function
Returns the state of a header label (collapsed or non collapsed). Parameters: label (str) : label of this item. flags (int)(optional) : see coalpy.gpu.ImGuiTreeNodeFlags Returns: True if open, False otherwise.
function
display a color square/button, hover for details, return true when pressed. Parameters: desc_id (str) col (float): tuple size 4 of color flags (optional): see coalpy.gpu.ImGuiColorEditFlags size (float tuple 2)(optional): size of the button. Defualt is (0, 0) Return: True if pressed, false otherwise
coalpy.gpu.ImguiBuilder.color_edit3
function
Parameters: label (str): label of widget col (float): tuple or array size 3 of color values (tuple or array) flags (optional): see coalpy.gpu.ImGuiColorEditFlags Return: The color edited (tuple of size 3) or None if nothing was set
coalpy.gpu.ImguiBuilder.color_edit4
function
Parameters: label (str): label of widget col (float): tuple or array size 4 of color values (tuple or array) flags (optional): see coalpy.gpu.ImGuiColorEditFlags Return: The color edited (tuple of size 4) or None if nothing was set
coalpy.gpu.ImguiBuilder.color_picker3
function
Parameters: label (str): label of widget col (float): tuple or array size 3 of color values (tuple or array) flags (optional): see coalpy.gpu.ImGuiColorEditFlags Return: The color picked (tuple of size 3) or None if nothing was set
coalpy.gpu.ImguiBuilder.color_picker4
function
Parameters: label (str): label of widget col (float): tuple or array size 4 of color values (tuple or array) flags (optional): see coalpy.gpu.ImGuiColorEditFlags Return: The color picked (tuple of size 4) or None if nothing was set
coalpy.gpu.ImguiBuilder.dockbuilder_add_node
function
Parameters: node_id (int) flags (int): see coalpy.gpu.ImGuiDockNodeFlags Returns: dock_id added.
coalpy.gpu.ImguiBuilder.dockbuilder_dock_window
function
Parameters: window_name (str) node_id (int)
coalpy.gpu.ImguiBuilder.dockbuilder_finish
function
Parameters: node_id (int)
coalpy.gpu.ImguiBuilder.dockbuilder_node_exists
function
Tests wether a dockspace exists. Ideal to setup dock layout at init. Use an id or a string. Parameters: label (str) dock_id (int)(optional) - if node_id is used, name will be ignored Returns: True if it exists, False otherwise
coalpy.gpu.ImguiBuilder.dockbuilder_remove_child_nodes
function
Parameters: node_id (int)
coalpy.gpu.ImguiBuilder.dockbuilder_remove_node
function
Parameters: node_id (int)
coalpy.gpu.ImguiBuilder.dockbuilder_set_node_pos
function
Parameters: node_id (int) pos (tuple 2)
coalpy.gpu.ImguiBuilder.dockbuilder_set_node_size
function
Parameters: node_id (int) size (tuple 2)
coalpy.gpu.ImguiBuilder.dockbuilder_split_node
function
Parameters: node_id (int) split_dir (int): see coalpy.gpu.ImGuiDir split_ratio (float) Returns: tuple 2: (dock_id_at_dir, dock_id_opposite_dir)
coalpy.gpu.ImguiBuilder.dockspace
function
Creates an explicit dockspace Parameters: label (str): the docking space name dock_id (int)(optional): the dockspace id. If provided, dockspace name will be ignored. Returns: dockspace_id (int): id of the dockspace used.
coalpy.gpu.ImguiBuilder.end
function
End method. Must be paired with a corresponding begin method.
coalpy.gpu.ImguiBuilder.end_combo
function
Ends a combo box. Must be paired with an begin_combo call only if it returns true..
function
End method for main menu bar. Must be paired with a begin_main_menu_bar method. Only call this if begin_main_menu_bar returns true.
function
End method for menu item. Must be paired with a begin_menu method. Only call this if begin_menu returns true.
coalpy.gpu.ImguiBuilder.end_tab_bar
function
only call EndTabBar() if BeginTabBar() returns true!
coalpy.gpu.ImguiBuilder.end_tab_item
function
only call EndTabItem() if BeginTabItem() returns true!
coalpy.gpu.ImguiBuilder.get_cursor_pos
function
Cursor position in window coordinates (relative to window position) Returns: Mouse pos (tuple x, y)
coalpy.gpu.ImguiBuilder.get_cursor_screen_pos
function
Cursor position in OS coordinates (absolute to OS) Returns: Mouse pos (tuple x, y)
coalpy.gpu.ImguiBuilder.get_id
function
Parameters: name (str) Returns: int (id)
coalpy.gpu.ImguiBuilder.get_item_rect_size
function
Get prev items rec size Return: size (tuple 2 float)
coalpy.gpu.ImguiBuilder.get_key_name
function
[DEBUG] returns English name of the key. Those names a provided for debugging purpose and are not meant to be saved persistently not compared. Parameters: key(int): see coalpy.gpu.ImGuiKey Returns: Gets the key name (str)
coalpy.gpu.ImguiBuilder.get_key_pressed_amount
function
uses provided repeat rate/delay. return a count, most often 0 or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate Parameters: key(int): see coalpy.gpu.ImGuiKey repeat_delay (float): rate(float): Returns: int, see comments
coalpy.gpu.ImguiBuilder.get_mouse_pos
function
Gets the absolute mouse position Returns: Mouse pos (tuple x, y)
coalpy.gpu.ImguiBuilder.get_viewport_work_pos
function
Work Area: Position of the viewport minus task bars, menus bars, status bars (>= Pos) Returns: tuple (x, y)
coalpy.gpu.ImguiBuilder.get_viewport_work_size
function
Work Area: Size of the viewport minus task bars, menu bars, status bars (<= Size) Returns: tuple (x, y)
coalpy.gpu.ImguiBuilder.get_window_content_region_max
function
Get the remaining content region Return: region min (tuple 2 float)
coalpy.gpu.ImguiBuilder.get_window_content_region_min
function
Get the remaining content region Return: region min (tuple 2 float)
coalpy.gpu.ImguiBuilder.get_window_pos
function
Gets the current window pos Returns: Window pos (tuple x, y)
coalpy.gpu.ImguiBuilder.get_window_size
function
Gets the current window size Returns: Window size (tuple x, y)
coalpy.gpu.ImguiBuilder.image
function
Draws an image Parameters: texture (Texture): coalpy.gpu.Texture object to draw in the UI. size (tuple): size of the image in pixels uv0 (tuple)(optional): uv coordinate of bottom (default (0.0, 0.0)) uv1 (tuple)(optional): uv coordinate of top (default (1.0, 1.0)) tint_col (tuple): size 4 tuple with image tint color (default (1,1,1,1)). border_col (tuple): size 4 tuple with background color (default (0,0,0,0)).
function
Draws an image button Parameters: texture (Texture): coalpy.gpu.Texture object to draw in the UI. size (tuple): size of the image in pixels uv0 (tuple)(optional): uv coordinate of bottom (default (0.0, 0.0)) uv1 (tuple)(optional): uv coordinate of top (default (1.0, 1.0)) frame_padding (int)(optional): default -1. < 0 uses from style (default), 0 no framing, >0 set framing size bg_col (tuple)(optional): size 4 tuple with image tint color (default (1,1,1,1)). tint_col (tuple)(optional): size 4 tuple with background color (default (0,0,0,0)). Return: True if button is pressed, false otherwise
coalpy.gpu.ImguiBuilder.input_float
function
Draws a box to input a single float value. Parameters: label (str): the label name for this box. v (float): the actual value to draw the slider. step (float)(optional): step value when scrolling slow step_fast (float)(optional): step value when scrolling fast. fmt (str)(optional): A formatting value to draw the float. For example %.3f draws 3 decimal precision. Returns: The new float value that the user set. Feed this value back on v on the next call to see a proper state update.
coalpy.gpu.ImguiBuilder.input_float2
function
Draws a box to input a float2 value. Parameters: label (str): the label name for this box. v (float): the actual value to draw the slider. (tuple or array) step (float)(optional): step value when scrolling slow step_fast (float)(optional): step value when scrolling fast. fmt (str)(optional): A formatting value to draw the float. For example %.3f draws 3 decimal precision. Returns: The new float2 value that the user set. Feed this value back on v on the next call to see a proper state update.
coalpy.gpu.ImguiBuilder.input_float3
function
Draws a box to input a float3 value. Parameters: label (str): the label name for this box. v (float): the actual value to draw the slider. (tuple or array) step (float)(optional): step value when scrolling slow step_fast (float)(optional): step value when scrolling fast. fmt (str)(optional): A formatting value to draw the float. For example %.3f draws 3 decimal precision. Returns: The new float3 value that the user set. Feed this value back on v on the next call to see a proper state update.
coalpy.gpu.ImguiBuilder.input_float4
function
Draws a box to input a float4 value. Parameters: label (str): the label name for this box. v (float): the actual value to draw the slider. (tuple or array) step (float)(optional): step value when scrolling slow step_fast (float)(optional): step value when scrolling fast. fmt (str)(optional): A formatting value to draw the float. For example %.3f draws 3 decimal precision. Returns: The new float4 value that the user set. Feed this value back on v on the next call to see a proper state update.
coalpy.gpu.ImguiBuilder.input_text
function
Draws a box for input text. Parameters: label (str): the label name for this box. v (str): the actual string value to display by default. Returns: The new str value that the user set. Feed this value back on v on the next call to see a proper state update.
coalpy.gpu.ImguiBuilder.is_item_hovered
function
flags (int): see coalpy.gpu.ImGuiHoveredFlags Returns: True if is hovered, false otherwise
coalpy.gpu.ImguiBuilder.is_key_down
function
is key being held. Parameters: key (int): see coalpy.gpu.ImGuiKey Returns: True if pressed, False otherwise
coalpy.gpu.ImguiBuilder.is_key_pressed
function
was key pressed (went from !Down to Down)? if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate Parameters: key (int): see coalpy.gpu.ImGuiKey repeat (bool)(optional): default is true Returns: True if pressed, False otherwise
coalpy.gpu.ImguiBuilder.is_key_released
function
was key released (went from Down to !Down)? Parameters: key (int): see coalpy.gpu.ImGuiKey Returns: True if released, False otherwise
coalpy.gpu.ImguiBuilder.is_mouse_clicked
function
Get mouse button state clicked Parameters: key (int): see (g.ImGuiMouseButton) Returns: True if button is clicked, False otherwise
coalpy.gpu.ImguiBuilder.is_mouse_double_clicked
function
Get mouse button state double clicked Parameters: key (int): see (g.ImGuiMouseButton) Returns: True if button is double clicked, False otherwise
coalpy.gpu.ImguiBuilder.is_mouse_down
function
Get mouse button state down Parameters: key (int): see (g.ImGuiMouseButton) Returns: True if button is down, False otherwise
coalpy.gpu.ImguiBuilder.is_mouse_released
function
Get mouse button state released Parameters: key (int): see (g.ImGuiMouseButton) Returns: True if button is released, False otherwise
coalpy.gpu.ImguiBuilder.is_window_focused
function
Returns boolean with current window focused. Parameters: flags (int)(optional): see coalpy.gpu.ImguiFocusedFlags Returns: True if window is focused, false otherwise
coalpy.gpu.ImguiBuilder.is_window_hovered
function
Returns boolean with current window hovered status. Parameters: flags (int)(optional): see coalpy.gpu.ImGuiHoveredFlags Returns: True if window is hovered, false otherwise
function
Parameters: label (str) : label of this menu item. shortcut (str): short cut key for this menu item. enabled (bool) : enables / disables menu item. Returns: True if activated. False otherwise.
coalpy.gpu.ImguiBuilder.new_line
function
Draws new line.
coalpy.gpu.ImguiBuilder.open_file_dialog
function
Open a file dialog Parameters: key (str): key of dialog title (str): title of dialog filter (str): file filter, i.e ".cpp.h.hpp" path (str): path of dialog Returns (tuple): (filePathName, filePath, response(bool)) Note: None means no action taken, and window should be re-rendered.
coalpy.gpu.ImguiBuilder.pop_id
function
Pops a corresponding name for a scope. Must be paired with a push_id.
coalpy.gpu.ImguiBuilder.progress_bar
function
Parameters: fraction (float) size_arg (tuple)(x, y) overlay (str)
coalpy.gpu.ImguiBuilder.push_id
function
Pushes a custom id name for a scope. See (docs/FAQ.md or http://dearimgui.org/faq) for more details about how ID are handled in dear imgui. This call to push_id must be paired with a corresponding pop_id call. Parameters: text (str): The identifier for this id stack scope.
coalpy.gpu.ImguiBuilder.same_line
function
Sets the same line for drawing next item. Parameters: offset_from_start_x (float)(optional): offset from the start of this x spacing (float)(optional): spacing amount
coalpy.gpu.ImguiBuilder.selectable
function
Draws a selectable item. Parameters: label (str): the label name for this selectable. selected (bool): the state if this value is selected. Returns: True if item is selected, false otherwise.
coalpy.gpu.ImguiBuilder.separator
function
Draw a separator.
coalpy.gpu.ImguiBuilder.set_color_edit_options
function
initialize current options (generally on application startup) if you want to select a default format, picker type, etc. User will be able to change many settings, unless you pass the _NoOptions flag to your calls. Parameters: flags : see coalpy.gpu.ImGuiColorEditFlags
coalpy.gpu.ImguiBuilder.set_next_frame_want_capture_keyboard
function
Override io.WantCaptureKeyboard flag next frame (said flag is left for your application to handle, typically when true it instructs your app to ignore inputs). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting "io.WantCaptureKeyboard = want_capture_keyboard"; after the next NewFrame() call. Parameters: want_capture_keyboard (bool)
coalpy.gpu.ImguiBuilder.set_next_window_pos
function
Parameters: pos (with, height) : the width and height of next window size. condition_flags (optional) : see ImGuiCond
coalpy.gpu.ImguiBuilder.set_next_window_size
function
Sets the next window size. Parameters: size (with, height) : the width and height of next window size. condition_flags (optional) : see ImGuiCond
coalpy.gpu.ImguiBuilder.set_tab_item_closed
function
notify TabBar or Docking system of a closed tab/window ahead (useful to reduce visual flicker on reorderable tab bars). For tab-bar: call after BeginTabBar() and before Tab submissions. Otherwise call with a window name. Parameters: label (str): tab or docked window label
coalpy.gpu.ImguiBuilder.set_tooltip
function
Sets tooltip of prev item Parameters: text (str) text of tooltip
coalpy.gpu.ImguiBuilder.set_window_dock
function
Parameters: window_name (str) dock_id (int)
coalpy.gpu.ImguiBuilder.set_window_focus
function
Sets the current windows focused.
coalpy.gpu.ImguiBuilder.set_window_size
function
Sets the current window size Parameters: size (tuple x, y): the window size to set
coalpy.gpu.ImguiBuilder.settings_loaded
function
Returns: True if the .ini settings have been loaded, False otherwise
coalpy.gpu.ImguiBuilder.show_demo_window
function
Shows the demo window.
coalpy.gpu.ImguiBuilder.slider_float
function
Draws a slider for a float value. Parameters: label (str): the label name for this slider. v (float): the actual value to draw the slider. v_min (float); the minimum possible value. v_max (float): the maximum possible value. fmt (str)(optional): A formatting value to draw the float. For example %.3f draws 3 decimal precision. Returns: The new float value that the user set. Feed this value back on v on the next call to see a proper state update.
coalpy.gpu.ImguiBuilder.slider_int
function
Draws a slider for an int value. Parameters: label (str): the label name for this slider. v (int): the actual value to draw the slider. v_min (int); the minimum possible value. v_max (int): the maximum possible value. fmt (str)(optional): A formatting value to draw the int. For example %d draws the int. Returns: The new int value that the user set. Feed this value back on v on the next call to see a proper state update.
function
create a Tab behaving like a button. return true when clicked. cannot be selected in the tab bar. label (str): name flags (int): See coalpy.gpu.ImGuiTabItemFlags Return: bool
coalpy.gpu.ImguiBuilder.text
function
Draws a box with solid text. Parameters: text (str): the label value to display
coalpy.gpu.ImguiBuilder.tree_node
function
Parameters: label (str): label of tree node flags (int) see coalpy.gpu.ImGuiTreeNodeFlags Return: bool - Note: must call tree_pop if return is True
coalpy.gpu.ImguiBuilder.tree_node_with_id
function
Parameters: id (int): int identifier text (str): text of node flags (int) see coalpy.gpu.ImGuiTreeNodeFlags Return: bool - Note: must call tree_pop if return is True
coalpy.gpu.ImguiBuilder.tree_pop
function
Must be called if tree_node returns True.
coalpy.gpu.ImplotBuilder
type
Implot builder class. Use this class' methods to build a Dear Implot on a specified window. To utilize you need to instantiate a Window object. In its constructor set use_imgui to True (which is by default). On the on_render function, you will receive a RenderArgs object. There will be a ImplotBuilder object in the implot member that you can now query to construct your plots. Coalpy does not support creation of a ImplotBuilder object, it will always be passed as an argument on the RenderArgs of the window.
coalpy.gpu.ImplotBuilder.begin_plot
function
Starts a 2D plotting context. If this function returns true, EndPlot() MUST be called! You are encouraged to use the following convention: if implot.begin_plot(...): ... implot.end_plot() Parameters: title_id (str): must be unique to the current ImGui ID scope. If you need to avoid ID collisions or don't want to display a title in the plot, use double hashes (e.g. "MyPlot##HiddenIdText" or "##NoTitle"). size (optional)(tuple 2 f): is the **frame** size of the plot widget, not the plot area. The default size of plots (i.e. when ImVec2(0,0)) can be modified in your ImPlotStyle. default value is (-1.0, 0.0) flags (int): see coalpy.gpu.ImPlotFlags Returns: True if is open, False otherwise
coalpy.gpu.ImplotBuilder.end_plot
function
Only call EndPlot() if BeginPlot() returns true! Typically called at the end of an if statement conditioned on BeginPlot(). See example above.
coalpy.gpu.ImplotBuilder.plot_line
function
Parameters: label (str) values (byte object, or numpy array): array must be contiguous floating point values (x, y) laid down in memory. object must implement buffer protocol. count: the number of points offset: offset of points. Note: value is treated as a circular buffer, that is, elements are read in order from offset to count using modulus index.
coalpy.gpu.ImplotBuilder.plot_shaded
function
Parameters: label (str) values (byte object, or numpy array): array must be contiguous floating point values (x, y) laid down in memory. object must implement buffer protocol. count: the number of points yref (float): can be +/-float('inf') offset: offset of points. Note: value is treated as a circular buffer, that is, elements are read in order from offset to count using modulus index.
coalpy.gpu.ImplotBuilder.setup_axes
function
Sets the label and/or flags for primary X and Y axes (shorthand for two calls to SetupAxis). Parameters: x_label (str) y_label (str) x_flags (int)(optional): see coalpy.gpu.ImPlotAxisFlags y_flags (int)(optional): see coalpy.gpu.ImPlotAxisFlags
coalpy.gpu.ImplotBuilder.setup_axis_limits
function
Parameters: axis (int): see coalpy.gpu.ImAxis v_min (float) v_max (float) cond (int)(optional): see coalpy.gpu.ImPlotCond , default is Once
coalpy.gpu.ImplotBuilder.show_demo_window
function
Shows the demo window.
coalpy.gpu.InResourceTable
type
Input resource table. Use this to specify the inputs of a dispatch call in CommandList. Constructor: name (str): name / identifier of this resource table. resource_list: array of Texture or Buffer to be specified. Each position in the table correspods to a t# register in hlsl.
coalpy.gpu.MarkerResults
type
Result object with GPU marker data.
markers | List of marker tuples. Each tuple has (name, parent_marker_index, begin_timestamp_index, end_timestamp_index). Time stamp are measured in ticks and stored in the GPU buffer member timestamp_buffer. A common practice is to store this result, along with the buffer, and poll it using a DownloadResourceRequest object. Once timestamps are available on CPU, divide timestamp by timestamp_frequency member to obtain time in seconds. |
timestamp_buffer | GPU buffer (uin64 elements) with time stamp ticks. |
timestamp_frequency | Frequency in ticks/secs. Divide timestamp ticks by frequency to obtain time in seconds. |
coalpy.gpu.OutResourceTable
type
Output resource table. Use this to specify a table of unordered access views (outputs) of a dispatch call in CommandList. Constructor: name (str): name / identifier of this resource table. resource_list: array of Texture or Buffer to be specified. Each position in the table correspods to a u# register in hlsl.
coalpy.gpu.RenderArgs
type
Parameters passed in the on_render function of a window.
delta_time | Delta time from previous frame in milliseconds |
height | The current height of this window. |
imgui | The ImguiBuilder object, used to build a Dear Imgui. For more info read on Window constructor, ImguiBuilder and its methods. |
implot | The ImplotBuilder object, used to build a Dear Implot. For more info read on Window constructor, ImplotBuilder and its methods. |
render_time | Total rendering time from the start of this application, in milliseconds |
user_data | Custom user_data object set in the Window object. You can store here your view user data such as texture / buffers / shaders. |
width | The current width of this window. |
window | The window object being rendered. |
coalpy.gpu.ResourceDownloadRequest
type
Class that represents a GPU -> CPU resource download request. This class can be used to read the memory of a resource in the CPU synchorneously or asynchronesouly (throug polling). Constructor: resource (Texture or Buffer): The resource to bind and read from the GPU. slice_index : If the resource is a texture array, gets the slice index. If out of range or not a texture array, an exception is thrown. Default value is 0. mip_level : If the resource is a texture, gets the mip level. If the mip level is out of range or not a texture, an exception is thrown. Default value is 0.
coalpy.gpu.ResourceDownloadRequest.data_as_bytearray
function
returns the data as a bytearray. This Byte array is internally cached and referenced by the ResourceDownload object.
coalpy.gpu.ResourceDownloadRequest.data_byte_row_pitch
function
Assuming the data is ready, this method returns the row pitch (in case the resource is a texture).
coalpy.gpu.ResourceDownloadRequest.is_ready
function
Polls the GPU (internally a fence) to check if the data is ready. When doing async this method can be used to query until we have data ready.
coalpy.gpu.ResourceDownloadRequest.resolve
function
Waits for binary data of the texture to be downloaded. This method will block the CPU until the GPU has finished downloading the data. After this call, check availability with is_ready and then get the data as desired.
coalpy.gpu.Sampler
type
Class that represents a Sampler GPU resource. Constructor: filter_type (int): see coalpy.gpu.FilterType. Sets the type of filter to use. address_u (int): see coalpy.gpu.TextureAddressMode. Sets behaviour on texture sampling when out of bounds for x axis. address_v (int): see coalpy.gpu.TextureAddressMode. Sets behaviour on texture sampling when out of bounds for y axis. address_w (int): see coalpy.gpu.TextureAddressMode. Sets behaviour on texture sampling when out of bounds for z axis. border_color (array): Must be an array of size 4 floats. Specifies the color in rgba format on border, when address mode is border. Ranges from 0.0 to 1.0 per channel. min_lod (float): Minimum texture mip. max_lod (float): Maximum texture mip. max_aniso (int): maximum quality for anisotropic filtering.
coalpy.gpu.SamplerTable
type
Sampler table. Use this to specify a table of Samplers to be used in a CommandList and shader. Constructor: name (str): name / identifier of this sampler table. samplers: array of Samplers to be specified.
coalpy.gpu.Settings
type
None
adapter_index | Current adapter index to use. |
dump_shader_pdbs | Dumps shader pdbs for debugging. Only works on dx12. |
enable_debug_device | Enables debug device settings for dx12 or vulkan (verbose device warnings). |
graphics_api | Graphics api to use. Valid strings are "dx12" or "vulkan" case sensitive. |
shader_model | HLSL shader model to use. Can be sm6_0, sm6_1, sm6_2, sm6_3, sm6_4, sm6_5. The system will try and find the maximum possible |
spirv_debug_reflection | For vulkan, prints out spirv reflection information. Has no effect in other render APIs |
coalpy.gpu.Settings.load
function
Load settings from a json file. Parameters: filename: name of the file to load. Returns: True if successful, False if it failed.
coalpy.gpu.Settings.save
function
Saves settings to a json file. Parameters: filename (optional): optional name of the file. Ensure to include the .json extension if specified. If not used, default settings are saved in ".coalpy_settings.json" which is the default settings read at module boot. Returns: True if successful, False if it failed.
coalpy.gpu.Shader
type
Class that represents a shader. Constructor: file (str): text file with shader code. name (str)(optional): identifier of the shader to use. Default will be the file name. main_function (str)(optional): entry point of shader. Default is 'main'. defines (array of str): an array of strings with defines for the shader. Utilize the = sign to set the definition inside the shader. I.e. ["HDR_LIGHTING=1"] will create the define HDR_LIGHTING inside the shader to a value of 1 source_code (str): text file with the source. If source is set, file will be ignored and the shader will be created from source.
coalpy.gpu.Shader.is_valid
function
Returns true if this is a valid shader, false otherwise.
coalpy.gpu.Shader.resolve
function
Waits for shader compilation to be finished. Resolve is mostly implicitely called upon any operation requiring the shader's definition.
coalpy.gpu.Texture
type
Class that represents a Texture GPU resource. Constructor: name (str): string to identify the resource with. mem_flags (int): see coalpy.gpu.MemFlags. Default is Gpu_Read and Gpu_Write type (int): dimensionality of texture, see coalpy.gpu.TextureType. Default is k2d format (int): Format of texture. See coalpy.gpu.Format for available formats. width (int): the width of the texture in texels. Default is 1 height (int): the height of the texture in texels. Default is 1 depth (int): the depth of the texture if k2dArray or k3d. Default is 1. mip_levels (int): number of mips supported on this texture. file (str): Load a texture file name (jpeg or png). All other parameters will be ignored when the file name set.
coalpy.gpu.TinyObjLoader
type
coalpy.gpu.TinyObjLoader.ObjReader
type
None
coalpy.gpu.TinyObjLoader.ObjReader.ParseFromFile
function
Parameters: filename (str): file to load option (ObjReaderConfig): configuration
coalpy.gpu.TinyObjLoader.ObjReaderConfig
type
None
triangulate |
coalpy.gpu.Window
type
Class that represnts a window. Constructor: title (str): String title for the window. width (int)(optional): initial width of window and swap chain texture. height (int)(optional): initial height of window and swap chain texture. on_render (function): Rendering function. The function has 1 argument of type RenderArgs and no return. See RenderArgs for more info. use_imgui (Boolean): (True by default), set to True, and during on_render the render_args object will contain an imgui object. Use this object to render imgui into the window. The ImguiBuilder object will contain the definition of all the available parameters.
display_texture | Display Texture. Use this as the output texture in CommmandList dispatch command to write directly to the window. |
user_data | Set this user data so its accessible during on_render callback. You can put here the custom state of your window. |
coalpy.gpu.Window.get_key_state
function
Gets the pressed state of a queried key. For a list of keys see coalpy.gpu.Keys. Parameters: key (int enum): The key (keyboard or mouse) to query info from. Use the coalpy.gpu.Keys enumerations to query a valid key. Returns: True if the queried key is pressed. False otherwise.
coalpy.gpu.Window.get_mouse_position
function
Gets the mouse position relative to the current window. This function will also give you the mouse coordinates even if the mouse is outside of the window. Returns: tuple with: (pixelX, pixelY, normalizedX, normalizedY) The pixelX and pixelY represent the pixel index (0 based to get_size()). The normalizedX and normalizedY are the pixel centered coordinates in x and y [0, 1] respectively, i.e. (x + 0.5)/ (window's width).
coalpy.gpu.Window.get_size
function
Returns: returns a touple with the current size of the window (width, height)
coalpy.gpu.exception_object
type
None
args | None |
coalpy.gpu.exception_object.add_note
function
Exception.add_note(note) -- add a note to the exception
coalpy.gpu.exception_object.with_traceback
function
Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.
coalpy.gpu.BufferType
enum
Type of buffer. Use enum values located at coalpy.gpu.BufferType
Raw | Raw byte buffer. |
Standard | Standard buffer. Obeys the format specified when sampling / writting into it. |
Structured | Structured buffer, requires stride parameter. |
coalpy.gpu.BufferUsage
enum
Buffer usage flags. Use enum values located at coalpy.gpu.BufferUsage
AppendConsume | Set flag when a buffer is to be used as an append consume queue. In HLSL this corresponds to AppendStructuredBuffer |
Constant | Set flag when buffer is to be bound in a dispatch called through the constant argument. |
IndirectArgs | Set flag when a buffer is to be used as an argument buffer on a dispatch call. |
Upload | Use this buffer as an upload resource. |
coalpy.gpu.DeviceFlags
enum
Flags utilized for device creation.
EnableDebug | Enable debug drivers for current device. |
coalpy.gpu.FilterType
enum
Filter types for samplers enumeration. Use enum values located at coalpy.gpu.FilterType
Anisotropic | High quality anisotropic filter type. |
Linear | Bilinear/trilinear filter type. |
Max | Min value of neighborhood filter type. |
Min | Max value of neighborhood filter type. |
Point | Point (nearest neighbor) filter type. |
coalpy.gpu.Format
enum
Formats supported for Textures and Standard Buffers.
BGRA_8_UNORM | |
BGRA_8_UNORM_SRGB | |
D16_UNORM | |
D32_FLOAT | |
R16_FLOAT | |
R16_SINT | |
R16_SNORM | |
R16_TYPELESS | |
R16_UINT | |
R16_UNORM | |
R32_FLOAT | |
R32_SINT | |
R32_TYPELESS | |
R32_UINT | |
R8_SINT | |
R8_SNORM | |
R8_TYPELESS | |
R8_UINT | |
R8_UNORM | |
RG16_FLOAT | |
RG16_SINT | |
RG16_SNORM | |
RG16_TYPELESS | |
RG16_UINT | |
RG16_UNORM | |
RGBA_16_FLOAT | |
RGBA_16_SINT | |
RGBA_16_SNORM | |
RGBA_16_TYPELESS | |
RGBA_16_UINT | |
RGBA_16_UNORM | |
RGBA_32_FLOAT | |
RGBA_32_SINT | |
RGBA_32_TYPELESS | |
RGBA_32_UINT | |
RGBA_8_SINT | |
RGBA_8_SNORM | |
RGBA_8_TYPELESS | |
RGBA_8_UINT | |
RGBA_8_UNORM | |
RGBA_8_UNORM_SRGB | |
RGB_32_FLOAT | |
RGB_32_SINT | |
RGB_32_TYPELESS | |
RGB_32_UINT | |
RG_32_FLOAT | |
RG_32_SINT | |
RG_32_TYPELESS | |
RG_32_UINT |
coalpy.gpu.ImAxis
enum
None
COUNT | |
X1 | enabled by default |
X2 | disabled by default |
X3 | disabled by default |
Y1 | enabled by default |
Y2 | disabled by default |
Y3 | disabled by default |
coalpy.gpu.ImGuiColorEditFlags
enum
None
AlphaBar | ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker. |
AlphaPreview | ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque. |
AlphaPreviewHalf | ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead of opaque. |
DefaultOptions_ | Default options |
DisplayHSV | [Display] " |
DisplayHex | [Display] " |
DisplayRGB | [Display] ColorEdit: override _display_ type among RGB/HSV/Hex. ColorPicker: select any combination using one or more of RGB/HSV/Hex. |
Float | [DataType] ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers. |
HDR | (WIP) ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well). |
InputHSV | [Input] ColorEdit, ColorPicker: input and output data in HSV format. |
InputRGB | [Input] ColorEdit, ColorPicker: input and output data in RGB format. |
NoAlpha | ColorEdit, ColorPicker, ColorButton: ignore Alpha component (will only read 3 components from the input pointer). |
NoBorder | ColorButton: disable border (which is enforced by default) |
NoDragDrop | ColorEdit: disable drag and drop target. ColorButton: disable drag and drop source. |
NoInputs | ColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the small preview color square). |
NoLabel | ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker). |
NoOptions | ColorEdit: disable toggling options menu when right-clicking on inputs/small preview. |
NoPicker | ColorEdit: disable picker when clicking on color square. |
NoSidePreview | ColorPicker: disable bigger color preview on right side of the picker, use small color square preview instead. |
NoSmallPreview | ColorEdit, ColorPicker: disable color square preview next to the inputs. (e.g. to show only the inputs) |
NoTooltip | ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview. |
None | |
PickerHueBar | [Picker] ColorPicker: bar for Hue, rectangle for Sat/Value. |
PickerHueWheel | [Picker] ColorPicker: wheel for Hue, triangle for Sat/Value. |
Uint8 | [DataType] ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0..255. |
coalpy.gpu.ImGuiCond
enum
None
Always | No condition (always set the variable), same as _None |
Appearing | Set the variable if the object/window is appearing after being hidden/inactive (or the first time) |
FirstUseEver | Set the variable if the object/window has no persistently saved data (no entry in .ini file) |
None | No condition (always set the variable), same as _Always |
Once | Set the variable once per runtime session (only the first call will succeed) |
coalpy.gpu.ImGuiDir
enum
None
COUNT | |
Down | |
Left | |
Right | |
Up |
coalpy.gpu.ImGuiDockNodeFlags
enum
Flags for docking
AutoHideTabBar | Tab bar will automatically hide when there is a single window in the dock node. |
KeepAliveOnly | Don't display the dockspace node but keep it alive. Windows docked into this dockspace node won't be undocked. |
NoDockingInCentralNode | Disable docking inside the Central Node, which will be always kept empty. |
NoResize | Disable resizing node using the splitter/separators. Useful with programmatically setup dockspaces. |
NoSplit | Disable splitting the node into smaller nodes. Useful e.g. when embedding dockspaces into a main root one (the root one may have splitting disabled to reduce confusion). Note: when turned off, existing splits will be preserved. |
PassthruCentralNode | Enable passthru dockspace: 1) DockSpace() will render a ImGuiCol_WindowBg background covering everything excepted the Central Node when empty. Meaning the host window should probably use SetNextWindowBgAlpha(0.0f) prior to Begin() when using this. 2) When Central Node is empty: let inputs pass-through + won't display a DockingEmptyBg background. See demo for details. |
coalpy.gpu.ImGuiFocusedFlags
enum
ImGUI Focused flags
AnyWindow | Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ! |
ChildWindows | Return true if any children of the window is focused |
DockHierarchy | Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow) |
NoPopupHierarchy | Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow) |
RootAndChildWindows | All the windows. |
RootWindow | Test from root window (top most parent of the current hierarchy) |
coalpy.gpu.ImGuiHoveredFlags
enum
Flags for IsHovered
AllowWhenBlockedByActiveItem | Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns. |
AllowWhenBlockedByPopup | Return true even if a popup window is normally blocking access to this item/window |
AllowWhenDisabled | IsItemHovered() only: Return true even if the item is disabled |
AllowWhenOverlapped | IsItemHovered() only: Return true even if the position is obstructed or overlapped by another window |
AnyWindow | IsWindowHovered() only: Return true if any window is hovered |
ChildWindows | "IsWindowHovered() only: Return true if any children of the window is hovered |
DockHierarchy | IsWindowHovered() only: Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow) |
NoNavOverride | Disable using gamepad/keyboard navigation state when active, always query mouse. |
NoPopupHierarchy | IsWindowHovered() only: Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow) |
RectOnly | ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped |
RootAndChildWindows | ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows |
RootWindow | IsWindowHovered() only: Test from root window (top most parent of the current hierarchy) |
coalpy.gpu.ImGuiKey
enum
None
A | |
Apostrophe | |
B | |
Backslash | |
Backspace | |
C | |
COUNT | |
CapsLock | |
Comma | |
D | |
Delete | |
DownArrow | |
E | |
End | |
Enter | |
Equal | |
Escape | |
F | |
F1 | |
F10 | |
F11 | |
F12 | |
F2 | |
F3 | |
F4 | |
F5 | |
F6 | |
F7 | |
F8 | |
F9 | |
G | |
GamepadBack | |
GamepadDpadDown | |
GamepadDpadLeft | |
GamepadDpadRight | |
GamepadDpadUp | |
GamepadFaceDown | |
GamepadFaceLeft | |
GamepadFaceRight | |
GamepadFaceUp | |
GamepadL1 | |
GamepadL2 | |
GamepadL3 | |
GamepadLStickDown | |
GamepadLStickLeft | |
GamepadLStickRight | |
GamepadLStickUp | |
GamepadR1 | |
GamepadR2 | |
GamepadR3 | |
GamepadRStickDown | |
GamepadRStickLeft | |
GamepadRStickRight | |
GamepadRStickUp | |
GamepadStart | |
GraveAccent | |
H | |
Home | |
I | |
Insert | |
J | |
K | |
Keypad0 | |
Keypad1 | |
Keypad2 | |
Keypad3 | |
Keypad4 | |
Keypad5 | |
Keypad6 | |
Keypad7 | |
Keypad8 | |
Keypad9 | |
KeypadAdd | |
KeypadDecimal | |
KeypadDivide | |
KeypadEnter | |
KeypadEqual | |
KeypadMultiply | |
KeypadSubtract | |
L | |
LeftAlt | |
LeftArrow | |
LeftBracket | |
LeftCtrl | |
LeftShift | |
LeftSuper | |
M | |
Menu | |
Minus | |
ModAlt | |
ModCtrl | |
ModShift | |
ModSuper | |
N | |
None | |
NumLock | |
O | |
P | |
PageDown | |
PageUp | |
Pause | |
Period | |
PrintScreen | |
Q | |
R | |
RightAlt | |
RightArrow | |
RightBracket | |
RightCtrl | |
RightShift | |
RightSuper | |
S | |
ScrollLock | |
Semicolon | |
Slash | |
Space | |
T | |
Tab | |
U | |
UpArrow | |
V | |
W | |
X | |
Y | |
Z | |
k0 | |
k1 | |
k2 | |
k3 | |
k4 | |
k5 | |
k6 | |
k7 | |
k8 | |
k9 |
coalpy.gpu.ImGuiMouseButton
enum
None
COUNT | |
Left | |
Middle | |
Right |
coalpy.gpu.ImGuiTabBarFlags
enum
None
AutoSelectNewTabs | Automatically select new tabs when they appear |
FittingPolicyDefault_ | |
FittingPolicyMask_ | |
FittingPolicyResizeDown | Resize tabs when they don't fit |
FittingPolicyScroll | Add scroll buttons when tabs don't fit |
NoCloseWithMiddleMouseButton | Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false. |
NoTabListScrollingButtons | Disable scrolling buttons (apply when fitting policy is ImGuiTabBarFlags_FittingPolicyScroll) |
NoTooltip | Disable tooltips when hovering a tab |
Reorderable | Allow manually dragging tabs to re-order them + New tabs are appended at the end of list |
TabListPopupButton | Disable buttons to open the tab list popup |
coalpy.gpu.ImGuiTabItemFlags
enum
None
Leading | Enforce the tab position to the left of the tab bar (after the tab list popup button) |
NoCloseWithMiddleMouseButton | Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false. |
NoPushId | Don't call PushID(tab->ID)/PopID() on BeginTabItem()/EndTabItem() |
NoReorder | Disable reordering this tab or having another tab cross over this tab |
NoTooltip | Disable tooltip for the given tab |
SetSelected | Trigger flag to programmatically make the tab selected when calling BeginTabItem() |
Trailing | the tab position to the right of the tab bar (before the scrolling buttons) |
UnsavedDocument | Display a dot next to the title + tab is selected when clicking the X + closure is not assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar. |
coalpy.gpu.ImGuiTreeNodeFlags
enum
None
AllowItemOverlap | Hit testing to allow subsequent widgets to overlap this one |
Bullet | Display a bullet instead of arrow |
CollapsingHeader | ImGuiTreeNodeFlags_NoAutoOpenOnLog |
DefaultOpen | Default node to be open |
FramePadding | // Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding(). |
Framed | Draw frame with background (e.g. for CollapsingHeader) |
Leaf | No collapsing, no arrow (use as a convenience for leaf nodes). |
NavLeftJumpsBackHere | // (WIP) Nav: left direction may move to this TreeNode() from any of its child (items submitted between TreeNode and TreePop) |
NoAutoOpenOnLog | Don't automatically and temporarily open node when Logging is active (by default logging will automatically open tree nodes) |
NoTreePushOnOpen | Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack |
OpenOnArrow | Only open when clicking on the arrow part. If ImGuiTreeNodeFlags_OpenOnDoubleClick is also set, single-click arrow or double-click all box to open. |
OpenOnDoubleClick | Need double-click to open node |
Selected | Draw as selected |
SpanAvailWidth | // Extend hit box to the right-most edge, even if not framed. This is not the default in order to allow adding other items on the same line. In the future we may refactor the hit system to be front-to-back, allowing natural overlaps and then this can become the default. |
SpanFullWidth | // Extend hit box to the left-most and right-most edges (bypass the indented area). |
coalpy.gpu.ImGuiWindowFlags
enum
ImGUI Window flags
AlwaysAutoResize | Resize every window to its content every frame |
AlwaysHorizontalScrollbar | Always show horizontal scrollbar (even if ContentSize.x < Size.x) |
AlwaysUseWindowPadding | Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient) |
AlwaysVerticalScrollbar | Always show vertical scrollbar (even if ContentSize.y < Size.y) |
HorizontalScrollbar | Allow horizontal scrollbar to appear (off by default). You may use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section. |
MenuBar | Has a menu-bar |
NoBackground | Disable drawing background color (WindowBg, etc.) and outside border. Similar as using SetNextWindowBgAlpha(0.0f). |
NoBringToFrontOnFocus | Disable bringing window to front when taking focus (e.g. clicking on it or programmatically giving it focus) |
NoCollapse | Disable user collapsing window by double-clicking on it. Also referred to as Window Menu Button (e.g. within a docking node). |
NoDocking | Disable docking of this window |
NoFocusOnAppearing | Disable taking focus when transitioning from hidden to visible state |
NoMouseInputs | Disable catching mouse, hovering test with pass through. |
NoMove | Disable user moving the window |
NoNavFocus | No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB) |
NoNavInputs | No gamepad/keyboard navigation within the window |
NoResize | Disable user resizing with the lower-right grip |
NoSavedSettings | Never load/save settings in .ini file |
NoScrollWithMouse | Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set. |
NoScrollbar | Disable scrollbars (window can still scroll with mouse or programmatically) |
NoTitleBar | Disable title-bar |
UnsavedDocument | Display a dot next to the title. When used in a tab/docking context, tab is selected when clicking the X + closure is not assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar. |
coalpy.gpu.ImPlotAxisFlags
enum
None
AutoFit | axis will be auto-fitting to data extents |
AuxDefault | |
Foreground | d lines will be displayed in the foreground (i.e. on top of data) in stead of the background |
Invert | the axis will be inverted |
Lock | |
LockMax | the axis maximum value will be locked when panning/zooming |
LockMin | the axis minimum value will be locked when panning/zooming |
NoDeforations | |
NoGridLines | rid lines will be displayed |
NoInitialFit | will not be initially fit to data extents on the first rendered frame |
NoLabel | the axis label will not be displayed (axis labels also hidden if the supplied string name is NULL |
NoMenus | the user will not be able to open context menus with right-click |
NoTickLabels | xt labels will be displayed |
NoTickMarks | ick marks will be displayed |
Opposite | xis ticks and labels will be rendered on conventionally opposite side (i.e, right or top |
RangeFit | xis will only fit points if the point is in the visible range of the **orthogonal** axis |
coalpy.gpu.ImPlotCond
enum
None
Always | No condition (always set the variable) |
None | No condition (always set the variable), same as _Always |
Once | Set the variable once per runtime session (only the first call will succeed) |
coalpy.gpu.ImPlotFlags
enum
None
CanvasOnly | |
Crosshairs | the default mouse cursor will be replaced with a crosshair when hovered |
Equal | x and y axes pairs will be constrained to have the same units/pixel |
NoBoxSelect | the user will not be able to box-select |
NoChild | a child window region will not be used to capture mouse scroll (can boost performance for single ImGui window applications) |
NoFrame | the ImGui frame will not be rendered |
NoInputs | the user will not be able to interact with the plot |
NoLegend | the legend will not be displayed |
NoMenus | the user will not be able to open context menus |
NoMouseText | the mouse position, in plot coordinates, will not be displayed inside of the plot |
NoTitle | the plot title will not be displayed (titles are also hidden if preceeded by double hashes, e.g. "##MyPlot") |
coalpy.gpu.Keys
enum
Enumeration of keyboard / mouse input keys. To be used with the input_state object from the Window. Use enum values located at coalpy.gpu.Keys
A | A key enumeration. |
B | B key enumeration. |
Backslash | Backslash key enumeration. |
Backspace | Backspace key enumeration. |
C | C key enumeration. |
Comma | Comma key enumeration. |
D | D key enumeration. |
Dot | Dot key enumeration. |
Down | Down key enumeration. |
E | E key enumeration. |
Enter | Enter key enumeration. |
F | F key enumeration. |
F1 | F1 key enumeration. |
F10 | F10 key enumeration. |
F11 | F11 key enumeration. |
F12 | F12 key enumeration. |
F2 | F2 key enumeration. |
F3 | F3 key enumeration. |
F4 | F4 key enumeration. |
F5 | F5 key enumeration. |
F6 | F6 key enumeration. |
F7 | F7 key enumeration. |
F8 | F8 key enumeration. |
F9 | F9 key enumeration. |
G | G key enumeration. |
H | H key enumeration. |
I | I key enumeration. |
J | J key enumeration. |
K | K key enumeration. |
L | L key enumeration. |
Left | Left key enumeration. |
LeftAlt | LeftAlt key enumeration. |
LeftBrac | LeftBrac key enumeration. |
LeftControl | LeftControl key enumeration. |
LeftShift | LeftShift key enumeration. |
M | M key enumeration. |
MouseCenter | MouseCenter key enumeration. |
MouseLeft | MouseLeft key enumeration. |
MouseLeftDouble | MouseLeftDouble key enumeration. |
MouseRight | MouseRight key enumeration. |
MouseRightDouble | MouseRightDouble key enumeration. |
N | N key enumeration. |
O | O key enumeration. |
P | P key enumeration. |
Q | Q key enumeration. |
R | R key enumeration. |
Right | Right key enumeration. |
RightAlt | RightAlt key enumeration. |
RightBrac | RightBrac key enumeration. |
RightControl | RightControl key enumeration. |
RightShift | RightShift key enumeration. |
S | S key enumeration. |
Semicolon | Semicolon key enumeration. |
Slash | Slash key enumeration. |
Space | Space key enumeration. |
T | T key enumeration. |
U | U key enumeration. |
Up | Up key enumeration. |
V | V key enumeration. |
W | W key enumeration. |
X | X key enumeration. |
Y | Y key enumeration. |
Z | Z key enumeration. |
k0 | k0 key enumeration. |
k1 | k1 key enumeration. |
k2 | k2 key enumeration. |
k3 | k3 key enumeration. |
k4 | k4 key enumeration. |
k5 | k5 key enumeration. |
k6 | k6 key enumeration. |
k7 | k7 key enumeration. |
k8 | k8 key enumeration. |
k9 | k9 key enumeration. |
coalpy.gpu.MemFlags
enum
Memory access enumerations. Use enum values located at coalpy.gpu.MemFlags
GpuRead | Specify flag for resource read access from InResourceTable / SRVs |
GpuWrite | Specify flag for resource write access from an OutResourceTable / UAV |
coalpy.gpu.TextureAddressMode
enum
Address behaviour of texture coordinates enumeration. Use enum values located at coalpy.gpu.TextureAddressMode
Border | Samples a border when UVs are in the edge. Set the border color in the sampler object. |
Clamp | Clamps the UV coordinates at the edges. |
Mirror | Applies UV mirroring when UV coordinates go into the next edge. |
Wrap | Repeats samples when UV coordinates exceed range. |
coalpy.gpu.TextureType
enum
Type of texture enumeration. Use enum values located at coalpy.gpu.TextureType
CubeMap | Cube map texture. |
CubeMapArray | Array of cube maps. Use the Depth as the number of cube maps supported in an array. |
k1d | One dimensional texture. Width & depth defaults to 1. |
k2d | Two dimensional texture. Depth defaults to 1. |
k2dArray | Two dimensional array texture. |
k3d | Volume texture type. |
coalpy.utils
Utilities script submodule. Find here miscelaneous utilities for the CoalPy library, mostly written in pure coalpy and python.
profiler | None |
coalpy.utils.Profiler
type
Profiler class. Instantiate to utilize helper function for profiling. Usage example: profiler = coalpy.Profiler() command_list = coalpy.gpu.CommandList() profiler.begin_capture() # starts the capture command_list.begin_marker("FirstMarker") command_list.begin_marker("SecondMarker") # .... some dispatches here ... command_list.end_marker() command_list.end_marker() coalpy.gpu.submit(command_list) profiler.end_capture() # ends capture for all these submits # then later we can draw it via build_ui profiler.build_ui(render_args.imgui, render_args.implot)
active | None |
coalpy.utils.Profiler._build_hierarchy_ui
function
None
coalpy.utils.Profiler._build_raw_counter_ui
function
None
coalpy.utils.Profiler._build_timeline_ui
function
None
coalpy.utils.Profiler.begin_capture
function
Begins the capture of all the following scheduled command lists. Note: you can write command lists outside this method. Whats important is that all the coalpy.gpu.schedule calls are wrapped by a begin_capture and end_capture
coalpy.utils.Profiler.build_ui
function
Builds a UI for this profiler user coalpy's imgui and implot objects. Parameters: imgui : the imgui builder object. Found in the render_args of a on_render callback. imgui : the implot builder object. Found in the render_args of a on_render callback.
coalpy.utils.Profiler.end_capture
function
Ends the capture of all the previously scheduled command lists. See begin_capture.