Skip to content

Commit

Permalink
Merge pull request #1 from clayjohn/RDG-adreno
Browse files Browse the repository at this point in the history
Add GPU name checking to limit compute_after_draw workaround to Adreno 6XX devices
  • Loading branch information
DarioSamo committed May 3, 2024
2 parents db14cf4 + c371381 commit d603c06
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion servers/rendering/rendering_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5107,7 +5107,7 @@ Error RenderingDevice::initialize(RenderingContextDriver *p_context, DisplayServ
driver->command_buffer_begin(frames[0].draw_command_buffer);

// Create draw graph and start it initialized as well.
draw_graph.initialize(driver, frames.size(), main_queue_family, SECONDARY_COMMAND_BUFFERS_PER_FRAME);
draw_graph.initialize(driver, device, frames.size(), main_queue_family, SECONDARY_COMMAND_BUFFERS_PER_FRAME);
draw_graph.begin();

for (uint32_t i = 0; i < frames.size(); i++) {
Expand Down
10 changes: 5 additions & 5 deletions servers/rendering/rendering_device_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,8 @@ void RenderingDeviceGraph::_print_compute_list(const uint8_t *p_instruction_data
}
}

void RenderingDeviceGraph::_check_driver_workarounds() {
void RenderingDeviceGraph::_check_driver_workarounds(RenderingContextDriver::Device p_device) {
const String rendering_device_name = p_device.name;
// Workaround for the Adreno 6XX family of devices.
//
// There's a known issue with the Vulkan driver in this family of devices where it'll crash if a dynamic state for drawing is
Expand All @@ -1270,11 +1271,10 @@ void RenderingDeviceGraph::_check_driver_workarounds() {
// all the individual submissions. This performance hit is accepted for the sake of being able to support these devices without
// limiting the design of the renderer.
//
// TODO: Implement the logic to check this. The driver is accessible here through RDD.
driver_workarounds.avoid_compute_after_draw = false;
driver_workarounds.avoid_compute_after_draw = (rendering_device_name.left(13) == "Adreno (TM) 6");
}

void RenderingDeviceGraph::initialize(RDD *p_driver, uint32_t p_frame_count, RDD::CommandQueueFamilyID p_secondary_command_queue_family, uint32_t p_secondary_command_buffers_per_frame) {
void RenderingDeviceGraph::initialize(RDD *p_driver, RenderingContextDriver::Device p_device, uint32_t p_frame_count, RDD::CommandQueueFamilyID p_secondary_command_queue_family, uint32_t p_secondary_command_buffers_per_frame) {
driver = p_driver;
frames.resize(p_frame_count);

Expand All @@ -1291,7 +1291,7 @@ void RenderingDeviceGraph::initialize(RDD *p_driver, uint32_t p_frame_count, RDD

driver_honors_barriers = driver->api_trait_get(RDD::API_TRAIT_HONORS_PIPELINE_BARRIERS);

_check_driver_workarounds();
_check_driver_workarounds(p_device);
}

void RenderingDeviceGraph::finalize() {
Expand Down
4 changes: 2 additions & 2 deletions servers/rendering/rendering_device_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -635,12 +635,12 @@ class RenderingDeviceGraph {
void _print_render_commands(const RecordedCommandSort *p_sorted_commands, uint32_t p_sorted_commands_count);
void _print_draw_list(const uint8_t *p_instruction_data, uint32_t p_instruction_data_size);
void _print_compute_list(const uint8_t *p_instruction_data, uint32_t p_instruction_data_size);
void _check_driver_workarounds();
void _check_driver_workarounds(RenderingContextDriver::Device p_device);

public:
RenderingDeviceGraph();
~RenderingDeviceGraph();
void initialize(RDD *p_driver, uint32_t p_frame_count, RDD::CommandQueueFamilyID p_secondary_command_queue_family, uint32_t p_secondary_command_buffers_per_frame);
void initialize(RDD *p_driver, RenderingContextDriver::Device p_device, uint32_t p_frame_count, RDD::CommandQueueFamilyID p_secondary_command_queue_family, uint32_t p_secondary_command_buffers_per_frame);
void finalize();
void begin();
void add_buffer_clear(RDD::BufferID p_dst, ResourceTracker *p_dst_tracker, uint32_t p_offset, uint32_t p_size);
Expand Down

0 comments on commit d603c06

Please sign in to comment.