summaryrefslogtreecommitdiff
path: root/pipeline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pipeline.cpp')
-rw-r--r--pipeline.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/pipeline.cpp b/pipeline.cpp
index 0636a1c..4d34ebd 100644
--- a/pipeline.cpp
+++ b/pipeline.cpp
@@ -23,6 +23,7 @@ Pipeline_Builder& Pipeline_Builder::rp_target(Texture_Id id, Colour clear) {
Render_Pass::Target t{
.id = id,
.fmt = texture.fmt,
+ .samples = texture.samples,
.mode = Clear_Mode::clear,
.clear = { .colour = clear }
};
@@ -37,6 +38,7 @@ Pipeline_Builder& Pipeline_Builder::rp_target(Texture_Id id, Clear_Mode clear) {
Render_Pass::Target t{
.id = id,
.fmt = texture.fmt,
+ .samples = texture.samples,
.mode = clear,
.clear = { .depth = 0.0f }
};
@@ -51,6 +53,7 @@ Pipeline_Builder& Pipeline_Builder::rp_depth_target(Texture_Id id, float clear)
Render_Pass::Target t{
.id = id,
.fmt = texture.fmt,
+ .samples = texture.samples,
.mode = Clear_Mode::clear,
.clear = { .depth = clear }
};
@@ -63,6 +66,7 @@ Pipeline_Builder& Pipeline_Builder::rp_depth_target(Texture_Id id, Clear_Mode mo
Render_Pass::Target t{
.id = id,
.fmt = texture.fmt,
+ .samples = texture.samples,
.mode = mode,
.clear = { .depth = 0.0f }
};
@@ -73,7 +77,7 @@ Pipeline_Builder& Pipeline_Builder::rp_depth_target(Texture_Id id, Clear_Mode mo
void Pipeline_Builder::validate_rp() {
int i, c = pass->colour_count;
- int w, h;
+ int w, h, s;
assert(c || pass->depth.id);
if (c) {
Texture& tex = dev->get_texture(pass->colours[0].id);
@@ -81,7 +85,8 @@ void Pipeline_Builder::validate_rp() {
assert(pass->colours[0].fmt == tex.fmt);
w = tex.w;
h = tex.h;
- assert(w && h);
+ s = tex.samples;
+ assert(w && h && s);
}
for (i = 1; i < c; i++) {
Texture& tex = dev->get_texture(pass->colours[i].id);
@@ -89,6 +94,7 @@ void Pipeline_Builder::validate_rp() {
assert(pass->colours[i].fmt == tex.fmt);
assert(tex.w == w);
assert(tex.h == h);
+ assert(tex.samples == s);
}
if (pass->depth.id) {
Texture& d = dev->get_texture(pass->depth.id);
@@ -101,6 +107,7 @@ void Pipeline_Builder::validate_rp() {
if (c) {
assert(d.w == w);
assert(d.h == h);
+ assert(d.samples == s);
}
}
}
@@ -247,6 +254,14 @@ Pipeline_Builder& Pipeline_Builder::shader(Shader_Id s) {
return *this;
}
+Pipeline_Builder& Pipeline_Builder::option(
+ Shader_Type type,
+ int mask
+) {
+ pip->shader_masks[type] = mask;
+ return *this;
+}
+
Pipeline_Builder& Pipeline_Builder::texture(
int binding,
Texture_Id t,
@@ -314,6 +329,7 @@ Pipeline& Pipeline_Builder::build() {
}
void Pipeline::hash() {
+ int i;
#define h(n, v) \
n = fnv1a64_2(n, (uint8_t*)&v, sizeof v)
pipeline_hash = fnv1a64(0, 0);
@@ -340,8 +356,10 @@ void Pipeline::hash() {
h(pipeline_hash, blend_src_alpha);
h(pipeline_hash, blend_dst_alpha);
h(pipeline_hash, cull_mode);
+ for (i = 0; i < shader_type_count; i++)
+ h(pipeline_hash, shader_masks[i]);
{
- int i, e = descriptor_count;
+ int e = descriptor_count;
descriptor_resource_hash = fnv1a64(0, 0);
for (i = 0; i < e; i++) {
Descriptor* d = &descriptors[i];