Skip to content

Commit

Permalink
sokol: Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
IonAgorria committed May 24, 2024
1 parent a256fc8 commit d53e10d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Source/Render/sokol/SokolRender.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ class cSokolRender: public cInterfaceRenderDevice {
struct RenderTarget final {
cTexture* target_texture = nullptr;
SokolTexture2D* depth_image = nullptr;
sg_pass render_pass{};
std::vector<SokolCommand*> commands;
sg_pass render_pass {};
std::vector<SokolCommand*> commands {};
};
std::vector<RenderTarget> render_targets;

Expand Down
11 changes: 0 additions & 11 deletions Source/Render/sokol/SokolRenderPipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,6 @@

#include "VertexFormat.h"

const uint32_t PIPELINE_ID_MODE_MASK = 0xFFFF;
const uint32_t PIPELINE_ID_MODE_BITS = 8;
static_assert((1 << PIPELINE_ID_MODE_BITS) - 1 < PIPELINE_ID_MODE_MASK);
const uint32_t PIPELINE_ID_VERTEX_FMT_BITS = (VERTEX_FMT_BITS - 1); //Remove 1 dedicated for Dot3 flag in D3D
const uint32_t PIPELINE_ID_VERTEX_FMT_MASK = (1 << PIPELINE_ID_VERTEX_FMT_BITS) - 1;
const uint32_t PIPELINE_ID_TYPE_MASK = 0xF;

const uint32_t PIPELINE_ID_MODE_SHIFT = 0;
const uint32_t PIPELINE_ID_VERTEX_FMT_SHIFT = 16;
const uint32_t PIPELINE_ID_TYPE_SHIFT = PIPELINE_ID_VERTEX_FMT_SHIFT + PIPELINE_ID_VERTEX_FMT_BITS;

const uint32_t PERIMETER_SOKOL_PIPELINES_MAX = 128;

struct SokolPipeline {
Expand Down
9 changes: 4 additions & 5 deletions Source/Render/sokol/SokolRenderState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void cSokolRender::DoSokolRendering(sg_pass& render_pass, const std::vector<Soko
const SokolPipeline* pipeline = command->pipeline;
if (pipeline == nullptr) {
//Not implemented vertex format
xxassert(0, "cSokolRender::EndScene missing pipeline for " + std::to_string(command->pipeline_id));
xxassert(0, "cSokolRender::EndScene missing pipeline");
continue;
}
#if defined(PERIMETER_DEBUG) && 0
Expand Down Expand Up @@ -476,7 +476,7 @@ void cSokolRender::CreateCommandEmpty() {
render_targets[0].commands.emplace_back(cmd);

#ifdef PERIMETER_RENDER_TRACKER_COMMANDS
label = "Submit - Pipeline: " + std::to_string(pipeline_id)
label = "Submit"
+ " Vtxs: " + std::to_string(cmd->vertices)
+ " Idxs: " + std::to_string(cmd->indices)
+ " Tex0: " + std::to_string(reinterpret_cast<size_t>(cmd->sokol_textures[0]))
Expand Down Expand Up @@ -504,8 +504,7 @@ void cSokolRender::CreateCommand(VertexBuffer* vb, size_t vertices, IndexBuffer*
}

#ifdef PERIMETER_RENDER_TRACKER_COMMANDS
std::string label = "Pipeline: " + std::to_string(pipeline_id);
RenderSubmitEvent(RenderEvent::CREATE_COMMAND, label.c_str());
RenderSubmitEvent(RenderEvent::CREATE_COMMAND, "Start");
#endif

#ifdef PERIMETER_DEBUG
Expand Down Expand Up @@ -629,7 +628,7 @@ void cSokolRender::CreateCommand(VertexBuffer* vb, size_t vertices, IndexBuffer*
render_targets[activeRenderTarget].commands.emplace_back(cmd);

#ifdef PERIMETER_RENDER_TRACKER_COMMANDS
label = "Submit - Pipeline: " + std::to_string(pipeline_id)
label = "Submit"
+ " Vtxs: " + std::to_string(cmd->vertices)
+ " Idxs: " + std::to_string(cmd->indices)
+ " Tex0: " + std::to_string(reinterpret_cast<size_t>(cmd->sokol_textures[0]))
Expand Down

0 comments on commit d53e10d

Please sign in to comment.