mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
display: Allow passing whole state into dispatch_compute()
This is mainly useful for unit testing
This commit is contained in:
parent
babd3a070d
commit
76ffef38d1
@ -162,3 +162,12 @@ make_parasite(GraphicsOutput *host, const std::string &name,
|
|||||||
host->get_gsg(), host);
|
host->get_gsg(), host);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version of dispatch_compute that takes a ShaderAttrib instead of a full
|
||||||
|
* RenderState.
|
||||||
|
*/
|
||||||
|
INLINE void GraphicsEngine::
|
||||||
|
dispatch_compute(const LVecBase3i &work_groups, const ShaderAttrib *sattr, GraphicsStateGuardian *gsg) {
|
||||||
|
dispatch_compute(work_groups, RenderState::make(sattr), gsg);
|
||||||
|
}
|
||||||
|
@ -1185,15 +1185,16 @@ extract_texture_data(Texture *tex, GraphicsStateGuardian *gsg) {
|
|||||||
* The return value is true if the operation is successful, false otherwise.
|
* The return value is true if the operation is successful, false otherwise.
|
||||||
*/
|
*/
|
||||||
void GraphicsEngine::
|
void GraphicsEngine::
|
||||||
dispatch_compute(const LVecBase3i &work_groups, const ShaderAttrib *sattr, GraphicsStateGuardian *gsg) {
|
dispatch_compute(const LVecBase3i &work_groups, const RenderState *state, GraphicsStateGuardian *gsg) {
|
||||||
|
const ShaderAttrib *sattr;
|
||||||
|
DCAST_INTO_V(sattr, state->get_attrib(ShaderAttrib::get_class_slot()));
|
||||||
|
|
||||||
const Shader *shader = sattr->get_shader();
|
const Shader *shader = sattr->get_shader();
|
||||||
nassertv(shader != nullptr);
|
nassertv(shader != nullptr);
|
||||||
nassertv(gsg != nullptr);
|
nassertv(gsg != nullptr);
|
||||||
|
|
||||||
ReMutexHolder holder(_lock);
|
ReMutexHolder holder(_lock);
|
||||||
|
|
||||||
CPT(RenderState) state = RenderState::make(sattr);
|
|
||||||
|
|
||||||
string draw_name = gsg->get_threading_model().get_draw_name();
|
string draw_name = gsg->get_threading_model().get_draw_name();
|
||||||
if (draw_name.empty()) {
|
if (draw_name.empty()) {
|
||||||
// A single-threaded environment. No problem.
|
// A single-threaded environment. No problem.
|
||||||
@ -1220,7 +1221,7 @@ dispatch_compute(const LVecBase3i &work_groups, const ShaderAttrib *sattr, Graph
|
|||||||
|
|
||||||
// Now that the draw thread is idle, signal it to do the compute task.
|
// Now that the draw thread is idle, signal it to do the compute task.
|
||||||
thread->_gsg = gsg;
|
thread->_gsg = gsg;
|
||||||
thread->_state = state.p();
|
thread->_state = state;
|
||||||
thread->_work_groups = work_groups;
|
thread->_work_groups = work_groups;
|
||||||
thread->_thread_state = TS_do_compute;
|
thread->_thread_state = TS_do_compute;
|
||||||
thread->_cv_mutex.release();
|
thread->_cv_mutex.release();
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "indirectLess.h"
|
#include "indirectLess.h"
|
||||||
#include "loader.h"
|
#include "loader.h"
|
||||||
#include "referenceCount.h"
|
#include "referenceCount.h"
|
||||||
|
#include "renderState.h"
|
||||||
|
|
||||||
class Pipeline;
|
class Pipeline;
|
||||||
class DisplayRegion;
|
class DisplayRegion;
|
||||||
@ -111,6 +112,9 @@ PUBLISHED:
|
|||||||
|
|
||||||
bool extract_texture_data(Texture *tex, GraphicsStateGuardian *gsg);
|
bool extract_texture_data(Texture *tex, GraphicsStateGuardian *gsg);
|
||||||
void dispatch_compute(const LVecBase3i &work_groups,
|
void dispatch_compute(const LVecBase3i &work_groups,
|
||||||
|
const RenderState *state,
|
||||||
|
GraphicsStateGuardian *gsg);
|
||||||
|
INLINE void dispatch_compute(const LVecBase3i &work_groups,
|
||||||
const ShaderAttrib *sattr,
|
const ShaderAttrib *sattr,
|
||||||
GraphicsStateGuardian *gsg);
|
GraphicsStateGuardian *gsg);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user